[libvirt] [PATCH 0/2] virtio-crypto: ccw support

The two patches of this series are based on the patch series [libvirt] [PATCH v3 0/4] Virtio-crypto device support https://www.redhat.com/archives/libvir-list/2017-July/msg00097.html They add ccw support and a test for virtio-crypto-ccw. Boris Fiuczynski (2): qemu: virtio-crypto: add ccw support qemu: virtio-crypto: add test for ccw support src/qemu/qemu_command.c | 8 ++++++-- .../qemuxml2argv-virtio-crypto-ccw.args | 22 ++++++++++++++++++++++ .../qemuxml2argv-virtio-crypto-ccw.xml | 16 ++++++++++++++++ tests/qemuxml2argvtest.c | 6 ++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.xml -- 2.7.4

Add device address type ccw which is supported since qemu 2.9.0. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> --- src/qemu/qemu_command.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5278edc..65dfc61 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6051,14 +6051,18 @@ qemuBuildCryptoDevStr(const virDomainDef *def, goto error; } - if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + virBufferAddLit(&buf, "virtio-crypto-pci"); + } else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { + virBufferAddLit(&buf, "virtio-crypto-ccw"); + } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported address type %s for virtio crypto device"), virDomainDeviceAddressTypeToString(dev->info.type)); goto error; } - virBufferAsprintf(&buf, "virtio-crypto-pci,cryptodev=obj%s,id=%s", + virBufferAsprintf(&buf, ",cryptodev=obj%s,id=%s", dev->info.alias, dev->info.alias); if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) -- 2.7.4

Add qemu command line tests for virtio-crypto ccw support. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> --- .../qemuxml2argv-virtio-crypto-ccw.args | 22 ++++++++++++++++++++++ .../qemuxml2argv-virtio-crypto-ccw.xml | 16 ++++++++++++++++ tests/qemuxml2argvtest.c | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.args new file mode 100644 index 0000000..1a59a2d --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-M s390-ccw \ +-m 214 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=readline \ +-device virtio-balloon-ccw,id=balloon0,devno=fe.0.0000 \ +-object cryptodev-backend-builtin,id=objcrypto0,queues=1 \ +-device virtio-crypto-ccw,cryptodev=objcrypto0,id=crypto0,devno=fe.0.0001 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.xml new file mode 100644 index 0000000..b8d07ff --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-crypto-ccw.xml @@ -0,0 +1,16 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory>219100</memory> + <currentMemory>219100</currentMemory> + <os> + <type arch='s390x' machine='s390-ccw'>hvm</type> + </os> + <devices> + <emulator>/usr/bin/qemu-system-s390x</emulator> + <memballoon model='virtio'/> + <crypto model='virtio'> + <backend type='builtin' queues='1'/> + </crypto> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 27eea70..70f85cd 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1781,6 +1781,12 @@ mymain(void) QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST("virtio-crypto-ccw", + QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_VIRTIO_CRYPTO, + QEMU_CAPS_OBJECT_CRYPTO_BUILTIN); + DO_TEST("s390-allow-bogus-usb-none", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_BOOTINDEX, QEMU_CAPS_VIRTIO_S390, -- 2.7.4
participants (1)
-
Boris Fiuczynski