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