Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: PPC: Fix machine checks on 32-bit Book3S

Commit 69acc0d3ba ("KVM: PPC: Resolve real-mode handlers through
function exports") resulted in vcpu->arch.trampoline_lowmem and
vcpu->arch.trampoline_enter ending up with kernel virtual addresses
rather than physical addresses. This is OK on 64-bit Book3S machines,
which ignore the top 4 bits of the effective address in real mode,
but on 32-bit Book3S machines, accessing these addresses in real mode
causes machine check interrupts, as the hardware uses the whole
effective address as the physical address in real mode.

This fixes the problem by using __pa() to convert these addresses
to physical addresses.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>

authored by

Paul Mackerras and committed by
Avi Kivity
149dbdb1 3c8c652a

+3 -2
+3 -2
arch/powerpc/kvm/book3s.c
··· 28 28 #include <asm/kvm_ppc.h> 29 29 #include <asm/kvm_book3s.h> 30 30 #include <asm/mmu_context.h> 31 + #include <asm/page.h> 31 32 #include <linux/gfp.h> 32 33 #include <linux/sched.h> 33 34 #include <linux/vmalloc.h> ··· 1343 1342 vcpu_book3s->slb_nr = 64; 1344 1343 1345 1344 /* remember where some real-mode handlers are */ 1346 - vcpu->arch.trampoline_lowmem = (ulong)kvmppc_handler_lowmem_trampoline; 1347 - vcpu->arch.trampoline_enter = (ulong)kvmppc_handler_trampoline_enter; 1345 + vcpu->arch.trampoline_lowmem = __pa(kvmppc_handler_lowmem_trampoline); 1346 + vcpu->arch.trampoline_enter = __pa(kvmppc_handler_trampoline_enter); 1348 1347 vcpu->arch.highmem_handler = (ulong)kvmppc_handler_highmem; 1349 1348 #ifdef CONFIG_PPC_BOOK3S_64 1350 1349 vcpu->arch.rmcall = *(ulong*)kvmppc_rmcall;