powerpc/64s/hash: provide arch_setup_exec hooks for hash slice setup
authorNicholas Piggin <npiggin@gmail.com>
Fri, 14 Sep 2018 15:30:55 +0000 (01:30 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 19 Sep 2018 12:01:56 +0000 (22:01 +1000)
This will be used by the SLB code in the next patch, but for now this
sets the slb_addr_limit to the correct size for 32-bit tasks.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/book3s/64/mmu-hash.h
arch/powerpc/include/asm/slice.h
arch/powerpc/include/asm/thread_info.h
arch/powerpc/kernel/process.c
arch/powerpc/mm/mmu_context_book3s64.c
arch/powerpc/mm/slice.c

index d3064c7d1b1f604f82e0efda341fa18f8f2bc45d..bbeaf6adf93c9c2c6c58a68852960ec7ab9b9514 100644 (file)
@@ -487,6 +487,8 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
 extern void pseries_add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages);
 extern void demote_segment_4k(struct mm_struct *mm, unsigned long addr);
 
+extern void hash__setup_new_exec(void);
+
 #ifdef CONFIG_PPC_PSERIES
 void hpte_init_pseries(void);
 #else
index e40406cf5628eafdedd045f81486a4855ee82751..a595461c9cb03b70f5f54b511ce13e7063a867f4 100644 (file)
@@ -32,6 +32,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
                           unsigned long len, unsigned int psize);
 
 void slice_init_new_context_exec(struct mm_struct *mm);
+void slice_setup_new_exec(void);
 
 #endif /* __ASSEMBLY__ */
 
index 3c0002044bc9e6237e0c5c7a18ca922e315d7231..f9a442bb5a729f01dd3d625b4ff1c4b9415d06a5 100644 (file)
@@ -72,6 +72,12 @@ static inline struct thread_info *current_thread_info(void)
 }
 
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+
+#ifdef CONFIG_PPC_BOOK3S_64
+void arch_setup_new_exec(void);
+#define arch_setup_new_exec arch_setup_new_exec
+#endif
+
 #endif /* __ASSEMBLY__ */
 
 /*
index 913c5725cdb2ad416d06513ed6a72240b4e9aa6d..e4feb45ae4c6e36508b8545ad5a7682f7b877d78 100644 (file)
@@ -1482,6 +1482,15 @@ void flush_thread(void)
 #endif /* CONFIG_HAVE_HW_BREAKPOINT */
 }
 
+#ifdef CONFIG_PPC_BOOK3S_64
+void arch_setup_new_exec(void)
+{
+       if (radix_enabled())
+               return;
+       hash__setup_new_exec();
+}
+#endif
+
 int set_thread_uses_vas(void)
 {
 #ifdef CONFIG_PPC_BOOK3S_64
index dbd8f762140b6942b32f41a8466cb3bfc7aee840..f7352c66b6b8e49dd8a8e5decba8ded88ca873b4 100644 (file)
@@ -84,6 +84,11 @@ static int hash__init_new_context(struct mm_struct *mm)
        return index;
 }
 
+void hash__setup_new_exec(void)
+{
+       slice_setup_new_exec();
+}
+
 static int radix__init_new_context(struct mm_struct *mm)
 {
        unsigned long rts_field;
index 606f424aac4794cce120fc9579d90800ee020f9a..fc5b3a1ec6664c4c9973e252459cf01e8c0f83f4 100644 (file)
@@ -746,6 +746,20 @@ void slice_init_new_context_exec(struct mm_struct *mm)
                bitmap_fill(mask->high_slices, SLICE_NUM_HIGH);
 }
 
+#ifdef CONFIG_PPC_BOOK3S_64
+void slice_setup_new_exec(void)
+{
+       struct mm_struct *mm = current->mm;
+
+       slice_dbg("slice_setup_new_exec(mm=%p)\n", mm);
+
+       if (!is_32bit_task())
+               return;
+
+       mm->context.slb_addr_limit = DEFAULT_MAP_WINDOW;
+}
+#endif
+
 void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
                           unsigned long len, unsigned int psize)
 {