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>
This commit is contained in:

committed by
Benjamin Herrenschmidt

parent
c72cd555e8
commit
7ffcf8ec26
@@ -210,18 +210,18 @@ static u64 scan_dispatch_log(u64 stop_tb)
|
||||
if (!dtl)
|
||||
return 0;
|
||||
|
||||
if (i == vpa->dtl_idx)
|
||||
if (i == be64_to_cpu(vpa->dtl_idx))
|
||||
return 0;
|
||||
while (i < vpa->dtl_idx) {
|
||||
while (i < be64_to_cpu(vpa->dtl_idx)) {
|
||||
if (dtl_consumer)
|
||||
dtl_consumer(dtl, i);
|
||||
dtb = dtl->timebase;
|
||||
tb_delta = dtl->enqueue_to_dispatch_time +
|
||||
dtl->ready_to_enqueue_time;
|
||||
dtb = be64_to_cpu(dtl->timebase);
|
||||
tb_delta = be32_to_cpu(dtl->enqueue_to_dispatch_time) +
|
||||
be32_to_cpu(dtl->ready_to_enqueue_time);
|
||||
barrier();
|
||||
if (i + N_DISPATCH_LOG < vpa->dtl_idx) {
|
||||
if (i + N_DISPATCH_LOG < be64_to_cpu(vpa->dtl_idx)) {
|
||||
/* buffer has overflowed */
|
||||
i = vpa->dtl_idx - N_DISPATCH_LOG;
|
||||
i = be64_to_cpu(vpa->dtl_idx) - N_DISPATCH_LOG;
|
||||
dtl = local_paca->dispatch_log + (i % N_DISPATCH_LOG);
|
||||
continue;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ static inline u64 calculate_stolen_time(u64 stop_tb)
|
||||
{
|
||||
u64 stolen = 0;
|
||||
|
||||
if (get_paca()->dtl_ridx != get_paca()->lppaca_ptr->dtl_idx) {
|
||||
if (get_paca()->dtl_ridx != be64_to_cpu(get_lppaca()->dtl_idx)) {
|
||||
stolen = scan_dispatch_log(stop_tb);
|
||||
get_paca()->system_time -= stolen;
|
||||
}
|
||||
|
Reference in New Issue
Block a user