v3: - Add virtio-blk-vhost-vdpa for vdpa-blk devices including VDUSE - Add discard and write zeroes support - Rebase and adopt latest libblkio APIs v2: - Add BDRV_REQ_REGISTERED_BUF to bs.supported_write_flags [Stefano] - Use new blkioq_get_num_completions() API - Implement .bdrv_refresh_limits()
This patch series adds a QEMU BlockDriver for libblkio (https://gitlab.com/libblkio/libblkio/), a library for high-performance block device I/O. Currently libblkio has io_uring and virtio-blk-vhost-vdpa support with additional drivers in development. The first patch adds the core BlockDriver and most of the libblkio API usage. The remainder of the patch series reworks the existing QEMU bdrv_register_buf() API so virtio-blk emulation efficiently map guest RAM for libblkio - some libblkio drivers require that I/O buffer memory is pre-registered (think VFIO, vhost, etc). This block driver is functional enough to boot guests. The libblkio 1.0 release is expected soon and I will drop the "RFC" once the API is stable. See the BlockDriver struct in block/blkio.c for a list of APIs that still need to be implemented. Regarding the design: each libblkio driver is a separately named BlockDriver. That means there is an "io_uring" BlockDriver and not a generic "libblkio" BlockDriver. This way QAPI and open parameters are type-safe and mandatory parameters can be checked by QEMU. Stefan Hajnoczi (8): blkio: add io_uring block driver using libblkio numa: call ->ram_block_removed() in ram_block_notifer_remove() block: pass size to bdrv_unregister_buf() block: add BDRV_REQ_REGISTERED_BUF request flag block: add BlockRAMRegistrar stubs: add memory_region_from_host() and memory_region_get_fd() blkio: implement BDRV_REQ_REGISTERED_BUF optimization virtio-blk: use BDRV_REQ_REGISTERED_BUF optimization hint MAINTAINERS | 7 + meson_options.txt | 2 + qapi/block-core.json | 37 +- meson.build | 9 + include/block/block-common.h | 9 + include/block/block-global-state.h | 5 +- include/block/block_int-common.h | 2 +- include/hw/virtio/virtio-blk.h | 2 + include/sysemu/block-backend-global-state.h | 2 +- include/sysemu/block-ram-registrar.h | 30 + block/blkio.c | 757 ++++++++++++++++++++ block/blkverify.c | 4 +- block/block-backend.c | 4 +- block/block-ram-registrar.c | 39 + block/crypto.c | 2 + block/io.c | 36 +- block/mirror.c | 2 + block/nvme.c | 2 +- block/raw-format.c | 2 + hw/block/virtio-blk.c | 13 +- hw/core/numa.c | 17 + qemu-img.c | 4 +- stubs/memory.c | 13 + tests/qtest/modules-test.c | 3 + util/vfio-helpers.c | 5 +- block/meson.build | 2 + scripts/meson-buildoptions.sh | 3 + stubs/meson.build | 1 + 28 files changed, 987 insertions(+), 27 deletions(-) create mode 100644 include/sysemu/block-ram-registrar.h create mode 100644 block/blkio.c create mode 100644 block/block-ram-registrar.c create mode 100644 stubs/memory.c -- 2.36.1