|
|
7f1c5b |
From 181705090c9963c2da97811838ace5bb058737c6 Mon Sep 17 00:00:00 2001
|
|
|
7f1c5b |
From: Cindy Lu <lulu@redhat.com>
|
|
|
7f1c5b |
Date: Thu, 22 Dec 2022 15:04:50 +0800
|
|
|
7f1c5b |
Subject: [PATCH 09/31] virtio-mmio: add support for configure interrupt
|
|
|
7f1c5b |
MIME-Version: 1.0
|
|
|
7f1c5b |
Content-Type: text/plain; charset=UTF-8
|
|
|
7f1c5b |
Content-Transfer-Encoding: 8bit
|
|
|
7f1c5b |
|
|
|
7f1c5b |
RH-Author: Cindy Lu <lulu@redhat.com>
|
|
|
7f1c5b |
RH-MergeRequest: 132: vhost-vdpa: support config interrupt in vhost-vdpa
|
|
|
7f1c5b |
RH-Bugzilla: 1905805
|
|
|
7f1c5b |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7f1c5b |
RH-Commit: [9/10] 742cc2b425ffd7bbd393772526e7481446ee131c (lulu6/qemu-kvm3)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
https://bugzilla.redhat.com/show_bug.cgi?id=1905805
|
|
|
7f1c5b |
Add configure interrupt support in virtio-mmio bus.
|
|
|
7f1c5b |
add function to set configure guest notifier.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Signed-off-by: Cindy Lu <lulu@redhat.com>
|
|
|
7f1c5b |
Message-Id: <20221222070451.936503-10-lulu@redhat.com>
|
|
|
7f1c5b |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
7f1c5b |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7f1c5b |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7f1c5b |
(cherry picked from commit cd336e834620ea78edef049c3567f312974e475b)
|
|
|
7f1c5b |
Signed-off-by: Cindy Lu <lulu@redhat.com>
|
|
|
7f1c5b |
---
|
|
|
7f1c5b |
hw/virtio/virtio-mmio.c | 27 +++++++++++++++++++++++++++
|
|
|
7f1c5b |
1 file changed, 27 insertions(+)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
|
|
|
7f1c5b |
index d240efef97..103260ec15 100644
|
|
|
7f1c5b |
--- a/hw/virtio/virtio-mmio.c
|
|
|
7f1c5b |
+++ b/hw/virtio/virtio-mmio.c
|
|
|
7f1c5b |
@@ -670,7 +670,30 @@ static int virtio_mmio_set_guest_notifier(DeviceState *d, int n, bool assign,
|
|
|
7f1c5b |
|
|
|
7f1c5b |
return 0;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
+static int virtio_mmio_set_config_guest_notifier(DeviceState *d, bool assign,
|
|
|
7f1c5b |
+ bool with_irqfd)
|
|
|
7f1c5b |
+{
|
|
|
7f1c5b |
+ VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
|
|
|
7f1c5b |
+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
|
|
7f1c5b |
+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
|
|
|
7f1c5b |
+ EventNotifier *notifier = virtio_config_get_guest_notifier(vdev);
|
|
|
7f1c5b |
+ int r = 0;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
+ if (assign) {
|
|
|
7f1c5b |
+ r = event_notifier_init(notifier, 0);
|
|
|
7f1c5b |
+ if (r < 0) {
|
|
|
7f1c5b |
+ return r;
|
|
|
7f1c5b |
+ }
|
|
|
7f1c5b |
+ virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
|
|
|
7f1c5b |
+ } else {
|
|
|
7f1c5b |
+ virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
|
|
|
7f1c5b |
+ event_notifier_cleanup(notifier);
|
|
|
7f1c5b |
+ }
|
|
|
7f1c5b |
+ if (vdc->guest_notifier_mask && vdev->use_guest_notifier_mask) {
|
|
|
7f1c5b |
+ vdc->guest_notifier_mask(vdev, VIRTIO_CONFIG_IRQ_IDX, !assign);
|
|
|
7f1c5b |
+ }
|
|
|
7f1c5b |
+ return r;
|
|
|
7f1c5b |
+}
|
|
|
7f1c5b |
static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
|
|
|
7f1c5b |
bool assign)
|
|
|
7f1c5b |
{
|
|
|
7f1c5b |
@@ -692,6 +715,10 @@ static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
|
|
|
7f1c5b |
goto assign_error;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
+ r = virtio_mmio_set_config_guest_notifier(d, assign, with_irqfd);
|
|
|
7f1c5b |
+ if (r < 0) {
|
|
|
7f1c5b |
+ goto assign_error;
|
|
|
7f1c5b |
+ }
|
|
|
7f1c5b |
|
|
|
7f1c5b |
return 0;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
--
|
|
|
7f1c5b |
2.31.1
|
|
|
7f1c5b |
|