aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2013-08-06 12:01:46 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-14 01:33:35 -0400
commit7ffcf8ec26f4b94b95b1297131d223b121d951e5 (patch)
tree7b4b47eaeafe56c253350b14470fecf03b40277f /arch/powerpc/kernel/time.c
parentc72cd555e828b710bce8c3635254dbb483397142 (diff)
powerpc: Fix little endian lppaca, slb_shadow and dtl_entry
The lppaca, slb_shadow and dtl_entry hypervisor structures are big endian, so we have to byte swap them in little endian builds. LE KVM hosts will also need to be fixed but for now add an #error to remind us. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c863aa1f524a..b2bcd34f72d2 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -210,18 +210,18 @@ static u64 scan_dispatch_log(u64 stop_tb)
210 if (!dtl) 210 if (!dtl)
211 return 0; 211 return 0;
212 212
213 if (i == vpa->dtl_idx) 213 if (i == be64_to_cpu(vpa->dtl_idx))
214 return 0; 214 return 0;
215 while (i < vpa->dtl_idx) { 215 while (i < be64_to_cpu(vpa->dtl_idx)) {
216 if (dtl_consumer) 216 if (dtl_consumer)
217 dtl_consumer(dtl, i); 217 dtl_consumer(dtl, i);
218 dtb = dtl->timebase; 218 dtb = be64_to_cpu(dtl->timebase);
219 tb_delta = dtl->enqueue_to_dispatch_time + 219 tb_delta = be32_to_cpu(dtl->enqueue_to_dispatch_time) +
220 dtl->ready_to_enqueue_time; 220 be32_to_cpu(dtl->ready_to_enqueue_time);
221 barrier(); 221 barrier();
222 if (i + N_DISPATCH_LOG < vpa->dtl_idx) { 222 if (i + N_DISPATCH_LOG < be64_to_cpu(vpa->dtl_idx)) {
223 /* buffer has overflowed */ 223 /* buffer has overflowed */
224 i = vpa->dtl_idx - N_DISPATCH_LOG; 224 i = be64_to_cpu(vpa->dtl_idx) - N_DISPATCH_LOG;
225 dtl = local_paca->dispatch_log + (i % N_DISPATCH_LOG); 225 dtl = local_paca->dispatch_log + (i % N_DISPATCH_LOG);
226 continue; 226 continue;
227 } 227 }
@@ -269,7 +269,7 @@ static inline u64 calculate_stolen_time(u64 stop_tb)
269{ 269{
270 u64 stolen = 0; 270 u64 stolen = 0;
271 271
272 if (get_paca()->dtl_ridx != get_paca()->lppaca_ptr->dtl_idx) { 272 if (get_paca()->dtl_ridx != be64_to_cpu(get_lppaca()->dtl_idx)) {
273 stolen = scan_dispatch_log(stop_tb); 273 stolen = scan_dispatch_log(stop_tb);
274 get_paca()->system_time -= stolen; 274 get_paca()->system_time -= stolen;
275 } 275 }