From patchwork Sun Jan 13 23:12:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 155384 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3040688jaa; Sun, 13 Jan 2019 15:13:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN7sEP86iZP39EkCqwm127q10OB0hElyzACQ+DSrCn1yls1aRmr4XI3X5h+lIOqLZNS6gtyR X-Received: by 2002:ac8:6b18:: with SMTP id w24mr21985184qts.144.1547421223596; Sun, 13 Jan 2019 15:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547421223; cv=none; d=google.com; s=arc-20160816; b=M1pzkDaMuG1SQQ/Fiq15VHDkdnTTQ4PluNue/lqg+1JjvBNrSXHH7ME948GmtMFmVn 21FjqbisXm8P5F3FKpW1oZ/75qAnxNPtwIwFWvX2zcnx5Pj/K5MHjNKICkxpN9Rq3kpP 7Xgt+ZAsbeIHiajPeca63vFdulosezoNEPIntwb54Bjzg9nomghOJndSvLPAyM5yWZ/t upxS5W3Dnd7Vjzo+nQBdDl8XvB3c1t/LPTvA7GnaXt0bSo7q9jN84VSCNy7RC5Ua0pJg g7VuJNDD7j1Y0WjxSQsj4kvbFawL5ScoraKLoD15uN6sdqkehJnTe5m7OYlXFShzObpm gEtQ== 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=VgAOI8j9VS2mjmCj/vGy4o9ipSgv7+TqKZeP2z4M0pA=; b=BJ8PKFwGfqPxeyBH8zlxjaqd6MJHuG+87xORmQDS0wzr1jeHAULNDa4IkXQ8/Tn/U7 w02Cvj1Bnv1nT0shHkn5nLzy+p+Ioq6pxd86qIQ7TiUghYf81nvi0ApekWX8TztaUPT/ UZjjeZzWATX2jMJPSm8k6ao0QBpyMjOD3DG5L9fiI86tjr0qFn1hE+5oewjTOc1jcKVw nWMyjflvqN9S39M4pR8xUO0Cqwuj22Rq29vWWqvVL22676+l4he494Q3B9bVnMP4z5PV 3O/4hF7/F+9Oyg57UaZpusIDD7Mbasr3ZARZyMrgDNvkqF324h9U7rmJ1a5IdILhA6jt E8lw== 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 h47si3785589qvd.189.2019.01.13.15.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Jan 2019 15:13:43 -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 379217518D; Sun, 13 Jan 2019 23:13:42 +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 F275F18250; Sun, 13 Jan 2019 23:13:41 +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 AADEE18434BE; Sun, 13 Jan 2019 23:13:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0DNDBXi028633 for ; Sun, 13 Jan 2019 18:13:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6D8FE17AB6; Sun, 13 Jan 2019 23:13:11 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-202.rdu2.redhat.com [10.10.120.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id E511E17A6A; Sun, 13 Jan 2019 23:13:10 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 13 Jan 2019 18:12:06 -0500 Message-Id: <1ac81ba920b03d153f80236fea5aa81321e054fa.1547420060.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/6] qemu: Wire up 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.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.28]); Sun, 13 Jan 2019 23:13:42 +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 | 31 ++++++++++++++++++- src/qemu/qemu_domain_address.c | 2 ++ ...virtio-non-transitional.x86_64-latest.args | 7 +++-- .../virtio-transitional.x86_64-latest.args | 4 +-- .../virtio-non-transitional.xml | 10 ++++-- 5 files changed, 45 insertions(+), 9 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 822d5f8669..ca6abea227 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -443,6 +443,33 @@ qemuBuildVirtioDevStr(virBufferPtr buf, return 0; } +static int +qemuBuildVirtioTransitional(virBufferPtr buf, + const char *baseName, + virDomainDeviceAddressType type, + bool transitional, + bool nontransitional) +{ + if (qemuBuildVirtioDevStr(buf, baseName, type) < 0) + return -1; + + if (type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + (transitional || nontransitional)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virtio transitional models are not supported " + "for address type=%s"), + virDomainDeviceAddressTypeToString(type)); + return -1; + } + + if (transitional) { + virBufferAddLit(buf, "-transitional"); + } else if (nontransitional) { + virBufferAddLit(buf, "-non-transitional"); + } + return 0; +} + static int qemuBuildVirtioOptionsStr(virBufferPtr buf, @@ -2049,7 +2076,9 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, break; case VIR_DOMAIN_DISK_BUS_VIRTIO: - if (qemuBuildVirtioDevStr(&opt, "virtio-blk", disk->info.type) < 0) + if (qemuBuildVirtioTransitional(&opt, "virtio-blk", disk->info.type, + disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL, + disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL) < 0) goto error; if (disk->iothread) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index bd6c4031e0..1a77b74ad1 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -723,6 +723,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, case VIR_DOMAIN_DEVICE_DISK: switch ((virDomainDiskBus) dev->data.disk->bus) { case VIR_DOMAIN_DISK_BUS_VIRTIO: + if (dev->data.disk->model == VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_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-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args index 070b4b8334..a8f878c99c 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-non-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-non-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/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args index 070b4b8334..7730b177e7 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-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-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/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 1c00365edf..a64a84d145 100644 --- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -30,9 +30,13 @@
- + + +
+ + - +