From patchwork Thu Jan 17 17:52: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: 155874 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2257936jaa; Thu, 17 Jan 2019 09:53:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN4HQk+ysiy5wRMmgKZuhi8y9q4sEkf9+e88fhCDVNrHKHf5eionh6n8ULEbMhgJ3f//EzDm X-Received: by 2002:ac8:2eb8:: with SMTP id h53mr12394428qta.18.1547747625645; Thu, 17 Jan 2019 09:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547747625; cv=none; d=google.com; s=arc-20160816; b=GVBfTdwF1GHePdhaSbdPiCC2LH61OZhT61LAYuaSK9mPvFDdBdKD6v1gD26Ypu6fWA Mtu5FUWZW+8//vQseoC4Jxtp5BELxFsAas6eOcCStMVhmcL8o3O7bygdNISGQ3u4AJIs zt/Xb566HOeaNGvH5C82BpXBzx61xHKMjikL7rm4yGAUTGMP3HebEwNN2dui5m214TUO RitOCuvPzHdmVM7++NB2riaOf914+DKsWaq8u9YiHBDl+ABw7xp0oQ80/On75I2J18oP TMu0iMaGSjnUydqzplMdRe/VQ59vzcZpKhi/l88cpoce0iJSncZSPMqfyA3IW3dIS8GC LACw== 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=rrNxz1EHKkQh3DHOIOA5lJL6fMXe9uKBbqQUQFFHoIQ=; b=dMClBqWR0PgihzlRoxNNQ8lnHC3ANy4GmS6IwXuh7bqS7cvIgwWUCEDkGdPJiHgxJZ B9H5qCT2xWi3HNdOR4Muymx1qd6DenAIJm8xZb+58jioGmNmhJdeQYGKLstlCiNcN/tz X6zAFlfAewrxIrTIhLJstZNymp9npNR1MkF9UN6fWZ5Fx41YdaJviZtrfCrJBRYTfj2F UDJlMmEnZUO/xC3UQCDbykRDD9to3fSp52+wrDQYCY6w81zVfKR57jdUlLFWI9hW9fVf 8Nk/TOTpGhgNXpDk/n6mWshu71NqdeKmF4BUdRxXLYESTE8e904nhQ9/BFWmcjbuSpD7 oiwA== 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 v60si6324158qtd.31.2019.01.17.09.53.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 09:53:45 -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 A5FD38AE45; Thu, 17 Jan 2019 17:53: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 D70A91048118; Thu, 17 Jan 2019 17:53: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 897F218033AA; Thu, 17 Jan 2019 17:53:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0HHrEZA005545 for ; Thu, 17 Jan 2019 12:53:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1136F600CC; Thu, 17 Jan 2019 17:53:14 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-122-144.rdu2.redhat.com [10.10.122.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id A588D600C6; Thu, 17 Jan 2019 17:53:13 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 17 Jan 2019 12:52:37 -0500 Message-Id: <95116e9e597f703acd654bdae2c6411fb20084e5.1547746867.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/18] qemu: Support filesystem 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.25]); Thu, 17 Jan 2019 17:53:44 +0000 (UTC) Add model handling for virtio transitional devices. Ex: ... --- src/qemu/qemu_capabilities.c | 6 +++++ src/qemu/qemu_capabilities.h | 4 ++++ src/qemu/qemu_command.c | 12 ++++++++-- src/qemu/qemu_domain_address.c | 3 ++- .../caps_4.0.0.x86_64.xml | 2 ++ .../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 ++++++++----------- 10 files changed, 53 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_capabilities.c b/src/qemu/qemu_capabilities.c index 0241353006..2f54b2c81b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -530,6 +530,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "vhost-scsi-pci-non-transitional", "virtio-rng-pci-transitional", "virtio-rng-pci-non-transitional", + + /* 335 */ + "virtio-9p-pci-transitional", + "virtio-9p-pci-non-transitional", ); @@ -1126,6 +1130,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { {"vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_NON_TRANSITIONAL}, {"virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL}, {"virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL}, + {"virtio-9p-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL}, + {"virtio-9p-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL}, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index b01578d88a..fef94883c9 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -515,6 +515,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL, /* -device virtio-blk-rng-transitional */ QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL, /* -device virtio-rng-pci-non-transitional */ + /* 335 */ + QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL, /* -device virtio-9p-pci-transitional */ + QEMU_CAPS_DEVICE_VIRTIO_9P_NON_TRANSITIONAL, /* -device virtio-9p-pci-non-transitional */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 73f145dcd7..56d52e1d7e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -483,9 +483,14 @@ qemuBuildVirtioTransitional(virBufferPtr buf, tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL; ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL; break; + case VIR_DOMAIN_DEVICE_FS: + has_tmodel = model == VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL; + has_ntmodel = model == VIR_DOMAIN_FS_MODEL_VIRTIO_NON_TRANSITIONAL; + tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_TRANSITIONAL; + ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_9P_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: @@ -2742,7 +2747,10 @@ qemuBuildFSDevStr(const virDomainDef *def, goto error; } - if (qemuBuildVirtioDevStr(&opt, "virtio-9p", fs->info.type) < 0) + if (qemuBuildVirtioTransitional(&opt, "virtio-9p", qemuCaps, + fs->info.type, + fs->model, NULL, + VIR_DOMAIN_DEVICE_FS) < 0) goto error; virBufferAsprintf(&opt, ",id=%s", fs->info.alias); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index a5491a1c0e..b7a1cbe2d1 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -681,7 +681,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, break; case VIR_DOMAIN_DEVICE_FS: - /* the only type of filesystem so far is virtio-9p-pci */ + if (dev->data.fs->model == VIR_DOMAIN_FS_MODEL_VIRTIO_TRANSITIONAL) + return pciFlags; return virtioFlags; case VIR_DOMAIN_DEVICE_NET: { diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index e54fe53590..1de12a9828 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -220,6 +220,8 @@ + + 3001050 0 446361 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 a7b663a728..60c84bee29 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,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,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\ +bus=pci.1,addr=0x0 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,disable-legacy=on,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 6e18c1c301..334cfaa6e4 100644 --- a/tests/qemuxml2xmloutdata/virtio-transitional.xml +++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml @@ -18,7 +18,7 @@ -
+
@@ -30,40 +30,35 @@
- - - -
- - +
- + - -
+ +
-
+
-
+
-
+
/dev/urandom -
+