]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/powerpc/include/asm/book3s/64/mmu.h
Merge tag 'powerpc-4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
[linux.git] / arch / powerpc / include / asm / book3s / 64 / mmu.h
index 37671feb2bf60f761140c8765c65cce29600cccd..5094696eecd6d4a010b08f5a4ff2bfb0d76eee02 100644 (file)
@@ -80,8 +80,29 @@ struct spinlock;
 /* Maximum possible number of NPUs in a system. */
 #define NV_MAX_NPUS 8
 
+/*
+ * One bit per slice. We have lower slices which cover 256MB segments
+ * upto 4G range. That gets us 16 low slices. For the rest we track slices
+ * in 1TB size.
+ */
+struct slice_mask {
+       u64 low_slices;
+       DECLARE_BITMAP(high_slices, SLICE_NUM_HIGH);
+};
+
 typedef struct {
-       mm_context_id_t id;
+       union {
+               /*
+                * We use id as the PIDR content for radix. On hash we can use
+                * more than one id. The extended ids are used when we start
+                * having address above 512TB. We allocate one extended id
+                * for each 512TB. The new id is then used with the 49 bit
+                * EA to build a new VA. We always use ESID_BITS_1T_MASK bits
+                * from EA and new context ids to build the new VAs.
+                */
+               mm_context_id_t id;
+               mm_context_id_t extended_id[TASK_SIZE_USER64/TASK_CONTEXT_SIZE];
+       };
        u16 user_psize;         /* page size index */
 
        /* Number of bits in the mm_cpumask */
@@ -94,9 +115,18 @@ typedef struct {
        struct npu_context *npu_context;
 
 #ifdef CONFIG_PPC_MM_SLICES
-       u64 low_slices_psize;   /* SLB page size encodings */
+        /* SLB page size encodings*/
+       unsigned char low_slices_psize[BITS_PER_LONG / BITS_PER_BYTE];
        unsigned char high_slices_psize[SLICE_ARRAY_SIZE];
        unsigned long slb_addr_limit;
+# ifdef CONFIG_PPC_64K_PAGES
+       struct slice_mask mask_64k;
+# endif
+       struct slice_mask mask_4k;
+# ifdef CONFIG_HUGETLB_PAGE
+       struct slice_mask mask_16m;
+       struct slice_mask mask_16g;
+# endif
 #else
        u16 sllp;               /* SLB page size encoding */
 #endif
@@ -177,5 +207,25 @@ extern void radix_init_pseries(void);
 static inline void radix_init_pseries(void) { };
 #endif
 
+static inline int get_ea_context(mm_context_t *ctx, unsigned long ea)
+{
+       int index = ea >> MAX_EA_BITS_PER_CONTEXT;
+
+       if (likely(index < ARRAY_SIZE(ctx->extended_id)))
+               return ctx->extended_id[index];
+
+       /* should never happen */
+       WARN_ON(1);
+       return 0;
+}
+
+static inline unsigned long get_user_vsid(mm_context_t *ctx,
+                                         unsigned long ea, int ssize)
+{
+       unsigned long context = get_ea_context(ctx, ea);
+
+       return get_vsid(context, ea, ssize);
+}
+
 #endif /* __ASSEMBLY__ */
 #endif /* _ASM_POWERPC_BOOK3S_64_MMU_H_ */