public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "kvm@vger.kernel.org list" <kvm@vger.kernel.org>
Cc: Avi Kivity <avi@redhat.com>,
	kvm-ppc@vger.kernel.org, Paul Mackerras <paulus@samba.org>
Subject: [PATCH 01/17] KVM: PPC: Fix machine checks on 32-bit Book3S
Date: Mon,  4 Jul 2011 16:12:38 +0200	[thread overview]
Message-ID: <1309788774-13644-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1309788774-13644-1-git-send-email-agraf@suse.de>

From: Paul Mackerras <paulus@samba.org>

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>
---
 arch/powerpc/kvm/book3s.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 73fdab8..83500fb 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -28,6 +28,7 @@
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
 #include <asm/mmu_context.h>
+#include <asm/page.h>
 #include <linux/gfp.h>
 #include <linux/sched.h>
 #include <linux/vmalloc.h>
@@ -1342,8 +1343,8 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
 	vcpu_book3s->slb_nr = 64;
 
 	/* remember where some real-mode handlers are */
-	vcpu->arch.trampoline_lowmem = (ulong)kvmppc_handler_lowmem_trampoline;
-	vcpu->arch.trampoline_enter = (ulong)kvmppc_handler_trampoline_enter;
+	vcpu->arch.trampoline_lowmem = __pa(kvmppc_handler_lowmem_trampoline);
+	vcpu->arch.trampoline_enter = __pa(kvmppc_handler_trampoline_enter);
 	vcpu->arch.highmem_handler = (ulong)kvmppc_handler_highmem;
 #ifdef CONFIG_PPC_BOOK3S_64
 	vcpu->arch.rmcall = *(ulong*)kvmppc_rmcall;
-- 
1.6.0.2


  reply	other threads:[~2011-07-04 14:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 14:12 [PULL 00/17] KVM PPC patch queue 2011-07-04 Alexander Graf
2011-07-04 14:12 ` Alexander Graf [this message]
2011-07-04 14:12 ` [PATCH 02/17] KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s Alexander Graf
2011-07-04 14:12 ` [PATCH 03/17] KVM: PPC: Split out code from book3s.c into book3s_pr.c Alexander Graf
2011-07-04 14:12 ` [PATCH 04/17] powerpc, KVM: Rework KVM checks in first-level interrupt handlers Alexander Graf
2011-07-04 14:12 ` [PATCH 05/17] KVM: PPC: Deliver program interrupts right away instead of queueing them Alexander Graf
2011-07-04 14:12 ` [PATCH 06/17] KVM: PPC: Pass init/destroy vm and prepare/commit memory region ops down Alexander Graf
2011-07-04 14:12 ` [PATCH 07/17] KVM: PPC: Move guest enter/exit down into subarch-specific code Alexander Graf
2011-07-04 14:12 ` [PATCH 08/17] powerpc: Set up LPCR for running guest partitions Alexander Graf
2011-07-04 14:12 ` [PATCH 09/17] KVM: PPC: Split host-state fields out of kvmppc_book3s_shadow_vcpu Alexander Graf
2011-07-04 14:12 ` [PATCH 10/17] KVM: PPC: Add support for Book3S processors in hypervisor mode Alexander Graf
2011-07-04 14:12 ` [PATCH 11/17] KVM: PPC: Handle some PAPR hcalls in the kernel Alexander Graf
2011-07-04 14:12 ` [PATCH 12/17] KVM: PPC: Accelerate H_PUT_TCE by implementing it in real mode Alexander Graf
2011-07-04 14:12 ` [PATCH 13/17] KVM: PPC: Allow book3s_hv guests to use SMT processor modes Alexander Graf
2011-07-04 14:12 ` [PATCH 14/17] KVM: PPC: Allocate RMAs (Real Mode Areas) at boot for use by guests Alexander Graf
2011-07-04 14:12 ` [PATCH 15/17] powerpc, KVM: Split HVMODE_206 cpu feature bit into separate HV and architecture bits Alexander Graf
2011-07-04 14:12 ` [PATCH 16/17] KVM: PPC: book3s_hv: Add support for PPC970-family processors Alexander Graf
2011-07-04 14:12 ` [PATCH 17/17] KVM: PPC: Remove prog_flags Alexander Graf
2011-07-07  9:35 ` [PULL 00/17] KVM PPC patch queue 2011-07-04 Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2011-06-29 10:15 [PATCH 0/17] Hypervisor-mode KVM on POWER7 and PPC970 Paul Mackerras
2011-06-29 10:16 ` [PATCH 01/17] KVM: PPC: Fix machine checks on 32-bit Book3S Paul Mackerras
2011-07-01 10:08   ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309788774-13644-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox