From nobody Wed Feb 11 10:09:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1489510910288245.07269288735813; Tue, 14 Mar 2017 10:01:50 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2EGwUae011328; Tue, 14 Mar 2017 12:58:30 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2EGvuZv002621 for ; Tue, 14 Mar 2017 12:57:56 -0400 Received: from virval.usersys.redhat.com (dhcp129-92.brq.redhat.com [10.34.129.92]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2EGvtk5018330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 14 Mar 2017 12:57:56 -0400 Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 85ABC1062D3; Tue, 14 Mar 2017 17:57:53 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 14 Mar 2017 17:57:45 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] qemu: Refactor KVM features check 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The checks are now in a dedicated qemuProcessVerifyKVMFeatures function. Signed-off-by: Jiri Denemark --- src/qemu/qemu_process.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 48820a204..df9489f3e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3779,6 +3779,28 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, } =20 =20 +static int +qemuProcessVerifyKVMFeatures(virDomainDefPtr def, + virCPUDataPtr cpu) +{ + int rc =3D 0; + + if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] !=3D VIR_TRISTATE_SWI= TCH_ON) + return 0; + + rc =3D virCPUDataCheckFeature(cpu, VIR_CPU_x86_KVM_PV_UNHALT); + + if (rc <=3D 0) { + if (rc =3D=3D 0) + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support paravirtual spinlocks")= ); + return -1; + } + + return 0; +} + + static bool qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -3808,15 +3830,8 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, goto cleanup; } =20 - if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] =3D=3D VIR_TRISTA= TE_SWITCH_ON) { - if (!virCPUDataCheckFeature(guestcpu, VIR_CPU_x86_KVM_PV_UNHAL= T)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support paravirtual spinloc= ks")); - goto cleanup; - } - } - - if (qemuProcessVerifyHypervFeatures(def, guestcpu) < 0) + if (qemuProcessVerifyKVMFeatures(def, guestcpu) < 0 || + qemuProcessVerifyHypervFeatures(def, guestcpu) < 0) goto cleanup; =20 if (def->cpu) { --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list