* [PATCH] hw/virtio: enable ioeventfd configuring for mmio
@ 2021-03-29 7:43 Pavel Dovgalyuk
2021-04-05 5:50 ` Pavel Dovgalyuk
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Dovgalyuk @ 2021-03-29 7:43 UTC (permalink / raw)
To: qemu-devel; +Cc: alex.bennee, pbonzini, pavel.dovgalyuk, mst
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>
---
hw/virtio/virtio-mmio.c | 11 ++++++++++-
include/hw/virtio/virtio-mmio.h | 5 +++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 342c918ea7..5952471b38 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -36,7 +36,9 @@
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,
@@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = {
DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
format_transport_address, 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(),
};
@@ -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,
d, NULL);
sysbus_init_irq(sbd, &proxy->irq);
+
+ if (!kvm_eventfds_enabled()) {
+ proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
+ }
+
if (proxy->legacy) {
memory_region_init_io(&proxy->iomem, OBJECT(d),
&virtio_legacy_mem_ops, proxy,
diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
index d4c4c386ab..090f7730e7 100644
--- a/include/hw/virtio/virtio-mmio.h
+++ b/include/hw/virtio/virtio-mmio.h
@@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
uint32_t used[2];
} VirtIOMMIOQueue;
+#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
+#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
+ (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
+
struct VirtIOMMIOProxy {
/* Generic */
SysBusDevice parent_obj;
MemoryRegion iomem;
qemu_irq irq;
bool legacy;
+ uint32_t flags;
/* Guest accessible state needing migration and reset */
uint32_t host_features_sel;
uint32_t guest_features_sel;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/virtio: enable ioeventfd configuring for mmio
2021-03-29 7:43 [PATCH] hw/virtio: enable ioeventfd configuring for mmio Pavel Dovgalyuk
@ 2021-04-05 5:50 ` Pavel Dovgalyuk
2021-04-06 10:02 ` Michael S. Tsirkin
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Dovgalyuk @ 2021-04-05 5:50 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, alex.bennee, mst
ping
On 29.03.2021 10:43, Pavel Dovgalyuk wrote:
> 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>
> ---
> hw/virtio/virtio-mmio.c | 11 ++++++++++-
> include/hw/virtio/virtio-mmio.h | 5 +++++
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
> index 342c918ea7..5952471b38 100644
> --- a/hw/virtio/virtio-mmio.c
> +++ b/hw/virtio/virtio-mmio.c
> @@ -36,7 +36,9 @@
>
> 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,
> @@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = {
> DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
> format_transport_address, 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(),
> };
>
> @@ -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,
> d, NULL);
> sysbus_init_irq(sbd, &proxy->irq);
> +
> + if (!kvm_eventfds_enabled()) {
> + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
> + }
> +
> if (proxy->legacy) {
> memory_region_init_io(&proxy->iomem, OBJECT(d),
> &virtio_legacy_mem_ops, proxy,
> diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
> index d4c4c386ab..090f7730e7 100644
> --- a/include/hw/virtio/virtio-mmio.h
> +++ b/include/hw/virtio/virtio-mmio.h
> @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
> uint32_t used[2];
> } VirtIOMMIOQueue;
>
> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
> + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
> +
> struct VirtIOMMIOProxy {
> /* Generic */
> SysBusDevice parent_obj;
> MemoryRegion iomem;
> qemu_irq irq;
> bool legacy;
> + uint32_t flags;
> /* Guest accessible state needing migration and reset */
> uint32_t host_features_sel;
> uint32_t guest_features_sel;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/virtio: enable ioeventfd configuring for mmio
2021-04-05 5:50 ` Pavel Dovgalyuk
@ 2021-04-06 10:02 ` Michael S. Tsirkin
2021-05-07 10:45 ` Pavel Dovgalyuk
0 siblings, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2021-04-06 10:02 UTC (permalink / raw)
To: Pavel Dovgalyuk; +Cc: pbonzini, alex.bennee, qemu-devel
i tagged it for 6.1
pls remind me after release so it's not lost
On Mon, Apr 05, 2021 at 08:50:31AM +0300, Pavel Dovgalyuk wrote:
> ping
>
> On 29.03.2021 10:43, Pavel Dovgalyuk wrote:
> > 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>
> > ---
> > hw/virtio/virtio-mmio.c | 11 ++++++++++-
> > include/hw/virtio/virtio-mmio.h | 5 +++++
> > 2 files changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
> > index 342c918ea7..5952471b38 100644
> > --- a/hw/virtio/virtio-mmio.c
> > +++ b/hw/virtio/virtio-mmio.c
> > @@ -36,7 +36,9 @@
> > 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,
> > @@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = {
> > DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
> > format_transport_address, 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(),
> > };
> > @@ -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,
> > d, NULL);
> > sysbus_init_irq(sbd, &proxy->irq);
> > +
> > + if (!kvm_eventfds_enabled()) {
> > + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
> > + }
> > +
> > if (proxy->legacy) {
> > memory_region_init_io(&proxy->iomem, OBJECT(d),
> > &virtio_legacy_mem_ops, proxy,
> > diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
> > index d4c4c386ab..090f7730e7 100644
> > --- a/include/hw/virtio/virtio-mmio.h
> > +++ b/include/hw/virtio/virtio-mmio.h
> > @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
> > uint32_t used[2];
> > } VirtIOMMIOQueue;
> > +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
> > +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
> > + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
> > +
> > struct VirtIOMMIOProxy {
> > /* Generic */
> > SysBusDevice parent_obj;
> > MemoryRegion iomem;
> > qemu_irq irq;
> > bool legacy;
> > + uint32_t flags;
> > /* Guest accessible state needing migration and reset */
> > uint32_t host_features_sel;
> > uint32_t guest_features_sel;
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/virtio: enable ioeventfd configuring for mmio
2021-04-06 10:02 ` Michael S. Tsirkin
@ 2021-05-07 10:45 ` Pavel Dovgalyuk
0 siblings, 0 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2021-05-07 10:45 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: pbonzini, alex.bennee, qemu-devel
ping
On 06.04.2021 13:02, Michael S. Tsirkin wrote:
> i tagged it for 6.1
> pls remind me after release so it's not lost
>
>
> On Mon, Apr 05, 2021 at 08:50:31AM +0300, Pavel Dovgalyuk wrote:
>> ping
>>
>> On 29.03.2021 10:43, Pavel Dovgalyuk wrote:
>>> 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>
>>> ---
>>> hw/virtio/virtio-mmio.c | 11 ++++++++++-
>>> include/hw/virtio/virtio-mmio.h | 5 +++++
>>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
>>> index 342c918ea7..5952471b38 100644
>>> --- a/hw/virtio/virtio-mmio.c
>>> +++ b/hw/virtio/virtio-mmio.c
>>> @@ -36,7 +36,9 @@
>>> 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,
>>> @@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = {
>>> DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
>>> format_transport_address, 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(),
>>> };
>>> @@ -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,
>>> d, NULL);
>>> sysbus_init_irq(sbd, &proxy->irq);
>>> +
>>> + if (!kvm_eventfds_enabled()) {
>>> + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
>>> + }
>>> +
>>> if (proxy->legacy) {
>>> memory_region_init_io(&proxy->iomem, OBJECT(d),
>>> &virtio_legacy_mem_ops, proxy,
>>> diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
>>> index d4c4c386ab..090f7730e7 100644
>>> --- a/include/hw/virtio/virtio-mmio.h
>>> +++ b/include/hw/virtio/virtio-mmio.h
>>> @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
>>> uint32_t used[2];
>>> } VirtIOMMIOQueue;
>>> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
>>> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
>>> + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
>>> +
>>> struct VirtIOMMIOProxy {
>>> /* Generic */
>>> SysBusDevice parent_obj;
>>> MemoryRegion iomem;
>>> qemu_irq irq;
>>> bool legacy;
>>> + uint32_t flags;
>>> /* Guest accessible state needing migration and reset */
>>> uint32_t host_features_sel;
>>> uint32_t guest_features_sel;
>>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] hw/virtio: enable ioeventfd configuring for mmio
@ 2021-02-24 13:33 Pavel Dovgalyuk
2021-03-02 8:14 ` Pavel Dovgalyuk
2021-03-15 6:00 ` Pavel Dovgalyuk
0 siblings, 2 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2021-02-24 13:33 UTC (permalink / raw)
To: qemu-devel; +Cc: alex.bennee, pbonzini, pavel.dovgalyuk, mst
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>
---
hw/virtio/virtio-mmio.c | 11 ++++++++++-
include/hw/virtio/virtio-mmio.h | 5 +++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 610661d6a5..551f831562 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -36,7 +36,9 @@
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,
@@ -690,6 +692,8 @@ static Property virtio_mmio_properties[] = {
DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
format_transport_address, 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(),
};
@@ -701,6 +705,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS,
d, NULL);
sysbus_init_irq(sbd, &proxy->irq);
+
+ if (!kvm_eventfds_enabled()) {
+ proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
+ }
+
if (proxy->legacy) {
memory_region_init_io(&proxy->iomem, OBJECT(d),
&virtio_legacy_mem_ops, proxy,
diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
index d4c4c386ab..090f7730e7 100644
--- a/include/hw/virtio/virtio-mmio.h
+++ b/include/hw/virtio/virtio-mmio.h
@@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
uint32_t used[2];
} VirtIOMMIOQueue;
+#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
+#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
+ (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
+
struct VirtIOMMIOProxy {
/* Generic */
SysBusDevice parent_obj;
MemoryRegion iomem;
qemu_irq irq;
bool legacy;
+ uint32_t flags;
/* Guest accessible state needing migration and reset */
uint32_t host_features_sel;
uint32_t guest_features_sel;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/virtio: enable ioeventfd configuring for mmio
2021-02-24 13:33 Pavel Dovgalyuk
@ 2021-03-02 8:14 ` Pavel Dovgalyuk
2021-03-15 6:00 ` Pavel Dovgalyuk
1 sibling, 0 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2021-03-02 8:14 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, alex.bennee, mst
ping
On 24.02.2021 16:33, Pavel Dovgalyuk wrote:
> 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>
> ---
> hw/virtio/virtio-mmio.c | 11 ++++++++++-
> include/hw/virtio/virtio-mmio.h | 5 +++++
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
> index 610661d6a5..551f831562 100644
> --- a/hw/virtio/virtio-mmio.c
> +++ b/hw/virtio/virtio-mmio.c
> @@ -36,7 +36,9 @@
>
> 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,
> @@ -690,6 +692,8 @@ static Property virtio_mmio_properties[] = {
> DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
> format_transport_address, 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(),
> };
>
> @@ -701,6 +705,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
> qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS,
> d, NULL);
> sysbus_init_irq(sbd, &proxy->irq);
> +
> + if (!kvm_eventfds_enabled()) {
> + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
> + }
> +
> if (proxy->legacy) {
> memory_region_init_io(&proxy->iomem, OBJECT(d),
> &virtio_legacy_mem_ops, proxy,
> diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
> index d4c4c386ab..090f7730e7 100644
> --- a/include/hw/virtio/virtio-mmio.h
> +++ b/include/hw/virtio/virtio-mmio.h
> @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
> uint32_t used[2];
> } VirtIOMMIOQueue;
>
> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
> + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
> +
> struct VirtIOMMIOProxy {
> /* Generic */
> SysBusDevice parent_obj;
> MemoryRegion iomem;
> qemu_irq irq;
> bool legacy;
> + uint32_t flags;
> /* Guest accessible state needing migration and reset */
> uint32_t host_features_sel;
> uint32_t guest_features_sel;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/virtio: enable ioeventfd configuring for mmio
2021-02-24 13:33 Pavel Dovgalyuk
2021-03-02 8:14 ` Pavel Dovgalyuk
@ 2021-03-15 6:00 ` Pavel Dovgalyuk
1 sibling, 0 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2021-03-15 6:00 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, alex.bennee, mst
ping
On 24.02.2021 16:33, Pavel Dovgalyuk wrote:
> 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>
> ---
> hw/virtio/virtio-mmio.c | 11 ++++++++++-
> include/hw/virtio/virtio-mmio.h | 5 +++++
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
> index 610661d6a5..551f831562 100644
> --- a/hw/virtio/virtio-mmio.c
> +++ b/hw/virtio/virtio-mmio.c
> @@ -36,7 +36,9 @@
>
> 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,
> @@ -690,6 +692,8 @@ static Property virtio_mmio_properties[] = {
> DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
> format_transport_address, 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(),
> };
>
> @@ -701,6 +705,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
> qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS,
> d, NULL);
> sysbus_init_irq(sbd, &proxy->irq);
> +
> + if (!kvm_eventfds_enabled()) {
> + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
> + }
> +
> if (proxy->legacy) {
> memory_region_init_io(&proxy->iomem, OBJECT(d),
> &virtio_legacy_mem_ops, proxy,
> diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
> index d4c4c386ab..090f7730e7 100644
> --- a/include/hw/virtio/virtio-mmio.h
> +++ b/include/hw/virtio/virtio-mmio.h
> @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue {
> uint32_t used[2];
> } VirtIOMMIOQueue;
>
> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1
> +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \
> + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT)
> +
> struct VirtIOMMIOProxy {
> /* Generic */
> SysBusDevice parent_obj;
> MemoryRegion iomem;
> qemu_irq irq;
> bool legacy;
> + uint32_t flags;
> /* Guest accessible state needing migration and reset */
> uint32_t host_features_sel;
> uint32_t guest_features_sel;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-07 10:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 7:43 [PATCH] hw/virtio: enable ioeventfd configuring for mmio Pavel Dovgalyuk
2021-04-05 5:50 ` Pavel Dovgalyuk
2021-04-06 10:02 ` Michael S. Tsirkin
2021-05-07 10:45 ` Pavel Dovgalyuk
-- strict thread matches above, loose matches on Subject: below --
2021-02-24 13:33 Pavel Dovgalyuk
2021-03-02 8:14 ` Pavel Dovgalyuk
2021-03-15 6:00 ` Pavel Dovgalyuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).