From nobody Mon Feb 9 23:42:38 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=1559057411; cv=none; d=zoho.com; s=zohoarc; b=HwvFPCSCq+CZHQ452L27wNe+HEUutwEZoc2bg2vmjf6Li+6oC7/1hbjHtcRAWcJSSS8z8qmxiq7gbNGCtL+dbiT5P/9jIX+Uh2Y13kiEQkzo7lRFKoudVg5JDnV2cBlsncpax30fi6aVJVAYP8AaBLgdZY9Wb7miRXM5G+lgF38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559057411; 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=qbEkQrqIxPNw9ruDWgaKis9GZBwxVF0W9D69Jw8QPGU=; b=jjpiUVXox+mCfaKWRZYP21oxrEaur2092ZmoR+UKxVu659DYfjk4YZexaVBGTvicexWTcJ5KdFAoI/N3xZwuRevAkEblVevJCWdArmu1nm3jaE3ypBtzxy0n9voO6Bo/y4Oc4Tk7Jtmc9KQVfIVJWJzbGVpBsXs0iHfh4JDnl6Q= 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 1559057411413927.5964339705257; Tue, 28 May 2019 08:30:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62BA4307E040; Tue, 28 May 2019 15:30:09 +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 28A7511436E3; Tue, 28 May 2019 15:30:09 +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 BB30F206D4; Tue, 28 May 2019 15:30:08 +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 x4SFTFnE015598 for ; Tue, 28 May 2019 11:29:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id A823FBF9F3; Tue, 28 May 2019 15:29:15 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 318145C26D for ; Tue, 28 May 2019 15:29:15 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 May 2019 17:28:58 +0200 Message-Id: <20190528152904.25650-6-abologna@redhat.com> In-Reply-To: <20190528152904.25650-1-abologna@redhat.com> References: <20190528152904.25650-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/11] qemu: Move capability checks inside switch() statements 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 28 May 2019 15:30:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Current capability checks are specific to Intel IOMMU, so we need to move them inside the switch() statement before we can introduce more virDomainIOMMUModel values. Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d5016cc99c..b2b9bef772 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6933,17 +6933,17 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, if (!iommu) return 0; =20 - /* qemuDomainDeviceDefValidate() already made sure we have one of - * QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU: here we - * handle the former case, while the latter is taken care of in - * qemuBuildMachineCommandLine() */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU)) - return 0; - switch (iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_INTEL: { VIR_AUTOCLEAN(virBuffer) opts =3D VIR_BUFFER_INITIALIZER; =20 + /* qemuDomainDeviceDefValidateIOMMU() already made sure we have + * one of QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU: + * here we handle the former case, while the latter is taken care + * of in qemuBuildMachineCommandLine() */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU)) + return 0; + virBufferAddLit(&opts, "intel-iommu"); if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT) { virBufferAsprintf(&opts, ",intremap=3D%s", @@ -7602,15 +7602,15 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } } =20 - /* qemuDomainDeviceDefValidate() already made sure we have one of - * QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU: here we - * handle the latter case, while the former is taken care of in - * qemuBuildIOMMUCommandLine() */ - if (def->iommu && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) { + if (def->iommu) { switch (def->iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_INTEL: - virBufferAddLit(&buf, ",iommu=3Don"); + /* qemuDomainDeviceDefValidateIOMMU() already made sure we have + * one of QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IO= MMU: + * here we handle the latter case, while the former is taken c= are + * of in qemuBuildIOMMUCommandLine() */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) + virBufferAddLit(&buf, ",iommu=3Don"); break; case VIR_DOMAIN_IOMMU_MODEL_LAST: default: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list