[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 30/40] spapr: fallback to raw mode if best compat mode
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 30/40] spapr: fallback to raw mode if best compat mode cannot be set during CAS |
Date: |
Fri, 8 Sep 2017 20:35:48 +1000 |
From: Greg Kurz <address@hidden>
KVM PR doesn't allow to set a compat mode. This causes ppc_set_compat_all()
to fail and we return H_HARDWARE to the guest right away.
This is excessive: even if we favor compat mode since commit 152ef803ceb19,
we should at least fallback to raw mode if the guest supports it.
This patch modifies cas_check_pvr() so that it also reports that the real
PVR was found in the table supplied by the guest. Note that this is only
makes sense if raw mode isn't explicitely disabled (ie, the user didn't
set the machine "max-cpu-compat" property). If this is the case, we can
simply ignore ppc_set_compat_all() failures, and let the guest run in raw
mode.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_hcall.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 7cf0993800..8b3c0e17e7 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1441,7 +1441,8 @@ static target_ulong h_signal_sys_reset(PowerPCCPU *cpu,
}
static uint32_t cas_check_pvr(sPAPRMachineState *spapr, PowerPCCPU *cpu,
- target_ulong *addr, Error **errp)
+ target_ulong *addr, bool *raw_mode_supported,
+ Error **errp)
{
bool explicit_match = false; /* Matched the CPU's real PVR */
uint32_t max_compat = spapr->max_compat_pvr;
@@ -1481,6 +1482,8 @@ static uint32_t cas_check_pvr(sPAPRMachineState *spapr,
PowerPCCPU *cpu,
return 0;
}
+ *raw_mode_supported = explicit_match;
+
/* Parsing finished */
trace_spapr_cas_pvr(cpu->compat_pvr, explicit_match, best_compat);
@@ -1499,8 +1502,9 @@ static target_ulong
h_client_architecture_support(PowerPCCPU *cpu,
sPAPROptionVector *ov1_guest, *ov5_guest, *ov5_cas_old, *ov5_updates;
bool guest_radix;
Error *local_err = NULL;
+ bool raw_mode_supported = false;
- cas_pvr = cas_check_pvr(spapr, cpu, &addr, &local_err);
+ cas_pvr = cas_check_pvr(spapr, cpu, &addr, &raw_mode_supported,
&local_err);
if (local_err) {
error_report_err(local_err);
return H_HARDWARE;
@@ -1510,8 +1514,14 @@ static target_ulong
h_client_architecture_support(PowerPCCPU *cpu,
if (cpu->compat_pvr != cas_pvr) {
ppc_set_compat_all(cas_pvr, &local_err);
if (local_err) {
- error_report_err(local_err);
- return H_HARDWARE;
+ /* We fail to set compat mode (likely because running with KVM PR),
+ * but maybe we can fallback to raw mode if the guest supports it.
+ */
+ if (!raw_mode_supported) {
+ error_report_err(local_err);
+ return H_HARDWARE;
+ }
+ local_err = NULL;
}
}
--
2.13.5
- [Qemu-ppc] [PULL 28/40] hw/ppc/spapr_cpu_core: Add a proper check for spapr machine, (continued)
- [Qemu-ppc] [PULL 28/40] hw/ppc/spapr_cpu_core: Add a proper check for spapr machine, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 24/40] ppc4xx: Split off 4xx I2C emulation from ppc405_uc to its own file, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 26/40] ppc4xx_i2c: Move to hw/i2c, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 25/40] ppc4xx_i2c: QOMify, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 36/40] ppc: replace inter-function cyclic dependency/recurssion with 2 simple lookups, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 40/40] ppc: spapr: Move VCPU ID calculation into sPAPR, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 31/40] PPC: KVM: Support machine option to set VSMT mode, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 33/40] ppc: use macros to make cpu type name from string literal, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 32/40] target/ppc: Remove old STATUS file, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 39/40] ppc: remove non implemented cpu models, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 30/40] spapr: fallback to raw mode if best compat mode cannot be set during CAS,
David Gibson <=
- [Qemu-ppc] [PULL 37/40] ppc: simplify cpu model lookup by PVR, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 35/40] ppc: make cpu alias point only to real cpu models, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 38/40] ppc: drop caching ObjectClass from PowerPCCPUAlias, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 22/40] ppc4xx: Move MAL from ppc405_uc to ppc4xx_devs, David Gibson, 2017/09/08
- [Qemu-ppc] [PULL 34/40] ppc: make cpu_model translation to type consistent, David Gibson, 2017/09/08
- Re: [Qemu-ppc] [PULL 00/40] ppc-for-2.11 queue 20170908, Peter Maydell, 2017/09/08