summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/book3s/32
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-06-03 08:41:38 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2021-06-17 00:09:08 +1000
commit7235bb3593781ed022d0714a73c2c0d8eb8a835f (patch)
tree73e0a356232dd321befd6264fa748321f7ba3287 /arch/powerpc/include/asm/book3s/32
parent91bb30822a2e1d7900f9f42e9e92647a9015f979 (diff)
downloadlinux-stable-7235bb3593781ed022d0714a73c2c0d8eb8a835f.tar.gz
linux-stable-7235bb3593781ed022d0714a73c2c0d8eb8a835f.tar.bz2
linux-stable-7235bb3593781ed022d0714a73c2c0d8eb8a835f.zip
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 <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/26b36ef2939234a04b37baf6ffe50cba81f5d1b7.1622708530.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/include/asm/book3s/32')
-rw-r--r--arch/powerpc/include/asm/book3s/32/mmu-hash.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/book3s/32/mmu-hash.h b/arch/powerpc/include/asm/book3s/32/mmu-hash.h
index cc0284bbac86..583388399b1b 100644
--- a/arch/powerpc/include/asm/book3s/32/mmu-hash.h
+++ b/arch/powerpc/include/asm/book3s/32/mmu-hash.h
@@ -67,6 +67,16 @@ struct ppc_bat {
#ifndef __ASSEMBLY__
/*
+ * This macro defines the mapping from contexts to VSIDs (virtual
+ * segment IDs). We use a skew on both the context and the high 4 bits
+ * of the 32-bit virtual address (the "effective segment ID") in order
+ * to spread out the entries in the MMU hash table. Note, if this
+ * function is changed then hash functions will have to be
+ * changed to correspond.
+ */
+#define CTX_TO_VSID(c, id) ((((c) * (897 * 16)) + (id * 0x111)) & 0xffffff)
+
+/*
* Hardware Page Table Entry
* Note that the xpn and x bitfields are used only by processors that
* support extended addressing; otherwise, those bits are reserved.