Skip to contentSkip to conversation

KVM regression on 64-bit big endian in 5.4

DISCUSSION Marcus Comstedt 1 participant 1 message Dec 9, 2019

lore
Share & tools
lore
#0 lore raw

Hi.

I discovered after upgrading to kernel 5.4 on my Talos II (Power9 Nimbus DD2.2) that KVM didn't work anymore. The guest would crash already in SLOF.

After bisecting, I found that the culprit was this commit:

| From 6c85b7bc637b64e681760f62c0eafba2f56745c6 Mon Sep 17 00:00:00 2001
| From: Sukadev Bhattiprolu <[email protected]>
| Date: Thu, 22 Aug 2019 00:48:38 -0300
| Subject: powerpc/kvm: Use UV_RETURN ucall to return to ultravisor
| 
| When an SVM makes an hypercall or incurs some other exception, the
| Ultravisor usually forwards (a.k.a. reflects) the exceptions to the
| Hypervisor. After processing the exception, Hypervisor uses the
| UV_RETURN ultracall to return control back to the SVM.

Looking at the diff, this change caught my eye:

- ld r6, VCPU_CR(r4)
+ lwz r0, VCPU_CR(r4)

So the loading of VPU_CR has changed from ld to lwz. This seems wrong. ccr is an unsigned long, and the store to VCPU_CR in the same file uses std, not stw. So loading VCPU_CR must be done with ld, otherwise the result will be wrong (truncated on LE, truncated and left shifted by 16 bits on BE)...

// Marcus