Blame SOURCES/kvm-ppc-spapr-caps-Define-the-pseries-2.12-sxxm-machine-.patch

37e7a1
From c51968caca390f8feade4d61c32778cf8c51c68a Mon Sep 17 00:00:00 2001
37e7a1
From: Suraj Jitindar Singh <sursingh@redhat.com>
37e7a1
Date: Tue, 13 Mar 2018 05:21:36 +0100
37e7a1
Subject: [PATCH 14/17] ppc/spapr-caps: Define the pseries-2.12-sxxm machine
37e7a1
 type
37e7a1
37e7a1
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
37e7a1
Message-id: <1520918499-27663-9-git-send-email-sursingh@redhat.com>
37e7a1
Patchwork-id: 79255
37e7a1
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 08/11] ppc/spapr-caps: Define the pseries-2.12-sxxm machine type
37e7a1
Bugzilla: 1554957
37e7a1
RH-Acked-by: David Gibson <dgibson@redhat.com>
37e7a1
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
37e7a1
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
37e7a1
37e7a1
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
37e7a1
37e7a1
The sxxm (speculative execution exploit mitigation) machine type is a
37e7a1
variant of the 2.12 machine type with workarounds for speculative
37e7a1
execution vulnerabilities enabled by default.
37e7a1
37e7a1
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
37e7a1
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
37e7a1
(cherry picked from commit 813f3cf655c6f3afe6e2ef04281ba7cd5ea24357)
37e7a1
37e7a1
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1548919
37e7a1
37e7a1
Signed-off-by: Suraj Jitindar Singh <sursingh@redhat.com>
37e7a1
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
37e7a1
---
37e7a1
 hw/ppc/spapr.c      | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
37e7a1
 hw/ppc/spapr_caps.c | 11 +++++++++++
37e7a1
 2 files changed, 64 insertions(+)
37e7a1
37e7a1
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
37e7a1
index c71ffac..a43e64c 100644
37e7a1
--- a/hw/ppc/spapr.c
37e7a1
+++ b/hw/ppc/spapr.c
37e7a1
@@ -3756,6 +3756,59 @@ static const TypeInfo spapr_machine_info = {
37e7a1
 
37e7a1
 #if 0 /* Disabled for Red Hat Enterprise Linux */
37e7a1
 /*
37e7a1
+ * pseries-2.12
37e7a1
+ */
37e7a1
+static void spapr_machine_2_12_instance_options(MachineState *machine)
37e7a1
+{
37e7a1
+}
37e7a1
+
37e7a1
+static void spapr_machine_2_12_class_options(MachineClass *mc)
37e7a1
+{
37e7a1
+    /* Defaults for the latest behaviour inherited from the base class */
37e7a1
+}
37e7a1
+
37e7a1
+DEFINE_SPAPR_MACHINE(2_12, "2.12", true);
37e7a1
+
37e7a1
+static void spapr_machine_2_12_sxxm_instance_options(MachineState *machine)
37e7a1
+{
37e7a1
+    spapr_machine_2_12_instance_options(machine);
37e7a1
+}
37e7a1
+
37e7a1
+static void spapr_machine_2_12_sxxm_class_options(MachineClass *mc)
37e7a1
+{
37e7a1
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
37e7a1
+
37e7a1
+    spapr_machine_2_12_class_options(mc);
37e7a1
+    smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND;
37e7a1
+    smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND;
37e7a1
+    smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_FIXED_CCD;
37e7a1
+}
37e7a1
+
37e7a1
+DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false);
37e7a1
+
37e7a1
+/*
37e7a1
+ * pseries-2.11
37e7a1
+ */
37e7a1
+#define SPAPR_COMPAT_2_11                                              \
37e7a1
+    HW_COMPAT_2_11
37e7a1
+
37e7a1
+static void spapr_machine_2_11_instance_options(MachineState *machine)
37e7a1
+{
37e7a1
+    spapr_machine_2_12_instance_options(machine);
37e7a1
+}
37e7a1
+
37e7a1
+static void spapr_machine_2_11_class_options(MachineClass *mc)
37e7a1
+{
37e7a1
+    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
37e7a1
+
37e7a1
+    spapr_machine_2_12_class_options(mc);
37e7a1
+    smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON;
37e7a1
+    SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_11);
37e7a1
+}
37e7a1
+
37e7a1
+DEFINE_SPAPR_MACHINE(2_11, "2.11", false);
37e7a1
+
37e7a1
+/*
37e7a1
  * pseries-2.10
37e7a1
  */
37e7a1
 static void spapr_machine_2_10_instance_options(MachineState *machine)
37e7a1
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
37e7a1
index da1f519..531e145 100644
37e7a1
--- a/hw/ppc/spapr_caps.c
37e7a1
+++ b/hw/ppc/spapr_caps.c
37e7a1
@@ -335,15 +335,26 @@ static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr,
37e7a1
 
37e7a1
     caps = smc->default_caps;
37e7a1
 
37e7a1
+    if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00,
37e7a1
+                          0, spapr->max_compat_pvr)) {
37e7a1
+        caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN;
37e7a1
+    }
37e7a1
+
37e7a1
     if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_07,
37e7a1
                           0, spapr->max_compat_pvr)) {
37e7a1
         caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_OFF;
37e7a1
     }
37e7a1
 
37e7a1
+    if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06_PLUS,
37e7a1
+                          0, spapr->max_compat_pvr)) {
37e7a1
+        caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN;
37e7a1
+    }
37e7a1
+
37e7a1
     if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06,
37e7a1
                           0, spapr->max_compat_pvr)) {
37e7a1
         caps.caps[SPAPR_CAP_VSX] = SPAPR_CAP_OFF;
37e7a1
         caps.caps[SPAPR_CAP_DFP] = SPAPR_CAP_OFF;
37e7a1
+        caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN;
37e7a1
     }
37e7a1
 
37e7a1
     return caps;
37e7a1
-- 
37e7a1
1.8.3.1
37e7a1