diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-02 17:17:41 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-09 02:47:38 -0400 |
commit | 91c60b5b8209627590b31c07262e40c27d27d272 (patch) | |
tree | 02b8cd432bc4206f5064aab192b160a93355414b /arch | |
parent | 0ebc4cdaa3fd7c9144d15fe9a6bcfcd310c265b8 (diff) |
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: Benjamin Herrenschmidt <benh@kernel.craashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/paca.h | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 32 | ||||
-rw-r--r-- | arch/powerpc/kernel/paca.c | 14 |
3 files changed, 39 insertions, 19 deletions
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 082b3aedf145..0ea1985bdb8b 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h | |||
@@ -43,6 +43,7 @@ struct task_struct; | |||
43 | * processor. | 43 | * processor. |
44 | */ | 44 | */ |
45 | struct paca_struct { | 45 | struct paca_struct { |
46 | #ifdef CONFIG_PPC_BOOK3S | ||
46 | /* | 47 | /* |
47 | * Because hw_cpu_id, unlike other paca fields, is accessed | 48 | * Because hw_cpu_id, unlike other paca fields, is accessed |
48 | * routinely from other CPUs (from the IRQ code), we stick to | 49 | * routinely from other CPUs (from the IRQ code), we stick to |
@@ -51,7 +52,7 @@ struct paca_struct { | |||
51 | */ | 52 | */ |
52 | 53 | ||
53 | struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ | 54 | struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ |
54 | 55 | #endif /* CONFIG_PPC_BOOK3S */ | |
55 | /* | 56 | /* |
56 | * MAGIC: the spinlock functions in arch/powerpc/lib/locks.c | 57 | * MAGIC: the spinlock functions in arch/powerpc/lib/locks.c |
57 | * load lock_token and paca_index with a single lwz | 58 | * load lock_token and paca_index with a single lwz |
@@ -64,13 +65,16 @@ struct paca_struct { | |||
64 | u64 kernel_toc; /* Kernel TOC address */ | 65 | u64 kernel_toc; /* Kernel TOC address */ |
65 | u64 kernelbase; /* Base address of kernel */ | 66 | u64 kernelbase; /* Base address of kernel */ |
66 | u64 kernel_msr; /* MSR while running in kernel */ | 67 | u64 kernel_msr; /* MSR while running in kernel */ |
68 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
67 | u64 stab_real; /* Absolute address of segment table */ | 69 | u64 stab_real; /* Absolute address of segment table */ |
68 | u64 stab_addr; /* Virtual address of segment table */ | 70 | u64 stab_addr; /* Virtual address of segment table */ |
71 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
69 | void *emergency_sp; /* pointer to emergency stack */ | 72 | void *emergency_sp; /* pointer to emergency stack */ |
70 | u64 data_offset; /* per cpu data offset */ | 73 | u64 data_offset; /* per cpu data offset */ |
71 | s16 hw_cpu_id; /* Physical processor number */ | 74 | s16 hw_cpu_id; /* Physical processor number */ |
72 | u8 cpu_start; /* At startup, processor spins until */ | 75 | u8 cpu_start; /* At startup, processor spins until */ |
73 | /* this becomes non-zero. */ | 76 | /* this becomes non-zero. */ |
77 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
74 | struct slb_shadow *slb_shadow_ptr; | 78 | struct slb_shadow *slb_shadow_ptr; |
75 | 79 | ||
76 | /* | 80 | /* |
@@ -81,11 +85,13 @@ struct paca_struct { | |||
81 | u64 exmc[10]; /* used for machine checks */ | 85 | u64 exmc[10]; /* used for machine checks */ |
82 | u64 exslb[10]; /* used for SLB/segment table misses | 86 | u64 exslb[10]; /* used for SLB/segment table misses |
83 | * on the linear mapping */ | 87 | * on the linear mapping */ |
84 | 88 | /* SLB related definitions */ | |
85 | mm_context_t context; | ||
86 | u16 vmalloc_sllp; | 89 | u16 vmalloc_sllp; |
87 | u16 slb_cache_ptr; | 90 | u16 slb_cache_ptr; |
88 | u16 slb_cache[SLB_CACHE_ENTRIES]; | 91 | u16 slb_cache[SLB_CACHE_ENTRIES]; |
92 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
93 | |||
94 | mm_context_t context; | ||
89 | 95 | ||
90 | /* | 96 | /* |
91 | * then miscellaneous read-write fields | 97 | * then miscellaneous read-write fields |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 1e40bc053946..ce90c570cd8e 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -122,8 +122,6 @@ int main(void) | |||
122 | DEFINE(PACAKSAVE, offsetof(struct paca_struct, kstack)); | 122 | DEFINE(PACAKSAVE, offsetof(struct paca_struct, kstack)); |
123 | DEFINE(PACACURRENT, offsetof(struct paca_struct, __current)); | 123 | DEFINE(PACACURRENT, offsetof(struct paca_struct, __current)); |
124 | DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr)); | 124 | DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr)); |
125 | DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real)); | ||
126 | DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr)); | ||
127 | DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr)); | 125 | DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr)); |
128 | DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1)); | 126 | DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1)); |
129 | DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc)); | 127 | DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc)); |
@@ -131,35 +129,30 @@ int main(void) | |||
131 | DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); | 129 | DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr)); |
132 | DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); | 130 | DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled)); |
133 | DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); | 131 | DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled)); |
134 | DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache)); | ||
135 | DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr)); | ||
136 | DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); | 132 | DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id)); |
137 | DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp)); | ||
138 | #ifdef CONFIG_PPC_MM_SLICES | 133 | #ifdef CONFIG_PPC_MM_SLICES |
139 | DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, | 134 | DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct, |
140 | context.low_slices_psize)); | 135 | context.low_slices_psize)); |
141 | DEFINE(PACAHIGHSLICEPSIZE, offsetof(struct paca_struct, | 136 | DEFINE(PACAHIGHSLICEPSIZE, offsetof(struct paca_struct, |
142 | context.high_slices_psize)); | 137 | context.high_slices_psize)); |
143 | DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def)); | 138 | DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def)); |
139 | #endif /* CONFIG_PPC_MM_SLICES */ | ||
140 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
141 | DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real)); | ||
142 | DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr)); | ||
143 | DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache)); | ||
144 | DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr)); | ||
145 | DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp)); | ||
146 | #ifdef CONFIG_PPC_MM_SLICES | ||
144 | DEFINE(MMUPSIZESLLP, offsetof(struct mmu_psize_def, sllp)); | 147 | DEFINE(MMUPSIZESLLP, offsetof(struct mmu_psize_def, sllp)); |
145 | #else | 148 | #else |
146 | DEFINE(PACACONTEXTSLLP, offsetof(struct paca_struct, context.sllp)); | 149 | DEFINE(PACACONTEXTSLLP, offsetof(struct paca_struct, context.sllp)); |
147 | |||
148 | #endif /* CONFIG_PPC_MM_SLICES */ | 150 | #endif /* CONFIG_PPC_MM_SLICES */ |
149 | DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen)); | 151 | DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen)); |
150 | DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc)); | 152 | DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc)); |
151 | DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb)); | 153 | DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb)); |
152 | DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp)); | ||
153 | DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr)); | 154 | DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr)); |
154 | DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); | ||
155 | DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); | ||
156 | DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr)); | ||
157 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); | ||
158 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | ||
159 | DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); | 155 | DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); |
160 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); | ||
161 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); | ||
162 | |||
163 | DEFINE(SLBSHADOW_STACKVSID, | 156 | DEFINE(SLBSHADOW_STACKVSID, |
164 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); | 157 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); |
165 | DEFINE(SLBSHADOW_STACKESID, | 158 | DEFINE(SLBSHADOW_STACKESID, |
@@ -169,6 +162,15 @@ int main(void) | |||
169 | DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); | 162 | DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); |
170 | DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); | 163 | DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); |
171 | DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area)); | 164 | DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area)); |
165 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
166 | DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp)); | ||
167 | DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); | ||
168 | DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); | ||
169 | DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr)); | ||
170 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); | ||
171 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | ||
172 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); | ||
173 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); | ||
172 | #endif /* CONFIG_PPC64 */ | 174 | #endif /* CONFIG_PPC64 */ |
173 | 175 | ||
174 | /* RTAS */ | 176 | /* RTAS */ |
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index c744b327bcab..e9962c7f8a09 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * field correctly */ | 18 | * field correctly */ |
19 | extern unsigned long __toc_start; | 19 | extern unsigned long __toc_start; |
20 | 20 | ||
21 | #ifdef CONFIG_PPC_BOOK3S | ||
22 | |||
21 | /* | 23 | /* |
22 | * The structure which the hypervisor knows about - this structure | 24 | * The structure which the hypervisor knows about - this structure |
23 | * should not cross a page boundary. The vpa_init/register_vpa call | 25 | * should not cross a page boundary. The vpa_init/register_vpa call |
@@ -41,6 +43,10 @@ struct lppaca lppaca[] = { | |||
41 | }, | 43 | }, |
42 | }; | 44 | }; |
43 | 45 | ||
46 | #endif /* CONFIG_PPC_BOOK3S */ | ||
47 | |||
48 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
49 | |||
44 | /* | 50 | /* |
45 | * 3 persistent SLBs are registered here. The buffer will be zero | 51 | * 3 persistent SLBs are registered here. The buffer will be zero |
46 | * initially, hence will all be invaild until we actually write them. | 52 | * initially, hence will all be invaild until we actually write them. |
@@ -52,6 +58,8 @@ struct slb_shadow slb_shadow[] __cacheline_aligned = { | |||
52 | }, | 58 | }, |
53 | }; | 59 | }; |
54 | 60 | ||
61 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
62 | |||
55 | /* The Paca is an array with one entry per processor. Each contains an | 63 | /* The Paca is an array with one entry per processor. Each contains an |
56 | * lppaca, which contains the information shared between the | 64 | * lppaca, which contains the information shared between the |
57 | * hypervisor and Linux. | 65 | * hypervisor and Linux. |
@@ -77,15 +85,19 @@ void __init initialise_pacas(void) | |||
77 | for (cpu = 0; cpu < NR_CPUS; cpu++) { | 85 | for (cpu = 0; cpu < NR_CPUS; cpu++) { |
78 | struct paca_struct *new_paca = &paca[cpu]; | 86 | struct paca_struct *new_paca = &paca[cpu]; |
79 | 87 | ||
88 | #ifdef CONFIG_PPC_BOOK3S | ||
80 | new_paca->lppaca_ptr = &lppaca[cpu]; | 89 | new_paca->lppaca_ptr = &lppaca[cpu]; |
90 | #endif | ||
81 | new_paca->lock_token = 0x8000; | 91 | new_paca->lock_token = 0x8000; |
82 | new_paca->paca_index = cpu; | 92 | new_paca->paca_index = cpu; |
83 | new_paca->kernel_toc = kernel_toc; | 93 | new_paca->kernel_toc = kernel_toc; |
84 | new_paca->kernelbase = (unsigned long) _stext; | 94 | new_paca->kernelbase = (unsigned long) _stext; |
85 | new_paca->kernel_msr = MSR_KERNEL; | 95 | new_paca->kernel_msr = MSR_KERNEL; |
86 | new_paca->hw_cpu_id = 0xffff; | 96 | new_paca->hw_cpu_id = 0xffff; |
87 | new_paca->slb_shadow_ptr = &slb_shadow[cpu]; | ||
88 | new_paca->__current = &init_task; | 97 | new_paca->__current = &init_task; |
98 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
99 | new_paca->slb_shadow_ptr = &slb_shadow[cpu]; | ||
100 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
89 | 101 | ||
90 | } | 102 | } |
91 | } | 103 | } |