From nobody Tue Nov 26 06:26:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1580984733636810.8557998198678; Thu, 6 Feb 2020 02:25:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-49-LW8Nbpw0MhKCp8BIIbKb0Q-1; Thu, 06 Feb 2020 05:25:30 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1525B107B7D5; Thu, 6 Feb 2020 10:25:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4D1A84DB8; Thu, 6 Feb 2020 10:25:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7A913866A9; Thu, 6 Feb 2020 10:25:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 016AP7Lc015518 for ; Thu, 6 Feb 2020 05:25:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 48D7C5C1D8; Thu, 6 Feb 2020 10:25:07 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6429A5C1B0; Thu, 6 Feb 2020 10:25:04 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 2D74C100170; Thu, 6 Feb 2020 11:25:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580984732; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Zk2cezX76cUmYX8glPYmK94VVWPs57m0NOuzhVDjgIQ=; b=XUJOFdxMdmQsveAAvGpiuEtok/D2INnV9U/JbWN5awJhHf9OHed1u/aA/hDRA0AJg95F7Q fQ0NH+QWg5w0jBM6lEz1yYFy8rKo4rGgf7KUwNspOM28oL2rYuXKKuSuDjyFs1lPrdybxF o3REw74lOeyf/dk841kTtTBKxh/e1YI= From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] qemu: Pass machine type to virQEMUCapsIsCPUModeSupported Date: Thu, 6 Feb 2020 11:24:45 +0100 Message-Id: <28de5eb0023614bcafe05790155d5f96482f0f7d.1580984567.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Christian Ehrhardt X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: LW8Nbpw0MhKCp8BIIbKb0Q-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The usability of a specific CPU mode may depend on machine type, let's prepare for this by passing it to virQEMUCapsIsCPUModeSupported. Signed-off-by: Jiri Denemark Reviewed-by: Boris Fiuczynski Reviewed-by: Christian Ehrhardt Reviewed-by: J=C3=A1n Tomko Tested-by: Christian Ehrhardt --- src/qemu/qemu_capabilities.c | 12 ++++++++---- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_process.c | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dfe7d48550..162e49e2d4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2279,7 +2279,8 @@ bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virArch hostarch, virDomainVirtType type, - virCPUMode mode) + virCPUMode mode, + const char *machineType G_GNUC_UNUSED) { qemuMonitorCPUDefsPtr cpus; =20 @@ -5644,18 +5645,21 @@ virQEMUCapsFillDomainCPUCaps(virQEMUCapsPtr qemuCap= s, virDomainCapsPtr domCaps) { if (virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, domCaps->virttyp= e, - VIR_CPU_MODE_HOST_PASSTHROUGH)) + VIR_CPU_MODE_HOST_PASSTHROUGH, + domCaps->machine)) domCaps->cpu.hostPassthrough =3D true; =20 if (virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, domCaps->virttyp= e, - VIR_CPU_MODE_HOST_MODEL)) { + VIR_CPU_MODE_HOST_MODEL, + domCaps->machine)) { virCPUDefPtr cpu =3D virQEMUCapsGetHostModel(qemuCaps, domCaps->vi= rttype, VIR_QEMU_CAPS_HOST_CPU_= REPORTED); domCaps->cpu.hostModel =3D virCPUDefCopy(cpu); } =20 if (virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, domCaps->virttyp= e, - VIR_CPU_MODE_CUSTOM)) { + VIR_CPU_MODE_CUSTOM, + domCaps->machine)) { const char *blacklist[] =3D { "host", NULL }; VIR_AUTOSTRINGLIST models =3D NULL; =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index b97c11ee1d..2473e64654 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -629,7 +629,8 @@ bool virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemu= Caps, bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virArch hostarch, virDomainVirtType type, - virCPUMode mode); + virCPUMode mode, + const char *machineType); const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType, const char *name); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 851f750bd7..1b4825a539 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4600,7 +4600,8 @@ qemuDomainDefSetDefaultCPU(virDomainDefPtr def, if (STREQ(model, "host")) { if (ARCH_IS_S390(def->os.arch) && virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, def->virtTyp= e, - VIR_CPU_MODE_HOST_MODEL)) { + VIR_CPU_MODE_HOST_MODEL, + def->os.machine)) { def->cpu->mode =3D VIR_CPU_MODE_HOST_MODEL; } else { def->cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ddcc763cfd..e3df75d281 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6022,7 +6022,7 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, } =20 if (!virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, def->virtType, - def->cpu->mode)) { + def->cpu->mode, def->os.machine)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU mode '%s' for %s %s domain on %s host is not= " "supported by hypervisor"), --=20 2.25.0 From nobody Tue Nov 26 06:26:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1580984720767334.9723265984785; Thu, 6 Feb 2020 02:25:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-34-Xj2L3M75Poy2RzeyBxCQxg-1; Thu, 06 Feb 2020 05:25:16 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 642C6DBB3; Thu, 6 Feb 2020 10:25:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A694460BF7; Thu, 6 Feb 2020 10:25:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ACC0B18089C8; Thu, 6 Feb 2020 10:25:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 016AP7Ao015524 for ; Thu, 6 Feb 2020 05:25:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5C643857B2; Thu, 6 Feb 2020 10:25:07 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6459584DB8; Thu, 6 Feb 2020 10:25:04 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 303C3101B00; Thu, 6 Feb 2020 11:25:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580984719; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XNQAbyRTQS7hxrRLCV1ZhutTkNd7qyWCWgMIypZ8zkY=; b=Qn8+5Olywd/Ec/+lULnZPFxZlBDvtobUhZ04BsQSXhYd1qfX+9p+qMk36+yoYEtEygLkYz upRtS1C8YFG8Av4phYgOEMZDNali5zNCiJwztiu0S8DxFXwiTKTJJW4f7G9NQAgrn2V6SL uJg+T3iov/GmVTDWgcNPuPCsAyptKY4= From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] qemuxml2*test: Add default CPU tests for s390-ccw-virtio-2.7 machines Date: Thu, 6 Feb 2020 11:24:46 +0100 Message-Id: <38791a9dd1f49c061c99d776fa5370af5b118229.1580984567.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Christian Ehrhardt X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: Xj2L3M75Poy2RzeyBxCQxg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Boris Fiuczynski Reviewed-by: Christian Ehrhardt Reviewed-by: J=C3=A1n Tomko Tested-by: Christian Ehrhardt --- ...t-cpu-kvm-ccw-virtio-2.7.s390x-latest.args | 34 +++++++++++++++++++ .../s390-default-cpu-kvm-ccw-virtio-2.7.xml | 16 +++++++++ ...t-cpu-tcg-ccw-virtio-2.7.s390x-latest.args | 32 +++++++++++++++++ .../s390-default-cpu-tcg-ccw-virtio-2.7.xml | 16 +++++++++ tests/qemuxml2argvtest.c | 2 ++ ...lt-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml | 24 +++++++++++++ ...lt-cpu-tcg-ccw-virtio-2.7.s390x-latest.xml | 26 ++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 8 files changed, 152 insertions(+) create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-= 2.7.s390x-latest.args create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-= 2.7.xml create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-= 2.7.s390x-latest.args create mode 100644 tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-= 2.7.xml create mode 100644 tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virti= o-2.7.s390x-latest.xml create mode 100644 tests/qemuxml2xmloutdata/s390-default-cpu-tcg-ccw-virti= o-2.7.s390x-latest.xml diff --git a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s39= 0x-latest.args b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7= .s390x-latest.args new file mode 100644 index 0000000000..8c25a01e74 --- /dev/null +++ b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-late= st.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name guest=3Dtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-test/master-key.aes \ +-machine s390-ccw-virtio-2.7,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-cpu z13.2-base,aen=3Don,aefsi=3Don,msa5=3Don,msa4=3Don,msa3=3Don,msa2=3Do= n,msa1=3Don,\ +sthyi=3Don,edat=3Don,ri=3Don,edat2=3Don,vx=3Don,ipter=3Don,ap=3Don,esop=3D= on,apft=3Don,apqci=3Don,\ +cte=3Don,bpb=3Don,ppa15=3Don,zpci=3Don,sea_esop2=3Don,te=3Don,cmm=3Don \ +-m 256 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0000 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml= b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml new file mode 100644 index 0000000000..a3c1804f57 --- /dev/null +++ b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml @@ -0,0 +1,16 @@ + + test + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + + hvm + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + diff --git a/tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-2.7.s39= 0x-latest.args b/tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-2.7= .s390x-latest.args new file mode 100644 index 0000000000..d30c30f648 --- /dev/null +++ b/tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-2.7.s390x-late= st.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name guest=3Dtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-test/master-key.aes \ +-machine s390-ccw-virtio-2.7,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu \ +-m 256 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0000 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-2.7.xml= b/tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-2.7.xml new file mode 100644 index 0000000000..3451e9d81f --- /dev/null +++ b/tests/qemuxml2argvdata/s390-default-cpu-tcg-ccw-virtio-2.7.xml @@ -0,0 +1,16 @@ + + test + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + + hvm + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5691317bad..028364a06c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3093,6 +3093,8 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-3.1", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-4.2", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-4.2", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-2.7", "s390x= "); + DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-2.7", "s390x= "); DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-4.2", "s390x= "); DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-4.2", "s390x= "); DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-kvm-pc-4.2", "x86_64"); diff --git a/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s= 390x-latest.xml b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-= 2.7.s390x-latest.xml new file mode 100644 index 0000000000..56fd22b6e5 --- /dev/null +++ b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-la= test.xml @@ -0,0 +1,24 @@ + + test + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + +
+ + + + diff --git a/tests/qemuxml2xmloutdata/s390-default-cpu-tcg-ccw-virtio-2.7.s= 390x-latest.xml b/tests/qemuxml2xmloutdata/s390-default-cpu-tcg-ccw-virtio-= 2.7.s390x-latest.xml new file mode 100644 index 0000000000..5048b09e15 --- /dev/null +++ b/tests/qemuxml2xmloutdata/s390-default-cpu-tcg-ccw-virtio-2.7.s390x-la= test.xml @@ -0,0 +1,26 @@ + + test + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + 1 + + hvm + + + + qemu + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + +
+ + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index fa238ec339..ecd12c3d30 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1463,6 +1463,8 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-3.1", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-kvm-pseries-4.2", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-default-cpu-tcg-pseries-4.2", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-2.7", "s390x= "); + DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-2.7", "s390x= "); DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-kvm-ccw-virtio-4.2", "s390x= "); DO_TEST_CAPS_ARCH_LATEST("s390-default-cpu-tcg-ccw-virtio-4.2", "s390x= "); DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-kvm-pc-4.2", "x86_64"); --=20 2.25.0 From nobody Tue Nov 26 06:26:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1580984719711164.15988698329556; Thu, 6 Feb 2020 02:25:19 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-uRnG8vdKPD60ZG-wwVuoKw-1; Thu, 06 Feb 2020 05:25:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6BE70800D5F; Thu, 6 Feb 2020 10:25:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C80DA790CF; Thu, 6 Feb 2020 10:25:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ACF67866A5; Thu, 6 Feb 2020 10:25:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 016AP752015513 for ; Thu, 6 Feb 2020 05:25:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 27F81790D8; Thu, 6 Feb 2020 10:25:07 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68FBF790ED; Thu, 6 Feb 2020 10:25:04 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 3302C101B02; Thu, 6 Feb 2020 11:25:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580984718; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=p0Vmb4j69UZmTYJQ6XXvHIHadclkG/gHMS30LYQTqSg=; b=f23nw5aH3NovxKFckK8fAa0ohfnXmJf4AUlmPZaiGT1y41H8RLGvxr57QpefNbfMFCyF1r WZu6g5aJuu9l3ewpJatEneNtdaQG9Qe3Hb/fuyXAxpre14e44mL/ql/F4EqALqETz0Qjcf WY+dxOG1kxUMrhgUXK3Gkonurk3KQ7E= From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] qemu_capabilities: Disable CPU models on old s390 machine types Date: Thu, 6 Feb 2020 11:24:47 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Christian Ehrhardt X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: uRnG8vdKPD60ZG-wwVuoKw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Starting a KVM domain on s390 with old machine type (such as s390-ccw-virtio-2.5) and without any guest CPU model configured fails with CPU models are not available: KVM doesn't support CPU models QEMU error. This is cause by libvirt using host-model CPU as the default CPU based on QEMU reporting "host" CPU model as being the default one (see commit v5.9.0-402-g24d8202294: qemu: Use host-model CPU on s390 by default). However, even though both QEMU and KVM support CPU models on s390 and QEMU can give us the host-model CPU, we can't use it with old machine types which only support -cpu host. https://bugzilla.redhat.com/show_bug.cgi?id=3D1795651 Reported-by: Christian Ehrhardt Signed-off-by: Jiri Denemark Reviewed-by: Boris Fiuczynski Reviewed-by: Christian Ehrhardt Reviewed-by: J=C3=A1n Tomko Tested-by: Christian Ehrhardt --- src/qemu/qemu_capabilities.c | 19 ++++++++++++++++++- ...t-cpu-kvm-ccw-virtio-2.7.s390x-latest.args | 4 +--- ...lt-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 162e49e2d4..dd2311cfa9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2274,16 +2274,33 @@ virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemuC= aps, return false; } =20 +const char *s390HostPassthroughOnlyMachines[] =3D { + "s390-ccw-virtio-2.4", + "s390-ccw-virtio-2.5", + "s390-ccw-virtio-2.6", + "s390-ccw-virtio-2.7", + NULL +}; =20 bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virArch hostarch, virDomainVirtType type, virCPUMode mode, - const char *machineType G_GNUC_UNUSED) + const char *machineType) { qemuMonitorCPUDefsPtr cpus; =20 + /* CPU models (except for "host") are not supported by QEMU for on s390 + * KVM domains with old machine types regardless on QEMU version. */ + if (ARCH_IS_S390(qemuCaps->arch) && + type =3D=3D VIR_DOMAIN_VIRT_KVM && + mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH && + machineType && + g_strv_contains(s390HostPassthroughOnlyMachines, machineType)) { + return false; + } + switch (mode) { case VIR_CPU_MODE_HOST_PASSTHROUGH: return type =3D=3D VIR_DOMAIN_VIRT_KVM && diff --git a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s39= 0x-latest.args b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7= .s390x-latest.args index 8c25a01e74..0c2567df6c 100644 --- a/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-late= st.args +++ b/tests/qemuxml2argvdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-late= st.args @@ -13,9 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-test/master-key.aes \ -machine s390-ccw-virtio-2.7,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ --cpu z13.2-base,aen=3Don,aefsi=3Don,msa5=3Don,msa4=3Don,msa3=3Don,msa2=3Do= n,msa1=3Don,\ -sthyi=3Don,edat=3Don,ri=3Don,edat2=3Don,vx=3Don,ipter=3Don,ap=3Don,esop=3D= on,apft=3Don,apqci=3Don,\ -cte=3Don,bpb=3Don,ppa15=3Don,zpci=3Don,sea_esop2=3Don,te=3Don,cmm=3Don \ +-cpu host \ -m 256 \ -overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s= 390x-latest.xml b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-= 2.7.s390x-latest.xml index 56fd22b6e5..8799584c11 100644 --- a/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-la= test.xml +++ b/tests/qemuxml2xmloutdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-la= test.xml @@ -8,7 +8,7 @@ hvm - + destroy restart --=20 2.25.0