Skip to content

Commit 7235bb3

Browse files
chleroympe
authored andcommitted
powerpc/32s: move CTX_TO_VSID() into mmu-hash.h
In order to reuse it in switch_mmu_context(), this patch moves CTX_TO_VSID() macro into asm/book3s/32/mmu-hash.h Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/26b36ef2939234a04b37baf6ffe50cba81f5d1b7.1622708530.git.christophe.leroy@csgroup.eu
1 parent 91bb308 commit 7235bb3

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

arch/powerpc/include/asm/book3s/32/mmu-hash.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ struct ppc_bat {
6666

6767
#ifndef __ASSEMBLY__
6868

69+
/*
70+
* This macro defines the mapping from contexts to VSIDs (virtual
71+
* segment IDs). We use a skew on both the context and the high 4 bits
72+
* of the 32-bit virtual address (the "effective segment ID") in order
73+
* to spread out the entries in the MMU hash table. Note, if this
74+
* function is changed then hash functions will have to be
75+
* changed to correspond.
76+
*/
77+
#define CTX_TO_VSID(c, id) ((((c) * (897 * 16)) + (id * 0x111)) & 0xffffff)
78+
6979
/*
7080
* Hardware Page Table Entry
7181
* Note that the xpn and x bitfields are used only by processors that

arch/powerpc/kvm/book3s_32_mmu_host.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@ void kvmppc_mmu_destroy_pr(struct kvm_vcpu *vcpu)
353353
preempt_enable();
354354
}
355355

356-
/* From mm/mmu_context_hash32.c */
357-
#define CTX_TO_VSID(c, id) ((((c) * (897 * 16)) + (id * 0x111)) & 0xffffff)
358-
359356
int kvmppc_mmu_init_pr(struct kvm_vcpu *vcpu)
360357
{
361358
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);

arch/powerpc/mm/book3s32/mmu_context.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,6 @@
3939
#define LAST_CONTEXT 32767
4040
#define FIRST_CONTEXT 1
4141

42-
/*
43-
* This function defines the mapping from contexts to VSIDs (virtual
44-
* segment IDs). We use a skew on both the context and the high 4 bits
45-
* of the 32-bit virtual address (the "effective segment ID") in order
46-
* to spread out the entries in the MMU hash table. Note, if this
47-
* function is changed then arch/ppc/mm/hashtable.S will have to be
48-
* changed to correspond.
49-
*
50-
*
51-
* CTX_TO_VSID(ctx, va) (((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
52-
* & 0xffffff)
53-
*/
54-
5542
static unsigned long next_mmu_context;
5643
static unsigned long context_map[LAST_CONTEXT / BITS_PER_LONG + 1];
5744

0 commit comments

Comments
 (0)