提交 91c60b5b 编写于 作者: B Benjamin Herrenschmidt

powerpc: Separate PACA fields for server CPUs

This patch has no effect other than re-ordering PACA fields on
current server CPUs. It however is a pre-requisite for future
support of BookE 64-bit processors. Various parts of the PACA
struct are now moved under some ifdef's, either the new
CONFIG_PPC_BOOK3S or CONFIG_PPC_STD_MMU_64, whatever seems more
appropriate.
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.craashing.org>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 0ebc4cda
...@@ -43,6 +43,7 @@ struct task_struct; ...@@ -43,6 +43,7 @@ struct task_struct;
* processor. * processor.
*/ */
struct paca_struct { struct paca_struct {
#ifdef CONFIG_PPC_BOOK3S
/* /*
* Because hw_cpu_id, unlike other paca fields, is accessed * Because hw_cpu_id, unlike other paca fields, is accessed
* routinely from other CPUs (from the IRQ code), we stick to * routinely from other CPUs (from the IRQ code), we stick to
...@@ -51,7 +52,7 @@ struct paca_struct { ...@@ -51,7 +52,7 @@ struct paca_struct {
*/ */
struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
#endif /* CONFIG_PPC_BOOK3S */
/* /*
* MAGIC: the spinlock functions in arch/powerpc/lib/locks.c * MAGIC: the spinlock functions in arch/powerpc/lib/locks.c
* load lock_token and paca_index with a single lwz * load lock_token and paca_index with a single lwz
...@@ -64,13 +65,16 @@ struct paca_struct { ...@@ -64,13 +65,16 @@ struct paca_struct {
u64 kernel_toc; /* Kernel TOC address */ u64 kernel_toc; /* Kernel TOC address */
u64 kernelbase; /* Base address of kernel */ u64 kernelbase; /* Base address of kernel */
u64 kernel_msr; /* MSR while running in kernel */ u64 kernel_msr; /* MSR while running in kernel */
#ifdef CONFIG_PPC_STD_MMU_64
u64 stab_real; /* Absolute address of segment table */ u64 stab_real; /* Absolute address of segment table */
u64 stab_addr; /* Virtual address of segment table */ u64 stab_addr; /* Virtual address of segment table */
#endif /* CONFIG_PPC_STD_MMU_64 */
void *emergency_sp; /* pointer to emergency stack */ void *emergency_sp; /* pointer to emergency stack */
u64 data_offset; /* per cpu data offset */ u64 data_offset; /* per cpu data offset */
s16 hw_cpu_id; /* Physical processor number */ s16 hw_cpu_id; /* Physical processor number */
u8 cpu_start; /* At startup, processor spins until */ u8 cpu_start; /* At startup, processor spins until */
/* this becomes non-zero. */ /* this becomes non-zero. */
#ifdef CONFIG_PPC_STD_MMU_64
struct slb_shadow *slb_shadow_ptr; struct slb_shadow *slb_shadow_ptr;
/* /*
...@@ -81,11 +85,13 @@ struct paca_struct { ...@@ -81,11 +85,13 @@ struct paca_struct {
u64 exmc[10]; /* used for machine checks */ u64 exmc[10]; /* used for machine checks */
u64 exslb[10]; /* used for SLB/segment table misses u64 exslb[10]; /* used for SLB/segment table misses
* on the linear mapping */ * on the linear mapping */
/* SLB related definitions */
mm_context_t context;
u16 vmalloc_sllp; u16 vmalloc_sllp;
u16 slb_cache_ptr; u16 slb_cache_ptr;
u16 slb_cache[SLB_CACHE_ENTRIES]; u16 slb_cache[SLB_CACHE_ENTRIES];
#endif /* CONFIG_PPC_STD_MMU_64 */
mm_context_t context;
/* /*
* then miscellaneous read-write fields * then miscellaneous read-write fields
......
...@@ -122,8 +122,6 @@ int main(void) ...@@ -122,8 +122,6 @@ int main(void)
DEFINE(PACAKSAVE, offsetof(struct paca_struct, kstack)); DEFINE(PACAKSAVE, offsetof(struct paca_struct, kstack));
DEFINE(PACACURRENT, offsetof(struct paca_struct, __current)); DEFINE(PACACURRENT, offsetof(struct paca_struct, __current));
DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr)); DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr));
DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real));
DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr));
DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr)); DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr));
DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1)); DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1));
DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc)); DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc));
...@@ -131,35 +129,30 @@ int main(void) ...@@ -131,35 +129,30 @@ int main(void)
DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled));
DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr));
DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp));
#ifdef CONFIG_PPC_MM_SLICES #ifdef CONFIG_PPC_MM_SLICES
DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct,
context.low_slices_psize)); context.low_slices_psize));
DEFINE(PACAHIGHSLICEPSIZE, offsetof(struct paca_struct, DEFINE(PACAHIGHSLICEPSIZE, offsetof(struct paca_struct,
context.high_slices_psize)); context.high_slices_psize));
DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def)); DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def));
#endif /* CONFIG_PPC_MM_SLICES */
#ifdef CONFIG_PPC_STD_MMU_64
DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real));
DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr));
DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr));
DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp));
#ifdef CONFIG_PPC_MM_SLICES
DEFINE(MMUPSIZESLLP, offsetof(struct mmu_psize_def, sllp)); DEFINE(MMUPSIZESLLP, offsetof(struct mmu_psize_def, sllp));
#else #else
DEFINE(PACACONTEXTSLLP, offsetof(struct paca_struct, context.sllp)); DEFINE(PACACONTEXTSLLP, offsetof(struct paca_struct, context.sllp));
#endif /* CONFIG_PPC_MM_SLICES */ #endif /* CONFIG_PPC_MM_SLICES */
DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen)); DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen));
DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc)); DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc));
DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb)); DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb));
DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr)); DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
DEFINE(SLBSHADOW_STACKVSID, DEFINE(SLBSHADOW_STACKVSID,
offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid));
DEFINE(SLBSHADOW_STACKESID, DEFINE(SLBSHADOW_STACKESID,
...@@ -169,6 +162,15 @@ int main(void) ...@@ -169,6 +162,15 @@ int main(void)
DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int));
DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int));
DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area)); DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area));
#endif /* CONFIG_PPC_STD_MMU_64 */
DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
/* RTAS */ /* RTAS */
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
* field correctly */ * field correctly */
extern unsigned long __toc_start; extern unsigned long __toc_start;
#ifdef CONFIG_PPC_BOOK3S
/* /*
* The structure which the hypervisor knows about - this structure * The structure which the hypervisor knows about - this structure
* should not cross a page boundary. The vpa_init/register_vpa call * should not cross a page boundary. The vpa_init/register_vpa call
...@@ -41,6 +43,10 @@ struct lppaca lppaca[] = { ...@@ -41,6 +43,10 @@ struct lppaca lppaca[] = {
}, },
}; };
#endif /* CONFIG_PPC_BOOK3S */
#ifdef CONFIG_PPC_STD_MMU_64
/* /*
* 3 persistent SLBs are registered here. The buffer will be zero * 3 persistent SLBs are registered here. The buffer will be zero
* initially, hence will all be invaild until we actually write them. * initially, hence will all be invaild until we actually write them.
...@@ -52,6 +58,8 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = { ...@@ -52,6 +58,8 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = {
}, },
}; };
#endif /* CONFIG_PPC_STD_MMU_64 */
/* The Paca is an array with one entry per processor. Each contains an /* The Paca is an array with one entry per processor. Each contains an
* lppaca, which contains the information shared between the * lppaca, which contains the information shared between the
* hypervisor and Linux. * hypervisor and Linux.
...@@ -77,15 +85,19 @@ void __init initialise_pacas(void) ...@@ -77,15 +85,19 @@ void __init initialise_pacas(void)
for (cpu = 0; cpu < NR_CPUS; cpu++) { for (cpu = 0; cpu < NR_CPUS; cpu++) {
struct paca_struct *new_paca = &paca[cpu]; struct paca_struct *new_paca = &paca[cpu];
#ifdef CONFIG_PPC_BOOK3S
new_paca->lppaca_ptr = &lppaca[cpu]; new_paca->lppaca_ptr = &lppaca[cpu];
#endif
new_paca->lock_token = 0x8000; new_paca->lock_token = 0x8000;
new_paca->paca_index = cpu; new_paca->paca_index = cpu;
new_paca->kernel_toc = kernel_toc; new_paca->kernel_toc = kernel_toc;
new_paca->kernelbase = (unsigned long) _stext; new_paca->kernelbase = (unsigned long) _stext;
new_paca->kernel_msr = MSR_KERNEL; new_paca->kernel_msr = MSR_KERNEL;
new_paca->hw_cpu_id = 0xffff; new_paca->hw_cpu_id = 0xffff;
new_paca->slb_shadow_ptr = &slb_shadow[cpu];
new_paca->__current = &init_task; new_paca->__current = &init_task;
#ifdef CONFIG_PPC_STD_MMU_64
new_paca->slb_shadow_ptr = &slb_shadow[cpu];
#endif /* CONFIG_PPC_STD_MMU_64 */
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册