block: Always compile virtio-blk dataplane

Dataplane doesn't depend on linux-aio any more, so we don't need the
compiling condition now.

Configure options are kept but just print a message.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1410329871-28885-4-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Fam Zheng 2014-09-10 14:17:51 +08:00 committed by Stefan Hajnoczi
parent 032f8b8158
commit 52b53c04fa
5 changed files with 6 additions and 41 deletions

21
configure vendored
View File

@ -327,7 +327,6 @@ glusterfs=""
glusterfs_discard="no" glusterfs_discard="no"
glusterfs_zerofill="no" glusterfs_zerofill="no"
archipelago="" archipelago=""
virtio_blk_data_plane=""
gtk="" gtk=""
gtkabi="" gtkabi=""
vte="" vte=""
@ -1093,9 +1092,8 @@ for opt do
;; ;;
--enable-archipelago) archipelago="yes" --enable-archipelago) archipelago="yes"
;; ;;
--disable-virtio-blk-data-plane) virtio_blk_data_plane="no" --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
;; echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
--enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
;; ;;
--disable-gtk) gtk="no" --disable-gtk) gtk="no"
;; ;;
@ -2943,16 +2941,6 @@ else
tpm_passthrough=no tpm_passthrough=no
fi fi
##########################################
# adjust virtio-blk-data-plane based on linux-aio
if test "$virtio_blk_data_plane" = "yes" -a \
"$linux_aio" != "yes" ; then
error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
elif test -z "$virtio_blk_data_plane" ; then
virtio_blk_data_plane=$linux_aio
fi
########################################## ##########################################
# attr probe # attr probe
@ -4327,7 +4315,6 @@ echo "coroutine backend $coroutine"
echo "coroutine pool $coroutine_pool" echo "coroutine pool $coroutine_pool"
echo "GlusterFS support $glusterfs" echo "GlusterFS support $glusterfs"
echo "Archipelago support $archipelago" echo "Archipelago support $archipelago"
echo "virtio-blk-data-plane $virtio_blk_data_plane"
echo "gcov $gcov_tool" echo "gcov $gcov_tool"
echo "gcov enabled $gcov" echo "gcov enabled $gcov"
echo "TPM support $tpm" echo "TPM support $tpm"
@ -4789,10 +4776,6 @@ if test "$quorum" = "yes" ; then
echo "CONFIG_QUORUM=y" >> $config_host_mak echo "CONFIG_QUORUM=y" >> $config_host_mak
fi fi
if test "$virtio_blk_data_plane" = "yes" ; then
echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
fi
if test "$vhdx" = "yes" ; then if test "$vhdx" = "yes" ; then
echo "CONFIG_VHDX=y" >> $config_host_mak echo "CONFIG_VHDX=y" >> $config_host_mak
fi fi

View File

@ -12,4 +12,4 @@ common-obj-$(CONFIG_NVME_PCI) += nvme.o
obj-$(CONFIG_SH4) += tc58128.o obj-$(CONFIG_SH4) += tc58128.o
obj-$(CONFIG_VIRTIO) += virtio-blk.o obj-$(CONFIG_VIRTIO) += virtio-blk.o
obj-$(CONFIG_VIRTIO_BLK_DATA_PLANE) += dataplane/ obj-$(CONFIG_VIRTIO) += dataplane/

View File

@ -18,10 +18,8 @@
#include "hw/block/block.h" #include "hw/block/block.h"
#include "sysemu/blockdev.h" #include "sysemu/blockdev.h"
#include "hw/virtio/virtio-blk.h" #include "hw/virtio/virtio-blk.h"
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE #include "dataplane/virtio-blk.h"
# include "dataplane/virtio-blk.h" #include "migration/migration.h"
# include "migration/migration.h"
#endif
#include "block/scsi.h" #include "block/scsi.h"
#ifdef __linux__ #ifdef __linux__
# include <scsi/sg.h> # include <scsi/sg.h>
@ -435,7 +433,6 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
.num_writes = 0, .num_writes = 0,
}; };
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
/* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start /* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start
* dataplane here instead of waiting for .set_status(). * dataplane here instead of waiting for .set_status().
*/ */
@ -443,7 +440,6 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
virtio_blk_data_plane_start(s->dataplane); virtio_blk_data_plane_start(s->dataplane);
return; return;
} }
#endif
while ((req = virtio_blk_get_request(s))) { while ((req = virtio_blk_get_request(s))) {
virtio_blk_handle_request(req, &mrb); virtio_blk_handle_request(req, &mrb);
@ -500,11 +496,9 @@ static void virtio_blk_reset(VirtIODevice *vdev)
{ {
VirtIOBlock *s = VIRTIO_BLK(vdev); VirtIOBlock *s = VIRTIO_BLK(vdev);
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
if (s->dataplane) { if (s->dataplane) {
virtio_blk_data_plane_stop(s->dataplane); virtio_blk_data_plane_stop(s->dataplane);
} }
#endif
/* /*
* This should cancel pending requests, but can't do nicely until there * This should cancel pending requests, but can't do nicely until there
@ -594,12 +588,10 @@ static void virtio_blk_set_status(VirtIODevice *vdev, uint8_t status)
VirtIOBlock *s = VIRTIO_BLK(vdev); VirtIOBlock *s = VIRTIO_BLK(vdev);
uint32_t features; uint32_t features;
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
if (s->dataplane && !(status & (VIRTIO_CONFIG_S_DRIVER | if (s->dataplane && !(status & (VIRTIO_CONFIG_S_DRIVER |
VIRTIO_CONFIG_S_DRIVER_OK))) { VIRTIO_CONFIG_S_DRIVER_OK))) {
virtio_blk_data_plane_stop(s->dataplane); virtio_blk_data_plane_stop(s->dataplane);
} }
#endif
if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) {
return; return;
@ -694,7 +686,6 @@ static const BlockDevOps virtio_block_ops = {
.resize_cb = virtio_blk_resize, .resize_cb = virtio_blk_resize,
}; };
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
/* Disable dataplane thread during live migration since it does not /* Disable dataplane thread during live migration since it does not
* update the dirty memory bitmap yet. * update the dirty memory bitmap yet.
*/ */
@ -725,7 +716,6 @@ static void virtio_blk_migration_state_changed(Notifier *notifier, void *data)
} }
} }
} }
#endif /* CONFIG_VIRTIO_BLK_DATA_PLANE */
static void virtio_blk_device_realize(DeviceState *dev, Error **errp) static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
{ {
@ -762,7 +752,6 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output); s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output);
s->complete_request = virtio_blk_complete_request; s->complete_request = virtio_blk_complete_request;
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
virtio_blk_data_plane_create(vdev, blk, &s->dataplane, &err); virtio_blk_data_plane_create(vdev, blk, &s->dataplane, &err);
if (err != NULL) { if (err != NULL) {
error_propagate(errp, err); error_propagate(errp, err);
@ -771,7 +760,6 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
} }
s->migration_state_notifier.notify = virtio_blk_migration_state_changed; s->migration_state_notifier.notify = virtio_blk_migration_state_changed;
add_migration_state_change_notifier(&s->migration_state_notifier); add_migration_state_change_notifier(&s->migration_state_notifier);
#endif
s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s); s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
register_savevm(dev, "virtio-blk", virtio_blk_id++, 2, register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
@ -789,11 +777,9 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOBlock *s = VIRTIO_BLK(dev); VirtIOBlock *s = VIRTIO_BLK(dev);
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
remove_migration_state_change_notifier(&s->migration_state_notifier); remove_migration_state_change_notifier(&s->migration_state_notifier);
virtio_blk_data_plane_destroy(s->dataplane); virtio_blk_data_plane_destroy(s->dataplane);
s->dataplane = NULL; s->dataplane = NULL;
#endif
qemu_del_vm_change_state_handler(s->change); qemu_del_vm_change_state_handler(s->change);
unregister_savevm(dev, "virtio-blk", s); unregister_savevm(dev, "virtio-blk", s);
blockdev_mark_auto_del(s->bs); blockdev_mark_auto_del(s->bs);
@ -818,9 +804,7 @@ static Property virtio_blk_properties[] = {
#ifdef __linux__ #ifdef __linux__
DEFINE_PROP_BIT("scsi", VirtIOBlock, blk.scsi, 0, true), DEFINE_PROP_BIT("scsi", VirtIOBlock, blk.scsi, 0, true),
#endif #endif
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
DEFINE_PROP_BIT("x-data-plane", VirtIOBlock, blk.data_plane, 0, false), DEFINE_PROP_BIT("x-data-plane", VirtIOBlock, blk.data_plane, 0, false),
#endif
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };

View File

@ -2,7 +2,7 @@ common-obj-y += virtio-rng.o
common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
common-obj-y += virtio-bus.o common-obj-y += virtio-bus.o
common-obj-y += virtio-mmio.o common-obj-y += virtio-mmio.o
common-obj-$(CONFIG_VIRTIO_BLK_DATA_PLANE) += dataplane/ common-obj-$(CONFIG_VIRTIO) += dataplane/
obj-y += virtio.o virtio-balloon.o obj-y += virtio.o virtio-balloon.o
obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o

View File

@ -132,10 +132,8 @@ typedef struct VirtIOBlock {
VMChangeStateEntry *change; VMChangeStateEntry *change;
/* Function to push to vq and notify guest */ /* Function to push to vq and notify guest */
void (*complete_request)(struct VirtIOBlockReq *req, unsigned char status); void (*complete_request)(struct VirtIOBlockReq *req, unsigned char status);
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
Notifier migration_state_notifier; Notifier migration_state_notifier;
struct VirtIOBlockDataPlane *dataplane; struct VirtIOBlockDataPlane *dataplane;
#endif
} VirtIOBlock; } VirtIOBlock;
typedef struct MultiReqBuffer { typedef struct MultiReqBuffer {