From patchwork Wed Jan 23 21:32:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156397 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201294jaa; Wed, 23 Jan 2019 13:33:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4E5UPz0Y6itg8rXdR38/r9c8ZYOagprbbKZeYh4H1I/MIUQ7GpmorYcSGPNBTrojUV6mLL X-Received: by 2002:a37:6a42:: with SMTP id f63mr3362276qkc.224.1548279201934; Wed, 23 Jan 2019 13:33:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279201; cv=none; d=google.com; s=arc-20160816; b=vv/EP28YHowmUX1myybamt3L7AwkEwhR0UASG0TXYuxwYeeZx5CDX/BuIPtMRJL9KS zsYov2G2sH1Q7L5Zs6zA9yUqijjUtyGLaTOWBHFbk5tJR1zMKdvq93q8WHDs6Pux/wgX 7N50AchXnPMBbpnOFtrvOCE0aHFpH4XQ5j5J4CXBinML7cnozHMSto3g4dQnkBdLsY// 9QcQZPX9G3oRd4PXZroHBuABEljFQKmSH+wLNn69bhkWSQT6Q3OAmxN5fn8l8Px3tP63 eZcNmcmlGRT6aZPn0uFpkgkK3PILhgtUEzS7olcHBDUrP4WJ33i3/7240reNlqtG1K1C Gnwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=9xH3mvpp5TNJJoolG0cj+cbW+J6377byEkR58QTiKOA=; b=EBc1dNiVhr2nU+WcC9TWrnHhwdk1lFqzVgoglxA7DtUlhUI+QWk3UhF14JCJuh3UCF G/zPM+hM8mXVcbyhy2P1DYfkb+wMbwTDIgGEe56dL9QywPWmuBFE5Hvqb0Ke1yIToVXt sR5y09VC4hV0DieFP4keJTfHAzr5UyMxVyUxKLIdNqa6ey6iXkHDXiIl4a+FzG3Jrq0D psSyTCrgNaiJKJh3q3umy8DbmA9D1K22f3h+977Vj4wPNT04FGqah5iLgWA05mFFgK8C EDsbN5siZzX68xndmIUjB6/k2Fpw3pqUV95uC3Ta5BQzOO8y8vtzFgmYyrxGNFONSx5M j/6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id v63si1405251qkl.145.2019.01.23.13.33.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:21 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 mx1.redhat.com (Postfix) with ESMTPS id 698CB2CD80F; Wed, 23 Jan 2019 21:33:20 +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 7C2BD26348; Wed, 23 Jan 2019 21:33:19 +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 9FC3E3F7D0; Wed, 23 Jan 2019 21:33:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXFl1032243 for ; Wed, 23 Jan 2019 16:33:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 88CA1BA50; Wed, 23 Jan 2019 21:33:15 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1AD167141; Wed, 23 Jan 2019 21:33:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:29 -0500 Message-Id: <3ef0b006becbb1912099ab98ce77f5b4de7232bf.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 01/25] conf: Set net->model earlier 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 23 Jan 2019 21:33:21 +0000 (UTC) So later code can more easily access def->model Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 54d6364f4f..564248e021 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11305,6 +11305,22 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, goto error; } + /* NIC model (see -net nic,model=?). We only check that it looks + * reasonable, not that it is a supported NIC type. FWIW kvm + * supports these types as of April 2008: + * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio + * QEMU PPC64 supports spapr-vlan + */ + if (model != NULL) { + if (strspn(model, NET_MODEL_CHARS) < strlen(model)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Model name contains invalid characters")); + goto error; + } + def->model = model; + model = NULL; + } + switch (def->type) { case VIR_DOMAIN_NET_TYPE_NETWORK: if (network == NULL) { @@ -11322,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, break; case VIR_DOMAIN_NET_TYPE_VHOSTUSER: - if (STRNEQ_NULLABLE(model, "virtio")) { + if (STRNEQ_NULLABLE(def->model, "virtio")) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Wrong or no 'type' attribute " "specified with . " @@ -11550,22 +11566,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, ifname_guest_actual = NULL; } - /* NIC model (see -net nic,model=?). We only check that it looks - * reasonable, not that it is a supported NIC type. FWIW kvm - * supports these types as of April 2008: - * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio - * QEMU PPC64 supports spapr-vlan - */ - if (model != NULL) { - if (strspn(model, NET_MODEL_CHARS) < strlen(model)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("Model name contains invalid characters")); - goto error; - } - def->model = model; - model = NULL; - } - if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && STREQ_NULLABLE(def->model, "virtio")) { if (backend != NULL) { From patchwork Wed Jan 23 21:32:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156400 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201440jaa; Wed, 23 Jan 2019 13:33:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6aglL5oJjxKVWTJHvPSxirq6dqEh2F5q8eMeybbbnKce0i2Lsy53X4zZG/L5qbbqpaepG2 X-Received: by 2002:a37:4d03:: with SMTP id a3mr3341323qkb.181.1548279209527; Wed, 23 Jan 2019 13:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279209; cv=none; d=google.com; s=arc-20160816; b=1HlJKdGFHzloRjika4BxetV4pVEvkKZ5tjdncSNq2kCvawKbTJdQYgDDFtcGZjLsMn e5wLzbYFfA7efWhxStN4RwtN6Y1lEMNqfVHJOuuWy8OwojKp1JAp0FV4Fv8eovgz3Ew2 dDrXyEBVb3QIM930uqNygs3kQhi9EVIwUxNO+4Tcd+yaLvjxX7bNXoYJpVaxp+u10SoH 2mn/MBy351MQtsmZkZ/mthiE+8bOs4xFMvYb3dIO1TzXf2MoZOJZBYV1+YyuxTcT+hpa 1MaYb9Q4N/4sEjxkoYlB7BhryN8QYkXe0aXzfedkN12F+Dsb62nV/LZ/mOGTzagVdmiO 9fAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=3/Fdey+3TKVytSTM7C5BST5pdfHLOYxpkvJnmKJADxw=; b=IPCfi07ZkXsKcxerUtHMrUuENwEv3cDFXdiST2wbRlVukA2Z4GmzlGzJXrmrWol8v7 vSZOPhNlF2Yp/+o0D1f3dP5UF8AwlOpIuATcZlt4wx1ZMVSM/hu3xyGwgkGoDRziaE1w RQxd8b3Ulg7CDvHDwxRYEpOr4AXVRsgbRd1TTZ1vcjEQE6Ne9NkGWPQzJIXkysnxAFeo HFTHXLm5MUh0Z78XIbrwS4mHv8J7LMIPmq12A8OuA8jXzZqfHR277iueZFflwDgFh2oc trZirbs9MxEAwsxbF0sSwAivSGtEQcul+9fMP5xFjcQ/0MyaKT2L6NW37BCb7nxd09EQ hyyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id j90si1036694qtd.27.2019.01.23.13.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2E1512F91F; Wed, 23 Jan 2019 21:33:27 +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 91FF565F72; Wed, 23 Jan 2019 21:33:27 +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 4BF4B180BAAC; Wed, 23 Jan 2019 21:33:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXGYP032253 for ; Wed, 23 Jan 2019 16:33:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id AB4B3BA8B; Wed, 23 Jan 2019 21:33:16 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id E993DBA50; Wed, 23 Jan 2019 21:33:15 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:30 -0500 Message-Id: <47ddb9fa42a14fdb72e1dfd8d4a66752ebee00ea.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 02/25] conf: Add virDomainNetIsVirtioModel 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 Jan 2019 21:33:28 +0000 (UTC) This will be extended in the future, so let's simplify things by centralizing the checks. Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 15 +++++++++++---- src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + src/qemu/qemu_command.c | 2 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domain_address.c | 2 +- src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_interface.c | 8 ++++---- src/security/virt-aa-helper.c | 2 +- tests/qemuxml2argvmock.c | 2 +- 10 files changed, 23 insertions(+), 14 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 564248e021..bcdb6b0a3a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4732,7 +4732,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev, if (dev->type == VIR_DOMAIN_DEVICE_NET) { virDomainNetDefPtr net = dev->data.net; - if (STRNEQ_NULLABLE(net->model, "virtio") && + if (!virDomainNetIsVirtioModel(net) && virDomainCheckVirtioOptions(net->virtio) < 0) return -1; } @@ -11338,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, break; case VIR_DOMAIN_NET_TYPE_VHOSTUSER: - if (STRNEQ_NULLABLE(def->model, "virtio")) { + if (!virDomainNetIsVirtioModel(def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Wrong or no 'type' attribute " "specified with . " @@ -11567,7 +11567,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } if (def->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && - STREQ_NULLABLE(def->model, "virtio")) { + virDomainNetIsVirtioModel(def)) { if (backend != NULL) { if ((val = virDomainNetBackendTypeFromString(backend)) < 0 || val == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) { @@ -25462,7 +25462,7 @@ virDomainNetDefFormat(virBufferPtr buf, if (def->model) { virBufferEscapeString(buf, "\n", def->model); - if (STREQ(def->model, "virtio")) { + if (virDomainNetIsVirtioModel(def)) { char *str = NULL, *gueststr = NULL, *hoststr = NULL; int rc = 0; @@ -29716,6 +29716,13 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface) } +bool +virDomainNetIsVirtioModel(const virDomainNetDef *net) +{ + return STREQ_NULLABLE(net->model, "virtio"); +} + + /* Return listens[i] from the appropriate union for the graphics * type, or NULL if this is an unsuitable type, or the index is out of * bounds. If force0 is TRUE, i == 0, and there is no listen array, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7776a3afb2..218aa4dd94 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3217,6 +3217,7 @@ virNetDevBandwidthPtr virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface); bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface); +bool virDomainNetIsVirtioModel(const virDomainNetDef *net); int virDomainNetAppendIPAddress(virDomainNetDefPtr def, const char *address, int family, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c3d6306809..6f4809a68a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -469,6 +469,7 @@ virDomainNetGetActualType; virDomainNetGetActualVirtPortProfile; virDomainNetGetActualVlan; virDomainNetInsert; +virDomainNetIsVirtioModel; virDomainNetNotifyActualDevice; virDomainNetReleaseActualDevice; virDomainNetRemove; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2fb7d32dd4..128cf331b3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3654,7 +3654,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, bool usingVirtio = false; char macaddr[VIR_MAC_STRING_BUFLEN]; - if (STREQ(net->model, "virtio")) { + if (virDomainNetIsVirtioModel(net)) { if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0) goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 32a43f2064..1376819020 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4665,7 +4665,7 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net) return -1; } - if (STREQ_NULLABLE(net->model, "virtio")) { + if (virDomainNetIsVirtioModel(net)) { if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("rx_queue_size has to be a power of two")); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 9e0b50d41e..cb1e5f9e40 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -320,7 +320,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; - if (STREQ_NULLABLE(net->model, "virtio") && + if (virDomainNetIsVirtioModel(net) && net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { net->info.type = type; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1df80fcab6..5894c3dd49 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3710,7 +3710,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, goto cleanup; } - if (olddev->model && STREQ(olddev->model, "virtio") && + if (virDomainNetIsVirtioModel(olddev) && (olddev->driver.virtio.name != newdev->driver.virtio.name || olddev->driver.virtio.txmode != newdev->driver.virtio.txmode || olddev->driver.virtio.ioeventfd != newdev->driver.virtio.ioeventfd || diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index 2607dea1f5..2816db908a 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -261,7 +261,7 @@ qemuInterfaceDirectConnect(virDomainDefPtr def, virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); unsigned int macvlan_create_flags = VIR_NETDEV_MACVLAN_CREATE_WITH_TAP; - if (net->model && STREQ(net->model, "virtio")) + if (virDomainNetIsVirtioModel(net)) macvlan_create_flags |= VIR_NETDEV_MACVLAN_VNET_HDR; if (virNetDevMacVLanCreateWithVPortProfile(net->ifname, @@ -434,7 +434,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def, template_ifname = true; } - if (net->model && STREQ(net->model, "virtio")) + if (virDomainNetIsVirtioModel(net)) tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR; if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize, @@ -533,7 +533,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def, template_ifname = true; } - if (net->model && STREQ(net->model, "virtio")) + if (virDomainNetIsVirtioModel(net)) tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR; if (virQEMUDriverIsPrivileged(driver)) { @@ -653,7 +653,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def, } /* If the nic model isn't virtio, don't try to open. */ - if (!(net->model && STREQ(net->model, "virtio"))) { + if (!virDomainNetIsVirtioModel(net)) { if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost-net is only supported for " diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 46443a3153..56d7cfadf1 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1255,7 +1255,7 @@ get_files(vahControl * ctl) if (net && net->model) { if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) continue; - if (STRNEQ(net->model, "virtio")) + if (!virDomainNetIsVirtioModel(net)) continue; } needsvhost = true; diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index b300793732..3f0c1c3fef 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -228,7 +228,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def ATTRIBUTE_UNUSED, { size_t i; - if (!(net->model && STREQ(net->model, "virtio"))) { + if (!virDomainNetIsVirtioModel(net)) { *vhostfdSize = 0; return 0; } From patchwork Wed Jan 23 21:32:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156399 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201437jaa; Wed, 23 Jan 2019 13:33:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN7L71O52dehIb4mAhvnGmaIB3AYak1X3o9t49aFaMlHhEubE38TxmdYkLGyWjvexbEYq/ZH X-Received: by 2002:ac8:31ed:: with SMTP id i42mr4082903qte.323.1548279209330; Wed, 23 Jan 2019 13:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279209; cv=none; d=google.com; s=arc-20160816; b=EZ6EVqeFykXm4fitCi5tyWxmAwcpnHYN+N+TpA6ATsrZT1n4qlZVdoJ3VMGGUQ0j0j xTSBbrQ3CR6KnVo4Jmm9Lr648Bkj4aQn8e5EC2+v5LSfdSL8NAu+/8QCEnfgiNzwAhwn X/oSfblM7bJpZrU7UWfYcuJUN11GrAcf5m5a7Wcjicb0kQ+KHxHLcCyn6uunl01fwAar uM/SrLUR28ihdDQefa4Ycc2nI+JskKbcB6m/Ql9g0ZehI9jVLyVqHORyyd8M+CbDc0Kv cnI/syFlqB/RLfjM1SShMhBYElCoFIJePjol9Tlx3FxZUaKR0A6f+EjsLAhBDqHwDeZp Atjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=K2kL8qqcxUhITNw95t0TAVxPljuK0vfR7A88Ea7mLek=; b=c9sGntyLkzzSXiCOB3lVvii1D98fTDZSKBLmvcfx0yCpZ0m0L94sA8PiWxgyDXznG3 /9plReDeWg4O8NWmk8xgEDyLbAelnWE8Fq3RTr7J6slezw1HoPf4nyVdqt33kMPeNYFy 2QlpPtHXSufqK/bSHVmbRUfcqxhN0CjNzZP+d2+EvNbCmNbOIeZhXVpob7/y0Nh1yDFz iFw53dVUoLgjbMCnpaOd4POqzndF/BdluYNyT3RoF6dxYwwG6NRiLJVZgIsju6WMJNVv u+jJiJjAOxTbAmKtNkeAf9oeTcsX6nO1GqbtYQ0FO446iPCMIhyChYRH6ouaoYfepCB7 5bDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t1si2675224qkj.73.2019.01.23.13.33.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 D8BC77FDE6; Wed, 23 Jan 2019 21:33:27 +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 9BAB360469; Wed, 23 Jan 2019 21:33:27 +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 54CAB18033A1; Wed, 23 Jan 2019 21:33:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXHXK032261 for ; Wed, 23 Jan 2019 16:33:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id B09A8BA8B; Wed, 23 Jan 2019 21:33:17 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE851BA50; Wed, 23 Jan 2019 21:33:16 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:31 -0500 Message-Id: <4125ca8687d60bf72f717b5642adf6cf95739759.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 03/25] qemu: Move validation out of qemu_command.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.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.27]); Wed, 23 Jan 2019 21:33:28 +0000 (UTC) If we validate that memballoon is NONE|VIRTIO at parse time, we can drop similar checks elsewhere in the qemu driver Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 17 ---------------- src/qemu/qemu_domain.c | 36 +++++++++++++++++++++++++++++++++- src/qemu/qemu_domain_address.c | 10 ++++------ src/qemu/qemu_driver.c | 17 +++++++--------- src/qemu/qemu_process.c | 3 +-- 5 files changed, 47 insertions(+), 36 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 128cf331b3..2d05b4a93b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4046,20 +4046,9 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, { virBuffer buf = VIR_BUFFER_INITIALIZER; - if (STRPREFIX(def->os.machine, "s390-virtio") && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) - def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; - if (!virDomainDefHasMemballoon(def)) return 0; - if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Memory balloon device type '%s' is not supported by this version of qemu"), - virDomainMemballoonModelTypeToString(def->memballoon->model)); - return -1; - } - if (qemuBuildVirtioDevStr(&buf, "virtio-balloon", def->memballoon->info.type) < 0) { goto error; @@ -4070,12 +4059,6 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, goto error; if (def->memballoon->autodeflate != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("deflate-on-oom is not supported by this QEMU binary")); - goto error; - } - virBufferAsprintf(&buf, ",deflate-on-oom=%s", virTristateSwitchTypeToString(def->memballoon->autodeflate)); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1376819020..a0ab55d5db 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3481,6 +3481,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, def->memballoon = memballoon; } + if (STRPREFIX(def->os.machine, "s390-virtio") && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon) + def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE; + if (addDefaultUSBKBD && def->ngraphics > 0 && virDomainDefMaybeAddInput(def, @@ -5980,6 +5984,33 @@ qemuDomainDeviceDefValidateInput(const virDomainInputDef *input, } +static int +qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *memballoon, + virQEMUCapsPtr qemuCaps) +{ + if (!memballoon || + memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { + return 0; + } + + if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Memory balloon device type '%s' is not supported by this version of qemu"), + virDomainMemballoonModelTypeToString(memballoon->model)); + return -1; + } + + if (memballoon->autodeflate != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("deflate-on-oom is not supported by this QEMU binary")); + return -1; + } + + return 0; +} + + static int qemuDomainDeviceDefValidateZPCIAddress(virDomainDeviceInfoPtr info, virQEMUCapsPtr qemuCaps) @@ -6088,11 +6119,14 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, ret = qemuDomainDeviceDefValidateInput(dev->data.input, def, qemuCaps); break; + case VIR_DOMAIN_DEVICE_MEMBALLOON: + ret = qemuDomainDeviceDefValidateMemballoon(dev->data.memballoon, qemuCaps); + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_HUB: - case VIR_DOMAIN_DEVICE_MEMBALLOON: case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_SHMEM: case VIR_DOMAIN_DEVICE_MEMORY: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index cb1e5f9e40..1802c36b86 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -358,8 +358,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, def->hostdevs[i]->info->type = type; } - if (def->memballoon && - def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && + /* All memballoon devices accepted by the qemu driver are virtio */ + if (virDomainDefHasMemballoon(def) && def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) def->memballoon->info.type = type; @@ -2268,11 +2268,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, goto error; } - /* VirtIO balloon */ - if (def->memballoon && - def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && + /* memballoon. the qemu driver only accepts virtio memballoon devices */ + if (virDomainDefHasMemballoon(def) && virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) { - if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->memballoon->info) < 0) goto error; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 90319261ff..26a83a754b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2439,11 +2439,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, priv = vm->privateData; if (def) { - if (!def->memballoon || - def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (!virDomainDefHasMemballoon(def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Memory balloon model must be virtio to set the" - " collection period")); + _("No memory balloon device configured, " + "can not set the collection period")); goto endjob; } @@ -2463,11 +2462,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, } if (persistentDef) { - if (!persistentDef->memballoon || - persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (!virDomainDefHasMemballoon(def)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Memory balloon model must be virtio to set the" - " collection period")); + _("No memory balloon device configured, " + "can not set the collection period")); goto endjob; } persistentDef->memballoon->period = period; @@ -11964,8 +11962,7 @@ qemuDomainMemoryStatsInternal(virQEMUDriverPtr driver, if (virDomainObjCheckActive(vm) < 0) return -1; - if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (virDomainDefHasMemballoon(vm->def)) { qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm), vm->def->memballoon, stats, nr_stats); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8120201eb6..9ccc3601a2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7593,8 +7593,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, if (running) { virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); - if (vm->def->memballoon && - vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && + if (virDomainDefHasMemballoon(vm->def) && vm->def->memballoon->period) { qemuDomainObjEnterMonitor(driver, vm); qemuMonitorSetMemoryStatsPeriod(priv->mon, vm->def->memballoon, From patchwork Wed Jan 23 21:32:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156401 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201490jaa; Wed, 23 Jan 2019 13:33:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN50vXr5DLqz+zd6JrmH1rU7hKkMcAFaR+f/ujeaZ78mABpBYQttz5oHe1JuZA4TXLIGgEyM X-Received: by 2002:a37:af42:: with SMTP id y63mr3219877qke.251.1548279213753; Wed, 23 Jan 2019 13:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279213; cv=none; d=google.com; s=arc-20160816; b=YgBJPzpOYMPgh3pb0vYTxNTl9uHAH4EEle7QlJpCLZG47v4mo+iJViFYcOFFoG65H+ b4RXvht7/bTl+CGs1gK7hOI76t1o270CWzLx7Wzdw/bns7fzI2qnORfVbapziKWvxY4l t+Gr737GzLHdMANNvxOyusy0rFzMzouRYCNez3iEGKI3EQHyLb9aX97c14TObSaHXrSQ 1np0jHZf+Wf74QCipG/66ujkJGQfbyvYUbspBjiV8bG4MiqMGO3Lry/PnnJqtvZzY+xp WcJ00TxFgTHxwPvK0In8vK+CySxyIm3LEWyLh5bb3LRyN+lKyGTUrHmMqg+D3wAc7+e6 l7Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=0jh5bKjab9wzQfj4u5tcK1OcmRQr2GwG0GsAVceIBO0=; b=JMJ7/+T7gtdFvG6jFhEOM0oJTmy5uzXYSGSk/HOtZX/ba8jUdu2Iyl1bS6ehXHIgb4 hE+4OLlt55WJAxzPCBOzBa9LDHNDdgHJxkLBnjrEQWVqygilbs931Nuc4q8GkDtEOeSm efLB81gzHrwISggPHt2fc5YCQ1obQQX4rKb4mWpGvub+La79FkVpLtkVjUc0dpV0lQDi Yjg77unEpEKzP9EBvZtmzOix1qpJq1jg6PyWaq1Wt/a6c5yKQIMxnBTJwDU8JES+idcC hEnyhivw5QWazKAiQRk93cnY1igcLnbDsqfQlpBEH5KF7QEh23PFWiDMyIjlgqqQ7j5f wWQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id k15si3289170qke.86.2019.01.23.13.33.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:33 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 186D87FDF3; Wed, 23 Jan 2019 21:33:32 +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 C746B6C212; Wed, 23 Jan 2019 21:33:31 +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 731B318033A1; Wed, 23 Jan 2019 21:33:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXIhj032268 for ; Wed, 23 Jan 2019 16:33:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id CFC00BA8B; Wed, 23 Jan 2019 21:33:18 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2EA8BA96; Wed, 23 Jan 2019 21:33:17 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:32 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 04/25] qemu: Move validation out of qemu_command.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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 Jan 2019 21:33:32 +0000 (UTC) Move the rng->model == VIRTIO check to parse time. This also allows us to remove similar checks throughout the qemu driver Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 8 -------- src/qemu/qemu_domain.c | 23 +++++++++++++++++++++-- src/qemu/qemu_domain_address.c | 9 ++++----- tests/qemuxml2xmltest.c | 9 ++++++--- 4 files changed, 31 insertions(+), 18 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2d05b4a93b..bbc85e75f0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5871,14 +5871,6 @@ qemuBuildRNGDevStr(const virDomainDef *def, { virBuffer buf = VIR_BUFFER_INITIALIZER; - if (dev->model != VIR_DOMAIN_RNG_MODEL_VIRTIO || - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("this qemu doesn't support RNG device type '%s'"), - virDomainRNGModelTypeToString(dev->model)); - goto error; - } - if (!qemuDomainCheckCCWS390AddressSupport(def, dev->info, qemuCaps, dev->source.file)) goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a0ab55d5db..27cdb30ca2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4536,12 +4536,31 @@ qemuDomainSmartcardDefValidate(const virDomainSmartcardDef *def) static int -qemuDomainRNGDefValidate(const virDomainRNGDef *def) +qemuDomainRNGDefValidate(const virDomainRNGDef *def, + virQEMUCapsPtr qemuCaps) { + bool model_supported = false; + if (def->backend == VIR_DOMAIN_RNG_BACKEND_EGD && qemuDomainChrSourceDefValidate(def->source.chardev) < 0) return -1; + switch ((virDomainRNGModel) def->model) { + case VIR_DOMAIN_RNG_MODEL_VIRTIO: + model_supported = virQEMUCapsGet(qemuCaps, + QEMU_CAPS_DEVICE_VIRTIO_RNG); + break; + case VIR_DOMAIN_RNG_MODEL_LAST: + break; + } + + if (!model_supported) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("this qemu doesn't support RNG device type '%s'"), + virDomainRNGModelTypeToString(def->model)); + return -1; + } + return 0; } @@ -6073,7 +6092,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, break; case VIR_DOMAIN_DEVICE_RNG: - ret = qemuDomainRNGDefValidate(dev->data.rng); + ret = qemuDomainRNGDefValidate(dev->data.rng, qemuCaps); break; case VIR_DOMAIN_DEVICE_REDIRDEV: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 1802c36b86..f2ae0804a8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -364,8 +364,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, def->memballoon->info.type = type; for (i = 0; i < def->nrngs; i++) { - if (def->rngs[i]->model == VIR_DOMAIN_RNG_MODEL_VIRTIO && - def->rngs[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) + /* All devices accepted by the qemu driver are virtio */ + if (def->rngs[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) def->rngs[i]->info.type = type; } @@ -2276,10 +2276,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, goto error; } - /* VirtIO RNG */ + /* rng. the qemu driver only accepts virtio rng devices */ for (i = 0; i < def->nrngs; i++) { - if (def->rngs[i]->model != VIR_DOMAIN_RNG_MODEL_VIRTIO || - !virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info)) + if (!virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info)) continue; if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info) < 0) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 82e2c0ee0f..b2c0c8505d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -585,8 +585,10 @@ mymain(void) DO_TEST("disk-serial", NONE); - DO_TEST("virtio-rng-random", NONE); - DO_TEST("virtio-rng-egd", NONE); + DO_TEST("virtio-rng-random", + QEMU_CAPS_DEVICE_VIRTIO_RNG); + DO_TEST("virtio-rng-egd", + QEMU_CAPS_DEVICE_VIRTIO_RNG); DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); @@ -1019,7 +1021,8 @@ mymain(void) DO_TEST("disk-backing-chains-index", NONE); DO_TEST("disk-backing-chains-noindex", NONE); - DO_TEST("chardev-label", NONE); + DO_TEST("chardev-label", + QEMU_CAPS_DEVICE_VIRTIO_RNG); DO_TEST("cpu-numa1", NONE); DO_TEST("cpu-numa2", NONE); From patchwork Wed Jan 23 21:32:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156403 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201557jaa; Wed, 23 Jan 2019 13:33:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN7/j9/upf9TMTTW4n7fcZcQcg/4WcXYDrELitz1/TOdaOdbVYVTJMRYYFhog/wUWZ5AgFqt X-Received: by 2002:ae9:c106:: with SMTP id z6mr3335384qki.197.1548279217329; Wed, 23 Jan 2019 13:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279217; cv=none; d=google.com; s=arc-20160816; b=H2n+k2Pi8bu0pcv65kYG50SOYLXnIebKJ/JhI5dCCwAqu62jUrNFCnJCBao5bLA75j XKqtZZ24uXXCbFr+gtO1hNv1ZGLXkvhsZBmz6/1dPT1vc4WAAjLfCYkbFvL2vIopZi5F gHc5u/pjEDvJvWW0RunpUytSJv7fqA//Dt973f8732IgHKtaJeW0Bre/kWzyZJabOahc 8dOJhNPNNByExbWKUZNfnxAiqOVrTSJ6eVZNopEFON7vJhU21DZXbWYKKDEC3aTmeaB4 DwowD/UPK+iOPtARKA/BOS25VqvkmT4+bzGOPmsO2dZZSO1zqS5Psn8LKjgR5BJOiCmO dqYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=F8Xf77iFqbysLyWw277x9CKI46DMmdYyGbTl1T7Vwdg=; b=ZX3QTWMlPTSrBdDZBQeNNcE0KQIMmxU684RPPBLaFughT+a06l+HxTYNmv+QoqBMmS kBAECd6jz3eoVp0unZMC/3ENtUnk8MufXKCzN6y46qwFTEhfKb29eGYU/Qq9VBnrjtIn ZuZBMiuNT6dOZDMptU5dD2rAT+xvAbVF54CNl64PYx52kz8HtwBBVM0WT1KyFExcv2fZ 3fxjwcZ/7i8Oe1x7ymT0KdzddhE+XW8+ovq+i4m3LSqRBEX4J+66tFnNV37qSbkQHUmI g+Mm8/dHV8rCt77qOLPX3Y+Qzu0aLblhrYt7n0FbGQiBTFhmDneQO9+TTbWcVGAq5nep tT2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id d197si3301622qkb.84.2019.01.23.13.33.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:37 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 023532CD814; Wed, 23 Jan 2019 21:33:36 +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 C43EF1048104; Wed, 23 Jan 2019 21:33:35 +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 7769D18033A1; Wed, 23 Jan 2019 21:33:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXJD7032282 for ; Wed, 23 Jan 2019 16:33:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC9AEBA8B; Wed, 23 Jan 2019 21:33:19 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20C5CBA50; Wed, 23 Jan 2019 21:33:19 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:33 -0500 Message-Id: <31eaef0e389c7a33846a473fcf6b0676961b530a.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 05/25] qemu: command: Make vhost-scsi device string depend on address 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 23 Jan 2019 21:33:36 +0000 (UTC) The vhost-scsi device string should depend on the requested address type, not strictly on the emulated arch. This is the same logic used by qemuBuildVirtioDevStr, and this particular path is already tested in the hostdev-scsi-vhost-scsi-ccw tests Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bbc85e75f0..a1d991cefc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4925,7 +4925,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, goto cleanup; } - if (ARCH_IS_S390(def->os.arch)) + if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) virBufferAddLit(&buf, "vhost-scsi-ccw"); else virBufferAddLit(&buf, "vhost-scsi-pci"); From patchwork Wed Jan 23 21:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156404 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201638jaa; Wed, 23 Jan 2019 13:33:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6gzfsjUKziJH2orN/VJFlDbuITVsDJ1nPa54c182XE1fpvuGrf/PNB2CqfBNMzNJK3zN2g X-Received: by 2002:ac8:548a:: with SMTP id h10mr4250764qtq.15.1548279222330; Wed, 23 Jan 2019 13:33:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279222; cv=none; d=google.com; s=arc-20160816; b=bXulo9+Bfv7StdlKI1nMJwSrL/LbimaJ+CYHvG3B+IqO+jK3tvE5+l61CebPXR9NY+ QkENhGXD53rTwJ2Dy3MQyHV+pPl3C/dUERQXRzpnaCuAS5B6UA/F2bhGqdJhWXoIE0Ex Pnk2AObGQh/CtkmJ0aZF6sdRl6hAUOlnIfyaIYNPulX11BSPasEYXsgPqiYDR2IPkT+2 NcFONY1P4yI9y/Rb4ItUi5Y2WkNAF9u5kGuJxOhufkrAhkGW9SoNOkVjZkBxx8bBWOdz oz6X0TdCfHG/gJLwogZTl3NgFs5O6jcRfK7VoNguoKlx/86c6y/sVfUyjwBve1IDsSuc rrng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=NCIsm0cmkwO5I9DF5MnqhQzaJLxn91RkRyb8bOdEYhk=; b=aODfzIvOtx8zXhXP83ejNWS1sPyPoJxuS8B+VtcKh1wTJms5GdY+Tm0PJ61ad8DmRo xE1ZmN8Tb+OUFBzDPvUp5Ov4kM/iBQiqoPuyOAVPlUjJ+kUpWLuKdTP6iayzySHjobf8 MBK9OQ1jtw5FbIkNITfPR8FgF+UBqxlezC2rVUrdCqlc4L51Yj2hakME4czMCO0nG4rc LDuiLTw6E8fYjF0D12eXY21yAICia4M9HNY0qvKUS2qXymHa309ZfHi1/5ClL7DVS8i5 bMGzpk/iizPl0Z5eMU4+JuMxzIQFgKBZBicN5iNXkcBEm+2Y+HSbAECzUFAF5w0nMIgx obtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id u37si4514926qtu.230.2019.01.23.13.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:42 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCB9719F34; Wed, 23 Jan 2019 21:33:39 +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 9380CBA96; Wed, 23 Jan 2019 21:33:39 +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 30BF73F608; Wed, 23 Jan 2019 21:33:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXLMX032289 for ; Wed, 23 Jan 2019 16:33:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 321F2BA6D; Wed, 23 Jan 2019 21:33:21 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55FD2BA50; Wed, 23 Jan 2019 21:33:20 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:34 -0500 Message-Id: <066d7b1e62cd29e74604d00c8a5940bec53e84db.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 06/25] qemu: command: Convert vhost-{vsock, scsi} to qemuBuildVirtioDevStr 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 Jan 2019 21:33:41 +0000 (UTC) Current code essentially duplicates the same logic, but misses some cases (like vhost-vsock-device). Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a1d991cefc..2dde4b9125 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4925,10 +4925,8 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, goto cleanup; } - if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) - virBufferAddLit(&buf, "vhost-scsi-ccw"); - else - virBufferAddLit(&buf, "vhost-scsi-pci"); + if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0) + goto cleanup; virBufferAsprintf(&buf, ",wwpn=%s,vhostfd=%s,id=%s", hostsrc->wwpn, @@ -10347,11 +10345,9 @@ qemuBuildVsockDevStr(virDomainDefPtr def, virBuffer buf = VIR_BUFFER_INITIALIZER; char *ret = NULL; - if (vsock->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { - virBufferAddLit(&buf, "vhost-vsock-ccw"); - } else { - virBufferAddLit(&buf, "vhost-vsock-pci"); - } + + if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0) + goto cleanup; virBufferAsprintf(&buf, ",id=%s", vsock->info.alias); virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid); From patchwork Wed Jan 23 21:32:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156398 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201402jaa; Wed, 23 Jan 2019 13:33:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ghTDb4nai6EuURWrq7KRWeDDYhHd4UjkCDbeQ7PpTGYjPnzLWJS9O+6FSvGZgcGNrgNhT X-Received: by 2002:aed:3442:: with SMTP id w60mr4212064qtd.339.1548279208287; Wed, 23 Jan 2019 13:33:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279208; cv=none; d=google.com; s=arc-20160816; b=zotCyzm1NMy6yQOcCKevDLIRT+dQjLXKf3xrCYx9rfk97sw6FcRkM3TeAg7tZrXfGi 0Oy+l1FJOaOnW/Wo3m5YZ9L9D9xmMpg37fOsaJ1NvoOg+XEi8D0k0ImECXP1ejjFpeGb 1kI9fGNrntSme/OtlQlolfTL3GYx6bc8QzNh8evDFLcjA/bgQaLNzxPS3d7le5OUKAvk khjLkSnkiI0szvh+zqXignmVu3GsG8B8RFjkshFU/8+kNax8Hy3tgdO9ZbW0Aa63eA1J tMJIi1O5fvUEoFWwlSNq6C0xGSJQMKpvyWEFw5x7TOGoy33ZEowYxDqNi/IKg0Xh2SU8 LUPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=2Bp5dSwt7GkJEeahEaRZ0in44Dc+ZPI36g77s3EZ02M=; b=hCOKHywyKo6JjXhUtHdQoqdFrYcR7/ep/fY/PqXCDjLOeNpNeZ7aVouEYCRkYAB1wY MFwU4qsj7vCrHWD6EMoFQtGKD/baudGgEVGKDZjmuLCvhjB5zQWkEkohBREbUwgt7Pjz pf9IQY1wBQHBrvJg2X+JtJbMFCKGv1SO3ykhHfAZJK0G3X8AKVzW4KhM/hMs07V+Mh+7 L+L62XLyaVOc/qdfd48y5ir9htulIskItwzfGiM907QK6ustVmivkuTND81eJYZVVEMT XbIVgq9Tr5rv5uf2oIU2o7kBxaTxRtk5VjiKXYLkwTZcenRWpEi058HXi+SmB9hLKz+4 0R1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t5si5435030qvj.105.2019.01.23.13.33.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:28 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 mx1.redhat.com (Postfix) with ESMTPS id CC18B80511; Wed, 23 Jan 2019 21:33: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 9A8E458B2; Wed, 23 Jan 2019 21:33: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 5151C3F605; Wed, 23 Jan 2019 21:33:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXMe0032297 for ; Wed, 23 Jan 2019 16:33:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 68961BA8B; Wed, 23 Jan 2019 21:33:22 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E6D9BA50; Wed, 23 Jan 2019 21:33:21 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:35 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 07/25] conf: Add virDomainDeviceSetData 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 Jan 2019 21:33:27 +0000 (UTC) This is essentially a wrapper for easily setting the variable name in virDomainDeviceDef that matches its associated VIR_DOMAIN_DEVICE_TYPE. Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 93 ++++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 3 ++ src/libvirt_private.syms | 1 + 3 files changed, 97 insertions(+) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bcdb6b0a3a..8af1a4ae73 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3702,6 +3702,99 @@ virDomainSkipBackcompatConsole(virDomainDefPtr def, } +/** + * virDomainDeviceSetData + * @device: virDomainDeviceDefPtr with ->type filled in + * @data: *DefPtr data for a device. Ex: virDomainDiskDefPtr + * + * Set the data.X variable for the device->type value. Basically + * a mapping of virDomainDeviceType to the associated name in + * the virDomainDeviceDef union + */ +void +virDomainDeviceSetData(virDomainDeviceDefPtr device, + void *devicedata) +{ + switch ((virDomainDeviceType) device->type) { + case VIR_DOMAIN_DEVICE_DISK: + device->data.disk = devicedata; + break; + case VIR_DOMAIN_DEVICE_NET: + device->data.net = devicedata; + break; + case VIR_DOMAIN_DEVICE_SOUND: + device->data.sound = devicedata; + break; + case VIR_DOMAIN_DEVICE_HOSTDEV: + device->data.hostdev = devicedata; + break; + case VIR_DOMAIN_DEVICE_VIDEO: + device->data.video = devicedata; + break; + case VIR_DOMAIN_DEVICE_CONTROLLER: + device->data.controller = devicedata; + break; + case VIR_DOMAIN_DEVICE_GRAPHICS: + device->data.graphics = devicedata; + break; + case VIR_DOMAIN_DEVICE_SMARTCARD: + device->data.smartcard = devicedata; + break; + case VIR_DOMAIN_DEVICE_CHR: + device->data.chr = devicedata; + break; + case VIR_DOMAIN_DEVICE_INPUT: + device->data.input = devicedata; + break; + case VIR_DOMAIN_DEVICE_FS: + device->data.fs = devicedata; + break; + case VIR_DOMAIN_DEVICE_WATCHDOG: + device->data.watchdog = devicedata; + break; + case VIR_DOMAIN_DEVICE_MEMBALLOON: + device->data.memballoon = devicedata; + break; + case VIR_DOMAIN_DEVICE_RNG: + device->data.rng = devicedata; + break; + case VIR_DOMAIN_DEVICE_NVRAM: + device->data.nvram = devicedata; + break; + case VIR_DOMAIN_DEVICE_HUB: + device->data.hub = devicedata; + break; + case VIR_DOMAIN_DEVICE_SHMEM: + device->data.shmem = devicedata; + break; + case VIR_DOMAIN_DEVICE_TPM: + device->data.tpm = devicedata; + break; + case VIR_DOMAIN_DEVICE_PANIC: + device->data.panic = devicedata; + break; + case VIR_DOMAIN_DEVICE_MEMORY: + device->data.memory = devicedata; + break; + case VIR_DOMAIN_DEVICE_REDIRDEV: + device->data.redirdev = devicedata; + break; + case VIR_DOMAIN_DEVICE_VSOCK: + device->data.vsock = devicedata; + break; + case VIR_DOMAIN_DEVICE_IOMMU: + device->data.iommu = devicedata; + break; + case VIR_DOMAIN_DEVICE_LEASE: + device->data.lease = devicedata; + break; + case VIR_DOMAIN_DEVICE_NONE: + case VIR_DOMAIN_DEVICE_LAST: + break; + } +} + + enum { DOMAIN_DEVICE_ITERATE_ALL_CONSOLES = 1 << 0, DOMAIN_DEVICE_ITERATE_GRAPHICS = 1 << 1 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 218aa4dd94..536b02ad3d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2937,6 +2937,9 @@ virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src, virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device); void virDomainTPMDefFree(virDomainTPMDefPtr def); +void virDomainDeviceSetData(virDomainDeviceDefPtr device, + void *devicedata); + typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def, virDomainDeviceDefPtr dev, virDomainDeviceInfoPtr info, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6f4809a68a..89b8ca3b4f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -307,6 +307,7 @@ virDomainDeviceDefParse; virDomainDeviceFindSCSIController; virDomainDeviceGetInfo; virDomainDeviceInfoIterate; +virDomainDeviceSetData; virDomainDeviceTypeToString; virDomainDeviceValidateAliasForHotplug; virDomainDiskBusTypeToString; From patchwork Wed Jan 23 21:32:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156405 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201706jaa; Wed, 23 Jan 2019 13:33:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN7L1Q+37kM1f6YJL45K2cMjhGeAXgYSCZGz4yvBAzc+7oCMIVPv2ZjEf1Yn7/pgBWxQ6aIj X-Received: by 2002:ac8:34cb:: with SMTP id x11mr4137756qtb.115.1548279226662; Wed, 23 Jan 2019 13:33:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279226; cv=none; d=google.com; s=arc-20160816; b=GL9YtWxf7qV8vXi1J8xpkeUaQ1TLYGyofauJhKismIxi6ze7v194h1xjPMU31HTARU 1it53Wakn8w/daXlc7SdvXsMXK+9hSuL6yrZnGX+6oD+zVhM2fvfnKl2k4RDsSemOcOt daYsKlCyh0OAbYO7jAFw1iqqcm/IxWUJcXors5iJ5LvBpopexUDYenddSE1c0PpknQMu zZHPpTr9zEPuXb3g+mDDYRn0zD6KdlDq17S9cpgB/+aWo0bHjW1mj9rEQB0NpSRhBsw2 KnNlynoW+GOCHoMbzVaNcLytYkPRZVjlKAGDlPeAxemDY5ugCVwFqEM/kgIra9P32gnA fUUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=WnDdKoAWWRKVdga5HlVjoJsy4X1v3aWEOAD1meFDVIo=; b=akWWKnMW5mIlRocBI4h39vam1+bIBJBTVCs0zWc2l/MYzXwlwNtW6jn3UvAvFsd6kv N+qs6V4vHrLOtDq4hlZI620wEvc9uAjHyimcl3FVHTUCsjKqof6hCWNPzOqxSlLtTizA gdVsQ7m2kP/dbmMkukANQ+mGCZHfH/MxRwaPgsQxudgn7JFxsb4WxI/64pH9HCMdM7KC ZTQx6za9MW+SN1rUDEL2ezBT93WbMjJTC4FkioJYFUuC9NbrZWFgr8c5BQW01FVRMD8D OEpdqDgf5oSboYUStDytfDW9/j7X+V5h0Wa+dCK1VP1MCTOa9HmbjX9NC3+mUQAjkYDq WRtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id w58si2995706qtb.24.2019.01.23.13.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:46 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7850DC07F66B; Wed, 23 Jan 2019 21:33:44 +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 428E4BA9E; Wed, 23 Jan 2019 21:33:44 +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 F26C318033A8; Wed, 23 Jan 2019 21:33:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXNOd032309 for ; Wed, 23 Jan 2019 16:33:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 73368BA8D; Wed, 23 Jan 2019 21:33:23 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4E68BA50; Wed, 23 Jan 2019 21:33:22 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:36 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 08/25] qemu: command: Make BuildVirtioDevStr more generic 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 23 Jan 2019 21:33:45 +0000 (UTC) Switch qemuBuildVirtioDevStr to use virDomainDeviceSetData: callers pass in the virDomainDeviceType and the void * DefPtr. This will save us from having to repeatedly extend the function argument list in subsequent patches. Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 82 ++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 18 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2dde4b9125..3a9e9def78 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -396,14 +396,34 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, } +/** + * qemuBuildVirtioDevStr + * @buf: virBufferPtr to append the built string + * @baseName: qemu virtio device basename string. Ex: virtio-rng for + * @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE_RNG + * @devdata: *DefPtr of the device definition + * + * Build the qemu virtio -device name from the passed parameters. Currently + * this is mostly about attaching the correct string prefix to @baseName for + * the passed @type. So for @baseName "virtio-rng" and devdata->info.type + * VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, generate "virtio-rng-pci" + * + * Returns: -1 on failure, 0 on success + */ static int qemuBuildVirtioDevStr(virBufferPtr buf, const char *baseName, - virDomainDeviceAddressType type) + virDomainDeviceType devtype, + void *devdata) { const char *implName = NULL; + virDomainDeviceDef device = { .type = devtype }; + virDomainDeviceInfoPtr info; - switch (type) { + virDomainDeviceSetData(&device, devdata); + info = virDomainDeviceGetInfo(&device); + + switch (info->type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: implName = "pci"; break; @@ -434,7 +454,7 @@ qemuBuildVirtioDevStr(virBufferPtr buf, case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST: default: - virReportEnumRangeError(virDomainDeviceAddressType, type); + virReportEnumRangeError(virDomainDeviceAddressType, info->type); return -1; } @@ -443,7 +463,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf, return 0; } - static int qemuBuildVirtioOptionsStr(virBufferPtr buf, virDomainVirtioOptionsPtr virtio, @@ -2050,8 +2069,10 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - if (qemuBuildVirtioDevStr(&opt, "virtio-blk", disk->info.type) < 0) + if (qemuBuildVirtioDevStr(&opt, "virtio-blk", + VIR_DOMAIN_DEVICE_DISK, disk) < 0) { goto error; + } if (disk->iothread) virBufferAsprintf(&opt, ",iothread=iothread%u", disk->iothread); @@ -2639,8 +2660,10 @@ qemuBuildFSDevStr(const virDomainDef *def, goto error; } - if (qemuBuildVirtioDevStr(&opt, "virtio-9p", fs->info.type) < 0) + if (qemuBuildVirtioDevStr(&opt, "virtio-9p", + VIR_DOMAIN_DEVICE_FS, fs) < 0) { goto error; + } virBufferAsprintf(&opt, ",id=%s", fs->info.alias); virBufferAsprintf(&opt, ",fsdev=%s%s", @@ -2845,8 +2868,10 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch ((virDomainControllerModelSCSI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", def->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", + VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) { goto error; + } if (def->iothread) { virBufferAsprintf(&buf, ",iothread=iothread%u", @@ -2886,8 +2911,10 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, break; case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: - if (qemuBuildVirtioDevStr(&buf, "virtio-serial", def->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-serial", + VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) { goto error; + } virBufferAsprintf(&buf, ",id=%s", def->info.alias); if (def->opts.vioserial.ports != -1) { @@ -3655,8 +3682,10 @@ qemuBuildNicDevStr(virDomainDefPtr def, char macaddr[VIR_MAC_STRING_BUFLEN]; if (virDomainNetIsVirtioModel(net)) { - if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-net", + VIR_DOMAIN_DEVICE_NET, net) < 0) { goto error; + } usingVirtio = true; } else { @@ -4050,7 +4079,8 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, return 0; if (qemuBuildVirtioDevStr(&buf, "virtio-balloon", - def->memballoon->info.type) < 0) { + VIR_DOMAIN_DEVICE_MEMBALLOON, + def->memballoon) < 0) { goto error; } @@ -4148,20 +4178,28 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, switch ((virDomainInputType)dev->type) { case VIR_DOMAIN_INPUT_TYPE_MOUSE: - if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", dev->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", + VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; + } break; case VIR_DOMAIN_INPUT_TYPE_TABLET: - if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", dev->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", + VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; + } break; case VIR_DOMAIN_INPUT_TYPE_KBD: - if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", dev->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", + VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; + } break; case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: - if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", dev->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", + VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; + } break; case VIR_DOMAIN_INPUT_TYPE_LAST: default: @@ -4479,8 +4517,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, } if (STREQ(model, "virtio-gpu")) { - if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", video->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", + VIR_DOMAIN_DEVICE_VIDEO, video) < 0) { goto error; + } } else { virBufferAsprintf(&buf, "%s", model); } @@ -4925,8 +4965,10 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, goto cleanup; } - if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0) + if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", + VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) { goto cleanup; + } virBufferAsprintf(&buf, ",wwpn=%s,vhostfd=%s,id=%s", hostsrc->wwpn, @@ -5873,8 +5915,10 @@ qemuBuildRNGDevStr(const virDomainDef *def, dev->source.file)) goto error; - if (qemuBuildVirtioDevStr(&buf, "virtio-rng", dev->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "virtio-rng", + VIR_DOMAIN_DEVICE_RNG, dev) < 0) { goto error; + } virBufferAsprintf(&buf, ",rng=obj%s,id=%s", dev->info.alias, dev->info.alias); @@ -10346,8 +10390,10 @@ qemuBuildVsockDevStr(virDomainDefPtr def, char *ret = NULL; - if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0) + if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", + VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) { goto cleanup; + } virBufferAsprintf(&buf, ",id=%s", vsock->info.alias); virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid); From patchwork Wed Jan 23 21:32:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156406 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201771jaa; Wed, 23 Jan 2019 13:33:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN5bHONBEFPiLcVbierzJ/FPxkuPfrDxOd/jErc1KWeFbpTOozZa6u676nwPffTH2XbyBJL4 X-Received: by 2002:ac8:28d2:: with SMTP id j18mr4087829qtj.191.1548279230569; Wed, 23 Jan 2019 13:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279230; cv=none; d=google.com; s=arc-20160816; b=i7NRJFMiVdGeZqQH4KzIbhlwr3AsT1RTkdM3sBStWSgLmq2kn6Kb0Jxij3I0aiD5qu aoYOUO+HcYQtmjTfmYzV4DXFG26d7KPOgjmNVqdgGDmWM5/s8heJaUSsKML2GNUuAt1N XGKhqDqOPo3VD7leadDnJpOssLfX8tA90JZLVr8GgBHGiOZona5jQW38q/ESQc7bDcUf 7GWH7fgzyc8A+LHmEJNOXvvcQJseMfGCEJ0dCDbxMxu5mmuopNekZHMVJeLg3P9oyvXJ jbfr8g2EFd50otV0rqOJXYUCI1laFgh1Stf9Jf7ZgD14sa6ic6an70We7u3qlQZ5AWFf +G6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=z3ocsB6q8W6aofWnZDgv8+ygDwfDYEZbdUxeAIWj6Z0=; b=Zpl4N79c+VZs84e4YcaUjR8q7++CZxXiwjJtVE1mNxOWGCVR5pnUHKDKCPO806NW/O aWMachPAdWBGxMeh/coKD+/oswtEuYRuXaPetdpbHfqZ5AYpdi4WyQ92WbaO2MmmTIf3 HEyp9Wev6oPgbsybfkH7dFuOHSE0ZhWS6l3lY0EjMEUTmD5sbSrQB7Hh/XXV8W7Bfja7 WBn2aceBbbF3pbOLhZOcTT4fPkc/eXDCyVXKevniR1SErVxqnKrbwzwLcOw4Ua+nd30g HOoYXEdvWOtS7ko7GRtloyJ6Vg4ere4iBQBGeewNcvCx44hwO6kY38ODh40mhq0RH64D rC+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id j13si7402416qti.103.2019.01.23.13.33.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:50 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 mx1.redhat.com (Postfix) with ESMTPS id BF5097F3FA; Wed, 23 Jan 2019 21:33:48 +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 7E4EC5D75F; Wed, 23 Jan 2019 21:33:48 +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 262AF3F60C; Wed, 23 Jan 2019 21:33:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXOH7032319 for ; Wed, 23 Jan 2019 16:33:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8C318BA8D; Wed, 23 Jan 2019 21:33:24 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7A7A65F72; Wed, 23 Jan 2019 21:33:23 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:37 -0500 Message-Id: <4a44cafbddd520ecb3214afc1b334546de2d8441.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 09/25] qemu: command: Add qemuCaps to BuildVirtioStr 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 23 Jan 2019 21:33:49 +0000 (UTC) It will be used in future patches Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3a9e9def78..659274f25a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -400,6 +400,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, * qemuBuildVirtioDevStr * @buf: virBufferPtr to append the built string * @baseName: qemu virtio device basename string. Ex: virtio-rng for + * @qemuCaps: virQEMUCapPtr * @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE_RNG * @devdata: *DefPtr of the device definition * @@ -413,6 +414,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, static int qemuBuildVirtioDevStr(virBufferPtr buf, const char *baseName, + virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED, virDomainDeviceType devtype, void *devdata) { @@ -2069,7 +2071,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - if (qemuBuildVirtioDevStr(&opt, "virtio-blk", + if (qemuBuildVirtioDevStr(&opt, "virtio-blk", qemuCaps, VIR_DOMAIN_DEVICE_DISK, disk) < 0) { goto error; } @@ -2660,7 +2662,7 @@ qemuBuildFSDevStr(const virDomainDef *def, goto error; } - if (qemuBuildVirtioDevStr(&opt, "virtio-9p", + if (qemuBuildVirtioDevStr(&opt, "virtio-9p", qemuCaps, VIR_DOMAIN_DEVICE_FS, fs) < 0) { goto error; } @@ -2868,7 +2870,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch ((virDomainControllerModelSCSI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", + if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", qemuCaps, VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) { goto error; } @@ -2911,7 +2913,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, break; case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: - if (qemuBuildVirtioDevStr(&buf, "virtio-serial", + if (qemuBuildVirtioDevStr(&buf, "virtio-serial", qemuCaps, VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) { goto error; } @@ -3682,7 +3684,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, char macaddr[VIR_MAC_STRING_BUFLEN]; if (virDomainNetIsVirtioModel(net)) { - if (qemuBuildVirtioDevStr(&buf, "virtio-net", + if (qemuBuildVirtioDevStr(&buf, "virtio-net", qemuCaps, VIR_DOMAIN_DEVICE_NET, net) < 0) { goto error; } @@ -4078,7 +4080,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, if (!virDomainDefHasMemballoon(def)) return 0; - if (qemuBuildVirtioDevStr(&buf, "virtio-balloon", + if (qemuBuildVirtioDevStr(&buf, "virtio-balloon", qemuCaps, VIR_DOMAIN_DEVICE_MEMBALLOON, def->memballoon) < 0) { goto error; @@ -4178,25 +4180,25 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, switch ((virDomainInputType)dev->type) { case VIR_DOMAIN_INPUT_TYPE_MOUSE: - if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", + if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", qemuCaps, VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; } break; case VIR_DOMAIN_INPUT_TYPE_TABLET: - if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", + if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", qemuCaps, VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; } break; case VIR_DOMAIN_INPUT_TYPE_KBD: - if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", + if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", qemuCaps, VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; } break; case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: - if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", + if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", qemuCaps, VIR_DOMAIN_DEVICE_INPUT, dev) < 0) { goto error; } @@ -4517,7 +4519,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, } if (STREQ(model, "virtio-gpu")) { - if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", + if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", qemuCaps, VIR_DOMAIN_DEVICE_VIDEO, video) < 0) { goto error; } @@ -4965,7 +4967,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, goto cleanup; } - if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", + if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", qemuCaps, VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) { goto cleanup; } @@ -5915,7 +5917,7 @@ qemuBuildRNGDevStr(const virDomainDef *def, dev->source.file)) goto error; - if (qemuBuildVirtioDevStr(&buf, "virtio-rng", + if (qemuBuildVirtioDevStr(&buf, "virtio-rng", qemuCaps, VIR_DOMAIN_DEVICE_RNG, dev) < 0) { goto error; } @@ -10390,7 +10392,7 @@ qemuBuildVsockDevStr(virDomainDefPtr def, char *ret = NULL; - if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", + if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", qemuCaps, VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) { goto cleanup; } From patchwork Wed Jan 23 21:32:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156407 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201839jaa; Wed, 23 Jan 2019 13:33:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN4vVuulVhOKYNvNhN9M6/TRf9o/HBq41myF52cF2y9/6+eyo5T5ovkyOTMPhIEOEZmqzrjD X-Received: by 2002:aed:24b7:: with SMTP id t52mr4230286qtc.131.1548279234684; Wed, 23 Jan 2019 13:33:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279234; cv=none; d=google.com; s=arc-20160816; b=XXZyD9Lmu1mmiKffFMrw0zvBGYS/YLHacsGNFDZ5cKDh7QFBg20/CnD1MxScYSRx9w rWmxS4ZFiNCQ3adl5BNXhdptJPh9JWEY+zNMBv35lV95/ZTBiprc0Cq+0UfvwhaQtCnD 3WVpp+BQ8lXiCtnj5MJeX6dxgKpHTZUX4wiaj7Nrn2htlrvUX6e0eSb5zBsAj1928T/s RTw+3Rvih3BbOocaYNU7T4IGzNxs3r3rluwiC/a1LJvz3oP28JCP0D5rXZvDh1IXV0p8 AzL3SjRx8kE5WNYlY8GzFlHQqE/jcq21RBWLyh1a+qdXW0/piD6MEmsG6ycv1F6AAAtS yH1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=X3aKp2KcE8iFuD9p8RbA1udRgsQwXaKhLK+oeM1OFA4=; b=WNCewC4YTclmgF3BKzbSN7LtHFI6rPluwiYjbJn/MPKC1g8FemZQqIFF9Xzpu/gALb htRGNMhTh9JwDjFck0pkFvd9RV7/+C6BAATbXdCWGP6IebOnjOkKIoExD6moWkmSEicU aMB3yi1rZF92Ex0WKmZ/Qa8VOYBs/LXrTGYWTznxFx6lCZskIBxNNmyO7QLaAy7JWrRr yWlJ0IDJ/M06meORmLH+3qp7gsbn7mKcyAf5VFFZ7BKfP5cGK3ihBnCiYfWlVyqk/BQ2 Q0O+phBIT4A7pBeRxetPvHhuwPIBc4C/GBjZni8Zn+RI5J7cOpqIB2afK3PgHy9B72Bm irlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id a6si3577331qtn.52.2019.01.23.13.33.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:54 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3C9987645; Wed, 23 Jan 2019 21:33:52 +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 B18C46BF7B; Wed, 23 Jan 2019 21:33:52 +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 5F6313F60D; Wed, 23 Jan 2019 21:33:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXPmw032324 for ; Wed, 23 Jan 2019 16:33:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id C70A5BA6D; Wed, 23 Jan 2019 21:33:25 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBD4EBA50; Wed, 23 Jan 2019 21:33:24 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:38 -0500 Message-Id: <4410eb25e13925ff94a0a71cd9de86971bf2dc1e.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 10/25] qemu: capabilities: Add virtio/vhost {non-}transitional 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 23 Jan 2019 21:33:53 +0000 (UTC) This adds QEMU_CAPS flags for the following devices virtio-blk-pci-transitional virtio-blk-pci-non-transitional virtio-net-pci-transitional virtio-net-pci-non-transitional vhost-scsi-pci-transitional vhost-scsi-pci-non-transitional virtio-rng-pci-transitional virtio-rng-pci-non-transitional virtio-9p-pci-transitional virtio-9p-pci-non-transitional virtio-balloon-pci-transitional virtio-balloon-pci-non-transitional vhost-vsock-pci-transitional vhost-vsock-pci-non-transitional virtio-input-host-pci-transitional virtio-input-host-pci-non-transitional virtio-scsi-pci-transitional virtio-scsi-pci-non-transitional virtio-serial-pci-transitional virtio-serial-pci-non-transitional Signed-off-by: Cole Robinson --- src/qemu/qemu_capabilities.c | 48 +++++++++++++++++++ src/qemu/qemu_capabilities.h | 28 +++++++++++ .../caps_4.0.0.x86_64.xml | 20 ++++++++ 3 files changed, 96 insertions(+) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f504db7d05..ee471787d9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -520,6 +520,34 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 325 */ "memory-backend-file.pmem", "nvdimm.unarmed", + "virtio-blk-pci-transitional", + "virtio-blk-pci-non-transitional", + "virtio-net-pci-transitional", + + /* 330 */ + "virtio-net-pci-non-transitional", + "vhost-scsi-pci-transitional", + "vhost-scsi-pci-non-transitional", + "virtio-rng-pci-transitional", + "virtio-rng-pci-non-transitional", + + /* 335 */ + "virtio-9p-pci-transitional", + "virtio-9p-pci-non-transitional", + "virtio-balloon-pci-transitional", + "virtio-balloon-pci-non-transitional", + "vhost-vsock-pci-transitional", + + /* 340 */ + "vhost-vsock-pci-non-transitional", + "virtio-input-host-pci-transitional", + "virtio-input-host-pci-non-transitional", + "virtio-scsi-pci-transitional", + "virtio-scsi-pci-non-transitional", + + /* 345 */ + "virtio-serial-pci-transitional", + "virtio-serial-pci-non-transitional", ); @@ -1108,6 +1136,26 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "vfio-ap", QEMU_CAPS_DEVICE_VFIO_AP }, { "zpci", QEMU_CAPS_DEVICE_ZPCI }, { "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD }, + { "virtio-blk-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL }, + { "virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL }, + { "virtio-net-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL }, + { "virtio-net-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL }, + { "vhost-scsi-pci-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL }, + { "vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL }, + { "virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL }, + { "virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL }, + { "virtio-9p-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSITIONAL }, + { "virtio-9p-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL }, + { "virtio-balloon-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_TRANSITIONAL }, + { "virtio-balloon-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL }, + { "vhost-vsock-pci-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRANSITIONAL }, + { "vhost-vsock-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL }, + { "virtio-input-host-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL }, + { "virtio-input-host-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL }, + { "virtio-scsi-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRANSITIONAL }, + { "virtio-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_NON_TRANSITIONAL }, + { "virtio-serial-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL }, + { "virtio-serial-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6d5ed8a3cc..cff3506355 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -504,6 +504,34 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 325 */ QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM, /* -object memory-backend-file,pmem= */ QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */ + QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL, /* -device virtio-blk-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL, /* -device virtio-blk-pci-non-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL, /* -device virtio-net-pci-transitional */ + + /* 330 */ + QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL, /* -device virtio-net-pci-non-transitional */ + QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL, /* -device vhost-scsi-pci-transitional */ + QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL, /* -device vhost-scsi-pci-non-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL, /* -device virtio-blk-rng-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL, /* -device virtio-rng-pci-non-transitional */ + + /* 335 */ + QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSITIONAL, /* -device virtio-9p-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL, /* -device virtio-9p-pci-non-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_TRANSITIONAL, /* -device virtio-balloon-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL, /* -device virtio-balloon-pci-transitional */ + QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRANSITIONAL, /* -device vhost-vsock-pci-transitional */ + + /* 340 */ + QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL, /* -device vhost-vsock-pci-non-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL, /* -device virtio-input-host-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL, /* -device virtio-input-host-pci-non-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRANSITIONAL, /* -device virtio-scsi-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_NON_TRANSITIONAL, /* -device virtio-scsi-pci-non-transitional */ + + /* 345 */ + QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL, /* -device virtio-serial-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL, /* -device virtio-serial-pci-non-transitional */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index c2db392e83..aaf7d404eb 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -212,6 +212,26 @@ + + + + + + + + + + + + + + + + + + + + 3001050 0 446361 From patchwork Wed Jan 23 21:32:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156402 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201519jaa; Wed, 23 Jan 2019 13:33:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN4dSqzYzIFKavz+EDGpYnAr/PrwxqxLamxdJfcNMCM3BbIqptyyBr6VXF/x3MSmAOqpstx+ X-Received: by 2002:aed:384a:: with SMTP id j68mr4112666qte.171.1548279215288; Wed, 23 Jan 2019 13:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279215; cv=none; d=google.com; s=arc-20160816; b=H+feObUtzk3060bQzgun/WEB9Nid6mQE+W5Da8mGBwaJ7U4pIU0dD5+xVE11K3uJKc aSEIUDfFSrMwf4b8XY7tjS+qKAaNDSPo7jB8Z1Kub2Ky4GUm+oJxSlKCKCAsyBPXGUK9 EJoXkXQTEbLYVE6xT7O72nMvwkv3lsO6yzWUl+3Zt4GgMSLAumnxriTUAoSa8hlgELq0 0oGVHa3fQQs+z17zY7dzkkf6NPssONGbNbn5aFizxQK5gysEIM3NdmXc3ipa/8EdVQH7 5tGmc91VTkbDnpzkd9LOYtDo/S++bVqhxEKaNbt5Smn2VPCkrTqPAK+bMhatzAgjXH5q pOAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=uk4ybrKQDXf0u3p1wNiHaZdTr9fu7IrQqgBlJKkVN3s=; b=cVsZuyPtequd9hfwxM64gwk9hBYo64j5l8MD4GAjTJH8ywAMDLcG83kYZ0lVtnPwF3 6B3Mge5GoMnUwZnpZ2xvt7G8LnxEl3RtmsBWDZckrCzVhzaJMhUiXS+Pfnwax8XY8jPH GsOmTqgoXkpbqjA8SSknQxXWnbXxphOsMKoMjFy8fCyr8+KiaKdOnJiWXOukl0Jp/fOv OlDCXxB5FPhietzYuOq/btmo9DcgJgqAtk38555kXfTSa1G7PCGO9h5uKxkYKzWYxpHf ptGmxg3tl/ezmpMCocY1f28kPMeHYvWAINZPD6fuSYYCPGRHOQEiyuAwbsdJZ2ue5Rzp DHlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id z3si4162749qtj.337.2019.01.23.13.33.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:35 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00DA2AD896; Wed, 23 Jan 2019 21:33:32 +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 A9FAB58824; Wed, 23 Jan 2019 21:33:31 +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 5CBBC3F606; Wed, 23 Jan 2019 21:33:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXRtY032340 for ; Wed, 23 Jan 2019 16:33:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F787BA96; Wed, 23 Jan 2019 21:33:27 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D48EBA50; Wed, 23 Jan 2019 21:33:25 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:39 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH v2 11/25] conf: Add 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 23 Jan 2019 21:33:33 +0000 (UTC) devices lack the model= attribute which is used by most other device types. bus= mostly acts as one, but it serves other purposes too like determing what target= prefix to use, and for matching against controller type= values. Extending bus= to handle additional virtio transitional devices will complicate apps lives, and it isn't a clean mapping anyways. So let's bite the bullet and add a new attribute, and wire up common handling for virtio and virtio-{non-}transitional Reviewed-by: Andrea Bolognani Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 10 +++++ docs/schemas/domaincommon.rng | 9 ++++ src/conf/domain_conf.c | 40 ++++++++++++++++++ src/conf/domain_conf.h | 11 +++++ src/libvirt_private.syms | 2 + .../virtio-non-transitional.x86_64-3.1.0.args | 34 +++++++++++++++ ...virtio-non-transitional.x86_64-latest.args | 34 +++++++++++++++ .../virtio-non-transitional.xml | 18 ++++++++ .../virtio-transitional.x86_64-3.1.0.args | 34 +++++++++++++++ .../virtio-transitional.x86_64-latest.args | 34 +++++++++++++++ .../qemuxml2argvdata/virtio-transitional.xml | 18 ++++++++ tests/qemuxml2argvtest.c | 6 +++ .../virtio-non-transitional.xml | 42 +++++++++++++++++++ .../virtio-transitional.xml | 42 +++++++++++++++++++ tests/qemuxml2xmltest.c | 11 +++++ 15 files changed, 345 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.xml create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args create mode 100644 tests/qemuxml2argvdata/virtio-transitional.xml create mode 100644 tests/qemuxml2xmloutdata/virtio-non-transitional.xml create mode 100644 tests/qemuxml2xmloutdata/virtio-transitional.xml -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7f07bb7f55..0f66b5a1fc 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2922,6 +2922,16 @@ Since 0.1.4

+
model
+
+ Indicates the emulated device model of the disk. Typically + this is indicated solely by the bus property but + for bus "virtio" the model can be specified further + with "virtio-transitional", "virtio-non-transitional", or + "virtio" which matches the old behavior. These settings are + only applicable when using controller bus type "pci". + Since 5.1.0 +
rawio
Indicates whether the disk needs rawio capability. Valid diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index aa50eac424..7af6e2532b 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1506,6 +1506,15 @@ + + + + virtio + virtio-transitional + virtio-non-transitional + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8af1a4ae73..eeb1191677 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -889,6 +889,13 @@ VIR_ENUM_IMPL(virDomainDiskDetectZeroes, VIR_DOMAIN_DISK_DETECT_ZEROES_LAST, "on", "unmap") +VIR_ENUM_IMPL(virDomainDiskModel, VIR_DOMAIN_DISK_MODEL_LAST, + "default", + "virtio", + "virtio-transitional", + "virtio-non-transitional", +); + VIR_ENUM_IMPL(virDomainDiskMirrorState, VIR_DOMAIN_DISK_MIRROR_STATE_LAST, "none", "yes", @@ -5525,6 +5532,17 @@ virDomainDiskDefValidate(const virDomainDiskDef *disk) return -1; } + if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO && + (disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO || + disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL || + disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk model '%s' not supported for bus '%s'"), + virDomainDiskModelTypeToString(disk->model), + virDomainDiskBusTypeToString(disk->bus)); + return -1; + } + return 0; } @@ -9612,6 +9630,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, } VIR_FREE(tmp); + if ((tmp = virXMLPropString(node, "model")) && + (def->model = virDomainDiskModelTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown disk model '%s'"), tmp); + goto error; + } + VIR_FREE(tmp); + snapshot = virXMLPropString(node, "snapshot"); rawio = virXMLPropString(node, "rawio"); @@ -21861,6 +21887,14 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src, return false; } + if (src->model != dst->model) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk model %s does not match source %s"), + virDomainDiskModelTypeToString(dst->model), + virDomainDiskModelTypeToString(src->model)); + return false; + } + if (src->virtio && dst->virtio && !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; @@ -24426,6 +24460,12 @@ virDomainDiskDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "model) { + virBufferAsprintf(buf, " model='%s'", + virDomainDiskModelTypeToString(def->model)); + } + if (def->rawio) { virBufferAsprintf(buf, " rawio='%s'", virTristateBoolTypeToString(def->rawio)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 536b02ad3d..644dde3dd3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -567,6 +567,15 @@ typedef enum { VIR_DOMAIN_DISK_DETECT_ZEROES_LAST } virDomainDiskDetectZeroes; +typedef enum { + VIR_DOMAIN_DISK_MODEL_DEFAULT = 0, + VIR_DOMAIN_DISK_MODEL_VIRTIO, + VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL, + + VIR_DOMAIN_DISK_MODEL_LAST +} virDomainDiskModel; + typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo; struct _virDomainBlockIoTuneInfo { unsigned long long total_bytes_sec; @@ -674,6 +683,7 @@ struct _virDomainDiskDef { int detect_zeroes; /* enum virDomainDiskDetectZeroes */ char *domain_name; /* backend domain name */ unsigned int queues; + int model; /* enum virDomainDiskModel */ virDomainVirtioOptionsPtr virtio; }; @@ -3417,6 +3427,7 @@ VIR_ENUM_DECL(virDomainDeviceSGIO) VIR_ENUM_DECL(virDomainDiskTray) VIR_ENUM_DECL(virDomainDiskDiscard) VIR_ENUM_DECL(virDomainDiskDetectZeroes) +VIR_ENUM_DECL(virDomainDiskModel) VIR_ENUM_DECL(virDomainDiskMirrorState) VIR_ENUM_DECL(virDomainController) VIR_ENUM_DECL(virDomainControllerModelPCI) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 89b8ca3b4f..8d27d507cc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -344,6 +344,8 @@ virDomainDiskIoTypeFromString; virDomainDiskIoTypeToString; virDomainDiskMirrorStateTypeFromString; virDomainDiskMirrorStateTypeToString; +virDomainDiskModelTypeFromString; +virDomainDiskModelTypeToString; virDomainDiskPathByName; virDomainDiskRemove; virDomainDiskRemoveByName; diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args new file mode 100644 index 0000000000..9e11e900da --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-q35-3.1,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ +addr=0x1 \ +-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ +id=virtio-disk0,bootindex=1 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args new file mode 100644 index 0000000000..070b4b8334 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine q35,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ +addr=0x1 \ +-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ +id=virtio-disk0,bootindex=1 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml new file mode 100644 index 0000000000..7899994622 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -0,0 +1,18 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + + hvm + + + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args new file mode 100644 index 0000000000..9e11e900da --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-q35-3.1,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ +addr=0x1 \ +-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ +id=virtio-disk0,bootindex=1 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args new file mode 100644 index 0000000000..070b4b8334 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine q35,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ +addr=0x1 \ +-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ +-device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ +id=virtio-disk0,bootindex=1 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml new file mode 100644 index 0000000000..678a7b9132 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -0,0 +1,18 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + + hvm + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ba6fd4db35..4f7adf18f5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3073,6 +3073,12 @@ mymain(void) DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); + /* Older version checks disable-legacy usage */ + DO_TEST_CAPS_VER("virtio-transitional", "3.1.0"); + DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0"); + DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional"); + /* Simple headless guests for various architectures */ DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64"); DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64"); diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml new file mode 100644 index 0000000000..7e4aa16b32 --- /dev/null +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -0,0 +1,42 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + +
+ + + + + +
+ + + + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml new file mode 100644 index 0000000000..1d28af9abb --- /dev/null +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -0,0 +1,42 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + +
+ + + + + +
+ + + + +
+ + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index b2c0c8505d..a84f9241d6 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1268,6 +1268,17 @@ mymain(void) DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); + DO_TEST("virtio-transitional", + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY); + DO_TEST("virtio-non-transitional", + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY); + if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir); From patchwork Wed Jan 23 21:32:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156409 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201894jaa; Wed, 23 Jan 2019 13:33:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN5r+5WdA8GsWn5I48hXK1myJc4mKGe4/fW/ixuVp8y0qfJaT5z9RVwB7uSOJQxn+07bD/JA X-Received: by 2002:ac8:1add:: with SMTP id h29mr4115586qtk.258.1548279238600; Wed, 23 Jan 2019 13:33:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279238; cv=none; d=google.com; s=arc-20160816; b=fuayaAXlCaKs0NNDIgbJd2qLqICfosqJD9mwTxJxQAezmkGqaTYme31decVrjFSR4v p+/POIdKQnVhK3pl3QZjR1iuHud7WgPPQRZXBF4aDWZ/E597QrO264ExVspZPO0Vy7uX iqZhdkiAJHZlRgUZQyNk9gJ+TLg24IaC3yhLU0l8YilxbqcpMRGtiLJpn+m205MYZsWK WCxO6G89i+V8xotIYfsVVHA29+CbYSrVNechXC6QGm5YKZmTjyviLvkbTRRtakdo1uNd K5KvmRumE89t+35zYpPjAWLMnO2G2MseFCGJOT63S8LkZ49yaBKXdKXetBF32+SGd7sA v+fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=H9acR3fNuhd9LyxyGDykS/hH7Juf+tUKRgJE0qrLLhg=; b=J6vruy4g0o0KB2PNTj3NzhwWc9v0OZtjXOs70b4tgL2z07OPCExkXT6QAnwn1frFnx wsMPE8X/He65yokcllX7Yw+Y5wPrqHteaFYa/IpK6oL9F9CtaTlUH7/s9CPVX8ZicpBw MyuNh9fchXtxoECqGPIVtk/FYtomz0c52BShkiusaWSu/Q+9fa1eltmvb+1GCBvptpFv 9CayafIbMLA1ybQF1skfc66udv/54PxoVTvHJ+hf7j4dm8Hjl1GnPvn3gUoxsRPkm8dw S0fXFgDs15Q+4CMy8BDAG/4mE+4mNZD4v8qhmJKfr9qgHQLJFXi3NlfcEpcPD8gxkHp5 JLrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id s127si1429935qkf.24.2019.01.23.13.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:58 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 0784B1451FD; Wed, 23 Jan 2019 21:33:57 +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 BBF711059592; Wed, 23 Jan 2019 21:33:56 +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 6F8FC18033CA; Wed, 23 Jan 2019 21:33:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXSXa032349 for ; Wed, 23 Jan 2019 16:33:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8979CBA96; Wed, 23 Jan 2019 21:33:28 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0A0EBA50; Wed, 23 Jan 2019 21:33:27 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:40 -0500 Message-Id: <8a63a2f5e7d1a30d0cc8389790dfb1a799762aa2.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 12/25] qemu: Support disk model=virtio-{non-}transitional 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 Jan 2019 21:33:57 +0000 (UTC) Add new model values for virtio transitional devices. When combined with bus='virtio': * "virtio-transitional" maps to qemu "virtio-blk-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-blk-pci-non-transitional" Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 71 +++++++++++++++++++ src/qemu/qemu_domain_address.c | 3 + .../virtio-non-transitional.x86_64-3.1.0.args | 4 +- ...virtio-non-transitional.x86_64-latest.args | 4 +- .../virtio-transitional.x86_64-3.1.0.args | 5 +- .../virtio-transitional.x86_64-latest.args | 7 +- .../virtio-transitional.xml | 10 ++- 7 files changed, 92 insertions(+), 12 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 659274f25a..3cf0f5b13e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -421,6 +421,8 @@ qemuBuildVirtioDevStr(virBufferPtr buf, const char *implName = NULL; virDomainDeviceDef device = { .type = devtype }; virDomainDeviceInfoPtr info; + int tmodel_cap, ntmodel_cap; + bool has_tmodel, has_ntmodel; virDomainDeviceSetData(&device, devdata); info = virDomainDeviceGetInfo(&device); @@ -462,9 +464,78 @@ qemuBuildVirtioDevStr(virBufferPtr buf, virBufferAsprintf(buf, "%s-%s", baseName, implName); + switch (devtype) { + case VIR_DOMAIN_DEVICE_DISK: + has_tmodel = device.data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL; + break; + + case VIR_DOMAIN_DEVICE_LEASE: + case VIR_DOMAIN_DEVICE_FS: + case VIR_DOMAIN_DEVICE_NET: + case VIR_DOMAIN_DEVICE_INPUT: + case VIR_DOMAIN_DEVICE_SOUND: + case VIR_DOMAIN_DEVICE_VIDEO: + case VIR_DOMAIN_DEVICE_HOSTDEV: + case VIR_DOMAIN_DEVICE_WATCHDOG: + case VIR_DOMAIN_DEVICE_CONTROLLER: + case VIR_DOMAIN_DEVICE_GRAPHICS: + case VIR_DOMAIN_DEVICE_HUB: + case VIR_DOMAIN_DEVICE_REDIRDEV: + case VIR_DOMAIN_DEVICE_NONE: + case VIR_DOMAIN_DEVICE_SMARTCARD: + case VIR_DOMAIN_DEVICE_CHR: + case VIR_DOMAIN_DEVICE_MEMBALLOON: + case VIR_DOMAIN_DEVICE_NVRAM: + case VIR_DOMAIN_DEVICE_SHMEM: + case VIR_DOMAIN_DEVICE_TPM: + case VIR_DOMAIN_DEVICE_PANIC: + case VIR_DOMAIN_DEVICE_RNG: + case VIR_DOMAIN_DEVICE_MEMORY: + case VIR_DOMAIN_DEVICE_IOMMU: + case VIR_DOMAIN_DEVICE_VSOCK: + case VIR_DOMAIN_DEVICE_LAST: + default: + return 0; + } + + if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + (has_tmodel || has_ntmodel)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virtio (non-)transitional models are not " + "supported for address type=%s"), + virDomainDeviceAddressTypeToString(info->type)); + return -1; + } + + if (has_tmodel) { + if (virQEMUCapsGet(qemuCaps, tmodel_cap)) + virBufferAddLit(buf, "-transitional"); + + /* No error for if -transitional is not supported: our address + * allocation will force the device into plain PCI bus, which + * is functionally identical to standard 'virtio-XXX' behavior + */ + } else if (has_ntmodel) { + if (virQEMUCapsGet(qemuCaps, ntmodel_cap)) { + virBufferAddLit(buf, "-non-transitional"); + } else if (virQEMUCapsGet(qemuCaps, + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) { + virBufferAddLit(buf, ",disable-legacy=on,disable-modern=off"); + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio non-transitional model not supported " + "for this qemu")); + return -1; + } + } + return 0; } + static int qemuBuildVirtioOptionsStr(virBufferPtr buf, virDomainVirtioOptionsPtr virtio, diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index f2ae0804a8..808e551b9c 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -720,6 +720,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_DEVICE_DISK: switch ((virDomainDiskBus) dev->data.disk->bus) { case VIR_DOMAIN_DISK_BUS_VIRTIO: + /* Transitional devices only work in conventional PCI slots */ + if (dev->data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL) + return pciFlags; return virtioFlags; /* only virtio disks use PCI */ case VIR_DOMAIN_DISK_BUS_IDE: diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 9e11e900da..70446f16f2 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -27,8 +27,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ -id=virtio-disk0,bootindex=1 \ +-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.1,\ +addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 070b4b8334..37078765bc 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -27,8 +27,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ -id=virtio-disk0,bootindex=1 \ +-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.1,addr=0x0,\ +drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 9e11e900da..356e8fdf4c 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -25,9 +25,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ --device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ +-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x1,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 070b4b8334..e78223eac8 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -25,10 +25,11 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ --device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ +-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.1,addr=0x0,drive=drive-virtio-disk0,\ -id=virtio-disk0,bootindex=1 \ +-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x1,\ +drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index 1d28af9abb..c19e133bb3 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -30,9 +30,13 @@
- + + +
+ + - +
From patchwork Wed Jan 23 21:32:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156410 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201976jaa; Wed, 23 Jan 2019 13:34:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN7NGop79D4T5XJ4jHdA1/yQlAgJ8xD1UM0kcwo8zJeCfPbeWNGTG1cimUsfvbt6P+49yhng X-Received: by 2002:a37:4350:: with SMTP id q77mr3319648qka.308.1548279244125; Wed, 23 Jan 2019 13:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279244; cv=none; d=google.com; s=arc-20160816; b=Vc1Ixeq6pWgz999R/L3ZX99cy7DBwt/vUN2FJ4aye5ug3Fywm/uIYzSyYHQINi7SJ6 pWm2D/oP9oZr1bNmU1/ZWW+uLJAL88WGslhPSiMH+dhKC21/Uegx2TBC6kerKlGLTkZJ btqbo6/EgH4dcFaJC3XOFoBIQF5q+i6YPhTlbTHhmhr+Ky8O5oEaZOrFuUrl6j0qDoER OEsrzz7+Wq3sF5Ui10hxNdwY1Ad3bS9ABrKFyOZ3vbvp3ZUoQhxV04HIWL59u+C0ux4Y bQ83krljk4xtPoHdwiwk5pyrzylX7cXrWSWHqIyfnKVSUDsWXsJcWLR7SraACHBR7gjO LHFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=4rLE4wInd1SkcH6rwnYQQR852Ch9Ffy/hBluDkjOO3U=; b=AYilbUSz+k7ntnPL8w+k8D5i8o16M77iMlc86nv0r3dqSeTqmGs3RBPnMc/scfr5bZ NQ4lJFr6NGj4H6AqUT+kSgBZkMTaWcsqR7WVGqd1TwF/dcYmZQMjzt9f2TeW4CC4EECG VdXLXmgwGWBDglnmBbPe9cCLnigiEU5lLZsOp0BYyUTDeQMCP+hVu2CPBi1HxFHmmCBe BUAxtgBnxE8BLujtbuXEOax6nTPoDzZdWCofbbOR8FYJMjzdUsb+3MdJIetB10rubSVQ qem+fyQNe6inwUsJIIlqrNAsl+mMBN5cjIBC53dgHHc8Wz0n8v9LZuEDl6s1B2aQhj5p mynQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id y4si343173qkj.29.2019.01.23.13.34.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:04 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3E1B43A2B; Wed, 23 Jan 2019 21:34:02 +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 6CC876BF6F; Wed, 23 Jan 2019 21:34:02 +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 0BA283F604; Wed, 23 Jan 2019 21:34:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXcIW032385 for ; Wed, 23 Jan 2019 16:33:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2DB61BA78; Wed, 23 Jan 2019 21:33:38 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id B774367141; Wed, 23 Jan 2019 21:33:28 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:41 -0500 Message-Id: <272f56b10751db3c58d90813ec59ab34f6a661fa.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 13/25] qemu: Support interface model=virtio-{non-}transitional 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 23 Jan 2019 21:34:03 +0000 (UTC) Add new model handling for virtio transitional devices. Ex: * "virtio-transitional" maps to qemu "virtio-net-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-net-pci-non-transitional" Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 4 +++- src/qemu/qemu_command.c | 8 +++++++- src/qemu/qemu_domain_address.c | 9 +++++++-- .../virtio-non-transitional.x86_64-3.1.0.args | 6 +++++- .../virtio-non-transitional.x86_64-latest.args | 6 +++++- tests/qemuxml2argvdata/virtio-non-transitional.xml | 4 ++++ .../virtio-transitional.x86_64-3.1.0.args | 5 ++++- .../virtio-transitional.x86_64-latest.args | 5 ++++- tests/qemuxml2argvdata/virtio-transitional.xml | 4 ++++ tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 12 +++++++++++- tests/qemuxml2xmloutdata/virtio-transitional.xml | 7 ++++++- 11 files changed, 60 insertions(+), 10 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index eeb1191677..0a59a4e91f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29852,7 +29852,9 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface) bool virDomainNetIsVirtioModel(const virDomainNetDef *net) { - return STREQ_NULLABLE(net->model, "virtio"); + return (STREQ_NULLABLE(net->model, "virtio") || + STREQ_NULLABLE(net->model, "virtio-transitional") || + STREQ_NULLABLE(net->model, "virtio-non-transitional")); } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3cf0f5b13e..6ddfe2703c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -472,9 +472,15 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_NET: + has_tmodel = STREQ_NULLABLE(device.data.net->model, "virtio-transitional"); + has_ntmodel = STREQ_NULLABLE(device.data.net->model, "virtio-non-transitional"); + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL; + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: - case VIR_DOMAIN_DEVICE_NET: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 808e551b9c..9f1a2dc9b8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -692,8 +692,13 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, return 0; } - if (STREQ_NULLABLE(net->model, "virtio")) - return virtioFlags; + if (STREQ_NULLABLE(net->model, "virtio") || + STREQ_NULLABLE(net->model, "virtio-non-transitional")) + return virtioFlags; + + /* Transitional devices only work in conventional PCI slots */ + if (STREQ_NULLABLE(net->model, "virtio-transitional")) + return pciFlags; if (STREQ_NULLABLE(net->model, "e1000e")) return pcieFlags; diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 70446f16f2..827b4070d4 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -26,9 +26,13 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.1,\ +-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ +id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 37078765bc..9a0eb9a1f3 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -26,9 +26,13 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-non-transitional,scsi=off,bus=pci.1,addr=0x0,\ +-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ +mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index 7899994622..a1b35d1c07 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -12,6 +12,10 @@ + + + + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 356e8fdf4c..9b80cd893a 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -28,8 +28,11 @@ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x1,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ +addr=0x1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index e78223eac8..46e139d492 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -28,8 +28,11 @@ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x1,\ +-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ +mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index 678a7b9132..18f665577a 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -12,6 +12,10 @@ + + + + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 7e4aa16b32..f0dc7c0833 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -35,6 +35,16 @@
+ + + +
+ + + + +
+ diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index c19e133bb3..f9729391a5 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -39,6 +39,11 @@
+ + + +
+ From patchwork Wed Jan 23 21:32:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156412 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202073jaa; Wed, 23 Jan 2019 13:34:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN5e3V3vF8M0LQF3EWvt161NAXTZhgkW13zE6ezk7PrS4tgMIDjmPOTeqqrNbkS7z07UqUd/ X-Received: by 2002:aed:3861:: with SMTP id j88mr4248203qte.31.1548279250951; Wed, 23 Jan 2019 13:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279250; cv=none; d=google.com; s=arc-20160816; b=vSLOaDN1Le0sLXIlHOlxVUxrCkU4+2MIeEh2N+VtAx0dRVar2/Fq2PRLfauF/2lg4I IV3H0yG2zqyTHZDRrKMSdCT1nJzNcIYqFpEGLXshw2HuOJB4lDx5Lx5AxfyyWNhtuU7z qlcceONzpS9d+ju5OL+FT9MMq2S/fjqUpeSPmPFDSHvL4e/k9I5F6/T/+xZmjC6g0aE1 RXqHWgO0zWz7EcEXJPZQalyXQ7dFVzpfeWUFNzSoz1T7c5foDzo6U15jusrRLQ2hWFyh Y+hOe6P++kF91rNqWeYqz7zc/BKrebtbp5eBNPDVF+Kk2ldpcEgHGTPHZIKvcG/ZoX+m hxwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=iCuY8a/R7CORpLconQtiQk9/toCW7O8YhxTmzdaUovw=; b=Gwgl+VKuqO/P3wHBAPr8FfOJTA0IX8/8ZPr+cCeUeTYsBZzlrM9lZbIf9kFLrE87mT VR1HPM3URm00NHukw9+Gh041eGJH24bDV2Uh5lxDyTvJw+cXT8XiMxM9mP3G3BmSRm9a WkiORRNqxx+teFu0L54JUAbSm0PD5T61TsufzVEr5nE1EdBp0sgGF0x9LXz+hmgss+Gu j+9XtAkmHdSHK7R0Nc/sD87gWx8gZxu1E2RD2Yw+Tbpf5FU66ZnDkiWc6Uj5g65o4umj 6/cXnJUIGxKkr3+Joh3K3fiV0vtYoKQYEe0P0lqU+C7qUTB4wcL5XoX2z5XYIt5zDbBH L5fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t24si2602521qtr.128.2019.01.23.13.34.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:10 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 208D37BDC4; Wed, 23 Jan 2019 21:34:08 +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 AEC8260C6E; Wed, 23 Jan 2019 21:34:07 +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 1CAF43F60F; Wed, 23 Jan 2019 21:34:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXkTu032423 for ; Wed, 23 Jan 2019 16:33:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8514067141; Wed, 23 Jan 2019 21:33:46 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1527BA8B; Wed, 23 Jan 2019 21:33:38 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:42 -0500 Message-Id: <4cce1b7008b8dd44ae7eb05eecb48cebaa0f41ee.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH v2 14/25] conf: Add 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 23 Jan 2019 21:34:09 +0000 (UTC) qemu vhost-scsi devices map to XML roughly like: To support vhost-scsi-pci-{non-}traditional in qemu, we need to to extend the SCSI Host hostdev XML to handle model= value. This matches the XML model= format used for mediated devices. This is just the domain_conf bits and some XML test cases. Use of virtio-X naming here does not match the hostdev protocol=vhost nor does it match the qemu vhost-X device naming, however it's more consistent with all other model= names in this area, and also matches the inconsistency of devices which use model=virtio but map to vhost-vsock on the qemu commandline Reviewed-by: Andrea Bolognani Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 5 ++- docs/schemas/domaincommon.rng | 9 +++++ src/conf/domain_conf.c | 38 ++++++++++++++++--- src/conf/domain_conf.h | 12 ++++++ src/libvirt_private.syms | 2 + .../virtio-non-transitional.x86_64-3.1.0.args | 3 ++ ...virtio-non-transitional.x86_64-latest.args | 3 ++ .../virtio-non-transitional.xml | 3 ++ .../virtio-transitional.x86_64-3.1.0.args | 3 ++ .../virtio-transitional.x86_64-latest.args | 3 ++ .../qemuxml2argvdata/virtio-transitional.xml | 3 ++ .../virtio-non-transitional.xml | 9 +++++ .../virtio-transitional.xml | 9 +++++ 13 files changed, 96 insertions(+), 6 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0f66b5a1fc..c4a4639300 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4680,7 +4680,10 @@
since 2.5.0For SCSI devices, user is responsible to make sure the device is not used by host. This type passes all LUNs presented by a single HBA to - the guest. + the guest. Since 5.1.0, the + model attribute can be specified further + with "virtio-transitional", "virtio-non-transitional", or + "virtio" which matches the old behavior.
mdev
For mediated devices (Since 3.2.0) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7af6e2532b..2b20a60edd 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4627,6 +4627,15 @@ scsi_host + + + + virtio + virtio-transitional + virtio-non-transitional + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0a59a4e91f..8db54daeeb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -714,6 +714,14 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIHostProtocol, "none", "vhost") +VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIVHostModel, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST, + "default", + "virtio", + "virtio-transitional", + "virtio-non-transitional", +); + VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST, "storage", "misc", @@ -7692,6 +7700,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, int ret = -1; virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = &def->source.subsys.u.scsi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev; /* @managed can be read from the xml document - it is always an @@ -7774,14 +7783,26 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, } } - if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) { + if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && + def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) { if (model) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'model' attribute in is only supported " - "when type='mdev'")); + virReportError(VIR_ERR_XML_ERROR, + _("'model' attribute in is not supported " + "for type='%s'"), + virDomainHostdevSubsysTypeToString(def->source.subsys.type)); goto cleanup; } - } else { + } + + if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) { + if (model && + ((scsihostsrc->model = virDomainHostdevSubsysSCSIVHostModelTypeFromString(model)) < 0)) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown hostdev model '%s'"), + model); + goto cleanup; + } + } else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) { if (!model) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'model' attribute in mediated device's " @@ -27210,6 +27231,7 @@ virDomainHostdevDefFormat(virBufferPtr buf, const char *mode = virDomainHostdevModeTypeToString(def->mode); virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi; virDomainHostdevSubsysMediatedDevPtr mdevsrc = &def->source.subsys.u.mdev; + virDomainHostdevSubsysSCSIVHostPtr scsihostsrc = &def->source.subsys.u.scsi_host; const char *type; if (!mode) { @@ -27260,6 +27282,12 @@ virDomainHostdevDefFormat(virBufferPtr buf, virTristateBoolTypeToString(scsisrc->rawio)); } + if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST && + scsihostsrc->model) { + virBufferAsprintf(buf, " model='%s'", + virDomainHostdevSubsysSCSIVHostModelTypeToString(scsihostsrc->model)); + } + if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) { virBufferAsprintf(buf, " model='%s'", virMediatedDeviceModelTypeToString(mdevsrc->model)); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 644dde3dd3..4812339163 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -394,11 +394,23 @@ typedef enum { VIR_ENUM_DECL(virDomainHostdevSubsysSCSIHostProtocol) +typedef enum { + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_DEFAULT, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL, + + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST, +} virDomainHostdevSubsysSCSIVHostModelType; + +VIR_ENUM_DECL(virDomainHostdevSubsysSCSIVHostModel) + typedef struct _virDomainHostdevSubsysSCSIVHost virDomainHostdevSubsysSCSIVHost; typedef virDomainHostdevSubsysSCSIVHost *virDomainHostdevSubsysSCSIVHostPtr; struct _virDomainHostdevSubsysSCSIVHost { int protocol; /* enum virDomainHostdevSubsysSCSIHostProtocolType */ char *wwpn; + int model; /* enum virDomainHostdevSubsysSCSIVHostModelType */ }; typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8d27d507cc..25038b4e92 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -408,6 +408,8 @@ virDomainHostdevInsert; virDomainHostdevModeTypeToString; virDomainHostdevRemove; virDomainHostdevSubsysPCIBackendTypeToString; +virDomainHostdevSubsysSCSIVHostModelTypeFromString; +virDomainHostdevSubsysSCSIVHostModelTypeToString; virDomainHostdevSubsysTypeToString; virDomainHPTResizingTypeToString; virDomainHubTypeFromString; diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 827b4070d4..9c38d713b2 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ +-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ +-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ +bus=pci.3,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 9a0eb9a1f3..82255909c4 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ +-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ +-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ +bus=pci.3,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index a1b35d1c07..32d2bdc638 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -16,6 +16,9 @@ + + + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 9b80cd893a..4e991d6187 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x1 \ +-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ +bus=pci.3,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 46e139d492..dab25ba2e8 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,12 +27,15 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \ +-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ +bus=pci.3,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index 18f665577a..eddc1ce9f5 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -16,6 +16,9 @@ + + + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index f0dc7c0833..2af5195dfd 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -40,6 +40,11 @@
+ + + +
+ @@ -47,6 +52,10 @@ + + +
+ diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index f9729391a5..ce7b109845 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -39,6 +39,11 @@
+ + + +
+ @@ -46,6 +51,10 @@ + + +
+ From patchwork Wed Jan 23 21:32:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156408 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201854jaa; Wed, 23 Jan 2019 13:33:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN5985p+AQx8QX0veUOUa/xpWqOr06VNkv+7FfDSusVfqGJS57BEPzkk9MH51NKVfcbP5q8j X-Received: by 2002:a37:8846:: with SMTP id k67mr3358071qkd.214.1548279235792; Wed, 23 Jan 2019 13:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279235; cv=none; d=google.com; s=arc-20160816; b=nWl5Tlv7xgEPe5z8ZymivhkA2w6stVu+qQWWwosxR9etagttN2riX1KSPkZMNy+5cT WpkkMH2zSvPyUKKnupEoFfFGXJKrm4cbf9yT03aAElyw1LywTe2dhhESlC3jyOgc0R26 qmbWds2GsgjhjCTP3tv94TyCzrqBPkK4WVwJyCmKrNhhvI0v50Bk3VZUu7ej7rzAQ6Z5 95ybuTtfGJ0BPtnBlNQLBK5Wq7KL4FU3xDb6Tv1fXn89l07H+UJqJAzWdyWKAh/1T4MC Kfd9oW82h6cJxttLcEG1LHFJn7LWl6kS/1ZctTIaR9wRB3rZk8T8Vy1IZFZKJer5lPaQ Xm3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=k07SWx/wXmaNI0fGpWhBmzgKgd3jGAWiyy5/dam9ltE=; b=klLuqZQYwMMEDZ5ycFMcrHTyH1QqYr5qa2kz0U6RI1zTY+e7b/hWmMcxsUH1dBE7ul giR6CpOcgUW8Pc/ZJ30ZDozlxNni7mdDEKE8V4vrWTxmcRNaknnHcCsdPcZGa3FcLCKu EQCQNYBoh5ZNOMxu21OX+NfKw0V79zZQ4FT9xrRSBCqPF/lrF2QdTH4hHXCnQuD5f3/1 zMV4oPD3ymVsUrQVuesS8cV0ZESKzE2rvvQiP8ctBqvMHsKW5+TSH3+JypFkLlLU3kzP fOlaNdXFsb9uep1izeogNH4B24ru1ScrTKB37d0Ez0Z1HSevOrLjrYA02hQ5UqnK7pXt 9vvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id j76si4419857qke.150.2019.01.23.13.33.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:55 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BEE8432D4; Wed, 23 Jan 2019 21:33:54 +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 18C706BF7B; Wed, 23 Jan 2019 21:33:54 +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 BFEDB18033AA; Wed, 23 Jan 2019 21:33:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXrGD032482 for ; Wed, 23 Jan 2019 16:33:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 24D91BA8B; Wed, 23 Jan 2019 21:33:53 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id D07CCBA50; Wed, 23 Jan 2019 21:33:46 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:43 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 15/25] qemu: Support hostdev model=virtio-{non-}transitional 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 23 Jan 2019 21:33:54 +0000 (UTC) Add protocol=vhost model handling for virtio transitional devices. Ex: * "virtio-transitional" maps to qemu "vhost-scsi-pci-transitional" * "virtio-non-transitional" maps to qemu "vhost-scsi-pci-non-transitional" Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 10 +++++++++- src/qemu/qemu_domain_address.c | 9 ++++++--- .../virtio-non-transitional.x86_64-3.1.0.args | 4 ++-- .../virtio-non-transitional.x86_64-latest.args | 4 ++-- .../virtio-transitional.x86_64-3.1.0.args | 3 +-- .../virtio-transitional.x86_64-latest.args | 5 ++--- tests/qemuxml2xmloutdata/virtio-transitional.xml | 7 +------ 7 files changed, 23 insertions(+), 19 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6ddfe2703c..eced41a98f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -479,12 +479,20 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_HOSTDEV: + if (device.data.hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) + return 0; + has_tmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL; + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: - case VIR_DOMAIN_DEVICE_HOSTDEV: case VIR_DOMAIN_DEVICE_WATCHDOG: case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_GRAPHICS: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 9f1a2dc9b8..993f33299f 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -785,11 +785,14 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, return pcieFlags; /* according to pbonzini, from the guest PoV vhost-scsi devices - * are the same as virtio-scsi, so they should use virtioFlags - * (same as virtio-scsi) to determine Express vs. legacy placement + * are the same as virtio-scsi, so they should follow virtio logic */ - if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) + if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) { + /* Transitional devices only work in conventional PCI slots */ + if (hostdev->source.subsys.u.scsi_host.model == VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL) + return pciFlags; return virtioFlags; + } if (!(pciDev = virPCIDeviceNew(hostAddr->domain, hostAddr->bus, diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 9c38d713b2..500c03bdc3 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -34,8 +34,8 @@ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ --device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.3,addr=0x0 \ +-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ +wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 82255909c4..c8dbffda65 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -34,8 +34,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ --device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.3,addr=0x0 \ +-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ +id=hostdev0,bus=pci.3,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 4e991d6187..38a9e348b3 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ @@ -35,7 +34,7 @@ id=virtio-disk0,bootindex=1 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x1 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.3,addr=0x0 \ +bus=pci.2,addr=0x3 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index dab25ba2e8..ab2c35514d 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,15 +27,14 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \ --device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.3,addr=0x0 \ +-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ +id=hostdev0,bus=pci.2,addr=0x3 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index ce7b109845..8c1baced0e 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -39,11 +39,6 @@
- - - -
- @@ -53,7 +48,7 @@ -
+
From patchwork Wed Jan 23 21:32:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156414 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202151jaa; Wed, 23 Jan 2019 13:34:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN5sL2QCcTwpsDyc0h8hOVMH3587kID7tEGvahrdnH3PayMt2uis2xwYrG89o7wzguQa2ui7 X-Received: by 2002:a0c:a3e2:: with SMTP id v89mr3539637qvv.226.1548279255136; Wed, 23 Jan 2019 13:34:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279255; cv=none; d=google.com; s=arc-20160816; b=JLf+vP6g2Gpce3Pkk3fSPi6IJmjP1OrULBZ5IBi26UPqj19IexN59sgixoQC6hOdKH GOhXqpRyLufntX63C4fbm3q98xqP0UXO1UcUNRpAI7ZupxiS5//p3gWZAaeucICW+ucB VNLlT5v8QodlvG0Kkl+ReFoEkEE1k9gQPRkZlqUmG1BXMP4VTofNebFAJQC2PPfH6tiK qQU+ntG+8KKC/PBNeFeUZl8OFsnnQzpYpa4bHXkvQtvW90JPOcC8Q20OFlJnEui3VDUZ chrqXI+RhUXZkjWl6vkyTIV1PXV76ZkLLKmxvu9kGTUqS1NMdnrO8yVGOLd6G0+oUH4r ncEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=fR7W38rq5uenq7GOGJ2Nz4RL8ats5rGDZU1f9ZcvjJs=; b=pLEWFOPGlBi2uclvdLN14X5e+bpFKsb5Y6IrXLFUDFEcPsk+BEOqgNQEA9NmWnZGFD oVxOa/f8Ye+bBf8G2lOOXitHZT3L+PAl/mctpmJuXZdK3D+WVgJb2CB8tOE/Rp0zUZTz yGqnAY38jtvveWqYmGOKfupqcZfLXstHKGVBGyBE0wB1nb24LNSUIRFyR8Mw1ePaZMoS /yNrsdrqkoTZ7df+mwFqQq4D94e1fvA/sXyP2YRe0IWP/Ef8nCL0nDdhNiTyzIbvk9so eSf4L5E7SfDGepjvH87E/C2n/BR3vmIv969moxv3vkQcnoT06YB0dcOi9TFveDkvFs5N I19g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id y36si3159358qtd.218.2019.01.23.13.34.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:15 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C7E41441B9; Wed, 23 Jan 2019 21:34:13 +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 953C96C212; Wed, 23 Jan 2019 21:34:12 +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 311EB18033CA; Wed, 23 Jan 2019 21:34:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLY4Ug032571 for ; Wed, 23 Jan 2019 16:34:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id A48B46715E; Wed, 23 Jan 2019 21:34:04 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2ECE4BA50; Wed, 23 Jan 2019 21:33:53 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:44 -0500 Message-Id: <6ec24ad917b9b9d8da1a64d4e4fbfd6d77bdb712.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 16/25] qemu: Support rng model=virtio-{non-}transitional 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 Jan 2019 21:34:14 +0000 (UTC) Add new model values for virtio transitional devices. Ex: ... * "virtio-transitional" maps to qemu "virtio-rng-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-rng-pci-non-transitional" Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 2 ++ docs/schemas/domaincommon.rng | 6 +++++- src/conf/domain_conf.c | 5 ++++- src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 8 +++++++- src/qemu/qemu_domain.c | 8 ++++++++ src/qemu/qemu_domain_address.c | 4 ++++ .../virtio-non-transitional.x86_64-3.1.0.args | 4 ++++ .../virtio-non-transitional.x86_64-latest.args | 3 +++ tests/qemuxml2argvdata/virtio-non-transitional.xml | 3 +++ .../virtio-transitional.x86_64-3.1.0.args | 2 ++ .../virtio-transitional.x86_64-latest.args | 2 ++ tests/qemuxml2argvdata/virtio-transitional.xml | 3 +++ tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 9 +++++++++ tests/qemuxml2xmloutdata/virtio-transitional.xml | 4 ++++ 15 files changed, 62 insertions(+), 3 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c4a4639300..bf64bf9feb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7971,6 +7971,8 @@ qemu-kvm -net nic,model=? /dev/null

  • 'virtio' - supported by qemu and virtio-rng kernel module
  • +
  • 'virtio-transitional' Since 5.1.0
  • +
  • 'virtio-non-transitional' Since 5.1.0
rate
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 2b20a60edd..58ae874dfd 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5452,7 +5452,11 @@ - virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8db54daeeb..fa772da52f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -859,7 +859,10 @@ VIR_ENUM_IMPL(virDomainDiskTray, VIR_DOMAIN_DISK_TRAY_LAST, VIR_ENUM_IMPL(virDomainRNGModel, VIR_DOMAIN_RNG_MODEL_LAST, - "virtio"); + "virtio", + "virtio-transitional", + "virtio-non-transitional", +); VIR_ENUM_IMPL(virDomainRNGBackend, VIR_DOMAIN_RNG_BACKEND_LAST, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4812339163..d73fcd1221 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2127,6 +2127,8 @@ struct _virBlkioDevice { typedef enum { VIR_DOMAIN_RNG_MODEL_VIRTIO, + VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL, VIR_DOMAIN_RNG_MODEL_LAST } virDomainRNGModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index eced41a98f..bf59ed72e1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -488,6 +488,13 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_RNG: + has_tmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL; + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_INPUT: @@ -506,7 +513,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf, case VIR_DOMAIN_DEVICE_SHMEM: case VIR_DOMAIN_DEVICE_TPM: case VIR_DOMAIN_DEVICE_PANIC: - case VIR_DOMAIN_DEVICE_RNG: case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_VSOCK: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 27cdb30ca2..52c73df9ea 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4550,6 +4550,14 @@ qemuDomainRNGDefValidate(const virDomainRNGDef *def, model_supported = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG); break; + case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL: + model_supported = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)); + break; + case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL: + model_supported = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)); + break; case VIR_DOMAIN_RNG_MODEL_LAST: break; } diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 993f33299f..8880c946f6 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -862,7 +862,11 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_DEVICE_RNG: switch ((virDomainRNGModel) dev->data.rng->model) { case VIR_DOMAIN_RNG_MODEL_VIRTIO: + case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL: return virtioFlags; + case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL: + /* Transitional devices only work in conventional PCI slots */ + return pciFlags; case VIR_DOMAIN_RNG_MODEL_LAST: return 0; diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 500c03bdc3..10cc6236cb 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -28,6 +28,7 @@ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ -device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ +-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -36,6 +37,9 @@ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x0 \ +-object rng-random,id=objrng0,filename=/dev/urandom \ +-device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\ +id=rng0,bus=pci.4,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index c8dbffda65..a0fc475c2f 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -28,6 +28,7 @@ addr=0x1 \ -device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ -device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ -device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ +-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -36,6 +37,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.3,addr=0x0 \ +-object rng-random,id=objrng0,filename=/dev/urandom \ +-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.4,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index 32d2bdc638..2075ccbf57 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -19,6 +19,9 @@ + + /dev/urandom + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 38a9e348b3..dc830d21b1 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -35,6 +35,8 @@ id=virtio-disk0,bootindex=1 \ addr=0x1 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ bus=pci.2,addr=0x3 \ +-object rng-random,id=objrng0,filename=/dev/urandom \ +-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index ab2c35514d..64fb4153fd 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -35,6 +35,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.2,addr=0x3 \ +-object rng-random,id=objrng0,filename=/dev/urandom \ +-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index eddc1ce9f5..82535c84d6 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -19,6 +19,9 @@ + + /dev/urandom + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 2af5195dfd..4a315050ab 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -45,6 +45,11 @@
+ + + +
+ @@ -57,5 +62,9 @@
+ + /dev/urandom +
+ diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index 8c1baced0e..ae3789ad93 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -51,5 +51,9 @@
+ + /dev/urandom +
+ From patchwork Wed Jan 23 21:32:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156411 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202068jaa; Wed, 23 Jan 2019 13:34:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN7sqvs6Xf95e8UTtCuRoj9K9gw45qkOvcXSbslbp4GGdxECrKdZRwJ33P7G6j3qschx/M3u X-Received: by 2002:a0c:bd15:: with SMTP id m21mr3529617qvg.57.1548279250662; Wed, 23 Jan 2019 13:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279250; cv=none; d=google.com; s=arc-20160816; b=ZWx0YXvB1ZCzcWCSUZlXk6qydnbk6/CR6Lsc2+TmRq+UmjderXTV3EfYOCL5+MJez9 TcaoYR5DXd5Xaqt89QV4lhVmh5m89hevPnp6zHHOfXPYkCf4P0MBaYuK/8xVOk/+9wEz bqzSSuC0iTDKSP6pOHxf2zk+i9UwY65T+F7NPhi/e9HZT0Fn/DGdy90Wl5a9nBtPBioF AoKMaIyHFO3+AY2j+EYUSzMxvGjA/v7QKOHAbDgh4BeYIkq9yxxejUKjxH8VeB3tt3Ff 2mX+9gLxBHpeLg6qZD5cUrjswd5p2YExvflyEKtfS1Jzrl9oxdlLY6jK69sZS6pLtLdb D1Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=5egEaGNTMIxluiluicWOA1CawjPZfBo5kgqxGjKG7QE=; b=GXdM/wLwvMAmK0fpIOGdSq5/t+EhvH42uoEoX1mr+p5DltRq0+MHRYTXD3jH7eFpmz zjJcgfrNOjYlw5vsBmMaI/lS6UFwMt5YqHxcjKaL+rLq6e/+kWBFDDHJwiK1RdfX7BIu FcP91firKnh9iGmz516P2sMx0jklr/EV3trrL/IMlnoCYhsl8L/7WInIPFfwipBIlMBB RVn0zkAkqHSsULoJmFnHsTqAhChSldp3gZLWScBiASJlpmdOB7fJKRsfSOn2M8qEizn0 Vmb6C81KEUNBwzEsEKjBs9zD2mn9pMdMtppaAZxrr5GTedZrE7yLoR6fdyC425WgYuJ6 o0SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id e32si836902qvd.6.2019.01.23.13.34.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:10 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 30C48432A0; Wed, 23 Jan 2019 21:34:09 +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 F086E600C6; Wed, 23 Jan 2019 21:34:08 +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 99306180339D; Wed, 23 Jan 2019 21:34:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLY7Tx032594 for ; Wed, 23 Jan 2019 16:34:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 443A060C6E; Wed, 23 Jan 2019 21:34:07 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 064E767144; Wed, 23 Jan 2019 21:34:04 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:45 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 17/25] conf: Add 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 23 Jan 2019 21:34:09 +0000 (UTC) devices lack the model= attribute which is used by most other device types. To eventually support virtio-9p-pci-{non-}traditional in qemu, let's add a standard model= attribute. The accepted values are: - virtio-9p - virtio-9p-transitional - virtio-9p-non-transitional The divergence in naming from other *-transitional values is because we expect to support virtio-fs in the future. Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 4 +++ docs/schemas/domaincommon.rng | 9 +++++ src/conf/domain_conf.c | 33 +++++++++++++++++-- src/conf/domain_conf.h | 11 +++++++ .../virtio-non-transitional.x86_64-3.1.0.args | 11 ++++--- ...virtio-non-transitional.x86_64-latest.args | 11 ++++--- .../virtio-non-transitional.xml | 4 +++ .../virtio-transitional.x86_64-3.1.0.args | 15 +++++---- .../virtio-transitional.x86_64-latest.args | 15 +++++---- .../qemuxml2argvdata/virtio-transitional.xml | 4 +++ .../virtio-non-transitional.xml | 18 +++++++--- .../virtio-transitional.xml | 26 ++++++++++----- 12 files changed, 127 insertions(+), 34 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bf64bf9feb..1f39601749 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3880,6 +3880,10 @@ + Since 5.1.0, the filesystem element + has an optional attribute model with supported values + "virtio-9p-transitional", "virtio-9p-non-transitional", or + "virtio-9p" which matches the default behavior of the QEMU driver.
driver
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 58ae874dfd..a6783a55c7 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2499,6 +2499,15 @@ + + + + virtio-9p + virtio-9p-transitional + virtio-9p-non-transitional + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fa772da52f..9bfedcb219 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -408,6 +408,13 @@ VIR_ENUM_IMPL(virDomainFSWrpolicy, VIR_DOMAIN_FS_WRPOLICY_LAST, "default", "immediate") +VIR_ENUM_IMPL(virDomainFSModel, VIR_DOMAIN_FS_MODEL_LAST, + "default", + "virtio-9p", + "virtio-9p-transitional", + "virtio-9p-non-transitional", +); + VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST, "user", "ethernet", @@ -10723,6 +10730,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, char *wrpolicy = NULL; char *usage = NULL; char *units = NULL; + char *model = NULL; ctxt->node = node; @@ -10751,6 +10759,15 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH; } + model = virXMLPropString(node, "model"); + if (model) { + if ((def->model = virDomainFSModelTypeFromString(model)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown model '%s'"), model); + goto error; + } + } + if (virDomainParseScaledValue("./space_hard_limit[1]", NULL, ctxt, &def->space_hard_limit, 1, ULLONG_MAX, false) < 0) @@ -10879,6 +10896,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(usage); VIR_FREE(units); VIR_FREE(format); + VIR_FREE(model); return def; @@ -22007,6 +22025,12 @@ virDomainFsDefCheckABIStability(virDomainFSDefPtr src, return false; } + if (src->model != dst->model) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target filesystem model does not match source")); + return false; + } + if (src->virtio && dst->virtio && !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; @@ -24812,10 +24836,15 @@ virDomainFSDefFormat(virBufferPtr buf, goto cleanup; } - virBufferAsprintf(buf, - "\n", + "model) { + virBufferAsprintf(buf, " model='%s'", + virDomainFSModelTypeToString(def->model)); + } + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); if (def->fsdriver) { virBufferAsprintf(&driverBuf, " type='%s'", fsdriver); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d73fcd1221..5d24cb0259 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -903,12 +903,22 @@ typedef enum { VIR_DOMAIN_FS_WRPOLICY_LAST } virDomainFSWrpolicy; +typedef enum { + VIR_DOMAIN_FS_MODEL_DEFAULT = 0, + VIR_DOMAIN_FS_MODEL_VIRTIO_9P, + VIR_DOMAIN_FS_MODEL_VIRTIO_9P_TRANSITIONAL, + VIR_DOMAIN_FS_MODEL_VIRTIO_9P_NON_TRANSITIONAL, + + VIR_DOMAIN_FS_MODEL_LAST +} virDomainFSModel; + struct _virDomainFSDef { int type; int fsdriver; /* enum virDomainFSDriverType */ int accessmode; /* enum virDomainFSAccessMode */ int wrpolicy; /* enum virDomainFSWrpolicy */ int format; /* virStorageFileFormat */ + int model; /* virDomainFSModel */ unsigned long long usage; /* in bytes */ virStorageSourcePtr src; char *dst; @@ -3453,6 +3463,7 @@ VIR_ENUM_DECL(virDomainFS) VIR_ENUM_DECL(virDomainFSDriver) VIR_ENUM_DECL(virDomainFSAccessMode) VIR_ENUM_DECL(virDomainFSWrpolicy) +VIR_ENUM_DECL(virDomainFSModel) VIR_ENUM_DECL(virDomainNet) VIR_ENUM_DECL(virDomainNetBackend) VIR_ENUM_DECL(virDomainNetVirtioTxMode) diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 10cc6236cb..824737338a 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -29,17 +29,20 @@ addr=0x1 \ -device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ -device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ -device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ +-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\ +-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ -id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ +id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ -wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x0 \ +wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ -device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\ -id=rng0,bus=pci.4,addr=0x0 \ +id=rng0,bus=pci.5,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index a0fc475c2f..e454eeadbd 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -29,16 +29,19 @@ addr=0x1 \ -device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \ -device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ -device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ +-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x0,\ +-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ -mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \ +mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.3,addr=0x0 \ +id=hostdev0,bus=pci.4,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.4,addr=0x0 \ +-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index 2075ccbf57..5f14e082cd 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -22,6 +22,10 @@ /dev/urandom + + + + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index dc830d21b1..6f07d5b707 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -25,18 +25,21 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ --device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ --device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \ +-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x2,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.3,addr=0x2,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \ -netdev user,id=hostnet0 \ --device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.3,\ addr=0x1 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.2,addr=0x3 \ +bus=pci.3,addr=0x3 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \ +-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 64fb4153fd..43c1cafd45 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -25,18 +25,21 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ --device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ --device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \ +-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x2,\ +-device virtio-blk-pci-transitional,scsi=off,bus=pci.3,addr=0x2,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ -mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \ +mac=00:11:22:33:44:55,bus=pci.3,addr=0x1 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.2,addr=0x3 \ +id=hostdev0,bus=pci.3,addr=0x3 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \ +-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index 82535c84d6..44639a970c 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -22,6 +22,10 @@ /dev/urandom + + + + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 4a315050ab..a903d44c34 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -50,21 +50,31 @@
+ + + +
+ + + + +
+ -
+
-
+
/dev/urandom -
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index ae3789ad93..61a3f91ef8 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -30,30 +30,40 @@
- + + + +
+ +
- + - -
+ +
+ + + +
+ -
+
-
+
/dev/urandom -
+
From patchwork Wed Jan 23 21:32:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156413 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202096jaa; Wed, 23 Jan 2019 13:34:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN5qSR1ebYz9/24Ea0TEOQdvJJsBMEZnYXdL9uvKeX506seHYOGXC9WNriZrZEWiUyHqpA1n X-Received: by 2002:ac8:1779:: with SMTP id u54mr4112320qtk.285.1548279252003; Wed, 23 Jan 2019 13:34:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279251; cv=none; d=google.com; s=arc-20160816; b=huVoYbOAnX3XOfAj4epS0tiP2aWgVg2pcOt8Z7TG4rfEFFnKtziTRtxlTUER2zOXmG B0jFLtPl5cQG6hl+Oy2j6zY3kH5L+Kj48WHJI3MC1PrwXK4bN09+/PLeoNcKSyyaukJ8 MTG/rLxY0c4/zSb9/twc0AFySYnsLivcR4Iet+wsLxs85PY0zbx5JC8dYto0DEweZjgi j3CFItxAsLBfFeh2QU7sYkfi6CchfzDGnW6mQ8mZezwsHuCGPensJ+HHnMZfa2kF0mES ABStn1txLxe7lZTn74Es7MlFm8+EGD7t0OdzFHCs8JmPwgjgKWXlWbycbVJjM4YdIsK2 pfiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=DZhybA6f5mbD9rdroeTXTi76tBsF4FHY7FnGZJQTIf8=; b=0jJKVsJTsj0hc2fn/4DJ+M7XL+mSc02eGoxrdt2GwKReVqEhgKJx8FQ7Ps1DC3flYZ rePeyR7jPcYVrNRjdhy3g3PgFu/8895GZr/kHFJ44JU7aqF50PkVMRPllrpalptpVufP YErnSXR/sFiV7Xz3lRTVwjog+qH1QcI2WjVC9885RnnVMhnNzqT1mNd/sQyiE9Shk3z/ e7Sju6DtwSyGYI9uFkcBmJA4ReVSMB95zoG+//g3Ud4maSIjI0NjlnKB6zKaOdZZxYeP Zs1sNGULAmtT+H9h/QlkMf2ZNcxHlQifKmuUejGyn0svjBwVWKfAagvm0IIIDoB2zIqJ DkcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id u7si2204978qkd.236.2019.01.23.13.34.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:11 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 5022FC0C8B9E; Wed, 23 Jan 2019 21:34:09 +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 16EB360469; Wed, 23 Jan 2019 21:34: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 C37EB18033A1; Wed, 23 Jan 2019 21:34:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLY8G1032608 for ; Wed, 23 Jan 2019 16:34:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 47D0CBA83; Wed, 23 Jan 2019 21:34:08 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEEF9BA50; Wed, 23 Jan 2019 21:34:07 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:46 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 18/25] qemu: Support filesystem model=virtio-9p-{non-}transitional 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 23 Jan 2019 21:34:11 +0000 (UTC) Add model handling for virtio transitional devices. Ex: ... --- src/qemu/qemu_command.c | 8 ++++++- src/qemu/qemu_domain_address.c | 4 +++- .../virtio-non-transitional.x86_64-3.1.0.args | 3 ++- ...virtio-non-transitional.x86_64-latest.args | 3 ++- .../virtio-transitional.x86_64-3.1.0.args | 17 +++++++------- .../virtio-transitional.x86_64-latest.args | 16 ++++++------- .../virtio-transitional.xml | 23 ++++++++----------- 7 files changed, 39 insertions(+), 35 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bf59ed72e1..c63f9d49d0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -495,8 +495,14 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL; break; - case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: + has_tmodel = device.data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_9P_TRANSITIONAL; + has_ntmodel = device.data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_9P_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL; + break; + + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 8880c946f6..e1fea7567f 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -677,7 +677,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, break; case VIR_DOMAIN_DEVICE_FS: - /* the only type of filesystem so far is virtio-9p-pci */ + /* Transitional devices only work in conventional PCI slots */ + if (dev->data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_9P_TRANSITIONAL) + return pciFlags; return virtioFlags; case VIR_DOMAIN_DEVICE_NET: { diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 824737338a..38a9cab582 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -34,7 +34,8 @@ addr=0x1 \ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ --device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ +-device virtio-9p-pci,disable-legacy=on,disable-modern=off,id=fs0,\ +fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index e454eeadbd..8c571c04f1 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -34,7 +34,8 @@ addr=0x1 \ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ --device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ +-device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ +bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 6f07d5b707..8fbeb6e937 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -25,21 +25,20 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ --device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ --device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ +-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ +-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.3,addr=0x2,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ --device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \ -netdev user,id=hostnet0 \ --device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.3,\ -addr=0x1 \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ +addr=0x2 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.3,addr=0x3 \ +bus=pci.2,addr=0x4 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \ +-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 43c1cafd45..eb8da465f6 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -25,21 +25,21 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ addr=0x1 \ --device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ --device pcie-pci-bridge,id=pci.3,bus=pci.1,addr=0x0 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ +-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ +-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-transitional,scsi=off,bus=pci.3,addr=0x2,\ +-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ --device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x0 \ +-device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ +bus=pci.2,addr=0x1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ -mac=00:11:22:33:44:55,bus=pci.3,addr=0x1 \ +mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.3,addr=0x3 \ +id=hostdev0,bus=pci.2,addr=0x4 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.3,addr=0x4 \ +-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index 61a3f91ef8..4ae070fb2a 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -30,40 +30,35 @@
- - - -
- - +
- + - -
+ +
-
+
-
+
-
+
/dev/urandom -
+
From patchwork Wed Jan 23 21:32:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156415 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202198jaa; Wed, 23 Jan 2019 13:34:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN4hUa7gGe7h+NSHQGBIXkSlmopzAPQGqllabuyGwSON+JlPHnV6NWLAxOlYcQeX/JTHawBP X-Received: by 2002:ac8:3365:: with SMTP id u34mr4117825qta.73.1548279258064; Wed, 23 Jan 2019 13:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279258; cv=none; d=google.com; s=arc-20160816; b=qkA4uMb0wPLI4MfDI2Wid54D00Yi7cC9lJ1GshIva7OJIAV8xqIwTBCUxfSIU+f7h7 d3iyf4/zZ1NjHhMqGAUsmd1zdsIFG8Eowy5NIWOPzZ8FfnOwmalUwKHRq4l+3dolirUQ stAiQeTElLaT3u2H5GYL/5xooPlmG1FKCZGVp5YqXRkOqSsgIcyWkSqAd5P+eoytQB32 M/GMvDya5qBCoCV1RspRKlwNK4zNi58bU29P6E56m1yDgCo8Xq95dVfGEG2NEU2th2TF WaMLlSZVIiuT9fr6sNA3mIczSvEZmgsehAmQRf2JBaC03MnQJ52E7ngd9yMdk1afsMjp qxRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=o2jphldK6ATWPnoMIySn2evB8TZ3klDBlYXxluyH078=; b=jO9nrdOe85I+6BEdlohnys0s0aNIWAltg2eBHVwXEWTu9SNEAtqd2QUENdSQyh1Fo7 g5E5o0YEHgWBzhxy6LeaQhQu/giIcoxs7sLbDf/zVaXhLuNdXphrocSXRMClEEfnAxe8 JXaJ3vT6zMAxLPtjM2mbiV+1CUhRyl8y8aDZ4EWmKRZ+cB7kuizwihnayRumpERAOuQY zmdUiQfuINFBpXHkYfi0SxU4ECjxnTQ/uqPGNfyWaS4+qqfgQMesT5Ky+TCn/+gwyUDs YYC7Gjy9CioOnQpm6vK2bwjLHLCOK837s3x/ZFay9oHi4VBXODBObdNPZlrlPxp3AWrD 0kYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id d4si599330qkf.248.2019.01.23.13.34.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:18 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4453D7EBC7; Wed, 23 Jan 2019 21:34:15 +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 97EBD6C203; Wed, 23 Jan 2019 21:34:14 +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 3415C3F60D; Wed, 23 Jan 2019 21:34:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLY98h032619 for ; Wed, 23 Jan 2019 16:34:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 682596714B; Wed, 23 Jan 2019 21:34:09 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F1DC67144; Wed, 23 Jan 2019 21:34:08 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:47 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 19/25] qemu: Support memballoon model=virtio-{non-}transitional 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 Jan 2019 21:34:17 +0000 (UTC) Add new model values for virtio transitional devices. Ex: * "virtio-transitional" maps to qemu "virtio-balloon-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-balloon-pci-non-transitional" Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 2 ++ docs/schemas/domaincommon.rng | 2 ++ src/conf/domain_conf.c | 5 ++++- src/conf/domain_conf.h | 2 ++ src/libxl/libxl_conf.c | 2 ++ src/qemu/qemu_command.c | 8 +++++++- src/qemu/qemu_domain.c | 4 +++- src/qemu/qemu_domain_address.c | 3 +++ .../virtio-non-transitional.x86_64-3.1.0.args | 5 ++++- .../virtio-non-transitional.x86_64-latest.args | 4 +++- tests/qemuxml2argvdata/virtio-non-transitional.xml | 2 +- .../virtio-transitional.x86_64-3.1.0.args | 3 ++- .../virtio-transitional.x86_64-latest.args | 3 ++- tests/qemuxml2argvdata/virtio-transitional.xml | 2 +- tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 11 +++++++++-- tests/qemuxml2xmloutdata/virtio-transitional.xml | 6 ++++-- 16 files changed, 51 insertions(+), 13 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 1f39601749..05f2beb237 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7902,6 +7902,8 @@ qemu-kvm -net nic,model=? /dev/null

  • 'virtio' - default with QEMU/KVM
  • +
  • 'virtio-transitional' (since 5.1.0)
  • +
  • 'virtio-non-transitional' (since 5.1.0)
  • 'xen' - default with Xen
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a6783a55c7..ac7c558511 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4090,6 +4090,8 @@ virtio + virtio-transitional + virtio-non-transitional xen none diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9bfedcb219..b51c2a86ee 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -551,7 +551,10 @@ VIR_ENUM_IMPL(virDomainKeyWrapCipherName, VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST, "virtio", "xen", - "none") + "none", + "virtio-transitional", + "virtio-non-transitional", +); VIR_ENUM_IMPL(virDomainSmbiosMode, VIR_DOMAIN_SMBIOS_LAST, "none", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5d24cb0259..f79b3e5f48 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1733,6 +1733,8 @@ typedef enum { VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO, VIR_DOMAIN_MEMBALLOON_MODEL_XEN, VIR_DOMAIN_MEMBALLOON_MODEL_NONE, + VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL, VIR_DOMAIN_MEMBALLOON_MODEL_LAST } virDomainMemballoonModel; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 73e988a3dc..4102a940b9 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -718,6 +718,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, case VIR_DOMAIN_MEMBALLOON_MODEL_XEN: break; case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO: + case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL: + case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported balloon device model '%s'"), virDomainMemballoonModelTypeToString(model)); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c63f9d49d0..614c9db291 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -502,6 +502,13 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_MEMBALLOON: + has_tmodel = device.data.memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL; + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: @@ -514,7 +521,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf, case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_SMARTCARD: case VIR_DOMAIN_DEVICE_CHR: - case VIR_DOMAIN_DEVICE_MEMBALLOON: case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_SHMEM: case VIR_DOMAIN_DEVICE_TPM: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 52c73df9ea..0634ed6f39 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6020,7 +6020,9 @@ qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *memballoon, return 0; } - if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { + if (memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && + memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL && + memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Memory balloon device type '%s' is not supported by this version of qemu"), virDomainMemballoonModelTypeToString(memballoon->model)); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index e1fea7567f..5164bcd49b 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -852,7 +852,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_DEVICE_MEMBALLOON: switch ((virDomainMemballoonModel) dev->data.memballoon->model) { case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO: + case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL: return virtioFlags; + case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL: + return pciFlags; case VIR_DOMAIN_MEMBALLOON_MODEL_XEN: case VIR_DOMAIN_MEMBALLOON_MODEL_NONE: diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 38a9cab582..30e8e4244e 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -30,6 +30,7 @@ addr=0x1 \ -device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ -device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ +-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -41,9 +42,11 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \ +-device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\ +bus=pci.5,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ -device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\ -id=rng0,bus=pci.5,addr=0x0 \ +id=rng0,bus=pci.6,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 8c571c04f1..dbf7a4ef15 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -30,6 +30,7 @@ addr=0x1 \ -device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \ -device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ +-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -41,8 +42,9 @@ bus=pci.1,addr=0x0 \ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.4,addr=0x0 \ +-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.5,addr=0x0 \ +-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index 5f14e082cd..b94ea58b5e 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -27,6 +27,6 @@ - + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 8fbeb6e937..c35e73ec45 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -37,8 +37,9 @@ id=virtio-disk0,bootindex=1 \ addr=0x2 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ bus=pci.2,addr=0x4 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \ +-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index eb8da465f6..77332549bf 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -38,8 +38,9 @@ bus=pci.2,addr=0x1 \ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.2,addr=0x4 \ +-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x5 \ +-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index 44639a970c..3bdb602a06 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -27,6 +27,6 @@ - + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index a903d44c34..7490dfdbbf 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -55,6 +55,11 @@
+ + + +
+ @@ -71,10 +76,12 @@
- + +
+ /dev/urandom -
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index 4ae070fb2a..2a42ce6359 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -55,10 +55,12 @@
- + +
+ /dev/urandom -
+
From patchwork Wed Jan 23 21:32:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156418 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202255jaa; Wed, 23 Jan 2019 13:34:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN6hSIIz7JZ+bDkoFEiDSYn4L0YTj9SwQSPsicT0ZYw4Fi9s0VTxzoJyhe6V8jjOlqetsL8Y X-Received: by 2002:a0c:a402:: with SMTP id w2mr3585924qvw.129.1548279260909; Wed, 23 Jan 2019 13:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279260; cv=none; d=google.com; s=arc-20160816; b=uUiGqgx+Skuz0WtTWrAwBltkv08mg8O+6hU+ZTBGJUFwPc7xXDgtWTw+S9Tya/zdb/ khomuzQ286VdOg5f+KNCDEg3e+jLTHa3hjhUPUR8YEZYwNU0i5Pd++PX6JWhHpJ21o8u Wc4AVuuYHIjL5TfG+a05hyznwMouHTCenlzT86FuC7ClJIVKD3oJwqAjbyQ/80cVgEnm bAy6kZAHQzc9fzBygwzUxU0n8hvZzHGeMG/oNd20u6LlmjCIdkqC+06NBry5MuJlLGCP l/YQEgdb3+z1vNhmu/eKU2UCzZbTbmjga86tkLKieKLr7OvP38X+2WHfTAWOFI3qGMc+ ZYqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=q9EMnTvLLQHlha0Yg1/sjY4aqqfQfFb2cYNEvxGqQT4=; b=fj9BFSjvwXH/VbJBbGtGM2ybgLa4CRZqBbRV9Fde9M9I+8RbHZgUzb3Tbj8zufIoHK I9WKu8vvsUvu/qq6NPl/SaKgpbKEKls2VpRwEvgPl/tOLOLh4u48s5+719WIJZCWzV16 F9wczExti9OyAwSoCpE5LOTIANeRC1CZ7dNbcZGC2MGzESuY/e1M77slTHAUQC93/GTY MNX+PXLouKkrgx3VXUKrIeF6a1iifPLVxTL+CDBqnROUY89ZQpBuHLIfVftyvBPR0jgU WMUvOQ6q7Zo3JMUqZuJiyujgJTicQmoD3AqHWUnvMfJ4II41u6qB4ZsEIrdlxQH0WkKC HdtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id m58si8945388qtb.280.2019.01.23.13.34.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:20 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37AC0432CB; Wed, 23 Jan 2019 21:34:19 +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 036B860C6E; Wed, 23 Jan 2019 21:34:19 +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 A50D73F60D; Wed, 23 Jan 2019 21:34:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYBHT032635 for ; Wed, 23 Jan 2019 16:34:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id F0C64BA9E; Wed, 23 Jan 2019 21:34:11 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7A22BAA5; Wed, 23 Jan 2019 21:34:09 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:48 -0500 Message-Id: <3da81528d9b14d709e1255b82b02d87b6f4bc6bd.1548278586.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 20/25] qemu: Support vsock model=virtio-{non-}transitional 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 23 Jan 2019 21:34:20 +0000 (UTC) Add model handling for virtio transitional devices. Ex: ... * "virtio-transitional" maps to qemu "vhost-vsock-pci-transitional" * "virtio-non-transitional" maps to qemu "vhost-vsock-pci-non-transitional" Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 4 +++- docs/schemas/domaincommon.rng | 6 +++++- src/conf/domain_conf.c | 5 ++++- src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 9 +++++++-- src/qemu/qemu_domain_address.c | 13 ++++++++++++- .../virtio-non-transitional.x86_64-3.1.0.args | 3 +++ .../virtio-non-transitional.x86_64-latest.args | 3 +++ tests/qemuxml2argvdata/virtio-non-transitional.xml | 3 +++ .../virtio-transitional.x86_64-3.1.0.args | 1 + .../virtio-transitional.x86_64-latest.args | 2 ++ tests/qemuxml2argvdata/virtio-transitional.xml | 3 +++ .../qemuxml2xmloutdata/virtio-non-transitional.xml | 9 +++++++++ tests/qemuxml2xmloutdata/virtio-transitional.xml | 4 ++++ tests/qemuxml2xmltest.c | 6 ++++-- 15 files changed, 65 insertions(+), 8 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 05f2beb237..eed35ef545 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8606,7 +8606,9 @@ qemu-kvm -net nic,model=? /dev/null

Vsock

A vsock host/guest interface. The model attribute - defaults to virtio. + defaults to virtio. Since 5.1.0 + model can also be 'virtio-transitional' and + 'virtio-non-transitional' The optional attribute address of the cid element specifies the CID assigned to the guest. If the attribute auto is set to yes, libvirt diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ac7c558511..1e26d5efca 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4301,7 +4301,11 @@ - virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b51c2a86ee..55ee8da179 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -897,7 +897,10 @@ VIR_ENUM_IMPL(virDomainIOMMUModel, VIR_DOMAIN_IOMMU_MODEL_LAST, VIR_ENUM_IMPL(virDomainVsockModel, VIR_DOMAIN_VSOCK_MODEL_LAST, "default", - "virtio") + "virtio", + "virtio-transitional", + "virtio-non-transitional", +); VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST, "default", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f79b3e5f48..f0d41e3153 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2420,6 +2420,8 @@ struct _virDomainIOMMUDef { typedef enum { VIR_DOMAIN_VSOCK_MODEL_DEFAULT, VIR_DOMAIN_VSOCK_MODEL_VIRTIO, + VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL, VIR_DOMAIN_VSOCK_MODEL_LAST } virDomainVsockModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 614c9db291..9d64c7d7b0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -509,6 +509,13 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_VSOCK: + has_tmodel = device.data.vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.vsock->model == VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL; + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: @@ -527,7 +534,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf, case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_IOMMU: - case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_LAST: default: return 0; @@ -10494,7 +10500,6 @@ qemuBuildVsockDevStr(virDomainDefPtr def, virBuffer buf = VIR_BUFFER_INITIALIZER; char *ret = NULL; - if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", qemuCaps, VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) { goto cleanup; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 5164bcd49b..4767b7aadc 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -947,7 +947,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, break; case VIR_DOMAIN_DEVICE_VSOCK: - return virtioFlags; + switch ((virDomainVsockModel) dev->data.vsock->model) { + case VIR_DOMAIN_VSOCK_MODEL_VIRTIO: + case VIR_DOMAIN_VSOCK_MODEL_VIRTIO_NON_TRANSITIONAL: + return virtioFlags; + case VIR_DOMAIN_VSOCK_MODEL_VIRTIO_TRANSITIONAL: + return pciFlags; + + case VIR_DOMAIN_VSOCK_MODEL_DEFAULT: + case VIR_DOMAIN_VSOCK_MODEL_LAST: + return 0; + } + break; /* These devices don't ever connect with PCI */ case VIR_DOMAIN_DEVICE_NVRAM: diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 30e8e4244e..97df54dd77 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -31,6 +31,7 @@ addr=0x1 \ -device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ +-device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -49,4 +50,6 @@ bus=pci.5,addr=0x0 \ id=rng0,bus=pci.6,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ +-device vhost-vsock-pci,disable-legacy=on,disable-modern=off,id=vsock0,\ +guest-cid=4,vhostfd=6789,bus=pci.7,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index dbf7a4ef15..2a73798ee2 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -31,6 +31,7 @@ addr=0x1 \ -device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ +-device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -47,4 +48,6 @@ id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ +-device vhost-vsock-pci-non-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ +bus=pci.7,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index b94ea58b5e..d4c07420dc 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -28,5 +28,8 @@ + + + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index c35e73ec45..d2429d2d2c 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -42,4 +42,5 @@ bus=pci.2,addr=0x4 \ -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ +-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x7 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 77332549bf..f3a4e0804e 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -43,4 +43,6 @@ id=hostdev0,bus=pci.2,addr=0x4 \ -device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ +-device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ +bus=pci.2,addr=0x7 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index 3bdb602a06..dd33071eb9 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -28,5 +28,8 @@ + + + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 7490dfdbbf..5ba39ea30f 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -60,6 +60,11 @@

+ + + +
+ @@ -83,5 +88,9 @@ /dev/urandom
+ + +
+ diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index 2a42ce6359..5cb6568cc8 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -62,5 +62,9 @@ /dev/urandom
+ + +
+ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a84f9241d6..c5ad3ba4b6 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1272,12 +1272,14 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY); + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, + QEMU_CAPS_DEVICE_VHOST_VSOCK); DO_TEST("virtio-non-transitional", QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY); + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, + QEMU_CAPS_DEVICE_VHOST_VSOCK); if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir); From patchwork Wed Jan 23 21:32:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156419 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202332jaa; Wed, 23 Jan 2019 13:34:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN7wi9VQox3ORIdjSL6FMeCQcHqgE3yb9vSMKytzL27A3FRl03sH+EqbO29PD+GjIvFPtzvb X-Received: by 2002:aed:3ecf:: with SMTP id o15mr4237065qtf.26.1548279266161; Wed, 23 Jan 2019 13:34:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279266; cv=none; d=google.com; s=arc-20160816; b=vJqRIboFtygwa5BZ4na4YFy3wMdgdrrZP6hDPT7tChyPs69Kq3WLksMd2NwBvbq53O JdlgJShq21HLu9d5NGC0U3q76LL6823DPKEyrR36zP6ZBcqRsMskWZ5rYlz+cT0NPuQS 0MI8+/XuICJUP37HNMyDXSw+pacaEEhslq9uy5kOlzH8vd7NVu6P10wB8D8JpnLTEL60 B/TtPXgBas0P8UHSnPNiLhqSoHBeorfcGHPTL3jv+ORLGI1Rx6GJONG+u42bFzyjTBBZ wk7OCIex6T2lBVXhUEQ+L6O+7IILxukf0lbsSFG5vWRHqEPvoSw3AbnNfe9LaTu+jUAC mBsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=3T3Ji4P9wSFOC+0s8PZZHc3rbP7jw9yhmzaewWYXS5I=; b=BmkJUQVrB9dGEREemRz2b02se7rpiA5yvSgx3jZ/ne2GgPgkZE6Sq2OGuSr8LzmW1D 1V+TnsTp637/ynSG6sVX2HpWEv8a2tMz4Q9dln4OiTpno1PqpSy6Mp6eu8P2DornYnWA ski5MUOnTqSGHgRCFuABlkOCXGLo049BW37O0PC603rJkPhgJRAwgygU/FHTUEgC9tS0 ZGs3UYUeiwiKWVjZPYcuRwsHtPAeGq5oPiYOnbNzOanAYz/OAEJMUviXgYiRQBFk820l JnbX/TEWXiyl4PZ6QBqpx5yXLlDgC+F99gNPdc9Vl6DRvFcYdiTCMAbjyjYjuAHtE4MP SVLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id g7si796521qkd.146.2019.01.23.13.34.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:26 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A586C0C7CAE; Wed, 23 Jan 2019 21:34:24 +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 C8E276C95F; Wed, 23 Jan 2019 21:34:23 +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 521943F60F; Wed, 23 Jan 2019 21:34:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYDmq032649 for ; Wed, 23 Jan 2019 16:34:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 07A7F67150; Wed, 23 Jan 2019 21:34:13 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B1B0BA8B; Wed, 23 Jan 2019 21:34:12 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:49 -0500 Message-Id: <7c3e9140c0f0b08167d6614be8b942b8b6712de7.1548278586.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 21/25] conf: Add 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 23 Jan 2019 21:34:25 +0000 (UTC) devices lack the model= attribute which is used by most other device types. To eventually support virtio-input-host-pci-{non-}traditional in qemu, let's add a standard model= attribute. This just adds the domain_conf wiring Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 4 +++ docs/schemas/domaincommon.rng | 9 +++++ src/conf/domain_conf.c | 35 +++++++++++++++++++ src/conf/domain_conf.h | 11 ++++++ .../virtio-non-transitional.x86_64-3.1.0.args | 5 ++- ...virtio-non-transitional.x86_64-latest.args | 5 ++- .../virtio-non-transitional.xml | 3 ++ .../virtio-transitional.x86_64-3.1.0.args | 3 ++ .../virtio-transitional.x86_64-latest.args | 3 ++ .../qemuxml2argvdata/virtio-transitional.xml | 3 ++ .../virtio-non-transitional.xml | 11 +++++- .../virtio-transitional.xml | 9 +++++ tests/qemuxml2xmltest.c | 6 ++-- 13 files changed, 102 insertions(+), 5 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index eed35ef545..6838774c74 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6431,6 +6431,10 @@ qemu-kvm -net nic,model=? /dev/null For type passthrough, the mandatory sub-element source must have an evdev attribute containing the absolute path to the event device passed through to guests. (KVM only) + + Since 5.1.0, the input element + accepts a model attribute which has the values 'virtio', + 'virtio-transitional' and 'virtio-non-transitional'.

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1e26d5efca..ccc94a2fba 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4406,6 +4406,15 @@ + + + + virtio + virtio-transitional + virtio-non-transitional + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 55ee8da179..8169428051 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -614,6 +614,13 @@ VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST, "parallels", "virtio") +VIR_ENUM_IMPL(virDomainInputModel, VIR_DOMAIN_INPUT_MODEL_LAST, + "default", + "virtio", + "virtio-transitional", + "virtio-non-transitional", +); + VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST, "sdl", "vnc", @@ -13082,6 +13089,7 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt, char *evdev = NULL; char *type = NULL; char *bus = NULL; + char *model = NULL; if (VIR_ALLOC(def) < 0) return NULL; @@ -13090,6 +13098,7 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt, type = virXMLPropString(node, "type"); bus = virXMLPropString(node, "bus"); + model = virXMLPropString(node, "model"); if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -13103,6 +13112,13 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt, goto error; } + if (model && + (def->model = virDomainInputModelTypeFromString(model)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown input model '%s'"), model); + goto error; + } + if (bus) { if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -13212,6 +13228,7 @@ virDomainInputDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(evdev); VIR_FREE(type); VIR_FREE(bus); + VIR_FREE(model); ctxt->node = save; return def; @@ -22109,6 +22126,14 @@ virDomainInputDefCheckABIStability(virDomainInputDefPtr src, return false; } + if (src->model != dst->model) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target input model %s does not match source %s"), + virDomainInputBusTypeToString(dst->model), + virDomainInputBusTypeToString(src->model)); + return false; + } + if (src->virtio && dst->virtio && !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; @@ -26696,6 +26721,7 @@ virDomainInputDefFormat(virBufferPtr buf, { const char *type = virDomainInputTypeToString(def->type); const char *bus = virDomainInputBusTypeToString(def->bus); + const char *model = virDomainInputModelTypeToString(def->model); virBuffer childbuf = VIR_BUFFER_INITIALIZER; virBuffer driverBuf = VIR_BUFFER_INITIALIZER; int ret = -1; @@ -26721,6 +26747,15 @@ virDomainInputDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "model) { + if (!model) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected input model %d"), def->model); + goto cleanup; + } + virBufferAsprintf(buf, " model='%s'", model); + } + virBufferSetChildIndent(&childbuf, buf); virDomainVirtioOptionsFormat(&driverBuf, def->virtio); if (virBufferCheckError(&driverBuf) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f0d41e3153..0e87d7efef 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1376,9 +1376,19 @@ typedef enum { VIR_DOMAIN_INPUT_BUS_LAST } virDomainInputBus; +typedef enum { + VIR_DOMAIN_INPUT_MODEL_DEFAULT, + VIR_DOMAIN_INPUT_MODEL_VIRTIO, + VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL, + + VIR_DOMAIN_INPUT_MODEL_LAST +} virDomainInputModel; + struct _virDomainInputDef { int type; int bus; + int model; /* virDomainInputModel */ struct { char *evdev; } source; @@ -3496,6 +3506,7 @@ VIR_ENUM_DECL(virDomainHub) VIR_ENUM_DECL(virDomainRedirdevBus) VIR_ENUM_DECL(virDomainInput) VIR_ENUM_DECL(virDomainInputBus) +VIR_ENUM_DECL(virDomainInputModel) VIR_ENUM_DECL(virDomainGraphics) VIR_ENUM_DECL(virDomainGraphicsListen) VIR_ENUM_DECL(virDomainGraphicsAuthConnected) diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 97df54dd77..9130572abe 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -32,6 +32,7 @@ addr=0x1 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ -device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \ +-device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,addr=0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -41,6 +42,8 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\ +addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\ @@ -51,5 +54,5 @@ id=rng0,bus=pci.6,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci,disable-legacy=on,disable-modern=off,id=vsock0,\ -guest-cid=4,vhostfd=6789,bus=pci.7,addr=0x0 \ +guest-cid=4,vhostfd=6789,bus=pci.8,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 2a73798ee2..8e0709816b 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -32,6 +32,7 @@ addr=0x1 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ -device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \ +-device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,addr=0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -41,6 +42,8 @@ bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\ +addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \ @@ -49,5 +52,5 @@ id=hostdev0,bus=pci.4,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-non-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.7,addr=0x0 \ +bus=pci.8,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index d4c07420dc..3fd32632d3 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -26,6 +26,9 @@ + + + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index d2429d2d2c..06fe70bb11 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,6 +27,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ @@ -35,6 +36,8 @@ id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x2 \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\ +addr=0x0 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ bus=pci.2,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \ diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index f3a4e0804e..24b49e6009 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,6 +27,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -36,6 +37,8 @@ bus=pci.2,addr=0x1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\ +addr=0x0 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.2,addr=0x4 \ -device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \ diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index dd33071eb9..5daea19ada 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -26,6 +26,9 @@ + + + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 5ba39ea30f..32c57a27f1 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -65,6 +65,11 @@

+ + + +
+ @@ -75,6 +80,10 @@
+ + +
+ @@ -90,7 +99,7 @@ -
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index 5cb6568cc8..b0da885c79 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -39,6 +39,11 @@
+ + + +
+ @@ -49,6 +54,10 @@
+ + +
+ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index c5ad3ba4b6..be8ef921ee 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1273,13 +1273,15 @@ mymain(void) QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK); + QEMU_CAPS_DEVICE_VHOST_VSOCK, + QEMU_CAPS_VIRTIO_INPUT_HOST); DO_TEST("virtio-non-transitional", QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK); + QEMU_CAPS_DEVICE_VHOST_VSOCK, + QEMU_CAPS_VIRTIO_INPUT_HOST); if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir); From patchwork Wed Jan 23 21:32:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156417 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202236jaa; Wed, 23 Jan 2019 13:34:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN7KDMXC+fBVnnbV+cJ33F/bu/QpbP5kWzrojWjBnU6sIU4tFf/Cj/fjllvjIATPaeVeYx+n X-Received: by 2002:ac8:2dc3:: with SMTP id q3mr4233996qta.178.1548279260323; Wed, 23 Jan 2019 13:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279260; cv=none; d=google.com; s=arc-20160816; b=NjH2M0SbN1QTif9nhBDDyqTLt/QgUMWZ6dVgehSQlGbMuI4A+kkCg0nZ48VOW3YRpW CzNDe5+f2jJenrz9TVMDIp4RjukvUcqD8FIn2mBep3Ok4kJNaIQ17Ln3zIUDXbBmVFFF nU720RJBbB/i/ObxW0VkDw8tIroJqiewjDFcePDsmML/biTZyTf8iipZSH7OjNgzxFOi RtK9glfPpT/Oi3RewQUx07QpawZ1fdzpfJRPkPNWCDtvhHn8fP8puhsRMQp/d33RxRbG I1lA5ry8FGM29A1oFtsy4UDKNJy8IndhnfjJ7/Tt9UXDS+rRLninPNpRvXzg4TPM8ZAS UlUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=YveCdWjdingCf0vEPdhg5pwC2FDdKByV75hl7fNaTdQ=; b=OPRWEsoCkG9o8dnPQKahLF0WfBC+Kd9jV/zuQEQ4NdGOeJHp+cwGElozH0x1bXSZUw UDswBU8b2e4ZNghGmIAyobBXkRcv4bC7iNJIiQQMm8sT4cfWPBmE51KV/gttKIgRJldK 8DfRX1/zF9VH1oE8uRW9XTAiggblLyBWREpz8MqkLt++TapKxjHfC8DtmyVLVNGVyOtn h4nBDLVa122Cs1sUrpgJRqonO0YyCCD06MsU1s6I3cgt4fTsP4htdPuYTwDSucaCrg2c ZkGMpnIMkeP25wS/VIy7I6ongdAE0CjN2YePVcg5goSlswr8U6FzeJqOAhY03q1XnSPg sUhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id e186si8330989qkf.27.2019.01.23.13.34.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:20 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 288587EBC5; Wed, 23 Jan 2019 21:34:18 +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 DB4D86C1F1; Wed, 23 Jan 2019 21:34:17 +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 716B918033A1; Wed, 23 Jan 2019 21:34:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYF5k032670 for ; Wed, 23 Jan 2019 16:34:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 422B1BA9E; Wed, 23 Jan 2019 21:34:15 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id A236065F72; Wed, 23 Jan 2019 21:34:13 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:50 -0500 Message-Id: <3b52eb01e5c90f4c1ada71a5eefe63e5acd72c2e.1548278586.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 22/25] qemu: Support input model=virtio-{non-}transitional 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 Jan 2019 21:34:18 +0000 (UTC) Add model handling for virtio transitional devices. Ex: ... * "virtio-transitional" maps to qemu "virtio-input-host-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-input-host-non-transitional" Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 10 +++++++++- src/qemu/qemu_domain_address.c | 13 ++++++++++++- .../virtio-non-transitional.x86_64-3.1.0.args | 4 ++-- .../virtio-non-transitional.x86_64-latest.args | 4 ++-- .../virtio-transitional.x86_64-3.1.0.args | 7 +++---- .../virtio-transitional.x86_64-latest.args | 7 +++---- tests/qemuxml2xmloutdata/virtio-transitional.xml | 9 ++------- 7 files changed, 33 insertions(+), 21 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9d64c7d7b0..a5c11956ed 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -516,8 +516,16 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL; break; - case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_INPUT: + if (device.data.input->type != VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) + return 0; + has_tmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.input->model == VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL; + break; + + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_WATCHDOG: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 4767b7aadc..7878d827de 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -919,7 +919,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_DEVICE_INPUT: switch ((virDomainInputBus) dev->data.input->bus) { case VIR_DOMAIN_INPUT_BUS_VIRTIO: - return virtioFlags; + switch ((virDomainInputModel) dev->data.input->model) { + case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL: + /* Transitional devices only work in conventional PCI slots */ + return pciFlags; + case VIR_DOMAIN_INPUT_MODEL_VIRTIO: + case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL: + case VIR_DOMAIN_INPUT_MODEL_DEFAULT: + return virtioFlags; + case VIR_DOMAIN_INPUT_MODEL_LAST: + break; + } + return 0; case VIR_DOMAIN_INPUT_BUS_PS2: case VIR_DOMAIN_INPUT_BUS_USB: diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 9130572abe..0f5de86315 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -42,8 +42,8 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\ -addr=0x0 \ +-device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\ +evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\ diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 8e0709816b..383b29f629 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -42,8 +42,8 @@ bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.7,\ -addr=0x0 \ +-device virtio-input-host-pci-non-transitional,id=input0,\ +evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.4,addr=0x0 \ -device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \ diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 06fe70bb11..8046e5c102 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ @@ -36,8 +35,8 @@ id=virtio-disk0,bootindex=1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x2 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\ -addr=0x0 \ +-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\ +addr=0x7 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ bus=pci.2,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \ @@ -45,5 +44,5 @@ bus=pci.2,addr=0x4 \ -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ --device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x7 \ +-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x8 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 24b49e6009..410eb28f0a 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,7 +27,6 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ --device pcie-root-port,port=0xa,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ -device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ @@ -37,8 +36,8 @@ bus=pci.2,addr=0x1 \ -netdev user,id=hostnet0 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ --device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.3,\ -addr=0x0 \ +-device virtio-input-host-pci-transitional,id=input0,\ +evdev=/dev/input/event1234,bus=pci.2,addr=0x7 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ id=hostdev0,bus=pci.2,addr=0x4 \ -device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \ @@ -47,5 +46,5 @@ id=hostdev0,bus=pci.2,addr=0x4 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.2,addr=0x7 \ +bus=pci.2,addr=0x8 \ -msg timestamp=on diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index b0da885c79..c944f0d9f8 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -39,11 +39,6 @@
- - - -
- @@ -56,7 +51,7 @@ -
+
@@ -73,7 +68,7 @@ -
+
From patchwork Wed Jan 23 21:32:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156416 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202224jaa; Wed, 23 Jan 2019 13:34:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN52x5ap71C6yqAWYnQX0E/DBzJgSYfhaWN7IkZ1HUaNTyK8g98jwnVxOpHo/NnpiyT6ismv X-Received: by 2002:a37:de09:: with SMTP id h9mr3396419qkj.113.1548279259685; Wed, 23 Jan 2019 13:34:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279259; cv=none; d=google.com; s=arc-20160816; b=gRoA4qVazBPQUuO/rUk5hj+1Qlli/7CNxRHhi+KUpcPFbXLpDPXDHgAsUxO22NqCbD pD/TCwS9JxGn+XvBx0FMMvJRHlm1TTs/pseGPlKbc3V+eomR8WduUXrc0b93UAwkJsUP jTUzfhHQ9hTHHo5lgVwToVz2CTeen0WAwmd/a6tDikSK9v3b72xIewnhfT3nkg3FHPvF JQLW5oHuwRC19TUa7C/lve8NGC/V6mTOC+tg58vbbeXPGZe7CfaZyCxV1ZECSHO6EUdd BkAdLR6JliTvpcV6D/7LIU8oBlXE2v+kiibIV47pFiLzoJfjvOTxlyInhmgzNhRss8J7 z6Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=pa7mJvHtw1XWO6rOzvwkhrQ4hhdalvHovJt5YjCDh8M=; b=kaBqaFpidTMWqJ0Y9NVa1YsA6gzm+XT9aZf3d0WWRljYqhWHtWOmrPtQTrs7a9/WPU jXSM8OAWs631/2ES+LFm9LmHM9Wcu7w6WgXri4kz6KyTCqa7JGMbl+SrlJaRBPNmZkEA ErItTR7jva85v5wzMdps7MrldddnL9naf+iKjhNAOWynq30GUQz5uYy6KOqQ1a/G3R9K jyTXzz9KGP1dRfs2EE+LU22V/2E5G3Ub5mz26VRv3Xef6ZjOThy/+u7yUqDol1FqfEQR lw9IVlkqiSYp+PhuZHXJnzcNCT4lGT1qY3Y6xBpqZDvqiuUhFcdFNKe2H3HzYnSsRSyg 1JEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id 63si1474989qth.271.2019.01.23.13.34.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:19 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A958145206; Wed, 23 Jan 2019 21:34:18 +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 EE1666C20A; Wed, 23 Jan 2019 21:34:17 +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 892D8180339F; Wed, 23 Jan 2019 21:34:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYG5t032694 for ; Wed, 23 Jan 2019 16:34:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7C42ABA9E; Wed, 23 Jan 2019 21:34:16 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 851EEBAA5; Wed, 23 Jan 2019 21:34:15 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:51 -0500 Message-Id: <19ade9466bcfe2b5e3da94c22aa564d7f9c6711c.1548278586.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 23/25] qemu: Support virtio-serial controller model=virtio-{non-}transitional 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 Jan 2019 21:34:18 +0000 (UTC) Add controller type='virtio-serial' model handling for virtio transitional devices. Ex: * "virtio-transitional" maps to qemu "virtio-serial-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-serial-pci-non-transitional" Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 4 +++- docs/schemas/domaincommon.rng | 9 ++++++++ src/conf/domain_conf.c | 11 ++++++++++ src/conf/domain_conf.h | 10 +++++++++ src/qemu/qemu_command.c | 12 +++++++++- src/qemu/qemu_domain_address.c | 15 ++++++++++++- .../virtio-non-transitional.x86_64-3.1.0.args | 18 +++++++++------ ...virtio-non-transitional.x86_64-latest.args | 18 +++++++++------ .../virtio-non-transitional.xml | 1 + .../virtio-transitional.x86_64-3.1.0.args | 13 ++++++----- .../virtio-transitional.x86_64-latest.args | 13 ++++++----- .../qemuxml2argvdata/virtio-transitional.xml | 1 + .../virtio-non-transitional.xml | 22 +++++++++++++------ .../virtio-transitional.xml | 15 ++++++++----- 14 files changed, 120 insertions(+), 42 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6838774c74..b820adbc8a 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4135,7 +4135,9 @@
The virtio-serial controller has two additional optional attributes ports and vectors, which control how many devices can be connected through the - controller.
+ controller. Since 5.1.0, it + supports an optional attribute model which can + be 'virtio', 'virtio-transitional', or 'virtio-non-transitional'
scsi
A scsi controller has an optional attribute model, which is one of 'auto', 'buslogic', 'ibmvscsi', diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ccc94a2fba..1c83281ad2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2310,6 +2310,15 @@ virtio-serial + + + + virtio + virtio-transitional + virtio-non-transitional + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8169428051..4518f426b2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -382,6 +382,13 @@ VIR_ENUM_IMPL(virDomainControllerModelIDE, VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST, "piix4", "ich6") +VIR_ENUM_IMPL(virDomainControllerModelVirtioSerial, + VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST, + "virtio", + "virtio-transitional", + "virtio-non-transitional", +); + VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST, "mount", "block", @@ -10321,6 +10328,8 @@ virDomainControllerModelTypeFromString(const virDomainControllerDef *def, return virDomainControllerModelPCITypeFromString(model); else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE) return virDomainControllerModelIDETypeFromString(model); + else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) + return virDomainControllerModelVirtioSerialTypeFromString(model); return -1; } @@ -10338,6 +10347,8 @@ virDomainControllerModelTypeToString(virDomainControllerDefPtr def, return virDomainControllerModelPCITypeToString(model); else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE) return virDomainControllerModelIDETypeToString(model); + else if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) + return virDomainControllerModelVirtioSerialTypeToString(model); return NULL; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0e87d7efef..804e6900e9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -789,6 +789,15 @@ typedef enum { VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST } virDomainControllerModelIDE; +typedef enum { + VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT = -1, + VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO, + VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL, + + VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST +} virDomainControllerModelVirtioSerial; + # define IS_USB2_CONTROLLER(ctrl) \ (((ctrl)->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) && \ ((ctrl)->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_EHCI1 || \ @@ -3473,6 +3482,7 @@ VIR_ENUM_DECL(virDomainControllerPCIModelName) VIR_ENUM_DECL(virDomainControllerModelSCSI) VIR_ENUM_DECL(virDomainControllerModelUSB) VIR_ENUM_DECL(virDomainControllerModelIDE) +VIR_ENUM_DECL(virDomainControllerModelVirtioSerial) VIR_ENUM_DECL(virDomainFS) VIR_ENUM_DECL(virDomainFSDriver) VIR_ENUM_DECL(virDomainFSAccessMode) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a5c11956ed..ea40494143 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -525,11 +525,21 @@ qemuBuildVirtioDevStr(virBufferPtr buf, ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_CONTROLLER: + if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) { + has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL; + } else { + return 0; + } + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_SOUND: case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_WATCHDOG: - case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_GRAPHICS: case VIR_DOMAIN_DEVICE_HUB: case VIR_DOMAIN_DEVICE_REDIRDEV: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7878d827de..6ecbb6defc 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -665,7 +665,20 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, break; case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: - return virtioFlags; + switch ((virDomainControllerModelVirtioSerial) cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL: + /* Transitional devices only work in conventional PCI slots */ + return pciFlags; + + case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO: + case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL: + case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_DEFAULT: + return virtioFlags; + + case VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_LAST: + return 0; + } + break; case VIR_DOMAIN_CONTROLLER_TYPE_FDC: case VIR_DOMAIN_CONTROLLER_TYPE_CCID: diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 0f5de86315..7543a225cb 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -32,9 +32,13 @@ addr=0x1 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ -device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \ --device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,addr=0x2 \ +-device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\ +multifunction=on,addr=0x2 \ +-device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \ +-device virtio-serial-pci,disable-legacy=on,disable-modern=off,\ +id=virtio-serial0,bus=pci.3,addr=0x0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.3,\ +-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.4,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci,disable-legacy=on,disable-modern=off,id=fs0,\ @@ -43,16 +47,16 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\ -evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \ +evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ -wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.4,addr=0x0 \ +wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.5,addr=0x0 \ -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\ -bus=pci.5,addr=0x0 \ +bus=pci.6,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ -device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\ -id=rng0,bus=pci.6,addr=0x0 \ +id=rng0,bus=pci.7,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci,disable-legacy=on,disable-modern=off,id=vsock0,\ -guest-cid=4,vhostfd=6789,bus=pci.8,addr=0x0 \ +guest-cid=4,vhostfd=6789,bus=pci.9,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 383b29f629..514db3ee7f 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -32,9 +32,13 @@ addr=0x1 \ -device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \ -device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \ -device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \ --device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,addr=0x2 \ +-device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\ +multifunction=on,addr=0x2 \ +-device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \ +-device virtio-serial-pci-non-transitional,id=virtio-serial0,bus=pci.3,\ +addr=0x0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-non-transitional,scsi=off,bus=pci.3,addr=0x0,\ +-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.4,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ @@ -43,14 +47,14 @@ bus=pci.1,addr=0x0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device virtio-input-host-pci-non-transitional,id=input0,\ -evdev=/dev/input/event1234,bus=pci.7,addr=0x0 \ +evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.4,addr=0x0 \ --device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.5,addr=0x0 \ +id=hostdev0,bus=pci.5,addr=0x0 \ +-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.6,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.6,addr=0x0 \ +-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.7,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-non-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.8,addr=0x0 \ +bus=pci.9,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index 3fd32632d3..a873821e4a 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -29,6 +29,7 @@ + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 8046e5c102..5b58af88df 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,8 +27,9 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x4,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \ @@ -36,13 +37,13 @@ id=virtio-disk0,bootindex=1 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x2 \ -device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\ -addr=0x7 \ +addr=0x8 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.2,addr=0x4 \ --device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x5 \ +bus=pci.2,addr=0x5 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x6 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ +-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ --device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x8 \ +-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x9 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 410eb28f0a..6c697eba83 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,8 +27,9 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device virtio-serial-pci-transitional,id=virtio-serial0,bus=pci.2,addr=0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x3,\ +-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x4,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ @@ -37,14 +38,14 @@ bus=pci.2,addr=0x1 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ -device virtio-input-host-pci-transitional,id=input0,\ -evdev=/dev/input/event1234,bus=pci.2,addr=0x7 \ +evdev=/dev/input/event1234,bus=pci.2,addr=0x8 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.2,addr=0x4 \ --device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x5 \ +id=hostdev0,bus=pci.2,addr=0x5 \ +-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x6 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x6 \ +-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.2,addr=0x8 \ +bus=pci.2,addr=0x9 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index 5daea19ada..fa1cccce64 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -29,6 +29,7 @@ + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 32c57a27f1..11496d872d 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -18,8 +18,11 @@ -
+
+ +
+
@@ -68,7 +71,12 @@ -
+
+ + + + +
@@ -82,24 +90,24 @@ -
+
-
+
-
+
/dev/urandom -
+
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index c944f0d9f8..c8edb4723c 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,8 +18,11 @@ -
+
+ +
+
@@ -51,24 +54,24 @@ -
+
-
+
-
+
/dev/urandom -
+
-
+
From patchwork Wed Jan 23 21:32:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156421 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202419jaa; Wed, 23 Jan 2019 13:34:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN4xDG1KHsDLuIfy/aq/917hBvxjsFT/UKNj353vSYk8SP1Z0WDMMyfOy0lZKIhU3BNHbLFc X-Received: by 2002:aed:2f82:: with SMTP id m2mr4260401qtd.4.1548279272609; Wed, 23 Jan 2019 13:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279272; cv=none; d=google.com; s=arc-20160816; b=PQEhNYqcHybUuoZm9/TTs137gyt0vAlE0VuMHfTrH9QVhE6QZIN8jY4VtRKPKZp4R0 /8DLPrSqHcybRCzxNNe4kiSyPNuPz84xGjR016Qhs6S9QejLWyvqBPN9NFHTHMZO0Dwp Bh3QUZ75lA61tlCRT3NDU8qOqWA31Dfac/a+U3RchJaCLR03UflimdFMW+xkbM2pCCMY IQ7/9c01fhW9oxPglSVh8M5dzi5D5Ynt4x8SBh5RrO951C5SjVBTyEOR9OL38awwUwbw 9smP+iL2EnuHHpFRfy5NhnenmP4vM8I4MGUFcVkg20wXrD/J5DyOvXQ6LaUHh/LnL8xY XywA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=Of0L5rnNefb3VZR84L2H2KHkM96WrkIAZ6ol64z+POg=; b=kN6NOHrlLgdHm+06kMdrOXO7dScg3/GsN/T/cnZPV4UAUk4gJ20ppRnDImLCtrTYY4 GoyXTxQXCkKqqIdsi1uXVdkYA5Q6zaomsdbwe80gPj1sHJPY5AQ4CK+Ei5NAGDt460KQ 8+K5+uK0pogw243CNdPd8dcXC/WBIHpJvhMF8rdJgU0LYSgxQPy0rp5IKoxo6bD2sBP0 shuILWt7k9kaN2vgReo79BhVvw25GqGigUzY3UH1e3spfcWPfD6100CsaXzns32gzZeb ne5YTi8PkGIZMpx6x4QOBv7vTzA3ruHcrjU3XtHIiH0OQqtgjary+P6G0uPz+qRjfvZ1 sY5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id u15si5436926qki.238.2019.01.23.13.34.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:32 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF68A7E9CC; Wed, 23 Jan 2019 21:34:30 +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 52B5968866; Wed, 23 Jan 2019 21:34:30 +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 F3BA23F60F; Wed, 23 Jan 2019 21:34:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYHXO032705 for ; Wed, 23 Jan 2019 16:34:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id B4578BA8B; Wed, 23 Jan 2019 21:34:17 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7AEB13ABE; Wed, 23 Jan 2019 21:34:16 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:52 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 24/25] qemu: Support scsi controller model=virtio-{non-}transitional 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 23 Jan 2019 21:34:31 +0000 (UTC) Add * "virtio-transitional" maps to qemu "virtio-scsi-pci-transitional" * "virtio-non-transitional" maps to qemu "virtio-scsi-non-transitional" The naming here doesn't match the pre-existing model=virtio-scsi. The prescence of '-scsi' there seems kind of redundant as we have type='scsi' already, so I decided to follow the pattern of other patches and use virtio-transitional etc. Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 4 ++-- docs/schemas/domaincommon.rng | 2 ++ src/conf/domain_conf.c | 14 ++++++++----- src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 7 +++++++ src/qemu/qemu_domain.c | 8 +++++++- src/qemu/qemu_domain_address.c | 3 +++ src/vbox/vbox_common.c | 2 ++ src/vmx/vmx.c | 5 ++++- .../virtio-non-transitional.x86_64-3.1.0.args | 15 ++++++++------ ...virtio-non-transitional.x86_64-latest.args | 14 +++++++------ .../virtio-non-transitional.xml | 1 + .../virtio-transitional.x86_64-3.1.0.args | 13 ++++++------ .../virtio-transitional.x86_64-latest.args | 13 ++++++------ .../qemuxml2argvdata/virtio-transitional.xml | 1 + .../virtio-non-transitional.xml | 20 +++++++++++++------ .../virtio-transitional.xml | 15 ++++++++------ tests/qemuxml2xmltest.c | 6 ++++-- 18 files changed, 98 insertions(+), 47 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b820adbc8a..3c0a30cc35 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4141,8 +4141,8 @@
scsi
A scsi controller has an optional attribute model, which is one of 'auto', 'buslogic', 'ibmvscsi', - 'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi' or - 'vmpvscsi'.
+ 'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi', + 'vmpvscsi', 'virtio-transitional', 'virtio-non-transitional'
usb
A usb controller has an optional attribute model, which is one of "piix3-uhci", "piix4-uhci", diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1c83281ad2..b875b11789 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2153,6 +2153,8 @@ ibmvscsi virtio-scsi lsisas1078 + virtio-transitional + virtio-non-transitional diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4518f426b2..8ade2022ed 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -359,7 +359,10 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS "vmpvscsi", "ibmvscsi", "virtio-scsi", - "lsisas1078"); + "lsisas1078", + "virtio-transitional", + "virtio-non-transitional", +); VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST, "piix3-uhci", @@ -4859,11 +4862,12 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev, virDomainControllerDefPtr cdev = dev->data.controller; if (cdev->iothread && - cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) { - virReportError(VIR_ERR_XML_ERROR, + cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI && + cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL && + cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("'iothread' attribute only supported for " - "controller model '%s'"), - virDomainControllerModelSCSITypeToString(VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)); + "virtio scsi controllers")); return -1; } } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 804e6900e9..cb1d18df8f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -756,6 +756,8 @@ typedef enum { VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078, + VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST } virDomainControllerModelSCSI; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ea40494143..b07e0fbbba 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -531,6 +531,11 @@ qemuBuildVirtioDevStr(virBufferPtr buf, has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL; tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL; ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL; + } else if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { + has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL; + has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_NON_TRANSITIONAL; } else { return 0; } @@ -2997,6 +3002,8 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch ((virDomainControllerModelSCSI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL: if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", qemuCaps, VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) { goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0634ed6f39..8991d4c804 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5091,7 +5091,9 @@ static int qemuDomainDeviceDefValidateControllerAttributes(const virDomainControllerDef *controller) { if (!(controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI && - controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) { + (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI || + controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL || + controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL))) { if (controller->queues) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'queues' is only supported by virtio-scsi controller")); @@ -5145,6 +5147,8 @@ qemuDomainCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps, } break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This QEMU doesn't support " @@ -5260,6 +5264,8 @@ qemuDomainDeviceDefValidateControllerSCSI(const virDomainControllerDef *controll { switch ((virDomainControllerModelSCSI) controller->model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL: if (!qemuDomainCheckSCSIControllerIOThreads(controller, def)) return -1; break; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 6ecbb6defc..22312cfd53 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -648,8 +648,11 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, return 0; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL: return virtioFlags; + /* Transitional devices only work in conventional PCI slots */ + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 664650f217..00d43d9a83 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -406,6 +406,8 @@ vboxSetStorageController(virDomainControllerDefPtr controller, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("The vbox driver does not support %s SCSI " diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 92601291fd..6b16d74c1d 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -517,7 +517,10 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST, "pvscsi", "UNUSED ibmvscsi", "UNUSED virtio-scsi", - "UNUSED lsisas1078"); + "UNUSED lsisas1078", + "UNUSED virtio-transitional", + "UNUSED virtio-non-transitional", +); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args index 7543a225cb..52f0855611 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args @@ -35,10 +35,13 @@ addr=0x1 \ -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\ multifunction=on,addr=0x2 \ -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \ +-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \ +-device virtio-scsi-pci,disable-legacy=on,disable-modern=off,id=scsi0,\ +bus=pci.4,addr=0x0 \ -device virtio-serial-pci,disable-legacy=on,disable-modern=off,\ id=virtio-serial0,bus=pci.3,addr=0x0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.4,\ +-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.5,\ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci,disable-legacy=on,disable-modern=off,id=fs0,\ @@ -47,16 +50,16 @@ fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \ -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\ id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\ -evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \ +evdev=/dev/input/event1234,bus=pci.9,addr=0x0 \ -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\ -wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.5,addr=0x0 \ +wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.6,addr=0x0 \ -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\ -bus=pci.6,addr=0x0 \ +bus=pci.7,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ -device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\ -id=rng0,bus=pci.7,addr=0x0 \ +id=rng0,bus=pci.8,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci,disable-legacy=on,disable-modern=off,id=vsock0,\ -guest-cid=4,vhostfd=6789,bus=pci.9,addr=0x0 \ +guest-cid=4,vhostfd=6789,bus=pci.10,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 514db3ee7f..54125d2102 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args @@ -35,10 +35,12 @@ addr=0x1 \ -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\ multifunction=on,addr=0x2 \ -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \ +-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \ +-device virtio-scsi-pci-non-transitional,id=scsi0,bus=pci.4,addr=0x0 \ -device virtio-serial-pci-non-transitional,id=virtio-serial0,bus=pci.3,\ addr=0x0 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-non-transitional,scsi=off,bus=pci.4,addr=0x0,\ +-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.5,addr=0x0,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ @@ -47,14 +49,14 @@ bus=pci.1,addr=0x0 \ -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \ -device virtio-input-host-pci-non-transitional,id=input0,\ -evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \ +evdev=/dev/input/event1234,bus=pci.9,addr=0x0 \ -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.5,addr=0x0 \ --device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.6,addr=0x0 \ +id=hostdev0,bus=pci.6,addr=0x0 \ +-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.7,addr=0x0 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.7,addr=0x0 \ +-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.8,addr=0x0 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-non-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.9,addr=0x0 \ +bus=pci.10,addr=0x0 \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml index a873821e4a..c5a4fc1eef 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -30,6 +30,7 @@ + diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args index 5b58af88df..71402f70f1 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -27,9 +27,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device virtio-scsi-pci,id=scsi0,bus=pci.2,addr=0x4 \ -device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x4,drive=drive-virtio-disk0,\ +-device virtio-blk-pci,scsi=off,bus=pci.2,addr=0x5,drive=drive-virtio-disk0,\ id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \ @@ -37,13 +38,13 @@ id=virtio-disk0,bootindex=1 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.2,\ addr=0x2 \ -device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234,bus=pci.2,\ -addr=0x8 \ +addr=0x9 \ -device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\ -bus=pci.2,addr=0x5 \ --device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x6 \ +bus=pci.2,addr=0x6 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x7 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \ +-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x8 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ --device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x9 \ +-device vhost-vsock-pci,id=vsock0,guest-cid=4,vhostfd=6789,bus=pci.2,addr=0xa \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 6c697eba83..49cfd12b92 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args @@ -27,9 +27,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ addr=0x1 \ -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \ -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \ +-device virtio-scsi-pci-transitional,id=scsi0,bus=pci.2,addr=0x4 \ -device virtio-serial-pci-transitional,id=virtio-serial0,bus=pci.2,addr=0x3 \ -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \ --device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x4,\ +-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x5,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ @@ -38,14 +39,14 @@ bus=pci.2,addr=0x1 \ -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\ mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \ -device virtio-input-host-pci-transitional,id=input0,\ -evdev=/dev/input/event1234,bus=pci.2,addr=0x8 \ +evdev=/dev/input/event1234,bus=pci.2,addr=0x9 \ -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\ -id=hostdev0,bus=pci.2,addr=0x5 \ --device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x6 \ +id=hostdev0,bus=pci.2,addr=0x6 \ +-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x7 \ -object rng-random,id=objrng0,filename=/dev/urandom \ --device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \ +-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x8 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\ -bus=pci.2,addr=0x9 \ +bus=pci.2,addr=0xa \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml index fa1cccce64..4ca21977eb 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -30,6 +30,7 @@ + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 11496d872d..11e1420733 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -18,11 +18,14 @@ -
+
+ +
+
@@ -78,6 +81,11 @@
+ + + +
+ @@ -90,24 +98,24 @@ -
+
-
+
-
+
/dev/urandom -
+
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml index c8edb4723c..e9c910d06c 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,11 +18,14 @@ -
+
+ +
+
@@ -54,24 +57,24 @@ -
+
-
+
-
+
/dev/urandom -
+
-
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index be8ef921ee..b2eee794de 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1274,14 +1274,16 @@ mymain(void) QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST); + QEMU_CAPS_VIRTIO_INPUT_HOST, + QEMU_CAPS_VIRTIO_SCSI); DO_TEST("virtio-non-transitional", QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST); + QEMU_CAPS_VIRTIO_INPUT_HOST, + QEMU_CAPS_VIRTIO_SCSI); if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir); From patchwork Wed Jan 23 21:32:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156420 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202356jaa; Wed, 23 Jan 2019 13:34:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN7tVW/8d7iPEZtCyYvEAiEwdol0tG0VboLl48XC1vAwchh1DAqPf9lkDywyS3qrhLBClr12 X-Received: by 2002:a0c:b093:: with SMTP id o19mr3563925qvc.49.1548279268296; Wed, 23 Jan 2019 13:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279268; cv=none; d=google.com; s=arc-20160816; b=bqNutVGzgLOuRIwpUqv4BSEdaGxrs5zoavDtDVOlSfKVO7uxev2Vk2OflljcM+SDp3 YX4BOzv5/OyhH0xS9tmh4sZaHHnWLKWCQEosWMOX5Ua0HWW0fv3c3F2/ZmbZ0bHfVpHQ jZSR2rwrEXrDmHlf1PTMNr2pns7WJDsgO9in6gGUOVWYbHlQfr//kRP7Jk4S0FFH+7FU ni5F34vODO4hCLkMKTZ/O9Apcrz989KiWFxvWg+H5Se/pf7nR30ozZWqmEtcfMGp4cnU d2AczTBcFPiWMdnDCnwwxHKL/UShOhBdbDPz/k7vjBm/TRkcHDhmUNIf+r4X4vKiHdd8 ai0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=Y+59m6wNvK+q2LO8qGaKmNO3VNDjPRnYU824Xkovfes=; b=hkhHpHEDWuCYEkHr1TynOqQlDZSDiOnQC2vz74juHGYm2tMt64+YT3J8jWyJcxnTLl 5u6wEPAOFKqcwL2Myh0G6KjrH0c2bCqulTSXK5EcOFtLiuryAWjn1EyhQrN/u/iBuHce E4G4AosBf3bMiPAf+eeuOMSdWLGEyWG2GTAL9zxR4utFcOXh4VsXDEX58ex7OAjcmINR aHvY0CNW+gWPofF+NI0Vys7dxAx/Iz8PI/OFDD4fZIMSnCbSS2Hu40092byUUu9ZDKXY 4RPmePL3gjXPaAv/AvVFS+VC7jHia1O7T+QAIwHKxheWyc+4HezyZSowphQagCl+eTBT 8tkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id x74si542800qka.175.2019.01.23.13.34.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:34:28 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BDC87BDC2; Wed, 23 Jan 2019 21:34: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 430C66C1F1; Wed, 23 Jan 2019 21:34: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 E7A623F600; Wed, 23 Jan 2019 21:34:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLYOp6032763 for ; Wed, 23 Jan 2019 16:34:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 758CE60C6E; Wed, 23 Jan 2019 21:34:24 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CC2D67147; Wed, 23 Jan 2019 21:34:17 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:53 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 25/25] qemu: domcaps: Report disk 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 23 Jan 2019 21:34:27 +0000 (UTC) This generates new XML like: virtio virtio-transitional virtio-non-transitional Signed-off-by: Cole Robinson --- src/conf/domain_capabilities.c | 1 + src/conf/domain_capabilities.h | 1 + src/qemu/qemu_capabilities.c | 13 ++ .../bhyve_basic.x86_64.xml | 1 + .../bhyve_fbuf.x86_64.xml | 1 + .../bhyve_uefi.x86_64.xml | 1 + tests/domaincapsschemadata/full.xml | 6 + .../domaincapsschemadata/libxl-xenfv-usb.xml | 1 + .../domaincapsschemadata/libxl-xenpv-usb.xml | 1 + .../qemu_1.7.0.x86_64.xml | 3 + .../qemu_2.12.0-virt.aarch64.xml | 5 + .../qemu_2.12.0.ppc64.xml | 5 + .../qemu_2.12.0.s390x.xml | 5 + .../qemu_2.12.0.x86_64.xml | 5 + .../qemu_2.6.0-virt.aarch64.xml | 5 + .../qemu_2.6.0.aarch64.xml | 5 + .../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 5 + .../qemu_2.6.0.x86_64.xml | 5 + .../domaincapsschemadata/qemu_2.7.0.s390x.xml | 5 + .../qemu_2.8.0-tcg.x86_64.xml | 5 + .../domaincapsschemadata/qemu_2.8.0.s390x.xml | 5 + .../qemu_2.8.0.x86_64.xml | 5 + .../qemu_2.9.0-q35.x86_64.xml | 5 + .../qemu_2.9.0-tcg.x86_64.xml | 5 + .../qemu_2.9.0.x86_64.xml | 5 + .../domaincapsschemadata/qemu_3.0.0.s390x.xml | 5 + .../qemu_4.0.0.x86_64.xml | 154 ++++++++++++++++++ tests/domaincapstest.c | 4 + 28 files changed, 267 insertions(+) create mode 100644 tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index ba2b6ba70f..4ed255d328 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -481,6 +481,7 @@ virDomainCapsDeviceDiskFormat(virBufferPtr buf, ENUM_PROCESS(disk, diskDevice, virDomainDiskDeviceTypeToString); ENUM_PROCESS(disk, bus, virDomainDiskBusTypeToString); + ENUM_PROCESS(disk, model, virDomainDiskModelTypeToString); FORMAT_EPILOGUE(disk); } diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 15e065359b..4a9a717539 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -65,6 +65,7 @@ struct _virDomainCapsDeviceDisk { bool supported; virDomainCapsEnum diskDevice; /* Info about virDomainDiskDevice enum values */ virDomainCapsEnum bus; /* Info about virDomainDiskBus enum values */ + virDomainCapsEnum model; /* Info about virDomainDiskModel enum values */ /* add new fields here */ }; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ee471787d9..ee3a1ff31b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5286,6 +5286,19 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps, if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_SATA); + /* disk->model values */ + VIR_DOMAIN_CAPS_ENUM_SET(disk->model, VIR_DOMAIN_DISK_MODEL_VIRTIO); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL)) { + VIR_DOMAIN_CAPS_ENUM_SET(disk->model, + VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL); + } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL)) { + VIR_DOMAIN_CAPS_ENUM_SET(disk->model, + VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL); + } + return 0; } diff --git a/tests/domaincapsschemadata/bhyve_basic.x86_64.xml b/tests/domaincapsschemadata/bhyve_basic.x86_64.xml index d6ecf061d0..bdf2c4eee8 100644 --- a/tests/domaincapsschemadata/bhyve_basic.x86_64.xml +++ b/tests/domaincapsschemadata/bhyve_basic.x86_64.xml @@ -21,6 +21,7 @@ virtio sata + + diff --git a/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml b/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml index b624fd0799..18f90023d5 100644 --- a/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml +++ b/tests/domaincapsschemadata/bhyve_uefi.x86_64.xml @@ -30,6 +30,7 @@ virtio sata + + + default + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/libxl-xenfv-usb.xml b/tests/domaincapsschemadata/libxl-xenfv-usb.xml index 29fe1f9aa3..4efc137c97 100644 --- a/tests/domaincapsschemadata/libxl-xenfv-usb.xml +++ b/tests/domaincapsschemadata/libxl-xenfv-usb.xml @@ -34,6 +34,7 @@ scsi xen + diff --git a/tests/domaincapsschemadata/libxl-xenpv-usb.xml b/tests/domaincapsschemadata/libxl-xenpv-usb.xml index b9f3ca736b..70e598fe9e 100644 --- a/tests/domaincapsschemadata/libxl-xenpv-usb.xml +++ b/tests/domaincapsschemadata/libxl-xenpv-usb.xml @@ -24,6 +24,7 @@ scsi xen + diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml index 3d73133919..497363bbe9 100644 --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml @@ -68,6 +68,9 @@ usb sata + + virtio + diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml index 56e403c4c7..7639df44c6 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml @@ -74,6 +74,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml index d0b9c3fdef..f10d361359 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml @@ -40,6 +40,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml index 8742dce530..41a81ff02f 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml @@ -133,6 +133,11 @@ scsi virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml index a8d6a4d629..5913e7fc63 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml @@ -98,6 +98,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml index b3e85de1d3..9ee801092e 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml @@ -71,6 +71,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml index 0fcc715940..4dd0b52ed3 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml @@ -71,6 +71,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml index f2dff05ff8..aa982d237e 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml @@ -44,6 +44,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml index c6d9fd8b37..6aa3f52ee4 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml @@ -72,6 +72,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml index 0c48bd6c75..8daa15ab9d 100644 --- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml @@ -38,6 +38,11 @@ scsi virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml index 1cb843d5d1..081805aa4a 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml @@ -73,6 +73,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml index 7293d89ae7..62c51e4087 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml @@ -119,6 +119,11 @@ scsi virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml index 8391603a3b..1bb034aa4f 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml @@ -73,6 +73,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml index c341de3ce2..67c6d5e77e 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml @@ -81,6 +81,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml index 4336e65dc8..588ef08199 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml @@ -105,6 +105,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml index 8e842b89fd..598937a971 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml @@ -82,6 +82,11 @@ usb sata + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml index 97231e044f..1d97f1f344 100644 --- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml @@ -139,6 +139,11 @@ scsi virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml new file mode 100644 index 0000000000..238605dd1f --- /dev/null +++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml @@ -0,0 +1,154 @@ + + /usr/bin/qemu-system-x86_64 + kvm + pc-i440fx-4.0 + x86_64 + + + + + /usr/share/AAVMF/AAVMF_CODE.fd + /usr/share/AAVMF/AAVMF32_CODE.fd + /usr/share/OVMF/OVMF_CODE.fd + + rom + pflash + + + yes + no + + + + + + + Skylake-Client-IBRS + Intel + + + + + + + + + + + + + + qemu64 + qemu32 + phenom + pentium3 + pentium2 + pentium + n270 + kvm64 + kvm32 + coreduo + core2duo + athlon + Westmere-IBRS + Westmere + Skylake-Server-IBRS + Skylake-Server + Skylake-Client-IBRS + Skylake-Client + SandyBridge-IBRS + SandyBridge + Penryn + Opteron_G5 + Opteron_G4 + Opteron_G3 + Opteron_G2 + Opteron_G1 + Nehalem-IBRS + Nehalem + IvyBridge-IBRS + IvyBridge + Icelake-Server + Icelake-Client + Haswell-noTSX-IBRS + Haswell-noTSX + Haswell-IBRS + Haswell + EPYC-IBPB + EPYC + Conroe + Broadwell-noTSX-IBRS + Broadwell-noTSX + Broadwell-IBRS + Broadwell + 486 + + + + + + disk + cdrom + floppy + lun + + + ide + fdc + scsi + virtio + usb + sata + + + virtio + virtio-transitional + virtio-non-transitional + + + + + sdl + vnc + spice + + + + + + subsystem + + + default + mandatory + requisite + optional + + + usb + pci + scsi + + + + default + kvm + vfio + + + + + + + + + + diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 7f52058bad..4ec2dc72b6 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -94,6 +94,7 @@ fillAllCaps(virDomainCapsPtr domCaps) disk->supported = true; SET_ALL_BITS(disk->diskDevice); SET_ALL_BITS(disk->bus); + SET_ALL_BITS(disk->model); graphics->supported = true; SET_ALL_BITS(graphics->type); @@ -502,6 +503,9 @@ mymain(void) "/usr/bin/qemu-system-s390x", NULL, "s390x", VIR_DOMAIN_VIRT_KVM); + DO_TEST_QEMU("4.0.0", "caps_4.0.0", + "/usr/bin/qemu-system-x86_64", NULL, + "x86_64", VIR_DOMAIN_VIRT_KVM); virObjectUnref(cfg); #endif /* WITH_QEMU */