|
|
9bac43 |
From 8663586f2bc64d4761d4f621bc7aa781a4a450b2 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Date: Fri, 20 Oct 2017 14:02:07 +0200
|
|
|
9bac43 |
Subject: [PATCH 1/9] qemu-kvm-rhev: only allows pseries-rhel7.5.0 machine type
|
|
|
9bac43 |
with POWER9 guest
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Message-id: <20171020140207.15190-1-lvivier@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 77416
|
|
|
9bac43 |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH v3 3/4] qemu-kvm-rhev: only allows pseries-rhel7.5.0 machine type with POWER9 guest
|
|
|
9bac43 |
Bugzilla: 1478469
|
|
|
9bac43 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
We disable all machine types except pseries-rhel7.5.0 for POWER9
|
|
|
9bac43 |
guest.
|
|
|
9bac43 |
|
|
|
9bac43 |
qemu-kvm-rhev does't not support POWER9 with former machine types
|
|
|
9bac43 |
so disable them dynamically. We allow all machine types on POWER9
|
|
|
9bac43 |
host but with guest in POWER8 CPU mode
|
|
|
9bac43 |
(for instance "-M pseries-rhel7.4.0,max-cpu-compat=power8")
|
|
|
9bac43 |
|
|
|
9bac43 |
"-M help" display all the machine types, but if the guest is started
|
|
|
9bac43 |
with "-cpu POWER9" and with a machine type which is not
|
|
|
9bac43 |
"pseries-rhel7.5.0" an error message is displayed and the guest is
|
|
|
9bac43 |
stopped.
|
|
|
9bac43 |
|
|
|
9bac43 |
We use the ppc_check_compat() to compare current CPU version with ISA
|
|
|
9bac43 |
level of POWER9 (CPU_POWERPC_LOGICAL_3_00), but as POWER9 DD1 has some
|
|
|
9bac43 |
bugs, POWER9 DD1 does not advertise PCR_COMPAT_3_00 (see
|
|
|
9bac43 |
kvmppc_host_cpu_class_init()), and thus this allows to run all the machine
|
|
|
9bac43 |
types with POWER9 DD1.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
hw/ppc/spapr.c | 2 ++
|
|
|
9bac43 |
hw/ppc/spapr_cpu_core.c | 13 +++++++++++++
|
|
|
9bac43 |
include/hw/ppc/spapr.h | 1 +
|
|
|
9bac43 |
target/ppc/compat.c | 11 +++++++++++
|
|
|
9bac43 |
target/ppc/cpu.h | 1 +
|
|
|
9bac43 |
5 files changed, 28 insertions(+)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
|
|
9bac43 |
index 5fe7769..42028ef 100644
|
|
|
9bac43 |
--- a/hw/ppc/spapr.c
|
|
|
9bac43 |
+++ b/hw/ppc/spapr.c
|
|
|
9bac43 |
@@ -3592,6 +3592,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
|
|
|
9bac43 |
* in which LMBs are represented and hot-added
|
|
|
9bac43 |
*/
|
|
|
9bac43 |
mc->numa_mem_align_shift = 28;
|
|
|
9bac43 |
+ smc->has_power9_support = true;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
static const TypeInfo spapr_machine_info = {
|
|
|
9bac43 |
@@ -3993,6 +3994,7 @@ static void spapr_machine_rhel740_class_options(MachineClass *mc)
|
|
|
9bac43 |
spapr_machine_rhel750_class_options(mc);
|
|
|
9bac43 |
SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_RHEL7_4);
|
|
|
9bac43 |
mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
|
|
|
9bac43 |
+ smc->has_power9_support = false;
|
|
|
9bac43 |
smc->pre_2_10_has_unused_icps = true;
|
|
|
9bac43 |
smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
|
|
|
9bac43 |
index 3e731e4..400ab56 100644
|
|
|
9bac43 |
--- a/hw/ppc/spapr_cpu_core.c
|
|
|
9bac43 |
+++ b/hw/ppc/spapr_cpu_core.c
|
|
|
9bac43 |
@@ -19,6 +19,7 @@
|
|
|
9bac43 |
#include "target/ppc/mmu-hash64.h"
|
|
|
9bac43 |
#include "sysemu/numa.h"
|
|
|
9bac43 |
#include "qemu/error-report.h"
|
|
|
9bac43 |
+#include "cpu-models.h"
|
|
|
9bac43 |
|
|
|
9bac43 |
void spapr_cpu_parse_features(sPAPRMachineState *spapr)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
@@ -111,6 +112,7 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu,
|
|
|
9bac43 |
Error **errp)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
CPUPPCState *env = &cpu->env;
|
|
|
9bac43 |
+ sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
|
|
|
9bac43 |
|
|
|
9bac43 |
/* Set time-base frequency to 512 MHz */
|
|
|
9bac43 |
cpu_ppc_tb_init(env, SPAPR_TIMEBASE_FREQ);
|
|
|
9bac43 |
@@ -118,6 +120,17 @@ static void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu,
|
|
|
9bac43 |
/* Enable PAPR mode in TCG or KVM */
|
|
|
9bac43 |
cpu_ppc_set_papr(cpu, PPC_VIRTUAL_HYPERVISOR(spapr));
|
|
|
9bac43 |
|
|
|
9bac43 |
+ if (!smc->has_power9_support &&
|
|
|
9bac43 |
+ (((spapr->max_compat_pvr &&
|
|
|
9bac43 |
+ ppc_compat_cmp(spapr->max_compat_pvr,
|
|
|
9bac43 |
+ CPU_POWERPC_LOGICAL_3_00) >= 0)) ||
|
|
|
9bac43 |
+ (!spapr->max_compat_pvr &&
|
|
|
9bac43 |
+ ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) {
|
|
|
9bac43 |
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
|
|
9bac43 |
+ "POWER9 CPU is not supported by this machine class");
|
|
|
9bac43 |
+ return;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+
|
|
|
9bac43 |
qemu_register_reset(spapr_cpu_reset, cpu);
|
|
|
9bac43 |
spapr_cpu_reset(cpu);
|
|
|
9bac43 |
}
|
|
|
9bac43 |
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
|
|
|
9bac43 |
index 3d0d206..d9e8e5a 100644
|
|
|
9bac43 |
--- a/include/hw/ppc/spapr.h
|
|
|
9bac43 |
+++ b/include/hw/ppc/spapr.h
|
|
|
9bac43 |
@@ -62,6 +62,7 @@ struct sPAPRMachineClass {
|
|
|
9bac43 |
bool use_ohci_by_default; /* use USB-OHCI instead of XHCI */
|
|
|
9bac43 |
const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
|
|
|
9bac43 |
bool pre_2_10_has_unused_icps;
|
|
|
9bac43 |
+ bool has_power9_support;
|
|
|
9bac43 |
void (*phb_placement)(sPAPRMachineState *spapr, uint32_t index,
|
|
|
9bac43 |
uint64_t *buid, hwaddr *pio,
|
|
|
9bac43 |
hwaddr *mmio32, hwaddr *mmio64,
|
|
|
9bac43 |
diff --git a/target/ppc/compat.c b/target/ppc/compat.c
|
|
|
9bac43 |
index f8729fe..540b4eb 100644
|
|
|
9bac43 |
--- a/target/ppc/compat.c
|
|
|
9bac43 |
+++ b/target/ppc/compat.c
|
|
|
9bac43 |
@@ -89,6 +89,17 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr)
|
|
|
9bac43 |
return NULL;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2)
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ const CompatInfo *compat1 = compat_by_pvr(pvr1);
|
|
|
9bac43 |
+ const CompatInfo *compat2 = compat_by_pvr(pvr2);
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ g_assert(compat1);
|
|
|
9bac43 |
+ g_assert(compat2);
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ return compat1 - compat2;
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
|
|
|
9bac43 |
uint32_t min_compat_pvr, uint32_t max_compat_pvr)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
|
|
|
9bac43 |
index 46d3dd8..6c770a2 100644
|
|
|
9bac43 |
--- a/target/ppc/cpu.h
|
|
|
9bac43 |
+++ b/target/ppc/cpu.h
|
|
|
9bac43 |
@@ -1367,6 +1367,7 @@ static inline int cpu_mmu_index (CPUPPCState *env, bool ifetch)
|
|
|
9bac43 |
|
|
|
9bac43 |
/* Compatibility modes */
|
|
|
9bac43 |
#if defined(TARGET_PPC64)
|
|
|
9bac43 |
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2);
|
|
|
9bac43 |
bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
|
|
|
9bac43 |
uint32_t min_compat_pvr, uint32_t max_compat_pvr);
|
|
|
9bac43 |
void ppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr, Error **errp);
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|