From nobody Sun Feb 8 16:30:54 2026 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=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1575933396; cv=none; d=zohomail.com; s=zohoarc; b=ClL4E4wd4jvffFUM/M9CUPdoQl9K0m/G3Zmv080Xq55TxJXKCLm76W6x4RvHcLNGpdSM9JV8X1K5dXoXE2MY4VVB+mqSdMFuie45FYE5Cgc4255UdQsBsEDB7Ui4r7ZcpM812btWdNTjZevw+0HuvDXoZZKe/nl7N10+7+7M+oI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933396; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=aBPfUGkzjw29YNfL5vFkqKXoPnmVSZJEJiLbe4+Moao=; b=EgwI0JtWUn7OzWV11Nb9DfegpWiOXg3pCdON1BJ9OtdFsDIwZW9WL+KhMRsW4SJHajDUBcyo7pCI907+7QBaUY8sXPqBJlLbS/QtDpGSZhDRgXR5twsW8RoBSbDZNqbB+iKhmw5801vyGntq9jpssZJCpLXuo1LZvyHGztgTWUE= ARC-Authentication-Results: i=1; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1575933396699258.94374763229246; Mon, 9 Dec 2019 15:16:36 -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-158-wYR4bw4lPV6InT2e5xhC0w-1; Mon, 09 Dec 2019 18:16:33 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC86E18B5F72; Mon, 9 Dec 2019 23:16:26 +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 A7ABCA7D0; Mon, 9 Dec 2019 23:16:26 +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 671F583566; Mon, 9 Dec 2019 23:16:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9NGKra008584 for ; Mon, 9 Dec 2019 18:16:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 71345DBF09; Mon, 9 Dec 2019 23:16:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C4ECDBF15 for ; Mon, 9 Dec 2019 23:16:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4054E8CCD22 for ; Mon, 9 Dec 2019 23:16:18 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-E0_ZIygcOn6YiyEjjAZqwg-1; Mon, 09 Dec 2019 18:16:13 -0500 Received: by mail-qk1-f195.google.com with SMTP id c17so4846769qkg.7; Mon, 09 Dec 2019 15:16:13 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:fe5:8243:c780:f073:3beb]) by smtp.gmail.com with ESMTPSA id e130sm352436qkb.72.2019.12.09.15.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933395; 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=aBPfUGkzjw29YNfL5vFkqKXoPnmVSZJEJiLbe4+Moao=; b=dAf15SmsUlTaN2phFya1/drBXBqxD3QLNCEZ8OiRc5EAv5Mb4jGbQycxrBQjC/VcBoztGu YbIDVdxCGA7D/vvQb2QwSINCB8VEEKI/El0DB8QBctOERZZ+2A64H0U1geQSPXqUVzf2nE o3WaffRbP4wrM7GbyWV1KLLXKcxu6Js= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rKRI3K1OrFL2v7D/2e7ofoL+YJgYlBEcKz3PWED8YKA=; b=iEBogyYhhar4jos5/ReCnUD3sSJ+Z4wLObPF4DziKGJvnBYXUo5vdDPxzDkZXYDAEn pjgqgK9MAuKtqXEej/v4Rm9jrzyydt67t+a+Uip2E0X8m0PGO+MW1vjFjO9buj3NMT2V KB+MaHRe+JJrv+rls9T4DrhrFKRAGpzPahhr7VovjiVXRGV1702IKvzyiLscl7WNxTId blg4lvlFBBGXr8JsFIzW7fwKwDIdNhnOUJGJ7enW4ZaTF87uWSFop3JQdRK0kNW53vh2 iFZnzEPGo6q+6tR5pJFZe3JPOCObMJ9DJDUGOy3oiM3vrxtpHzTomDR5RyNjaI9We+yv 85mQ== X-Gm-Message-State: APjAAAVRWchzSfdD9LCDxpOt9xO9YZTjuoedkDL8wR2WWPSxNZQtDlWv Ciwqt7fV9l6PA/CekiAJK+W4hdNK25o= X-Google-Smtp-Source: APXvYqzUxD9DaJ3KQUMIyhuUuWya71U3M7yxkMJ7UzdJ0KqrEa0hcjm5enPoyM5tAXFqL/ciCdmwhw== X-Received: by 2002:a05:620a:134d:: with SMTP id c13mr3179783qkl.322.1575933373035; Mon, 09 Dec 2019 15:16:13 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:24 -0300 Message-Id: <20191209231531.2423222-20-danielhb413@gmail.com> In-Reply-To: <20191209231531.2423222-1-danielhb413@gmail.com> References: <20191209231531.2423222-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: E0_ZIygcOn6YiyEjjAZqwg-1 X-MC-Unique: wYR4bw4lPV6InT2e5xhC0w-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xB9NGKra008584 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 19/26] qemu_command.c: move pcihole64 validation to qemu_domain.c 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.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move the pcihole64 validation being done by qemuBuildGlobalControllerCommandLine() to the existing function qemuDomainDeviceDefValidateControllerPCI(), which provides domain define time validation. The existing pcihole64 validations in qemu_domain.c were replaced by the ones moved from qemu_command.c. The reason is that they are more specific, allowing VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT and VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT to have distinct validation, with exclusive QEMU caps and machine types. Tests were adapted to consider the new caps being needed in this earlier stage. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 24 ++---------------------- src/qemu/qemu_domain.c | 37 +++++++++++++++++++++++++++++++------ tests/qemuxml2argvtest.c | 2 +- tests/qemuxml2xmltest.c | 6 +++--- 4 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7d4272a896..31b8784070 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6392,8 +6392,7 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, =20 static int qemuBuildGlobalControllerCommandLine(virCommandPtr cmd, - const virDomainDef *def, - virQEMUCapsPtr qemuCaps) + const virDomainDef *def) { size_t i; =20 @@ -6402,20 +6401,14 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr = cmd, if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && cont->opts.pciopts.pcihole64) { const char *hoststr =3D NULL; - bool cap =3D false; - bool machine =3D false; =20 switch (cont->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: hoststr =3D "i440FX-pcihost"; - cap =3D virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE= 64_SIZE); - machine =3D qemuDomainIsI440FX(def); break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: hoststr =3D "q35-pcihost"; - cap =3D virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_= SIZE); - machine =3D qemuDomainIsQ35(def); break; =20 default: @@ -6425,19 +6418,6 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr c= md, return -1; } =20 - if (!machine) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Setting the 64-bit PCI hole size is not " - "supported for machine '%s'"), def->os.machin= e); - return -1; - } - if (!cap) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("64-bit PCI hole size setting is not supp= orted " - "with this QEMU binary")); - return -1; - } - virCommandAddArg(cmd, "-global"); virCommandAddArgFormat(cmd, "%s.pci-hole64-size=3D%luK", hosts= tr, cont->opts.pciopts.pcihole64size); @@ -9995,7 +9975,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildIOMMUCommandLine(cmd, def, qemuCaps) < 0) return NULL; =20 - if (qemuBuildGlobalControllerCommandLine(cmd, def, qemuCaps) < 0) + if (qemuBuildGlobalControllerCommandLine(cmd, def) < 0) return NULL; =20 if (qemuBuildControllersCommandLine(cmd, def, qemuCaps) < 0) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0c04ba9dcc..7f6daaf276 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7188,13 +7188,38 @@ qemuDomainDeviceDefValidateControllerPCI(const virD= omainControllerDef *cont, /* pcihole64 */ switch ((virDomainControllerModelPCI) cont->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + if (pciopts->pcihole64 || pciopts->pcihole64size !=3D 0) { + if (!qemuDomainIsI440FX(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Setting the 64-bit PCI hole size is not " + "supported for machine '%s'"), def->os.ma= chine); + return -1; + } + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE= )) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("64-bit PCI hole size setting is not supp= orted " + "with this QEMU binary")); + return -1; + } + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: - /* The pcihole64 option only applies to x86 guests */ - if ((pciopts->pcihole64 || - pciopts->pcihole64size !=3D 0) && - !ARCH_IS_X86(def->os.arch)) { - virReportControllerInvalidOption(cont, model, modelName, "pcih= ole64"); - return -1; + if (pciopts->pcihole64 || pciopts->pcihole64size !=3D 0) { + if (!qemuDomainIsQ35(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Setting the 64-bit PCI hole size is not " + "supported for machine '%s'"), def->os.ma= chine); + return -1; + } + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_SIZE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("64-bit PCI hole size setting is not supp= orted " + "with this QEMU binary")); + return -1; + } } break; =20 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 802ecc98f8..3a002bb393 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2526,7 +2526,7 @@ mymain(void) QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI); =20 DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE); - DO_TEST_FAILURE("pcihole64-none", NONE); + DO_TEST_PARSE_ERROR("pcihole64-none", NONE); DO_TEST("pcihole64-q35", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ee76d50a41..0eb523fd43 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -996,9 +996,9 @@ mymain(void) DO_TEST("s390-serial-console", QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390); =20 - DO_TEST("pcihole64", NONE); - DO_TEST("pcihole64-gib", NONE); - DO_TEST("pcihole64-none", NONE); + DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE); + DO_TEST("pcihole64-gib", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE); + DO_TEST("pcihole64-none", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE); DO_TEST("pcihole64-q35", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list