[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 33/34] pseries: Don't test for MSR_PR for hypercalls u
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 33/34] pseries: Don't test for MSR_PR for hypercalls under KVM |
Date: |
Thu, 4 Oct 2012 15:56:55 +0200 |
From: David Gibson <address@hidden>
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 <address@hidden>
CC: address@hidden
Signed-off-by: Alexander Graf <address@hidden>
---
hw/spapr.c | 7 ++++++-
hw/spapr_hcall.c | 5 -----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/spapr.c b/hw/spapr.c
index a8bd3c1..ab227a0 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -573,7 +573,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_htab(sPAPREnvironment *spapr)
diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c
index 826ca67..194d9c2 100644
--- a/hw/spapr_hcall.c
+++ b/hw/spapr_hcall.c
@@ -681,11 +681,6 @@ void spapr_register_hypercall(target_ulong opcode,
spapr_hcall_fn fn)
target_ulong spapr_hypercall(CPUPPCState *env, target_ulong opcode,
target_ulong *args)
{
- if (msr_pr) {
- hcall_dprintf("Hypercall made with MSR[PR]=1\n");
- return H_PRIVILEGE;
- }
-
if ((opcode <= MAX_HCALL_OPCODE)
&& ((opcode & 0x3) == 0)) {
spapr_hcall_fn fn = papr_hypercall_table[opcode / 4];
--
1.6.0.2
- [Qemu-ppc] [PATCH 06/34] target-ppc: simplify NaN propagation for vector functions, (continued)
- [Qemu-ppc] [PATCH 06/34] target-ppc: simplify NaN propagation for vector functions, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 08/34] target-ppc: use the softfloat float32_muladd function, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 10/34] ppc: Make kvm_arch_put_registers() put *all* the registers, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 18/34] pseries: Remove C bitfields from xics code, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 17/34] pseries: Small cleanup to H_CEDE implementation, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 21/34] pseries: Rework implementation of TCE bypass, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 20/34] pseries: Remove never used flags field from spapr vio devices, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 14/34] pseries: Clear TCE and signal state when resetting PAPR VIO devices, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 29/34] fdt: move dumpdtb interpretation code to device_tree.c, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 26/34] pseries: Set hash table size based on RAM size, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 33/34] pseries: Don't test for MSR_PR for hypercalls under KVM,
Alexander Graf <=
- [Qemu-ppc] [PATCH 27/34] target-ppc: Remove unused power_mode field from cpu state, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 28/34] target-ppc: Extend FPU state for newer POWER CPUs, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 32/34] PPC: e500: calculate initrd_base like dt_base, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 30/34] device tree: simplify dumpdtb code, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 34/34] ppc/pseries: Reset VPA registration on CPU reset, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 25/34] pseries: Remove unnecessary locking from PAPR hash table hcalls, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 04/34] MAINTAINERS: Document Bamboo machine and ppc4xx devices, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 24/34] ppc405_uc: Fix buffer overflow, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 16/34] pseries: Fix XICS reset, Alexander Graf, 2012/10/04
- [Qemu-ppc] [PATCH 11/34] pseries: Fix and cleanup CPU initialization and reset, Alexander Graf, 2012/10/04