Skip to content

Commit

Permalink
powerpc: Rename slb0_limit() to safe_stack_limit() and add Book3E sup…
Browse files Browse the repository at this point in the history
…port

slb0_limit() wasn't a very descriptive name. This changes it along with
a comment explaining what it's used for, and provides a 64-bit BookE
implementation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Benjamin Herrenschmidt committed May 6, 2011
1 parent 77eafe1 commit 40bd587
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/include/asm/mmu-book3e.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
extern int mmu_linear_psize;
extern int mmu_vmemmap_psize;

#ifdef CONFIG_PPC64
extern unsigned long linear_map_top;
#endif

#endif /* !__ASSEMBLY__ */

#endif /* _ASM_POWERPC_MMU_BOOK3E_H_ */
23 changes: 18 additions & 5 deletions arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,30 @@ void __init setup_system(void)
DBG(" <- setup_system()\n");
}

static u64 slb0_limit(void)
/* This returns the limit below which memory accesses to the linear
* mapping are guarnateed not to cause a TLB or SLB miss. This is
* used to allocate interrupt or emergency stacks for which our
* exception entry path doesn't deal with being interrupted.
*/
static u64 safe_stack_limit(void)
{
if (mmu_has_feature(MMU_FTR_1T_SEGMENT)) {
#ifdef CONFIG_PPC_BOOK3E
/* Freescale BookE bolts the entire linear mapping */
if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
return linear_map_top;
/* Other BookE, we assume the first GB is bolted */
return 1ul << 30;
#else
/* BookS, the first segment is bolted */
if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
return 1UL << SID_SHIFT_1T;
}
return 1UL << SID_SHIFT;
#endif
}

static void __init irqstack_early_init(void)
{
u64 limit = slb0_limit();
u64 limit = safe_stack_limit();
unsigned int i;

/*
Expand Down Expand Up @@ -497,7 +510,7 @@ static void __init emergency_stack_init(void)
* bringup, we need to get at them in real mode. This means they
* must also be within the RMO region.
*/
limit = min(slb0_limit(), ppc64_rma_size);
limit = min(safe_stack_limit(), ppc64_rma_size);

for_each_possible_cpu(i) {
unsigned long sp;
Expand Down

0 comments on commit 40bd587

Please sign in to comment.