From nobody Tue Nov 26 09:30:53 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 --- 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