Skip to content

Commit

Permalink
powerpc/64s/hash: Provide arch_setup_exec() hooks for hash slice setup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicholas Piggin authored and Michael Ellerman committed Oct 14, 2018
1 parent 126b11b commit 425d331
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/powerpc/include/asm/book3s/64/mmu-hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

Expand Down
6 changes: 6 additions & 0 deletions arch/powerpc/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

/*
Expand Down
9 changes: 9 additions & 0 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,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
Expand Down
5 changes: 5 additions & 0 deletions arch/powerpc/mm/mmu_context_book3s64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions arch/powerpc/mm/slice.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,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)
{
Expand Down

0 comments on commit 425d331

Please sign in to comment.