KVM: PPC: Book3S HV: Fix regression on big endian hosts
Subsystems (2)
PATCH 1/1 KVM: PPC: Book3S HV: Fix regression on big endian hosts
VCPU_CR is the offset of arch.regs.ccr in kvm_vcpu. arch/powerpc/include/asm/kvm_host.h defines arch.regs as a struct pt_regs, and arch/powerpc/include/asm/ptrace.h defines the ccr field of pt_regs as "unsigned long ccr". Since unsigned long is 64 bits, a 64-bit load needs to be used to load it, unless an endianness specific correction offset is added to access the desired subpart. In this case there is no reason to _not_ use a 64 bit load though.
---
This was tested on 5.4.3 on a Talos II (POWER9 Nimbus DD2.2)
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +2 -2
@@ -1117,7 +1117,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) ld r7, VCPU_GPR(R7)(r4) bne ret_to_ultra - lwz r0, VCPU_CR(r4) + ld r0, VCPU_CR(r4) mtcr r0 ld r0, VCPU_GPR(R0)(r4)
@@ -1137,7 +1137,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) * R3 = UV_RETURN */ ret_to_ultra: - lwz r0, VCPU_CR(r4) + ld r0, VCPU_CR(r4) mtcr r0 ld r0, VCPU_GPR(R3)(r4)
Signature · 1 line
2.23.0
Michael Ellerman
AppliedQuoted 9 lines · Marcus Comstedt
VCPU_CRis the offset of arch.regs.ccr inkvm_vcpu.arch/powerpc/include/asm/kvm_host.hdefines arch.regs as a structpt_regs, andarch/powerpc/include/asm/ptrace.hdefines the ccr field ofpt_regsas "unsigned long ccr". Since unsigned long is 64 bits, a 64-bit load needs to be used to load it, unless an endianness specific correction offset is added to access the desired subpart. In this case there is no reason to _not_ use a 64 bit load though.Signed-off-by Marcus Comstedt <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/228b607d8ea1b7d4561945058d5692709099d432
cheers