From nobody Mon Feb 9 10:01:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560937146; cv=none; d=zoho.com; s=zohoarc; b=a2TRWvPq6iabA7aNHy6QzMmfnKRaGKO4Ffp2Drg9hm/4H7ZfVMmtUdtUo9U6kXjnDTEyyZoyB6sgfz7eXiXbWPyWlfGXxuhNU02P7W8nboxIlI9TfC1+ksPhHvDTYCgUH3pTgZXGiE6pxPXAclJvYObAOXIPdUli29OPXpB8QT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560937146; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BsTZFgOJCQUvASQqP+FsbebSEngx+7c/EKkxHaO9YFY=; b=CnSGdln/DupCayP7UzD+yC7VjjYWcOFALpygTgoBpQ+n9aKP9QrIn2G8/Tn6NNgaT/8QBY1edEFmKL1J+y4gIkhan4lhSkPIT9uKKdllg174H0GhRHq9/ofoBGm0rRlSHzUMaWi2FN8zXcok/U4wyEyS4vNKkVIxUdGU2+QEBKk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560937146439664.619372142612; Wed, 19 Jun 2019 02:39:06 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 80DF1C045770; Wed, 19 Jun 2019 09:38:48 +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 F09A5601A5; Wed, 19 Jun 2019 09:38:42 +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 628511806B19; Wed, 19 Jun 2019 09:38:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5J9cT5i024314 for ; Wed, 19 Jun 2019 05:38:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85A66183F0; Wed, 19 Jun 2019 09:38:29 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F9DF608C2 for ; Wed, 19 Jun 2019 09:38:29 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id 88C8B2A26F5; Wed, 19 Jun 2019 11:38:23 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 19 Jun 2019 11:38:03 +0200 Message-Id: <3959942a014a164a8eb624177c5c77311850163f.1560936842.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/24] qemu_command: Use consistent syntax for CPU features 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 19 Jun 2019 09:39:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Normal CPU features use modern -cpu ...,feature=3Don|off syntax when available, but kvm features kept using the old +feature or -feature. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 46 +++++++++---------- .../eoi-disabled.x86_64-latest.args | 2 +- .../eoi-enabled.x86_64-latest.args | 2 +- .../kvmclock+eoi-disabled.x86_64-latest.args | 2 +- .../pv-spinlock-disabled.x86_64-latest.args | 2 +- .../pv-spinlock-enabled.x86_64-latest.args | 2 +- 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a23e428322..08da30d10c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7039,6 +7039,19 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr c= md, } =20 =20 +static void +qemuBuildCpuFeature(virQEMUCapsPtr qemuCaps, + virBufferPtr buf, + const char *name, + bool state) +{ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) + virBufferAsprintf(buf, ",%s=3D%s", name, state ? "on" : "off"); + else + virBufferAsprintf(buf, ",%c%s", state ? '+' : '-', name); +} + + static int qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, const virDomainDef *def, @@ -7109,18 +7122,12 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver, switch ((virCPUFeaturePolicy) cpu->features[i].policy) { case VIR_CPU_FEATURE_FORCE: case VIR_CPU_FEATURE_REQUIRE: - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSI= ON)) - virBufferAsprintf(buf, ",%s=3Don", cpu->features[i].name); - else - virBufferAsprintf(buf, ",+%s", cpu->features[i].name); + qemuBuildCpuFeature(qemuCaps, buf, cpu->features[i].name, true= ); break; =20 case VIR_CPU_FEATURE_DISABLE: case VIR_CPU_FEATURE_FORBID: - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSI= ON)) - virBufferAsprintf(buf, ",%s=3Doff", cpu->features[i].name); - else - virBufferAsprintf(buf, ",-%s", cpu->features[i].name); + qemuBuildCpuFeature(qemuCaps, buf, cpu->features[i].name, fals= e); break; =20 case VIR_CPU_FEATURE_OPTIONAL: @@ -7179,8 +7186,8 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, =20 if (timer->name =3D=3D VIR_DOMAIN_TIMER_NAME_KVMCLOCK && timer->present !=3D -1) { - virBufferAsprintf(&buf, ",%ckvmclock", - timer->present ? '+' : '-'); + qemuBuildCpuFeature(qemuCaps, &buf, "kvmclock", + !!timer->present); } else if (timer->name =3D=3D VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK && timer->present =3D=3D 1) { virBufferAddLit(&buf, ",hv_time"); @@ -7191,24 +7198,13 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, } =20 if (def->apic_eoi) { - char sign; - if (def->apic_eoi =3D=3D VIR_TRISTATE_SWITCH_ON) - sign =3D '+'; - else - sign =3D '-'; - - virBufferAsprintf(&buf, ",%ckvm_pv_eoi", sign); + qemuBuildCpuFeature(qemuCaps, &buf, "kvm_pv_eoi", + def->apic_eoi =3D=3D VIR_TRISTATE_SWITCH_ON); } =20 if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK]) { - char sign; - if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] =3D=3D - VIR_TRISTATE_SWITCH_ON) - sign =3D '+'; - else - sign =3D '-'; - - virBufferAsprintf(&buf, ",%ckvm_pv_unhalt", sign); + qemuBuildCpuFeature(qemuCaps, &buf, "kvm_pv_unhalt", + def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] = =3D=3D VIR_TRISTATE_SWITCH_ON); } =20 if (def->features[VIR_DOMAIN_FEATURE_HYPERV] =3D=3D VIR_TRISTATE_SWITC= H_ON) { diff --git a/tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args b/tests= /qemuxml2argvdata/eoi-disabled.x86_64-latest.args index e59d0ab29b..caae868abf 100644 --- a/tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args +++ b/tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args @@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ --cpu qemu32,-kvm_pv_eoi \ +-cpu qemu32,kvm_pv_eoi=3Doff \ -m 214 \ -overcommit mem-lock=3Doff \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args b/tests/= qemuxml2argvdata/eoi-enabled.x86_64-latest.args index fed8deb688..abafafa411 100644 --- a/tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args +++ b/tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args @@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ --cpu qemu32,+kvm_pv_eoi \ +-cpu qemu32,kvm_pv_eoi=3Don \ -m 214 \ -overcommit mem-lock=3Doff \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.arg= s b/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.args index c1c6e2b621..23d2bcb87e 100644 --- a/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.args +++ b/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.args @@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ --cpu qemu32,-kvmclock,-kvm_pv_eoi \ +-cpu qemu32,kvmclock=3Doff,kvm_pv_eoi=3Doff \ -m 214 \ -overcommit mem-lock=3Doff \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args= b/tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args index 52a36ca075..b78533cf39 100644 --- a/tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args +++ b/tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args @@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ --cpu qemu32,-kvm_pv_unhalt \ +-cpu qemu32,kvm_pv_unhalt=3Doff \ -m 214 \ -overcommit mem-lock=3Doff \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args = b/tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args index 4f1ab219af..a016e80016 100644 --- a/tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args +++ b/tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args @@ -13,7 +13,7 @@ QEMU_AUDIO_DRV=3Dnone \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ --cpu qemu32,+kvm_pv_unhalt \ +-cpu qemu32,kvm_pv_unhalt=3Don \ -m 214 \ -overcommit mem-lock=3Doff \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ --=20 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list