Skip to content

Commit 425d331

Browse files
npigginmpe
authored andcommitted
powerpc/64s/hash: Provide arch_setup_exec() hooks for hash slice setup
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>
1 parent 126b11b commit 425d331

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
487487
extern void pseries_add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages);
488488
extern void demote_segment_4k(struct mm_struct *mm, unsigned long addr);
489489

490+
extern void hash__setup_new_exec(void);
491+
490492
#ifdef CONFIG_PPC_PSERIES
491493
void hpte_init_pseries(void);
492494
#else

arch/powerpc/include/asm/slice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
3232
unsigned long len, unsigned int psize);
3333

3434
void slice_init_new_context_exec(struct mm_struct *mm);
35+
void slice_setup_new_exec(void);
3536

3637
#endif /* __ASSEMBLY__ */
3738

arch/powerpc/include/asm/thread_info.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ static inline struct thread_info *current_thread_info(void)
7272
}
7373

7474
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
75+
76+
#ifdef CONFIG_PPC_BOOK3S_64
77+
void arch_setup_new_exec(void);
78+
#define arch_setup_new_exec arch_setup_new_exec
79+
#endif
80+
7581
#endif /* __ASSEMBLY__ */
7682

7783
/*

arch/powerpc/kernel/process.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,15 @@ void flush_thread(void)
14901490
#endif /* CONFIG_HAVE_HW_BREAKPOINT */
14911491
}
14921492

1493+
#ifdef CONFIG_PPC_BOOK3S_64
1494+
void arch_setup_new_exec(void)
1495+
{
1496+
if (radix_enabled())
1497+
return;
1498+
hash__setup_new_exec();
1499+
}
1500+
#endif
1501+
14931502
int set_thread_uses_vas(void)
14941503
{
14951504
#ifdef CONFIG_PPC_BOOK3S_64

arch/powerpc/mm/mmu_context_book3s64.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ static int hash__init_new_context(struct mm_struct *mm)
8484
return index;
8585
}
8686

87+
void hash__setup_new_exec(void)
88+
{
89+
slice_setup_new_exec();
90+
}
91+
8792
static int radix__init_new_context(struct mm_struct *mm)
8893
{
8994
unsigned long rts_field;

arch/powerpc/mm/slice.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,20 @@ void slice_init_new_context_exec(struct mm_struct *mm)
757757
bitmap_fill(mask->high_slices, SLICE_NUM_HIGH);
758758
}
759759

760+
#ifdef CONFIG_PPC_BOOK3S_64
761+
void slice_setup_new_exec(void)
762+
{
763+
struct mm_struct *mm = current->mm;
764+
765+
slice_dbg("slice_setup_new_exec(mm=%p)\n", mm);
766+
767+
if (!is_32bit_task())
768+
return;
769+
770+
mm->context.slb_addr_limit = DEFAULT_MAP_WINDOW;
771+
}
772+
#endif
773+
760774
void slice_set_range_psize(struct mm_struct *mm, unsigned long start,
761775
unsigned long len, unsigned int psize)
762776
{

0 commit comments

Comments
 (0)