[PATCH v2 0/3] Implement paeg-per-vq to virtio devices

Diff from v1: - Remove some duplicated test cases - Merge some err msgs of 2 lines into one line - Rebase to latest upstream v1: https://listman.redhat.com/archives/libvir-list/2021-September/msg00087.html Han Han (3): qemu_capabilities: Add flag QEMU_CAPS_VIRTIO_PAGE_PER_VQ conf: Add page_per_vq for driver element qemu: Add support for virtio device option page-per-vq docs/formatdomain.rst | 9 +++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 16 ++++++++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 6 +++ src/qemu/qemu_capabilities.c | 6 +++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 4 ++ src/qemu/qemu_hotplug.c | 3 +- src/qemu/qemu_validate.c | 7 ++++ .../caps_2.11.0.s390x.xml | 1 + .../caps_2.11.0.x86_64.xml | 1 + .../caps_2.12.0.aarch64.xml | 1 + .../caps_2.12.0.ppc64.xml | 1 + .../caps_2.12.0.s390x.xml | 1 + .../caps_2.12.0.x86_64.xml | 1 + .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 + .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 + .../caps_3.0.0.x86_64.xml | 1 + .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 + .../caps_3.1.0.x86_64.xml | 1 + .../caps_4.0.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 + .../caps_4.0.0.riscv32.xml | 1 + .../caps_4.0.0.riscv64.xml | 1 + .../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 + .../caps_4.0.0.x86_64.xml | 1 + .../caps_4.1.0.x86_64.xml | 1 + .../caps_4.2.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 + .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + .../caps_4.2.0.x86_64.xml | 1 + .../caps_5.0.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + .../caps_5.0.0.riscv64.xml | 1 + .../caps_5.0.0.x86_64.xml | 1 + .../caps_5.1.0.x86_64.xml | 1 + .../caps_5.2.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 + .../caps_5.2.0.riscv64.xml | 1 + .../qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 + .../caps_5.2.0.x86_64.xml | 1 + .../caps_6.0.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + .../caps_6.0.0.x86_64.xml | 1 + .../caps_6.1.0.x86_64.xml | 1 + .../virtio-options-controller-page_per_vq.err | 1 + .../virtio-options-controller-page_per_vq.xml | 38 +++++++++++++++++++ .../virtio-options-disk-page_per_vq.err | 1 + .../virtio-options-disk-page_per_vq.xml | 34 +++++++++++++++++ .../virtio-options-fs-page_per_vq.err | 1 + .../virtio-options-fs-page_per_vq.xml | 34 +++++++++++++++++ .../virtio-options-input-page_per_vq.err | 1 + .../virtio-options-input-page_per_vq.xml | 30 +++++++++++++++ .../virtio-options-memballoon-page_per_vq.err | 1 + .../virtio-options-memballoon-page_per_vq.xml | 23 +++++++++++ .../virtio-options-net-page_per_vq.err | 1 + .../virtio-options-net-page_per_vq.xml | 34 +++++++++++++++++ .../virtio-options-rng-page_per_vq.err | 1 + .../virtio-options-rng-page_per_vq.xml | 32 ++++++++++++++++ .../virtio-options-video-page_per_vq.err | 1 + .../virtio-options-video-page_per_vq.xml | 36 ++++++++++++++++++ .../virtio-options.x86_64-latest.args | 26 ++++++------- tests/qemuxml2argvdata/virtio-options.xml | 26 ++++++------- tests/qemuxml2argvtest.c | 14 +++++++ 65 files changed, 402 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml -- 2.31.1

The qemu capability will be used for the page_per_vq option of virtio devices. Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 + 38 files changed, 43 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 82687dbf39..95caea9b41 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -644,6 +644,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio-mem-pci", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI */ "memory-backend-file.reserve", /* QEMU_CAPS_MEMORY_BACKEND_RESERVE */ "piix4.acpi-root-pci-hotplug", /* QEMU_CAPS_PIIX4_ACPI_ROOT_PCI_HOTPLUG */ + "virtio.page-per-vq", /* QEMU_CAPS_VIRTIO_PAGE_PER_VQ */ ); @@ -1377,6 +1378,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioBalloon[] { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, { "free-page-reporting", QEMU_CAPS_VIRTIO_BALLOON_FREE_PAGE_REPORTING, NULL }, { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, + { "page-per-vq", QEMU_CAPS_VIRTIO_PAGE_PER_VQ, NULL }, }; @@ -1411,6 +1413,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioBlk[] = { { "werror", QEMU_CAPS_STORAGE_WERROR, NULL }, { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, + { "page-per-vq", QEMU_CAPS_VIRTIO_PAGE_PER_VQ, NULL }, }; static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[] = { @@ -1425,6 +1428,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[] = { { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER, NULL }, { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, + { "page-per-vq", QEMU_CAPS_VIRTIO_PAGE_PER_VQ, NULL }, }; static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPort[] = { @@ -1446,6 +1450,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioSCSI[] = { { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL }, { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, + { "page-per-vq", QEMU_CAPS_VIRTIO_PAGE_PER_VQ, NULL }, }; static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVfioPCI[] = { @@ -1519,6 +1524,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioGpu[] = { { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL }, { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, + { "page-per-vq", QEMU_CAPS_VIRTIO_PAGE_PER_VQ, NULL }, }; static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsICH9[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2bbfc15dc4..4300d7e5d2 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -624,6 +624,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI, /* -device virtio-mem-pci */ QEMU_CAPS_MEMORY_BACKEND_RESERVE, /* -object memory-backend-*.reserve= */ QEMU_CAPS_PIIX4_ACPI_ROOT_PCI_HOTPLUG, /* -M pc PIIX4_PM.acpi-root-pci-hotplug */ + QEMU_CAPS_VIRTIO_PAGE_PER_VQ, /* virtio.page_per_vq */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml index e9fd6e96e5..1527df31ae 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -96,6 +96,7 @@ <flag name='migration-param.downtime'/> <flag name='migration-param.xbzrle-cache-size'/> <flag name='input-linux'/> + <flag name='virtio.page-per-vq'/> <version>2011000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100288</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml index d6549d6440..19c999c80a 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml @@ -172,6 +172,7 @@ <flag name='am53c974'/> <flag name='cpu-max'/> <flag name='input-linux'/> + <flag name='virtio.page-per-vq'/> <version>2011000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100288</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml index 302206cf6f..7a3a9286e6 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml @@ -143,6 +143,7 @@ <flag name='rotation-rate'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>2012000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml index bf3afc904c..bb1a794421 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml @@ -142,6 +142,7 @@ <flag name='cpu-max'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml index cd5e39b5f3..9fe874f779 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -110,6 +110,7 @@ <flag name='vhost-user-blk'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>2012000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml index 354a95cebc..f39c166d57 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -184,6 +184,7 @@ <flag name='cpu-max'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>2011090</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100289</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml index 21d5c088d7..1a6c7418fa 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml @@ -144,6 +144,7 @@ <flag name='cpu-max'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>2012050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml index 6e60415999..049880024a 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml @@ -113,6 +113,7 @@ <flag name='vhost-user-blk'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml index cffe482bf6..5d44668cf8 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml @@ -190,6 +190,7 @@ <flag name='cpu-max'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>3000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100239</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml index b8739804e2..285eb46ccf 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.xml @@ -149,6 +149,7 @@ <flag name='cpu-max'/> <flag name='input-linux'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>3000091</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml index 514e5985ac..49cf1ace45 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml @@ -194,6 +194,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>3000092</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml index af1ccb93ed..7c5649c26f 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml @@ -159,6 +159,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml index 2d7f0e91df..39d6b233a4 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml @@ -166,6 +166,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml index 363e3aba12..5cec9a585b 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml @@ -157,6 +157,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml index 16915bf78b..0a71c1f562 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml @@ -157,6 +157,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml index 3a39d82ae6..d2645f894d 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml @@ -125,6 +125,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml index 5e733fec13..bcf51bf393 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -202,6 +202,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100240</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml index ba9ee0dd96..21bbcd1671 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -209,6 +209,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4001000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 976e8447f8..a184a300c1 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -174,6 +174,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 963fad815e..8b03f64447 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -173,6 +173,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index 64a43940a4..159bed2843 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -138,6 +138,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 034a770b08..ad83cc404c 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -220,6 +220,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index 2c125044de..35456c4f40 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -184,6 +184,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml index ce0f63c2b8..831a7ede73 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -192,6 +192,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml index 05c8e0e467..d9227e02fc 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml @@ -177,6 +177,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml index aae5fe018f..b3443808d6 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -227,6 +227,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml index e9ae3c5abb..a56352a9e3 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -230,6 +230,7 @@ <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> <flag name='virtio-mem-pci'/> + <flag name='virtio.page-per-vq'/> <version>5001000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml index 59e1f746ca..7a574d9fd4 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml @@ -188,6 +188,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700243</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml index 0ce8a5ba2f..dac4f66c3a 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml @@ -194,6 +194,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900243</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml index 1219ba2666..90083a0246 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml @@ -179,6 +179,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>0</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml index db92662f4c..4c4f0a234e 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml @@ -145,6 +145,7 @@ <flag name='input-linux'/> <flag name='query-display-options'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>5002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100243</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml index 98b5f34f2b..e43459a1c7 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -232,6 +232,7 @@ <flag name='virtio-blk.queue-size'/> <flag name='virtio-mem-pci'/> <flag name='piix4.acpi-root-pci-hotplug'/> + <flag name='virtio.page-per-vq'/> <version>5002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100243</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml index 6a9833a176..666c81d457 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml @@ -196,6 +196,7 @@ <flag name='query-display-options'/> <flag name='set-action'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>6000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml index a96c756ef8..3ed5985a78 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml @@ -153,6 +153,7 @@ <flag name='s390-pv-guest'/> <flag name='set-action'/> <flag name='virtio-blk.queue-size'/> + <flag name='virtio.page-per-vq'/> <version>6000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml index f13a909314..524347e6e1 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -240,6 +240,7 @@ <flag name='virtio-blk.queue-size'/> <flag name='virtio-mem-pci'/> <flag name='piix4.acpi-root-pci-hotplug'/> + <flag name='virtio.page-per-vq'/> <version>6000000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml index 87b37a2b7c..00bb6a1a79 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml @@ -243,6 +243,7 @@ <flag name='virtio-mem-pci'/> <flag name='memory-backend-file.reserve'/> <flag name='piix4.acpi-root-pci-hotplug'/> + <flag name='virtio.page-per-vq'/> <version>6001000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100243</microcodeVersion> -- 2.31.1

On Sat, Oct 09, 2021 at 17:37:42 +0800, Han Han wrote:
The qemu capability will be used for the page_per_vq option of virtio devices.
Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 +
NACK, the capability is apparently supported with the oldest qemu libvirt supports so there's no point adding it.

On Mon, Oct 11, 2021 at 3:50 AM Peter Krempa <pkrempa@redhat.com> wrote:
On Sat, Oct 09, 2021 at 17:37:42 +0800, Han Han wrote:
The qemu capability will be used for the page_per_vq option of virtio devices.
Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 +
NACK,
OK. BTW, where to check the least version of qemu that libvirt supports?
the capability is apparently supported with the oldest qemu libvirt supports so there's no point adding it.

On 10/11/21 2:54 AM, Han Han wrote:
On Mon, Oct 11, 2021 at 3:50 AM Peter Krempa <pkrempa@redhat.com <mailto:pkrempa@redhat.com>> wrote:
On Sat, Oct 09, 2021 at 17:37:42 +0800, Han Han wrote: > The qemu capability will be used for the page_per_vq option of virtio > devices. > > Signed-off-by: Han Han <hhan@redhat.com <mailto:hhan@redhat.com>> > --- > src/qemu/qemu_capabilities.c | 6 ++++++ > src/qemu/qemu_capabilities.h | 1 + > tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + > tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 +
NACK,
OK. BTW, where to check the least version of qemu that libvirt supports?
libvirt.git $ grep QEMU_MIN src/qemu/qemu_capabilities.c #define QEMU_MIN_MAJOR 2 #define QEMU_MIN_MINOR 11 #define QEMU_MIN_MICRO 0 So can you please post v3 and fix also the signed-off we've talked about earlier? Thanks. Michal

On Thu, Oct 14, 2021 at 5:53 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 10/11/21 2:54 AM, Han Han wrote:
On Mon, Oct 11, 2021 at 3:50 AM Peter Krempa <pkrempa@redhat.com <mailto:pkrempa@redhat.com>> wrote:
On Sat, Oct 09, 2021 at 17:37:42 +0800, Han Han wrote: > The qemu capability will be used for the page_per_vq option of
virtio
> devices. > > Signed-off-by: Han Han <hhan@redhat.com <mailto:hhan@redhat.com>> > --- > src/qemu/qemu_capabilities.c | 6 ++++++ > src/qemu/qemu_capabilities.h | 1 + > tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + > tests/qemucapabilitiesdata/caps_2.11.0.x86_64.xml | 1 +
NACK,
OK. BTW, where to check the least version of qemu that libvirt supports?
libvirt.git $ grep QEMU_MIN src/qemu/qemu_capabilities.c #define QEMU_MIN_MAJOR 2 #define QEMU_MIN_MINOR 11 #define QEMU_MIN_MICRO 0
So can you please post v3 and fix also the signed-off we've talked about earlier? Thanks.
OK. v3: https://listman.redhat.com/archives/libvir-list/2021-October/msg00666.html
Michal

Signed-off-by: Han Han <hhan@redhat.com> --- docs/formatdomain.rst | 9 +++++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 16 ++++++++++++++++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 6 ++++++ 5 files changed, 37 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index a02802a954..289e7bf5f1 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3548,6 +3548,15 @@ virtqueues are actually used depends on the feature negotiation between QEMU, vhost backends and guest drivers. Possible values are ``on`` or ``off``. :since:`Since 6.3.0 (QEMU and KVM only)` +This optional attribute ``page_per_vq`` controls the layout of the notification +capabilities exposed to the guest. When enabled, each virtio queue will have a +dedicated page on the device BAR exposed to the guest. It is recommended to be +used when vDPA is enabled on the hypervisor, as it enables mapping the +notification area to the physical device, which is only supported in page +granularity. The default is determined by QEMU. :since:`Since 7.8.0` +Note: In general you should leave this option alone, unless you are very certain +you know what you are doing. + :anchor:`<a id="elementsVirtioTransitional"/>` Virtio transitional devices diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ec5bd91740..f71e375a33 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6810,6 +6810,11 @@ <ref name="virOnOff"/> </attribute> </optional> + <optional> + <attribute name="page_per_vq"> + <ref name="virOnOff"/> + </attribute> + </optional> </define> <define name="usbmaster"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b8370f6950..04bdd110b6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1630,6 +1630,10 @@ virDomainVirtioOptionsParseXML(xmlNodePtr driver, &(*virtio)->packed) < 0) return -1; + if (virXMLPropTristateSwitch(driver, "page_per_vq", VIR_XML_PROP_NONE, + &(*virtio)->page_per_vq) < 0) + return -1; + return 0; } @@ -6314,6 +6318,10 @@ virDomainVirtioOptionsFormat(virBuffer *buf, virBufferAsprintf(buf, " packed='%s'", virTristateSwitchTypeToString(virtio->packed)); } + if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(buf, " page_per_vq='%s'", + virTristateSwitchTypeToString(virtio->page_per_vq)); + } } @@ -20784,6 +20792,14 @@ virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptions *src, virTristateSwitchTypeToString(src->packed)); return false; } + if (src->page_per_vq != dst->page_per_vq) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device page_per_vq option '%s' does not " + "match source '%s'"), + virTristateSwitchTypeToString(dst->page_per_vq), + virTristateSwitchTypeToString(src->page_per_vq)); + return false; + } return true; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c23c233184..d6bc3dd0d2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2733,6 +2733,7 @@ struct _virDomainVirtioOptions { virTristateSwitch iommu; virTristateSwitch ats; virTristateSwitch packed; + virTristateSwitch page_per_vq; }; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f023d22f23..80401cf8c7 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -135,6 +135,12 @@ virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOptions *virtio) "for virtio devices")); return -1; } + + if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("page_per_vq option is only supported for virtio devices")); + return -1; + } return 0; } -- 2.31.1

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925363 Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_command.c | 4 ++ src/qemu/qemu_hotplug.c | 3 +- src/qemu/qemu_validate.c | 7 ++++ .../virtio-options-controller-page_per_vq.err | 1 + .../virtio-options-controller-page_per_vq.xml | 38 +++++++++++++++++++ .../virtio-options-disk-page_per_vq.err | 1 + .../virtio-options-disk-page_per_vq.xml | 34 +++++++++++++++++ .../virtio-options-fs-page_per_vq.err | 1 + .../virtio-options-fs-page_per_vq.xml | 34 +++++++++++++++++ .../virtio-options-input-page_per_vq.err | 1 + .../virtio-options-input-page_per_vq.xml | 30 +++++++++++++++ .../virtio-options-memballoon-page_per_vq.err | 1 + .../virtio-options-memballoon-page_per_vq.xml | 23 +++++++++++ .../virtio-options-net-page_per_vq.err | 1 + .../virtio-options-net-page_per_vq.xml | 34 +++++++++++++++++ .../virtio-options-rng-page_per_vq.err | 1 + .../virtio-options-rng-page_per_vq.xml | 32 ++++++++++++++++ .../virtio-options-video-page_per_vq.err | 1 + .../virtio-options-video-page_per_vq.xml | 36 ++++++++++++++++++ .../virtio-options.x86_64-latest.args | 26 ++++++------- tests/qemuxml2argvdata/virtio-options.xml | 26 ++++++------- tests/qemuxml2argvtest.c | 14 +++++++ 22 files changed, 322 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err create mode 100644 tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 28bca1519c..36159971fa 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -636,6 +636,10 @@ qemuBuildVirtioOptionsStr(virBuffer *buf, virBufferAsprintf(buf, ",packed=%s", virTristateSwitchTypeToString(virtio->packed)); } + if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(buf, ",page-per-vq=%s", + virTristateSwitchTypeToString(virtio->page_per_vq)); + } } static int diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 22239b2689..9bbbab47e3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3675,7 +3675,8 @@ qemuDomainChangeNet(virQEMUDriver *driver, (olddev->virtio && newdev->virtio && (olddev->virtio->iommu != newdev->virtio->iommu || olddev->virtio->ats != newdev->virtio->ats || - olddev->virtio->packed != newdev->virtio->packed))) { + olddev->virtio->packed != newdev->virtio->packed || + olddev->virtio->page_per_vq != newdev->virtio->page_per_vq))) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot modify virtio network device driver options")); goto cleanup; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index c84508cb64..233544e944 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1430,6 +1430,13 @@ qemuValidateDomainVirtioOptions(const virDomainVirtioOptions *virtio, "QEMU binary")); return -1; } + + if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PAGE_PER_VQ)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the page_per_vq setting is not supported with this QEMU binary")); + return -1; + } return 0; } diff --git a/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml new file mode 100644 index 0000000000..395142ba8a --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml @@ -0,0 +1,38 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <controller type='scsi' index='0' model='virtio-scsi'> + <driver page_per_vq='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='scsi' index='1' model='virtio-scsi'> + <driver page_per_vq='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <controller type='virtio-serial' index='0'> + <driver page_per_vq='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> + <controller type='virtio-serial' index='1'> + <driver page_per_vq='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </controller> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml new file mode 100644 index 0000000000..8040685f7a --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' page_per_vq='on'/> + <source file='/var/lib/libvirt/images/img1'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' page_per_vq='off'/> + <source file='/var/lib/libvirt/images/img2'/> + <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </disk> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml new file mode 100644 index 0000000000..abf89ab53b --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <filesystem type='mount' accessmode='passthrough'> + <driver page_per_vq='on'/> + <source dir='/export/fs1'/> + <target dir='fs1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='passthrough'> + <driver page_per_vq='off'/> + <source dir='/export/fs2'/> + <target dir='fs2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </filesystem> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml new file mode 100644 index 0000000000..e08234786b --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='virtio'> + <driver page_per_vq='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </input> + <input type='keyboard' bus='virtio'> + <driver page_per_vq='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </input> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml new file mode 100644 index 0000000000..cf7c3da971 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml @@ -0,0 +1,23 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <driver page_per_vq='on'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml new file mode 100644 index 0000000000..2c38daa0d5 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <interface type='user'> + <mac address='52:54:56:58:5a:5c'/> + <model type='virtio'/> + <driver page_per_vq='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </interface> + <interface type='user'> + <mac address='62:64:66:68:6a:6c'/> + <model type='virtio'/> + <driver page_per_vq='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml new file mode 100644 index 0000000000..c93d70156c --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver page_per_vq='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </rng> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver page_per_vq='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </rng> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err new file mode 100644 index 0000000000..475aa8be43 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err @@ -0,0 +1 @@ +unsupported configuration: the page_per_vq setting is not supported with this QEMU binary diff --git a/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml new file mode 100644 index 0000000000..2d79932135 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <video> + <driver page_per_vq='on' name='vhostuser'/> + <model type='virtio' heads='1' primary='yes'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <video> + <driver page_per_vq='off' name='vhostuser'/> + <model type='virtio' heads='1' primary='no'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args index 06a4520036..4b69080502 100644 --- a/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args @@ -27,26 +27,26 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -no-acpi \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,id=scsi0,bus=pci.0,addr=0x8 \ --device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0x9 \ +-device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=scsi0,bus=pci.0,addr=0x8 \ +-device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0x9 \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/img1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ --device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xa,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \ +-device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0xa,drive=libvirt-1-format,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,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0x3 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0x3 \ -fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,path=/export/fs2 \ --device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0x4 \ +-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0x4 \ -netdev user,id=hostnet0 \ --device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,addr=0x6,iommu_platform=on,ats=on,packed=on \ --device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,packed=on \ --device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,ats=on,packed=on \ --device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,ats=on,packed=on \ --device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,addr=0x12,iommu_platform=on,ats=on,packed=on \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,addr=0x6,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ +-device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ +-device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ +-device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,addr=0x12,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ -audiodev id=audio1,driver=none \ -chardev socket,id=chr-vu-video0,fd=1729 \ --device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2,iommu_platform=on,ats=on,packed=on \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,ats=on,packed=on \ +-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,ats=on,packed=on,page-per-vq=on \ -object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/random"}' \ --device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xd \ +-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0xd \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-options.xml b/tests/qemuxml2argvdata/virtio-options.xml index 9c9b80d5c4..59e293d8e9 100644 --- a/tests/qemuxml2argvdata/virtio-options.xml +++ b/tests/qemuxml2argvdata/virtio-options.xml @@ -18,7 +18,7 @@ <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/> + <driver name='qemu' type='raw' iommu='on' ats='on' packed='on' page_per_vq='on'/> <source file='/var/lib/libvirt/images/img1'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> @@ -30,22 +30,22 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='scsi' index='0' model='virtio-scsi'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='virtio-serial' index='0'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </controller> <filesystem type='mount' accessmode='passthrough'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <source dir='/export/fs1'/> <target dir='fs1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </filesystem> <filesystem type='mount' accessmode='mapped'> - <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on'/> + <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on' page_per_vq='on'/> <source dir='/export/fs2'/> <target dir='fs2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> @@ -53,23 +53,23 @@ <interface type='user'> <mac address='52:54:56:58:5a:5c'/> <model type='virtio'/> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <input type='mouse' bus='virtio'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/> </input> <input type='keyboard' bus='virtio'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> </input> <input type='tablet' bus='virtio'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/> </input> <input type='passthrough' bus='virtio'> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <source evdev='/dev/input/event1234'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/> </input> @@ -77,7 +77,7 @@ <input type='keyboard' bus='ps2'/> <audio id='1' type='none'/> <video> - <driver iommu='on' ats='on' packed='on' name='vhostuser'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on' name='vhostuser'/> <model type='virtio' heads='1' primary='yes'> <acceleration accel3d='yes' rendernode='/dev/dri/test'/> </model> @@ -85,11 +85,11 @@ </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> </memballoon> <rng model='virtio'> <backend model='random'>/dev/random</backend> - <driver iommu='on' ats='on' packed='on'/> + <driver iommu='on' ats='on' packed='on' page_per_vq='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/> </rng> </devices> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7df3946751..eff86eccf5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3309,6 +3309,20 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_VIRTIO_GPU_VIRGL, QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-page_per_vq", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-disk-page_per_vq"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-fs-page_per_vq"); + DO_TEST_PARSE_ERROR("virtio-options-input-page_per_vq", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-page_per_vq"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-freepage-reporting"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-net-page_per_vq"); + DO_TEST_PARSE_ERROR("virtio-options-rng-page_per_vq", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-page_per_vq", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); -- 2.31.1

On Sat, Oct 09, 2021 at 17:37:44 +0800, Han Han wrote:
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925363
Signed-off-by: Han Han <hhan@redhat.com> --- src/qemu/qemu_command.c | 4 ++ src/qemu/qemu_hotplug.c | 3 +- src/qemu/qemu_validate.c | 7 ++++
Please make sure to wait for my series converting -device to JSON, or rebase this patch to it when you'll be removing the remnants of the NACKed capability.
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 28bca1519c..36159971fa 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -636,6 +636,10 @@ qemuBuildVirtioOptionsStr(virBuffer *buf, virBufferAsprintf(buf, ",packed=%s", virTristateSwitchTypeToString(virtio->packed)); } + if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(buf, ",page-per-vq=%s", + virTristateSwitchTypeToString(virtio->page_per_vq)); + }
This will conflict, the formatting of virtio options will move once I push it.
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7df3946751..eff86eccf5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3309,6 +3309,20 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_VIRTIO_GPU_VIRGL, QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-page_per_vq", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-disk-page_per_vq"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-fs-page_per_vq"); + DO_TEST_PARSE_ERROR("virtio-options-input-page_per_vq", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-page_per_vq"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-freepage-reporting"); + DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-net-page_per_vq"); + DO_TEST_PARSE_ERROR("virtio-options-rng-page_per_vq", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-page_per_vq", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VHOST_USER_GPU);
Please try to use the real caps versions (DO_TEST_CAPS_*) as much as possible. Many of the test cases also won't make sense if the capability is always present.
participants (3)
-
Han Han
-
Michal Prívozník
-
Peter Krempa