hw/virtio: enable ioeventfd configuring for mmio
This patch adds ioeventfd flag for virtio-mmio configuration. It allows switching ioeventfd on and off. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> Message-Id: <161700379211.1135943.8859209566937991305.stgit@pasha-ThinkPad-X280> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
05dfb447a4
commit
b8893a3c86
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
static bool virtio_mmio_ioeventfd_enabled(DeviceState *d)
|
static bool virtio_mmio_ioeventfd_enabled(DeviceState *d)
|
||||||
{
|
{
|
||||||
return kvm_eventfds_enabled();
|
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
|
||||||
|
|
||||||
|
return (proxy->flags & VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_mmio_ioeventfd_assign(DeviceState *d,
|
static int virtio_mmio_ioeventfd_assign(DeviceState *d,
|
||||||
@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = {
|
|||||||
DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
|
DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
|
||||||
format_transport_address, true),
|
format_transport_address, true),
|
||||||
DEFINE_PROP_BOOL("force-legacy", VirtIOMMIOProxy, legacy, true),
|
DEFINE_PROP_BOOL("force-legacy", VirtIOMMIOProxy, legacy, true),
|
||||||
|
DEFINE_PROP_BIT("ioeventfd", VirtIOMMIOProxy, flags,
|
||||||
|
VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT, true),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -731,6 +735,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
|
|||||||
qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS,
|
qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS,
|
||||||
d, NULL);
|
d, NULL);
|
||||||
sysbus_init_irq(sbd, &proxy->irq);
|
sysbus_init_irq(sbd, &proxy->irq);
|
||||||
|
|
||||||
|
if (!kvm_eventfds_enabled()) {
|
||||||
|
proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
|
||||||
|
}
|
||||||
|
|
||||||
if (proxy->legacy) {
|
if (proxy->legacy) {
|
||||||
memory_region_init_io(&proxy->iomem, OBJECT(d),
|
memory_region_init_io(&proxy->iomem, OBJECT(d),
|
||||||
&virtio_legacy_mem_ops, proxy,
|
&virtio_legacy_mem_ops, proxy,
|
||||||
|
@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
|
|||||||
uint32_t used[2];
|
uint32_t used[2];
|
||||||
} VirtIOMMIOQueue;
|
} VirtIOMMIOQueue;
|
||||||
|
|
||||||
|
#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
|
||||||
|
#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
|
||||||
|
(1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
|
||||||
|
|
||||||
struct VirtIOMMIOProxy {
|
struct VirtIOMMIOProxy {
|
||||||
/* Generic */
|
/* Generic */
|
||||||
SysBusDevice parent_obj;
|
SysBusDevice parent_obj;
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
bool legacy;
|
bool legacy;
|
||||||
|
uint32_t flags;
|
||||||
/* Guest accessible state needing migration and reset */
|
/* Guest accessible state needing migration and reset */
|
||||||
uint32_t host_features_sel;
|
uint32_t host_features_sel;
|
||||||
uint32_t guest_features_sel;
|
uint32_t guest_features_sel;
|
||||||
|
Loading…
Reference in New Issue
Block a user