diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2012-09-25 17:12:20 +0000 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2012-10-11 21:44:21 -0500 |
commit | 159fe82dea23fdaf2e747d09c4f71afee00f664c (patch) | |
tree | 1ba0103ae377854f10ba7558ced4601c84e051a0 /hw/spapr.c | |
parent | a8f2299d1b170b6100b0e9ad00788a7a7e31719b (diff) |
pseries: Don't test for MSR_PR for hypercalls under KVM
PAPR hypercalls should only be invoked from the guest kernel, not guest
user programs, that is, with MSR[PR]=0. Currently we check this in
spapr_hypercall, returning H_PRIVILEGE if MSR[PR]=1.
However, under KVM the state of MSR[PR] is already checked by the host
kernel before passing the hypercall to qemu, making this check redundant.
Worse, however, we don't generally synchronize KVM and qemu state on the
hypercall path, meaning that qemu could incorrectly reject a hypercall
because it has a stale MSR value.
This patch fixes the problem by moving the privilege test exclusively to
the TCG hypercall path.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
CC: qemu-stable@nongnu.org
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit efcb9383b974114e5f682e531346006f8f2466c0)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw/spapr.c')
-rw-r--r-- | hw/spapr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/spapr.c b/hw/spapr.c index c34b767c6e..5e5543051c 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -556,7 +556,12 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) static void emulate_spapr_hypercall(CPUPPCState *env) { - env->gpr[3] = spapr_hypercall(env, env->gpr[3], &env->gpr[4]); + if (msr_pr) { + hcall_dprintf("Hypercall made with MSR[PR]=1\n"); + env->gpr[3] = H_PRIVILEGE; + } else { + env->gpr[3] = spapr_hypercall(env, env->gpr[3], &env->gpr[4]); + } } static void spapr_reset(void *opaque) |