2019-07-22 20:51:40 +02:00
|
|
|
#include "qemu/osdep.h"
|
2022-03-30 11:39:05 +02:00
|
|
|
#include "libqtest.h"
|
2019-07-22 20:51:40 +02:00
|
|
|
|
2019-08-27 16:02:41 +02:00
|
|
|
const char common_args[] = "-nodefaults -machine none";
|
|
|
|
|
2019-07-22 20:51:40 +02:00
|
|
|
static void test_modules_load(const void *data)
|
|
|
|
{
|
|
|
|
QTestState *qts;
|
2019-08-22 19:42:13 +02:00
|
|
|
const char **args = (const char **)data;
|
2019-07-22 20:51:40 +02:00
|
|
|
|
2019-08-27 16:02:41 +02:00
|
|
|
qts = qtest_init(common_args);
|
2019-07-22 20:51:40 +02:00
|
|
|
qtest_module_load(qts, args[0], args[1]);
|
|
|
|
qtest_quit(qts);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
const char *modules[] = {
|
blkio: add libblkio block driver
libblkio (https://gitlab.com/libblkio/libblkio/) is a library for
high-performance disk I/O. It currently supports io_uring,
virtio-blk-vhost-user, and virtio-blk-vhost-vdpa with additional drivers
under development.
One of the reasons for developing libblkio is that other applications
besides QEMU can use it. This will be particularly useful for
virtio-blk-vhost-user which applications may wish to use for connecting
to qemu-storage-daemon.
libblkio also gives us an opportunity to develop in Rust behind a C API
that is easy to consume from QEMU.
This commit adds io_uring, nvme-io_uring, virtio-blk-vhost-user, and
virtio-blk-vhost-vdpa BlockDrivers to QEMU using libblkio. It will be
easy to add other libblkio drivers since they will share the majority of
code.
For now I/O buffers are copied through bounce buffers if the libblkio
driver requires it. Later commits add an optimization for
pre-registering guest RAM to avoid bounce buffers.
The syntax is:
--blockdev io_uring,node-name=drive0,filename=test.img,readonly=on|off,cache.direct=on|off
--blockdev nvme-io_uring,node-name=drive0,filename=/dev/ng0n1,readonly=on|off,cache.direct=on
--blockdev virtio-blk-vhost-vdpa,node-name=drive0,path=/dev/vdpa...,readonly=on|off,cache.direct=on
--blockdev virtio-blk-vhost-user,node-name=drive0,path=vhost-user-blk.sock,readonly=on|off,cache.direct=on
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20221013185908.1297568-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-10-13 20:58:57 +02:00
|
|
|
#ifdef CONFIG_BLKIO
|
|
|
|
"block-", "blkio",
|
|
|
|
#endif
|
2019-07-22 20:51:40 +02:00
|
|
|
#ifdef CONFIG_CURL
|
|
|
|
"block-", "curl",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_GLUSTERFS
|
|
|
|
"block-", "gluster",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_LIBISCSI
|
|
|
|
"block-", "iscsi",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_LIBNFS
|
|
|
|
"block-", "nfs",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_LIBSSH
|
|
|
|
"block-", "ssh",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_RBD
|
|
|
|
"block-", "rbd",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_AUDIO_ALSA
|
|
|
|
"audio-", "alsa",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_AUDIO_OSS
|
|
|
|
"audio-", "oss",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_AUDIO_PA
|
|
|
|
"audio-", "pa",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_AUDIO_SDL
|
|
|
|
"audio-", "sdl",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_CURSES
|
|
|
|
"ui-", "curses",
|
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_GTK) && defined(CONFIG_VTE)
|
|
|
|
"ui-", "gtk",
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SDL
|
|
|
|
"ui-", "sdl",
|
2019-08-27 16:02:40 +02:00
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_SPICE) && defined(CONFIG_GIO)
|
|
|
|
"ui-", "spice-app",
|
2019-07-22 20:51:40 +02:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
int i;
|
|
|
|
|
|
|
|
g_test_init(&argc, &argv, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS(modules); i += 2) {
|
2019-11-13 22:09:35 +01:00
|
|
|
char *testname = g_strdup_printf("/module/load/%s%s",
|
|
|
|
modules[i], modules[i + 1]);
|
2019-07-22 20:51:40 +02:00
|
|
|
qtest_add_data_func(testname, modules + i, test_modules_load);
|
|
|
|
g_free(testname);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_test_run();
|
|
|
|
}
|