From patchwork Fri Feb 8 22:11:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 157877 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1256jaa; Fri, 8 Feb 2019 14:12:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IZlLcw5mBiS1G4wn3eZRLQJbKFY2S/pgFsvtmZRbLWd4m0485n0RfkwKjbDrNilSzTuTC++ X-Received: by 2002:a37:bd47:: with SMTP id n68mr17531710qkf.203.1549663967364; Fri, 08 Feb 2019 14:12:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549663967; cv=none; d=google.com; s=arc-20160816; b=A2AowmwZLkHw/OvOP87sm9Vp4zRd19ykIo7hL9dsG4O7t2IvZIOqC1QcDIsVFBPCU9 +ylWr7wdn6z/UAxmXKVmV570AoUe9KTTFKM/ZLBu5YhqzAxPfKB10m8iyUpDnpZI6mJU ePqNaarYfeEHchUbmQSOwB9V30I9tlCzikLH0MPdpwxbfNN3N/j7mh9hGVj7tv3H8uud y7/UIbEFFPh877aIoh2FEf/gu4TXr9S6qEu+BGragBw/EyHxj6nQW+ID41+mcShowsRR WJBG+hNtQFaRDKJNM/4badjRp+fsqwhzTnUe9In5SuFdtuJ3+vYqCIjOpY0iXrfH4vEI fWGw== 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=oc3Oh/HShieqY8uMxTf06fkaNXce4HsRZT0X5mXB7E8=; b=IVvcOEZJccIHybCNZ4qWzGmTdS25w6ms7REDpcglcFHHX+fs5FbWzAMYy6JD9/jeTM JkSmfogXfK190X6Pc33HgYtfqWZQwkRipMTJTLFteGbn+2WPPzLgubkxRLsUWJkxVP3t DJxxYOC5QM1Ee0WZJt2bgeDwew61y3MSEemmx5VG5BNGaE5/7StfX2og5VYzlOzFQDOF CNC93UIaNWk3hexoUANtyhFQ+g+bcE0tlZr754mUIo2QUAmvSlp6mtMcP3X2w/sAUyZE 7F7y7zj2wiYUl/xLUr0MHztoXVtN9g7FOpkuQW59F9IiMR6/Lxv818nBmEV+KnM5sE1a YAmw== 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 46si925449qty.384.2019.02.08.14.12.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 14:12:47 -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 AF1B0C058CAD; Fri, 8 Feb 2019 22:12:45 +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 7CCB11001F5D; Fri, 8 Feb 2019 22:12:45 +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 275F618033A3; Fri, 8 Feb 2019 22:12:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x18MCLiY008413 for ; Fri, 8 Feb 2019 17:12:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id E49225C6A6; Fri, 8 Feb 2019 22:12:21 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-123-115.rdu2.redhat.com [10.10.123.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88FD25C6A5; Fri, 8 Feb 2019 22:12:21 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 8 Feb 2019 17:11:56 -0500 Message-Id: <851d9ed5978c1eb1d005ef9bab616e29dace910b.1549663396.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 05/17] 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.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.32]); Fri, 08 Feb 2019 22:12:46 +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 --- docs/formatdomain.html.in | 6 +++++- src/conf/domain_conf.c | 4 +++- src/qemu/qemu_command.c | 6 ++++++ 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 ++++++- 12 files changed, 64 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/docs/formatdomain.html.in b/docs/formatdomain.html.in index 85bc6a9d0b..c8012f0a22 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5749,7 +5749,11 @@ qemu-kvm -net nic,model=? /dev/null

Typical values for QEMU and KVM include: - ne2k_isa i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio + ne2k_isa i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio. + Since 5.1.0, virtio-transitional + and virtio-non-transitional values are supported. + See Virtio transitional devices + for more details.

Setting NIC driver-specific options
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3768143b2c..e29f143f3d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29943,7 +29943,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 9dda5619fd..552f4c0807 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -479,6 +479,12 @@ qemuBuildVirtioDevStr(virBufferPtr buf, 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"); + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_INPUT: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 40b8efa0b5..5920439a96 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 115ae48737..72d92ba720 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -11,6 +11,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 e254014471..ed0d3b7f7a 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -29,7 +29,10 @@ addr=0x1 \ -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,disable-legacy=off,disable-modern=off,scsi=off,\ -bus=pci.2,addr=0x1,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +bus=pci.2,addr=0x2,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,disable-legacy=off,disable-modern=off,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 8febfc8423..a35a2e9cb4 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -11,6 +11,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 @@
+ + + +
+