Blame SOURCES/kvm-s390x-cpumodel-Disable-unsupported-CPU-models.patch

4a2fec
From d5959fcefcda5639e99793f21688ba071bc2886a Mon Sep 17 00:00:00 2001
4a2fec
From: David Hildenbrand <david@redhat.com>
4a2fec
Date: Fri, 10 Nov 2017 14:49:04 +0100
4a2fec
Subject: [PATCH 7/7] s390x/cpumodel: Disable unsupported CPU models
4a2fec
4a2fec
RH-Author: David Hildenbrand <david@redhat.com>
4a2fec
Message-id: <20171110144904.7026-3-david@redhat.com>
4a2fec
Patchwork-id: 77648
4a2fec
O-Subject: [RHEL-7.5 qemu-kvm-ma PATCH v3 2/2] s390x/cpumodel: Disable unsupported CPU models
4a2fec
Bugzilla: 1504138
4a2fec
RH-Acked-by: Thomas Huth <thuth@redhat.com>
4a2fec
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
4a2fec
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
4a2fec
4a2fec
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1504138
4a2fec
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=14527097
4a2fec
Upstream-status: RHEL-only
4a2fec
4a2fec
We will only be supporting CPU models >= HW generation 11 (including
4a2fec
z196, z12, z13, z14).
4a2fec
4a2fec
As completely removing CPU models is tricky (mainly due to TCG), we
4a2fec
simply disallow to instantiate them with KVM.
4a2fec
4a2fec
In addition, report via query-cpu-definitions, that these models are
4a2fec
not runnable under kvm.
4a2fec
4a2fec
Signed-off-by: David Hildenbrand <david@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 target/s390x/cpu_models.c | 3 +++
4a2fec
 target/s390x/kvm.c        | 8 ++++++++
4a2fec
 2 files changed, 11 insertions(+)
4a2fec
4a2fec
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
4a2fec
index e055852..d8f7bed 100644
4a2fec
--- a/target/s390x/cpu_models.c
4a2fec
+++ b/target/s390x/cpu_models.c
4a2fec
@@ -360,6 +360,9 @@ static void check_unavailable_features(const S390CPUModel *max_model,
4a2fec
         (max_model->def->gen == model->def->gen &&
4a2fec
          max_model->def->ec_ga < model->def->ec_ga)) {
4a2fec
         list_add_feat("type", unavailable);
4a2fec
+    } else if (model->def->gen < 11 && kvm_enabled()) {
4a2fec
+        /* Older CPU models are not supported on Red Hat Enterprise Linux */
4a2fec
+        list_add_feat("type", unavailable);
4a2fec
     }
4a2fec
 
4a2fec
     /* detect missing features if any to properly report them */
4a2fec
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
4a2fec
index eb0dbb3..3589e6e 100644
4a2fec
--- a/target/s390x/kvm.c
4a2fec
+++ b/target/s390x/kvm.c
4a2fec
@@ -2712,6 +2712,14 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
4a2fec
         error_setg(errp, "KVM doesn't support CPU models");
4a2fec
         return;
4a2fec
     }
4a2fec
+
4a2fec
+    /* Older CPU models are not supported on Red Hat Enterprise Linux */
4a2fec
+    if (model->def->gen < 11) {
4a2fec
+        error_setg(errp, "KVM: Unsupported CPU model specified: %s",
4a2fec
+                   MACHINE(qdev_get_machine())->cpu_model);
4a2fec
+        return;
4a2fec
+    }
4a2fec
+
4a2fec
     prop.cpuid = s390_cpuid_from_cpu_model(model);
4a2fec
     prop.ibc = s390_ibc_from_cpu_model(model);
4a2fec
     /* configure cpu features indicated via STFL(e) */
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec