From patchwork Fri Feb 8 22:12:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 157883 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1472jaa; Fri, 8 Feb 2019 14:13:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IZVDADAmrIUvOuix+vDb9dR6+7NjeBpfow9sM5nqW4DrxeJJL9/a+CWviUzQ3RZsSP/jmlz X-Received: by 2002:a0c:fd8a:: with SMTP id p10mr18120827qvr.48.1549663982103; Fri, 08 Feb 2019 14:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549663982; cv=none; d=google.com; s=arc-20160816; b=FPeh87QWNf4Ew5N6eEdKmL7qfBNVmE305NrBGiGEr+REn+kkMRd2DG37led9dWlTRb 2r4UyYmU9qdqGWxRj5HUG1RBkYWtR7ftP6VjqKbcGv1lkn0b+8BvpQkzCu2leYOi9fZT aEGkQV7nt7fnzmZrjiAa5St3Sr2ocivZzAo546CtytGG0AhaozAFAT+mfqFzjD//+obb YLdsWvHy6m8A/k5M0ocu1AK0qAzyJqegeJK73Kc532yPM3PW5/bMQWfqV4adHH0yeE5H D2CI6ngw99lfAcb2gXCk0Bf+uWI4egg77IKCt2N2SnTJghVHfakqMvzEQ65uMpPWVbGw lMbw== 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=KwBKDvg8F5S6fSROWk56ZttUNiLwuIXv+RM9m/J1skg=; b=rUZRRsXy9o7uq7rlpghH8VyQV6bH0DSs2tW+AjWpGU+ac9Qm7BTSJOGTnUXi021VRr wHWyBkLcmOsKRSSdM28a2msAuikdQAXwVE45/toMRxYWPNDaIkAxkjtojcc1Gc9moezy Qm88+RNfquh/xKj8vdyaIfDpMebHrJ3gZC3t/ysECmFC4XAFGQqztji40g2z0uX5ttOU LirJZ1orDOflE1shf0024W0S/qEJxMohQVTsvXHPLklADhpitELoUOoeO24Ie89wm/wM uAaQXqF68WVfbKgPcNW+I5ySWE3IQYCqmOE+ivdHMG6FLKHg7r2wiwFxQrddpOl4wF7h Xo/Q== 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 w13si315947qkf.213.2019.02.08.14.13.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 14:13:02 -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 8A48F5947C; Fri, 8 Feb 2019 22:13:00 +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 4609762662; Fri, 8 Feb 2019 22:13:00 +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 EB8553F615; Fri, 8 Feb 2019 22:12:59 +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 x18MCRVg008476 for ; Fri, 8 Feb 2019 17:12:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4FEFC5C6C1; Fri, 8 Feb 2019 22:12:27 +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 D02EE5C6A5; Fri, 8 Feb 2019 22:12:26 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 8 Feb 2019 17:12:03 -0500 Message-Id: <799dce4e13814bbb7ad7474891c8d23217b134b2.1549663397.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 Cc: Andrea Bolognani Subject: [libvirt] [PATCH v3 12/17] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 08 Feb 2019 22:13:01 +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" Reviewed-by: Andrea Bolognani Signed-off-by: Cole Robinson --- docs/formatdomain.html.in | 6 +++++- docs/schemas/domaincommon.rng | 6 +++++- src/conf/domain_conf.c | 2 ++ src/conf/domain_conf.h | 2 ++ src/qemu/qemu_command.c | 6 +++++- 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 | 2 ++ .../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, 64 insertions(+), 6 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 4a1ba83cd8..15aed5381f 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8652,7 +8652,11 @@ 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', see + Virtio transitional devices + for more details. 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 94c358b578..e1e5a64592 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4304,7 +4304,11 @@ - virtio + + virtio + virtio-transitional + virtio-non-transitional + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e4484f9982..22f07307ad 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -990,6 +990,8 @@ VIR_ENUM_IMPL(virDomainIOMMUModel, VIR_DOMAIN_IOMMU_MODEL_LAST, VIR_ENUM_IMPL(virDomainVsockModel, VIR_DOMAIN_VSOCK_MODEL_LAST, "default", "virtio", + "virtio-transitional", + "virtio-non-transitional", ); VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 40da1b40b7..a236d4fc9c 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 b843408402..022d5a5d90 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -507,6 +507,11 @@ qemuBuildVirtioDevStr(virBufferPtr buf, has_ntmodel = device.data.memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_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; + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_INPUT: case VIR_DOMAIN_DEVICE_SOUND: @@ -525,7 +530,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; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index c1a6d94a4c..badf237333 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -977,7 +977,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 6d9691c1e5..97d9c77a73 100644 --- a/tests/qemuxml2argvdata/virtio-non-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml @@ -27,5 +27,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 b7cb304891..c3df97ca86 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args +++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args @@ -45,4 +45,6 @@ bus=pci.2,addr=0x5 \ id=rng0,bus=pci.2,addr=0x6 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ +-device vhost-vsock-pci,disable-legacy=off,disable-modern=off,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 43c55e9d31..a2ca96ed09 100644 --- a/tests/qemuxml2argvdata/virtio-transitional.xml +++ b/tests/qemuxml2argvdata/virtio-transitional.xml @@ -27,5 +27,8 @@ + + + diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml index 721dccbaef..9f05de5089 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 2402c5f227..0d99aa2ded 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 15f0ccffb1..30954cc341 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1258,12 +1258,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);