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

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