42a945317b
- kvm-virtio-iommu-Fix-64kB-host-page-size-VFIO-device-ass.patch [bz#2211609 bz#2211634] - kvm-virtio-iommu-Rework-the-traces-in-virtio_iommu_set_p.patch [bz#2211609 bz#2211634] - kvm-vfio-pci-add-support-for-VF-token.patch [bz#2192818] - kvm-vfio-migration-Skip-log_sync-during-migration-SETUP-.patch [bz#2192818] - kvm-vfio-pci-Static-Resizable-BAR-capability.patch [bz#2192818] - kvm-vfio-pci-Fix-a-use-after-free-issue.patch [bz#2192818] - kvm-util-vfio-helpers-Use-g_file_read_link.patch [bz#2192818] - kvm-migration-Make-all-functions-check-have-the-same-for.patch [bz#2192818] - kvm-migration-Move-migration_properties-to-options.c.patch [bz#2192818] - kvm-migration-Add-switchover-ack-capability.patch [bz#2192818] - kvm-migration-Implement-switchover-ack-logic.patch [bz#2192818] - kvm-migration-Enable-switchover-ack-capability.patch [bz#2192818] - kvm-vfio-migration-Refactor-vfio_save_block-to-return-sa.patch [bz#2192818] - kvm-vfio-migration-Store-VFIO-migration-flags-in-VFIOMig.patch [bz#2192818] - kvm-vfio-migration-Add-VFIO-migration-pre-copy-support.patch [bz#2192818] - kvm-vfio-migration-Add-support-for-switchover-ack-capabi.patch [bz#2192818] - kvm-vfio-Implement-a-common-device-info-helper.patch [bz#2192818] - kvm-hw-vfio-pci-quirks-Support-alternate-offset-for-GPUD.patch [bz#2192818] - kvm-vfio-pci-Call-vfio_prepare_kvm_msi_virq_batch-in-MSI.patch [bz#2192818] - kvm-vfio-migration-Reset-bytes_transferred-properly.patch [bz#2192818] - kvm-vfio-migration-Make-VFIO-migration-non-experimental.patch [bz#2192818] - kvm-vfio-pci-Fix-a-segfault-in-vfio_realize.patch [bz#2192818] - kvm-vfio-pci-Free-leaked-timer-in-vfio_realize-error-pat.patch [bz#2192818] - kvm-hw-vfio-pci-quirks-Sanitize-capability-pointer.patch [bz#2192818] - kvm-vfio-pci-Disable-INTx-in-vfio_realize-error-path.patch [bz#2192818] - kvm-vfio-migration-Change-vIOMMU-blocker-from-global-to-.patch [bz#2192818] - kvm-vfio-migration-Free-resources-when-vfio_migration_re.patch [bz#2192818] - kvm-vfio-migration-Remove-print-of-Migration-disabled.patch [bz#2192818] - kvm-vfio-migration-Return-bool-type-for-vfio_migration_r.patch [bz#2192818] - kvm-vfio-Fix-null-pointer-dereference-bug-in-vfio_bars_f.patch [bz#2192818] - kvm-pc-bios-s390-ccw-Makefile-Use-z-noexecstack-to-silen.patch [bz#2220866] - kvm-pc-bios-s390-ccw-Fix-indentation-in-start.S.patch [bz#2220866] - kvm-pc-bios-s390-ccw-Provide-space-for-initial-stack-fra.patch [bz#2220866] - kvm-pc-bios-s390-ccw-Don-t-use-__bss_start-with-the-larl.patch [bz#2220866] - kvm-ui-Fix-pixel-colour-channel-order-for-PNG-screenshot.patch [bz#2222579] - kvm-block-blkio-fix-module_block.py-parsing.patch [bz#2213317] - kvm-Fix-virtio-blk-vhost-vdpa-typo-in-spec-file.patch [bz#2213317] - Resolves: bz#2211609 (With virtio-iommu and vfio-pci, qemu reports "warning: virtio-iommu page mask 0xfffffffffffff000 does not match 0x40201000") - Resolves: bz#2211634 ([aarch64] With virtio-iommu and vfio-pci, qemu coredump when host using kernel-64k package) - Resolves: bz#2192818 ([VFIO LM] Live migration) - Resolves: bz#2220866 (Misaligned symbol for s390-ccw image during qemu-kvm build) - Resolves: bz#2222579 (PNG screendump doesn't save screen correctly) - Resolves: bz#2213317 (Enable libblkio-based block drivers in QEMU)
206 lines
8.0 KiB
Diff
206 lines
8.0 KiB
Diff
From 545482400ea87d54b1b839587f8aaad41e30692f Mon Sep 17 00:00:00 2001
|
|
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Date: Tue, 4 Jul 2023 14:34:36 +0200
|
|
Subject: [PATCH 36/37] block/blkio: fix module_block.py parsing
|
|
|
|
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-MergeRequest: 181: block/blkio: fix module_block.py parsing
|
|
RH-Bugzilla: 2213317
|
|
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
RH-Commit: [1/2] c85df95824f4889526a73527771dec9efcb06926 (stefanha/centos-stream-qemu-kvm)
|
|
|
|
When QEMU is built with --enable-modules, the module_block.py script
|
|
parses block/*.c to find block drivers that are built as modules. The
|
|
script generates a table of block drivers called block_driver_modules[].
|
|
This table is used for block driver module loading.
|
|
|
|
The blkio.c driver uses macros to define its BlockDriver structs. This
|
|
was done to avoid code duplication but the module_block.py script is
|
|
unable to parse the macro. The result is that libblkio-based block
|
|
drivers can be built as modules but will not be found at runtime.
|
|
|
|
One fix is to make the module_block.py script or build system fancier so
|
|
it can parse C macros (e.g. by parsing the preprocessed source code). I
|
|
chose not to do this because it raises the complexity of the build,
|
|
making future issues harder to debug.
|
|
|
|
Keep things simple: use the macro to avoid duplicating BlockDriver
|
|
function pointers but define .format_name and .protocol_name manually
|
|
for each BlockDriver. This way the module_block.py is able to parse the
|
|
code.
|
|
|
|
Also get rid of the block driver name macros (e.g. DRIVER_IO_URING)
|
|
because module_block.py cannot parse them either.
|
|
|
|
Fixes: fd66dbd424f5 ("blkio: add libblkio block driver")
|
|
Reported-by: Qing Wang <qinwang@redhat.com>
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
Message-id: 20230704123436.187761-1-stefanha@redhat.com
|
|
Cc: Stefano Garzarella <sgarzare@redhat.com>
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
(cherry picked from commit c21eae1ccc782440f320accb6f90c66cb8f45ee9)
|
|
|
|
Conflicts:
|
|
- Downstream lacks commit 28ff7b4dfbb5 ("block/blkio: convert to
|
|
blk_io_plug_call() API") so keep the .bdrv_co_io_unplug callback.
|
|
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
---
|
|
block/blkio.c | 118 ++++++++++++++++++++++++++------------------------
|
|
1 file changed, 61 insertions(+), 57 deletions(-)
|
|
|
|
diff --git a/block/blkio.c b/block/blkio.c
|
|
index 6a6f20f923..afcec359f2 100644
|
|
--- a/block/blkio.c
|
|
+++ b/block/blkio.c
|
|
@@ -21,16 +21,6 @@
|
|
|
|
#include "block/block-io.h"
|
|
|
|
-/*
|
|
- * Keep the QEMU BlockDriver names identical to the libblkio driver names.
|
|
- * Using macros instead of typing out the string literals avoids typos.
|
|
- */
|
|
-#define DRIVER_IO_URING "io_uring"
|
|
-#define DRIVER_NVME_IO_URING "nvme-io_uring"
|
|
-#define DRIVER_VIRTIO_BLK_VFIO_PCI "virtio-blk-vfio-pci"
|
|
-#define DRIVER_VIRTIO_BLK_VHOST_USER "virtio-blk-vhost-user"
|
|
-#define DRIVER_VIRTIO_BLK_VHOST_VDPA "virtio-blk-vhost-vdpa"
|
|
-
|
|
/*
|
|
* Allocated bounce buffers are kept in a list sorted by buffer address.
|
|
*/
|
|
@@ -743,15 +733,15 @@ static int blkio_file_open(BlockDriverState *bs, QDict *options, int flags,
|
|
return ret;
|
|
}
|
|
|
|
- if (strcmp(blkio_driver, DRIVER_IO_URING) == 0) {
|
|
+ if (strcmp(blkio_driver, "io_uring") == 0) {
|
|
ret = blkio_io_uring_open(bs, options, flags, errp);
|
|
- } else if (strcmp(blkio_driver, DRIVER_NVME_IO_URING) == 0) {
|
|
+ } else if (strcmp(blkio_driver, "nvme-io_uring") == 0) {
|
|
ret = blkio_nvme_io_uring(bs, options, flags, errp);
|
|
- } else if (strcmp(blkio_driver, DRIVER_VIRTIO_BLK_VFIO_PCI) == 0) {
|
|
+ } else if (strcmp(blkio_driver, "virtio-blk-vfio-pci") == 0) {
|
|
ret = blkio_virtio_blk_common_open(bs, options, flags, errp);
|
|
- } else if (strcmp(blkio_driver, DRIVER_VIRTIO_BLK_VHOST_USER) == 0) {
|
|
+ } else if (strcmp(blkio_driver, "virtio-blk-vhost-user") == 0) {
|
|
ret = blkio_virtio_blk_common_open(bs, options, flags, errp);
|
|
- } else if (strcmp(blkio_driver, DRIVER_VIRTIO_BLK_VHOST_VDPA) == 0) {
|
|
+ } else if (strcmp(blkio_driver, "virtio-blk-vhost-vdpa") == 0) {
|
|
ret = blkio_virtio_blk_common_open(bs, options, flags, errp);
|
|
} else {
|
|
g_assert_not_reached();
|
|
@@ -1027,50 +1017,64 @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp)
|
|
* - truncate
|
|
*/
|
|
|
|
-#define BLKIO_DRIVER(name, ...) \
|
|
- { \
|
|
- .format_name = name, \
|
|
- .protocol_name = name, \
|
|
- .instance_size = sizeof(BDRVBlkioState), \
|
|
- .bdrv_file_open = blkio_file_open, \
|
|
- .bdrv_close = blkio_close, \
|
|
- .bdrv_co_getlength = blkio_co_getlength, \
|
|
- .bdrv_co_truncate = blkio_truncate, \
|
|
- .bdrv_co_get_info = blkio_co_get_info, \
|
|
- .bdrv_attach_aio_context = blkio_attach_aio_context, \
|
|
- .bdrv_detach_aio_context = blkio_detach_aio_context, \
|
|
- .bdrv_co_pdiscard = blkio_co_pdiscard, \
|
|
- .bdrv_co_preadv = blkio_co_preadv, \
|
|
- .bdrv_co_pwritev = blkio_co_pwritev, \
|
|
- .bdrv_co_flush_to_disk = blkio_co_flush, \
|
|
- .bdrv_co_pwrite_zeroes = blkio_co_pwrite_zeroes, \
|
|
- .bdrv_co_io_unplug = blkio_co_io_unplug, \
|
|
- .bdrv_refresh_limits = blkio_refresh_limits, \
|
|
- .bdrv_register_buf = blkio_register_buf, \
|
|
- .bdrv_unregister_buf = blkio_unregister_buf, \
|
|
- __VA_ARGS__ \
|
|
- }
|
|
-
|
|
-static BlockDriver bdrv_io_uring = BLKIO_DRIVER(
|
|
- DRIVER_IO_URING,
|
|
- .bdrv_needs_filename = true,
|
|
-);
|
|
-
|
|
-static BlockDriver bdrv_nvme_io_uring = BLKIO_DRIVER(
|
|
- DRIVER_NVME_IO_URING,
|
|
-);
|
|
-
|
|
-static BlockDriver bdrv_virtio_blk_vfio_pci = BLKIO_DRIVER(
|
|
- DRIVER_VIRTIO_BLK_VFIO_PCI
|
|
-);
|
|
+/*
|
|
+ * Do not include .format_name and .protocol_name because module_block.py
|
|
+ * does not parse macros in the source code.
|
|
+ */
|
|
+#define BLKIO_DRIVER_COMMON \
|
|
+ .instance_size = sizeof(BDRVBlkioState), \
|
|
+ .bdrv_file_open = blkio_file_open, \
|
|
+ .bdrv_close = blkio_close, \
|
|
+ .bdrv_co_getlength = blkio_co_getlength, \
|
|
+ .bdrv_co_truncate = blkio_truncate, \
|
|
+ .bdrv_co_get_info = blkio_co_get_info, \
|
|
+ .bdrv_attach_aio_context = blkio_attach_aio_context, \
|
|
+ .bdrv_detach_aio_context = blkio_detach_aio_context, \
|
|
+ .bdrv_co_pdiscard = blkio_co_pdiscard, \
|
|
+ .bdrv_co_preadv = blkio_co_preadv, \
|
|
+ .bdrv_co_pwritev = blkio_co_pwritev, \
|
|
+ .bdrv_co_flush_to_disk = blkio_co_flush, \
|
|
+ .bdrv_co_pwrite_zeroes = blkio_co_pwrite_zeroes, \
|
|
+ .bdrv_co_io_unplug = blkio_co_io_unplug, \
|
|
+ .bdrv_refresh_limits = blkio_refresh_limits, \
|
|
+ .bdrv_register_buf = blkio_register_buf, \
|
|
+ .bdrv_unregister_buf = blkio_unregister_buf,
|
|
|
|
-static BlockDriver bdrv_virtio_blk_vhost_user = BLKIO_DRIVER(
|
|
- DRIVER_VIRTIO_BLK_VHOST_USER
|
|
-);
|
|
+/*
|
|
+ * Use the same .format_name and .protocol_name as the libblkio driver name for
|
|
+ * consistency.
|
|
+ */
|
|
|
|
-static BlockDriver bdrv_virtio_blk_vhost_vdpa = BLKIO_DRIVER(
|
|
- DRIVER_VIRTIO_BLK_VHOST_VDPA
|
|
-);
|
|
+static BlockDriver bdrv_io_uring = {
|
|
+ .format_name = "io_uring",
|
|
+ .protocol_name = "io_uring",
|
|
+ .bdrv_needs_filename = true,
|
|
+ BLKIO_DRIVER_COMMON
|
|
+};
|
|
+
|
|
+static BlockDriver bdrv_nvme_io_uring = {
|
|
+ .format_name = "nvme-io_uring",
|
|
+ .protocol_name = "nvme-io_uring",
|
|
+ BLKIO_DRIVER_COMMON
|
|
+};
|
|
+
|
|
+static BlockDriver bdrv_virtio_blk_vfio_pci = {
|
|
+ .format_name = "virtio-blk-vfio-pci",
|
|
+ .protocol_name = "virtio-blk-vfio-pci",
|
|
+ BLKIO_DRIVER_COMMON
|
|
+};
|
|
+
|
|
+static BlockDriver bdrv_virtio_blk_vhost_user = {
|
|
+ .format_name = "virtio-blk-vhost-user",
|
|
+ .protocol_name = "virtio-blk-vhost-user",
|
|
+ BLKIO_DRIVER_COMMON
|
|
+};
|
|
+
|
|
+static BlockDriver bdrv_virtio_blk_vhost_vdpa = {
|
|
+ .format_name = "virtio-blk-vhost-vdpa",
|
|
+ .protocol_name = "virtio-blk-vhost-vdpa",
|
|
+ BLKIO_DRIVER_COMMON
|
|
+};
|
|
|
|
static void bdrv_blkio_init(void)
|
|
{
|
|
--
|
|
2.39.3
|
|
|