2019-05-07 21:00:36 +00:00
|
|
|
From 373a3f8f11227ba6bce10dab17ddfb6caffc75cf Mon Sep 17 00:00:00 2001
|
2018-11-08 17:02:33 +00:00
|
|
|
From: Miroslav Rezanina <mrezanin@redhat.com>
|
2018-11-29 12:09:34 +00:00
|
|
|
Date: Fri, 19 Oct 2018 13:27:13 +0200
|
2018-11-08 17:02:33 +00:00
|
|
|
Subject: Add ppc64 machine types
|
|
|
|
|
|
|
|
Adding changes to add RHEL machine types for ppc64 architecture.
|
|
|
|
|
|
|
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
2019-05-07 21:00:36 +00:00
|
|
|
|
|
|
|
Rebase changes (weekly-190111):
|
|
|
|
- remove instance options and use upstream solution
|
|
|
|
- Use upstream compat handling
|
|
|
|
- Replace SPAPR_PCI_2_7_MMIO_WIN_SIZE with value (changed upstream)
|
|
|
|
|
|
|
|
Rebase changes (weekly-190104):
|
|
|
|
- re-add handling of instance_options (removed upstream)
|
|
|
|
- Use p8 as default for rhel machine types (p9 default upstream)
|
|
|
|
|
|
|
|
Rebase changes (weekly-190315):
|
|
|
|
- sPAPRMachineClass renamed to SpaprMachineClass (upstream)
|
|
|
|
|
|
|
|
Merged patches (weekly-190104):
|
|
|
|
- 467d59a redhat: define pseries-rhel8.0.0 machine type
|
|
|
|
|
|
|
|
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
2018-11-08 17:02:33 +00:00
|
|
|
---
|
2019-05-07 21:00:36 +00:00
|
|
|
hw/ppc/spapr.c | 252 ++++++++++++++++++++++++++++++++++++++++
|
2018-11-08 17:02:33 +00:00
|
|
|
hw/ppc/spapr_cpu_core.c | 13 +++
|
|
|
|
include/hw/ppc/spapr.h | 1 +
|
|
|
|
target/ppc/compat.c | 13 ++-
|
|
|
|
target/ppc/cpu.h | 1 +
|
|
|
|
5 files changed, 279 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
2019-05-07 21:00:36 +00:00
|
|
|
index b52b82d298..daa59203ea 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/hw/ppc/spapr.c
|
|
|
|
+++ b/hw/ppc/spapr.c
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -4300,6 +4300,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
|
2018-11-08 17:02:33 +00:00
|
|
|
spapr_caps_add_properties(smc, &error_abort);
|
2018-11-29 12:09:34 +00:00
|
|
|
smc->irq = &spapr_irq_xics;
|
2019-05-07 21:00:36 +00:00
|
|
|
smc->dr_phb_enabled = true;
|
2018-11-08 17:02:33 +00:00
|
|
|
+ smc->has_power9_support = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const TypeInfo spapr_machine_info = {
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -4344,6 +4345,7 @@ static const TypeInfo spapr_machine_info = {
|
2018-11-08 17:02:33 +00:00
|
|
|
} \
|
|
|
|
type_init(spapr_machine_register_##suffix)
|
|
|
|
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
2019-05-07 21:00:36 +00:00
|
|
|
/*
|
|
|
|
* pseries-4.0
|
|
|
|
*/
|
|
|
|
@@ -4499,6 +4501,7 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false);
|
|
|
|
/*
|
|
|
|
* pseries-2.7
|
2018-11-08 17:02:33 +00:00
|
|
|
*/
|
|
|
|
+#endif
|
|
|
|
|
2019-05-07 21:00:36 +00:00
|
|
|
static void phb_placement_2_7(SpaprMachineState *spapr, uint32_t index,
|
2018-11-08 17:02:33 +00:00
|
|
|
uint64_t *buid, hwaddr *pio,
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -4549,6 +4552,7 @@ static void phb_placement_2_7(SpaprMachineState *spapr, uint32_t index,
|
2018-11-08 17:02:33 +00:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
2019-05-07 21:00:36 +00:00
|
|
|
static void spapr_machine_2_7_class_options(MachineClass *mc)
|
2018-11-08 17:02:33 +00:00
|
|
|
{
|
2019-05-07 21:00:36 +00:00
|
|
|
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
|
|
|
@@ -4663,6 +4667,254 @@ static void spapr_machine_2_1_class_options(MachineClass *mc)
|
|
|
|
compat_props_add(mc->compat_props, hw_compat_2_1, hw_compat_2_1_len);
|
2018-11-08 17:02:33 +00:00
|
|
|
}
|
|
|
|
DEFINE_SPAPR_MACHINE(2_1, "2.1", false);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/*
|
2019-05-07 21:00:36 +00:00
|
|
|
+ * pseries-rhel8.0.0
|
2018-11-08 17:02:33 +00:00
|
|
|
+ */
|
|
|
|
+
|
2019-05-07 21:00:36 +00:00
|
|
|
+static void spapr_machine_rhel800_class_options(MachineClass *mc)
|
2018-11-08 17:02:33 +00:00
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ /* Defaults for the latest behaviour inherited from the base class */
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
|
|
|
+
|
2019-05-07 21:00:36 +00:00
|
|
|
+DEFINE_SPAPR_MACHINE(rhel800, "rhel8.0.0", true);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.6.0
|
|
|
|
+ * like spapr_compat_2_12 and spapr_compat_3_0
|
|
|
|
+ * spapr_compat_0 is empty
|
|
|
|
+ */
|
|
|
|
+GlobalProperty spapr_compat_rhel7_6[] = {
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_POWERPC_CPU,
|
|
|
|
+ .property = "pre-3.0-migration",
|
|
|
|
+ .value = "on",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_SPAPR_CPU_CORE,
|
|
|
|
+ .property = "pre-3.0-migration",
|
|
|
|
+ .value = "on",
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+const size_t spapr_compat_rhel7_6_len = G_N_ELEMENTS(spapr_compat_rhel7_6);
|
|
|
|
+
|
|
|
|
+
|
2018-11-08 17:02:33 +00:00
|
|
|
+static void spapr_machine_rhel760_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
|
|
|
+
|
|
|
|
+ spapr_machine_rhel800_class_options(mc);
|
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
|
|
|
|
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_6, spapr_compat_rhel7_6_len);
|
|
|
|
+
|
|
|
|
+ /* from spapr_machine_3_0_class_options() */
|
|
|
|
+ smc->legacy_irq_allocation = true;
|
|
|
|
+ smc->irq = &spapr_irq_xics_legacy;
|
|
|
|
+
|
|
|
|
+ /* from spapr_machine_2_12_class_options() */
|
|
|
|
+ /* We depend on kvm_enabled() to choose a default value for the
|
|
|
|
+ * hpt-max-page-size capability. Of course we can't do it here
|
|
|
|
+ * because this is too early and the HW accelerator isn't initialzed
|
|
|
|
+ * yet. Postpone this to machine init (see default_caps_with_cpu()).
|
|
|
|
+ */
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 0;
|
2018-11-08 17:02:33 +00:00
|
|
|
+ /* Defaults for the latest behaviour inherited from the base class */
|
2019-05-07 21:00:36 +00:00
|
|
|
+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
|
|
|
+
|
2019-05-07 21:00:36 +00:00
|
|
|
+DEFINE_SPAPR_MACHINE(rhel760, "rhel7.6.0", false);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.6.0-sxxm
|
|
|
|
+ *
|
|
|
|
+ * pseries-rhel7.6.0 with speculative execution exploit mitigations enabled by default
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel760sxxm_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel760_class_options(mc);
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel760sxxm, "rhel7.6.0-sxxm", false);
|
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel750_class_options(MachineClass *mc)
|
|
|
|
+{
|
|
|
|
+ spapr_machine_rhel760_class_options(mc);
|
2019-05-07 21:00:36 +00:00
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_5, hw_compat_rhel_7_5_len);
|
|
|
|
+
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel750, "rhel7.5.0", false);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.5.0-sxxm
|
|
|
|
+ *
|
|
|
|
+ * pseries-rhel7.5.0 with speculative execution exploit mitigations enabled by default
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel750sxxm_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel750_class_options(mc);
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel750sxxm, "rhel7.5.0-sxxm", false);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.4.0
|
2019-05-07 21:00:36 +00:00
|
|
|
+ * like spapr_compat_2_9
|
2018-11-08 17:02:33 +00:00
|
|
|
+ */
|
2019-05-07 21:00:36 +00:00
|
|
|
+GlobalProperty spapr_compat_rhel7_4[] = {
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_POWERPC_CPU,
|
|
|
|
+ .property = "pre-2.10-migration",
|
|
|
|
+ .value = "on",
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+const size_t spapr_compat_rhel7_4_len = G_N_ELEMENTS(spapr_compat_rhel7_4);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel740_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel750_class_options(mc);
|
2019-05-07 21:00:36 +00:00
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_4, hw_compat_rhel_7_4_len);
|
|
|
|
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_4, spapr_compat_rhel7_4_len);
|
2018-11-08 17:02:33 +00:00
|
|
|
+ mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
|
|
|
|
+ smc->has_power9_support = false;
|
|
|
|
+ smc->pre_2_10_has_unused_icps = true;
|
|
|
|
+ smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel740, "rhel7.4.0", false);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.4.0-sxxm
|
|
|
|
+ *
|
|
|
|
+ * pseries-rhel7.4.0 with speculative execution exploit mitigations enabled by default
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel740sxxm_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel740_class_options(mc);
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel740sxxm, "rhel7.4.0-sxxm", false);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.3.0
|
2019-05-07 21:00:36 +00:00
|
|
|
+ * like spapr_compat_2_6/_2_7/_2_8 but "ddw" has been backported to RHEL7_3
|
2018-11-08 17:02:33 +00:00
|
|
|
+ */
|
2019-05-07 21:00:36 +00:00
|
|
|
+GlobalProperty spapr_compat_rhel7_3[] = {
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
|
|
|
|
+ .property = "mem_win_size",
|
|
|
|
+ .value = "0xf80000000",
|
2018-11-08 17:02:33 +00:00
|
|
|
+ },
|
2019-05-07 21:00:36 +00:00
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
|
|
|
|
+ .property = "mem64_win_size",
|
|
|
|
+ .value = "0",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_POWERPC_CPU,
|
|
|
|
+ .property = "pre-2.8-migration",
|
|
|
|
+ .value = "on",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
|
|
|
|
+ .property = "pre-2.8-migration",
|
|
|
|
+ .value = "on",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
|
|
|
|
+ .property = "pcie-extended-configuration-space",
|
|
|
|
+ .value = "off",
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+const size_t spapr_compat_rhel7_3_len = G_N_ELEMENTS(spapr_compat_rhel7_3);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel730_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel740_class_options(mc);
|
|
|
|
+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power7_v2.3");
|
2019-05-07 21:00:36 +00:00
|
|
|
+ mc->default_machine_opts = "modern-hotplug-events=off";
|
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_3, hw_compat_rhel_7_3_len);
|
|
|
|
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_3, spapr_compat_rhel7_3_len);
|
|
|
|
+
|
2018-11-08 17:02:33 +00:00
|
|
|
+ smc->phb_placement = phb_placement_2_7;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel730, "rhel7.3.0", false);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.3.0-sxxm
|
|
|
|
+ *
|
|
|
|
+ * pseries-rhel7.3.0 with speculative execution exploit mitigations enabled by default
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel730sxxm_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel730_class_options(mc);
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
|
|
|
|
+ smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel730sxxm, "rhel7.3.0-sxxm", false);
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * pseries-rhel7.2.0
|
|
|
|
+ */
|
2019-05-07 21:00:36 +00:00
|
|
|
+/* Should be like spapr_compat_2_5 + 2_4 + 2_3, but "dynamic-reconfiguration"
|
2018-11-08 17:02:33 +00:00
|
|
|
+ * has been backported to RHEL7_2 so we don't need it here.
|
|
|
|
+ */
|
|
|
|
+
|
2019-05-07 21:00:36 +00:00
|
|
|
+GlobalProperty spapr_compat_rhel7_2[] = {
|
|
|
|
+ {
|
|
|
|
+ .driver = "spapr-vlan",
|
|
|
|
+ .property = "use-rx-buffer-pools",
|
|
|
|
+ .value = "off",
|
|
|
|
+ },{
|
|
|
|
+ .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
|
|
|
|
+ .property = "ddw",
|
|
|
|
+ .value = "off",
|
2018-11-08 17:02:33 +00:00
|
|
|
+ },
|
2019-05-07 21:00:36 +00:00
|
|
|
+};
|
|
|
|
+const size_t spapr_compat_rhel7_2_len = G_N_ELEMENTS(spapr_compat_rhel7_2);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+static void spapr_machine_rhel720_class_options(MachineClass *mc)
|
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ spapr_machine_rhel730_class_options(mc);
|
|
|
|
+ smc->use_ohci_by_default = true;
|
|
|
|
+ mc->has_hotpluggable_cpus = NULL;
|
2019-05-07 21:00:36 +00:00
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_7_2, hw_compat_rhel_7_2_len);
|
|
|
|
+ compat_props_add(mc->compat_props, spapr_compat_rhel7_2, spapr_compat_rhel7_2_len);
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+DEFINE_SPAPR_MACHINE(rhel720, "rhel7.2.0", false);
|
|
|
|
|
|
|
|
static void spapr_machine_register_types(void)
|
|
|
|
{
|
|
|
|
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
|
2019-05-07 21:00:36 +00:00
|
|
|
index c664969b5b..7556debbef 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/hw/ppc/spapr_cpu_core.c
|
|
|
|
+++ b/hw/ppc/spapr_cpu_core.c
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -21,6 +21,7 @@
|
2018-11-08 17:02:33 +00:00
|
|
|
#include "sysemu/numa.h"
|
|
|
|
#include "sysemu/hw_accel.h"
|
|
|
|
#include "qemu/error-report.h"
|
|
|
|
+#include "cpu-models.h"
|
|
|
|
|
|
|
|
static void spapr_cpu_reset(void *opaque)
|
|
|
|
{
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -222,6 +223,7 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
2018-11-08 17:02:33 +00:00
|
|
|
CPUPPCState *env = &cpu->env;
|
2018-11-29 12:09:34 +00:00
|
|
|
CPUState *cs = CPU(cpu);
|
2018-11-08 17:02:33 +00:00
|
|
|
Error *local_err = NULL;
|
2019-05-07 21:00:36 +00:00
|
|
|
+ SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
object_property_set_bool(OBJECT(cpu), true, "realized", &local_err);
|
|
|
|
if (local_err) {
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -234,6 +236,17 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
|
2018-11-08 17:02:33 +00:00
|
|
|
cpu_ppc_set_vhyp(cpu, PPC_VIRTUAL_HYPERVISOR(spapr));
|
|
|
|
kvmppc_set_papr(cpu);
|
|
|
|
|
|
|
|
+ if (!smc->has_power9_support &&
|
|
|
|
+ (((spapr->max_compat_pvr &&
|
|
|
|
+ ppc_compat_cmp(spapr->max_compat_pvr,
|
|
|
|
+ CPU_POWERPC_LOGICAL_3_00) >= 0)) ||
|
|
|
|
+ (!spapr->max_compat_pvr &&
|
|
|
|
+ ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, 0)))) {
|
|
|
|
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
|
|
|
+ "POWER9 CPU is not supported by this machine class");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
qemu_register_reset(spapr_cpu_reset, cpu);
|
|
|
|
spapr_cpu_reset(cpu);
|
|
|
|
|
|
|
|
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
|
2019-05-07 21:00:36 +00:00
|
|
|
index 5ea8081041..8737516ada 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/include/hw/ppc/spapr.h
|
|
|
|
+++ b/include/hw/ppc/spapr.h
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -120,6 +120,7 @@ struct SpaprMachineClass {
|
2018-11-29 12:09:34 +00:00
|
|
|
bool legacy_irq_allocation;
|
2019-05-07 21:00:36 +00:00
|
|
|
bool broken_host_serial_model; /* present real host info to the guest */
|
2018-11-29 12:09:34 +00:00
|
|
|
|
2018-11-08 17:02:33 +00:00
|
|
|
+ bool has_power9_support;
|
2019-05-07 21:00:36 +00:00
|
|
|
void (*phb_placement)(SpaprMachineState *spapr, uint32_t index,
|
2018-11-08 17:02:33 +00:00
|
|
|
uint64_t *buid, hwaddr *pio,
|
|
|
|
hwaddr *mmio32, hwaddr *mmio64,
|
|
|
|
diff --git a/target/ppc/compat.c b/target/ppc/compat.c
|
2019-05-07 21:00:36 +00:00
|
|
|
index 7de4bf3122..3e2e35342d 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/target/ppc/compat.c
|
|
|
|
+++ b/target/ppc/compat.c
|
|
|
|
@@ -105,8 +105,19 @@ static const CompatInfo *compat_by_pvr(uint32_t pvr)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2)
|
|
|
|
+{
|
|
|
|
+ const CompatInfo *compat1 = compat_by_pvr(pvr1);
|
|
|
|
+ const CompatInfo *compat2 = compat_by_pvr(pvr2);
|
|
|
|
+
|
|
|
|
+ g_assert(compat1);
|
|
|
|
+ g_assert(compat2);
|
|
|
|
+
|
|
|
|
+ return compat1 - compat2;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr,
|
|
|
|
- uint32_t min_compat_pvr, uint32_t max_compat_pvr)
|
|
|
|
+ uint32_t min_compat_pvr, uint32_t max_compat_pvr)
|
|
|
|
{
|
|
|
|
const CompatInfo *compat = compat_by_pvr(compat_pvr);
|
|
|
|
const CompatInfo *min = compat_by_pvr(min_compat_pvr);
|
|
|
|
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
|
2019-05-07 21:00:36 +00:00
|
|
|
index 0707177584..60cc41fd53 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/target/ppc/cpu.h
|
|
|
|
+++ b/target/ppc/cpu.h
|
2019-05-07 21:00:36 +00:00
|
|
|
@@ -1381,6 +1381,7 @@ static inline int cpu_mmu_index (CPUPPCState *env, bool ifetch)
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
/* Compatibility modes */
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
+long ppc_compat_cmp(uint32_t pvr1, uint32_t pvr2);
|
|
|
|
bool ppc_check_compat(PowerPCCPU *cpu, uint32_t compat_pvr,
|
|
|
|
uint32_t min_compat_pvr, uint32_t max_compat_pvr);
|
|
|
|
bool ppc_type_check_compat(const char *cputype, uint32_t compat_pvr,
|
|
|
|
--
|
2019-05-07 21:00:36 +00:00
|
|
|
2.20.1
|
2018-11-08 17:02:33 +00:00
|
|
|
|