* [PULL v2 01/10] Revert "virtio-pci: add support for configure interrupt"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
@ 2022-01-10 21:04 ` Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 02/10] Revert "virtio-mmio: " Michael S. Tsirkin
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit d5d24d859c3957ea1674d0e102f96439cdbfe93a.
Fixes: d5d24d859c ("virtio-pci: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-pci.h | 4 +-
hw/virtio/virtio-pci.c | 92 ++++++------------------------------------
2 files changed, 13 insertions(+), 83 deletions(-)
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index b704acc5a8..2446dcd9ae 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -251,7 +251,5 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t);
* @fixed_queues.
*/
unsigned virtio_pci_optimal_num_queues(unsigned fixed_queues);
-void virtio_pci_set_guest_notifier_fd_handler(VirtIODevice *vdev, VirtQueue *vq,
- int n, bool assign,
- bool with_irqfd);
+
#endif
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 98fb5493ae..7201cf3dc1 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -727,8 +727,7 @@ static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
VirtQueue *vq;
if (queue_no == VIRTIO_CONFIG_IRQ_IDX) {
- *n = virtio_config_get_guest_notifier(vdev);
- *vector = vdev->config_vector;
+ return -1;
} else {
if (!virtio_queue_get_num(vdev, queue_no)) {
return -1;
@@ -803,10 +802,6 @@ static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
return ret;
}
-static int kvm_virtio_pci_vector_config_use(VirtIOPCIProxy *proxy)
-{
- return kvm_virtio_pci_vector_use_one(proxy, VIRTIO_CONFIG_IRQ_IDX);
-}
static void kvm_virtio_pci_vector_release_one(VirtIOPCIProxy *proxy,
int queue_no)
@@ -844,11 +839,6 @@ static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
}
}
-static void kvm_virtio_pci_vector_config_release(VirtIOPCIProxy *proxy)
-{
- kvm_virtio_pci_vector_release_one(proxy, VIRTIO_CONFIG_IRQ_IDX);
-}
-
static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
unsigned int queue_no,
unsigned int vector,
@@ -930,17 +920,9 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
}
vq = virtio_vector_next_queue(vq);
}
- /* unmask config intr */
- n = virtio_config_get_guest_notifier(vdev);
- ret = virtio_pci_one_vector_unmask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector,
- msg, n);
- if (ret < 0) {
- goto undo_config;
- }
+
return 0;
-undo_config:
- n = virtio_config_get_guest_notifier(vdev);
- virtio_pci_one_vector_mask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector, n);
+
undo:
vq = virtio_vector_first_queue(vdev, vector);
while (vq && unmasked >= 0) {
@@ -974,8 +956,6 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector)
}
vq = virtio_vector_next_queue(vq);
}
- n = virtio_config_get_guest_notifier(vdev);
- virtio_pci_one_vector_mask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector, n);
}
static void virtio_pci_vector_poll(PCIDevice *dev,
@@ -1007,34 +987,6 @@ static void virtio_pci_vector_poll(PCIDevice *dev,
msix_set_pending(dev, vector);
}
}
- /* poll the config intr */
- ret = virtio_pci_get_notifier(proxy, VIRTIO_CONFIG_IRQ_IDX, ¬ifier,
- &vector);
- if (ret < 0) {
- return;
- }
- if (vector < vector_start || vector >= vector_end ||
- !msix_is_masked(dev, vector)) {
- return;
- }
- if (k->guest_notifier_pending) {
- if (k->guest_notifier_pending(vdev, VIRTIO_CONFIG_IRQ_IDX)) {
- msix_set_pending(dev, vector);
- }
- } else if (event_notifier_test_and_clear(notifier)) {
- msix_set_pending(dev, vector);
- }
-}
-
-void virtio_pci_set_guest_notifier_fd_handler(VirtIODevice *vdev, VirtQueue *vq,
- int n, bool assign,
- bool with_irqfd)
-{
- if (n == VIRTIO_CONFIG_IRQ_IDX) {
- virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
- } else {
- virtio_queue_set_guest_notifier_fd_handler(vq, assign, with_irqfd);
- }
}
static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
@@ -1043,25 +995,17 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
- VirtQueue *vq = NULL;
- EventNotifier *notifier = NULL;
-
- if (n == VIRTIO_CONFIG_IRQ_IDX) {
- notifier = virtio_config_get_guest_notifier(vdev);
- } else {
- vq = virtio_get_queue(vdev, n);
- notifier = virtio_queue_get_guest_notifier(vq);
- }
+ VirtQueue *vq = virtio_get_queue(vdev, n);
+ EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
if (assign) {
int r = event_notifier_init(notifier, 0);
if (r < 0) {
return r;
}
- virtio_pci_set_guest_notifier_fd_handler(vdev, vq, n, true, with_irqfd);
+ virtio_queue_set_guest_notifier_fd_handler(vq, true, with_irqfd);
} else {
- virtio_pci_set_guest_notifier_fd_handler(vdev, vq, n, false,
- with_irqfd);
+ virtio_queue_set_guest_notifier_fd_handler(vq, false, with_irqfd);
event_notifier_cleanup(notifier);
}
@@ -1103,7 +1047,6 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
msix_unset_vector_notifiers(&proxy->pci_dev);
if (proxy->vector_irqfd) {
kvm_virtio_pci_vector_release(proxy, nvqs);
- kvm_virtio_pci_vector_config_release(proxy);
g_free(proxy->vector_irqfd);
proxy->vector_irqfd = NULL;
}
@@ -1119,11 +1062,7 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
goto assign_error;
}
}
- r = virtio_pci_set_guest_notifier(d, VIRTIO_CONFIG_IRQ_IDX, assign,
- with_irqfd);
- if (r < 0) {
- goto config_assign_error;
- }
+
/* Must set vector notifier after guest notifier has been assigned */
if ((with_irqfd || k->guest_notifier_mask) && assign) {
if (with_irqfd) {
@@ -1132,14 +1071,11 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
msix_nr_vectors_allocated(&proxy->pci_dev));
r = kvm_virtio_pci_vector_use(proxy, nvqs);
if (r < 0) {
- goto config_assign_error;
+ goto assign_error;
}
}
- r = kvm_virtio_pci_vector_config_use(proxy);
- if (r < 0) {
- goto config_error;
- }
- r = msix_set_vector_notifiers(&proxy->pci_dev, virtio_pci_vector_unmask,
+ r = msix_set_vector_notifiers(&proxy->pci_dev,
+ virtio_pci_vector_unmask,
virtio_pci_vector_mask,
virtio_pci_vector_poll);
if (r < 0) {
@@ -1154,11 +1090,7 @@ notifiers_error:
assert(assign);
kvm_virtio_pci_vector_release(proxy, nvqs);
}
-config_error:
- kvm_virtio_pci_vector_config_release(proxy);
-config_assign_error:
- virtio_pci_set_guest_notifier(d, VIRTIO_CONFIG_IRQ_IDX, !assign,
- with_irqfd);
+
assign_error:
/* We get here on assignment failure. Recover by undoing for VQs 0 .. n. */
assert(assign);
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 02/10] Revert "virtio-mmio: add support for configure interrupt"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 01/10] Revert "virtio-pci: add support for configure interrupt" Michael S. Tsirkin
@ 2022-01-10 21:04 ` Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 03/10] Revert "virtio-net: " Michael S. Tsirkin
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit d48185f1a40d4e4ed2fa2873a42b2a5eb8748256.
Fixes: d48185f1a4 ("virtio-mmio: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-mmio.c | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 809132018b..72da12fea5 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -673,30 +673,7 @@ static int virtio_mmio_set_guest_notifier(DeviceState *d, int n, bool assign,
return 0;
}
-static int virtio_mmio_set_config_guest_notifier(DeviceState *d, bool assign)
-{
- VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
- VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
- VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
- bool with_irqfd = false;
- EventNotifier *notifier = virtio_config_get_guest_notifier(vdev);
- int r = 0;
- if (assign) {
- r = event_notifier_init(notifier, 0);
- if (r < 0) {
- return r;
- }
- virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
- } else {
- virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
- event_notifier_cleanup(notifier);
- }
- if (vdc->guest_notifier_mask && vdev->use_guest_notifier_mask) {
- vdc->guest_notifier_mask(vdev, VIRTIO_CONFIG_IRQ_IDX, !assign);
- }
- return r;
-}
static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
bool assign)
{
@@ -718,10 +695,6 @@ static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
goto assign_error;
}
}
- r = virtio_mmio_set_config_guest_notifier(d, assign);
- if (r < 0) {
- goto assign_error;
- }
return 0;
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 03/10] Revert "virtio-net: add support for configure interrupt"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 01/10] Revert "virtio-pci: add support for configure interrupt" Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 02/10] Revert "virtio-mmio: " Michael S. Tsirkin
@ 2022-01-10 21:04 ` Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 04/10] Revert "vhost: " Michael S. Tsirkin
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Jason Wang, Cindy Lu
This reverts commit 497679d51087090d5a22fd265d1b96cf92d49d9d.
Fixes: 497679d510 ("virtio-net: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/net/vhost_net.h | 2 --
hw/net/vhost_net-stub.c | 9 ---------
hw/net/vhost_net.c | 9 ---------
hw/net/virtio-net.c | 4 ++--
4 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index fc37498550..387e913e4e 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -39,8 +39,6 @@ int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
int idx, bool mask);
-bool vhost_net_config_pending(VHostNetState *net);
-void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask);
int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr);
VHostNetState *get_vhost_net(NetClientState *nc);
diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c
index 126ee35b70..89d71cfb8e 100644
--- a/hw/net/vhost_net-stub.c
+++ b/hw/net/vhost_net-stub.c
@@ -101,12 +101,3 @@ int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
{
return 0;
}
-
-bool vhost_net_config_pending(VHostNetState *net)
-{
- return false;
-}
-
-void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
-{
-}
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 9c9fd0a73f..30379d2ca4 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -457,15 +457,6 @@ void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
vhost_virtqueue_mask(&net->dev, dev, idx, mask);
}
-bool vhost_net_config_pending(VHostNetState *net)
-{
- return vhost_config_pending(&net->dev);
-}
-
-void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
-{
- vhost_config_mask(&net->dev, dev, mask);
-}
VHostNetState *get_vhost_net(NetClientState *nc)
{
VHostNetState *vhost_net = 0;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 5806a50c8d..5e03c0dd14 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3169,7 +3169,7 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return vhost_net_config_pending(get_vhost_net(nc->peer));
+ return false;
}
return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
}
@@ -3181,9 +3181,9 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- vhost_net_config_mask(get_vhost_net(nc->peer), vdev, mask);
return;
}
+
vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
}
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 04/10] Revert "vhost: add support for configure interrupt"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (2 preceding siblings ...)
2022-01-10 21:04 ` [PULL v2 03/10] Revert "virtio-net: " Michael S. Tsirkin
@ 2022-01-10 21:04 ` Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 05/10] Revert "virtio: " Michael S. Tsirkin
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit f7220a7ce21604a4bc6260ccca4dc9068c1f27f2.
Fixes: f7220a7ce2 ("vhost: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/vhost.h | 4 ---
hw/virtio/vhost.c | 76 ---------------------------------------
2 files changed, 80 deletions(-)
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index b0f3b78987..58a73e7b7a 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -29,7 +29,6 @@ struct vhost_virtqueue {
unsigned long long used_phys;
unsigned used_size;
EventNotifier masked_notifier;
- EventNotifier masked_config_notifier;
struct vhost_dev *dev;
};
@@ -38,7 +37,6 @@ typedef unsigned long vhost_log_chunk_t;
#define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
#define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
#define VHOST_INVALID_FEATURE_BIT (0xff)
-#define VHOST_QUEUE_NUM_CONFIG_INR 0
struct vhost_log {
unsigned long long size;
@@ -118,8 +116,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev);
void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev);
int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
-bool vhost_config_pending(struct vhost_dev *hdev);
-void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask);
/* Test and clear masked event pending status.
* Should be called after unmask to avoid losing events.
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index cbf3b792da..7b03efccec 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1554,67 +1554,6 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
}
}
-bool vhost_config_pending(struct vhost_dev *hdev)
-{
- assert(hdev->vhost_ops);
- if ((hdev->started == false) ||
- (hdev->vhost_ops->vhost_set_config_call == NULL)) {
- return false;
- }
-
- EventNotifier *notifier =
- &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
- return event_notifier_test_and_clear(notifier);
-}
-
-void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask)
-{
- int fd;
- int r;
- EventNotifier *notifier =
- &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
- EventNotifier *config_notifier = &vdev->config_notifier;
- assert(hdev->vhost_ops);
-
- if ((hdev->started == false) ||
- (hdev->vhost_ops->vhost_set_config_call == NULL)) {
- return;
- }
- if (mask) {
- assert(vdev->use_guest_notifier_mask);
- fd = event_notifier_get_fd(notifier);
- } else {
- fd = event_notifier_get_fd(config_notifier);
- }
- r = hdev->vhost_ops->vhost_set_config_call(hdev, fd);
- if (r < 0) {
- VHOST_OPS_DEBUG(r, "vhost_set_config_call failed");
- }
-}
-
-static void vhost_stop_config_intr(struct vhost_dev *dev)
-{
- int fd = -1;
- assert(dev->vhost_ops);
- if (dev->vhost_ops->vhost_set_config_call) {
- dev->vhost_ops->vhost_set_config_call(dev, fd);
- }
-}
-
-static void vhost_start_config_intr(struct vhost_dev *dev)
-{
- int r;
-
- assert(dev->vhost_ops);
- int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
- if (dev->vhost_ops->vhost_set_config_call) {
- r = dev->vhost_ops->vhost_set_config_call(dev, fd);
- if (!r) {
- event_notifier_set(&dev->vdev->config_notifier);
- }
- }
-}
-
uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
uint64_t features)
{
@@ -1827,16 +1766,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
}
}
- r = event_notifier_init(
- &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier, 0);
- if (r < 0) {
- return r;
- }
- event_notifier_test_and_clear(
- &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
- if (!vdev->use_guest_notifier_mask) {
- vhost_config_mask(hdev, vdev, true);
- }
if (hdev->log_enabled) {
uint64_t log_base;
@@ -1869,7 +1798,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
vhost_device_iotlb_miss(hdev, vq->used_phys, true);
}
}
- vhost_start_config_intr(hdev);
return 0;
fail_log:
vhost_log_put(hdev, false);
@@ -1895,9 +1823,6 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
/* should only be called after backend is connected */
assert(hdev->vhost_ops);
- event_notifier_test_and_clear(
- &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
- event_notifier_test_and_clear(&vdev->config_notifier);
if (hdev->vhost_ops->vhost_dev_start) {
hdev->vhost_ops->vhost_dev_start(hdev, false);
@@ -1915,7 +1840,6 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
}
memory_listener_unregister(&hdev->iommu_listener);
}
- vhost_stop_config_intr(hdev);
vhost_log_put(hdev, true);
hdev->started = false;
hdev->vdev = NULL;
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 05/10] Revert "virtio: add support for configure interrupt"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (3 preceding siblings ...)
2022-01-10 21:04 ` [PULL v2 04/10] Revert "vhost: " Michael S. Tsirkin
@ 2022-01-10 21:04 ` Michael S. Tsirkin
2022-01-10 21:05 ` [PULL v2 06/10] Revert "vhost-vdpa: add support for config interrupt" Michael S. Tsirkin
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit 081f864f56307551f59c5e934e3f30a7290d0faa.
Fixes: 081f864f56 ("virtio: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio.h | 4 ----
hw/virtio/virtio.c | 29 -----------------------------
2 files changed, 33 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index d78088d872..605ea79c90 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -111,7 +111,6 @@ struct VirtIODevice
bool use_guest_notifier_mask;
AddressSpace *dma_as;
QLIST_HEAD(, VirtQueue) *vector_queues;
- EventNotifier config_notifier;
};
struct VirtioDeviceClass {
@@ -314,14 +313,11 @@ uint16_t virtio_get_queue_index(VirtQueue *vq);
EventNotifier *virtio_queue_get_guest_notifier(VirtQueue *vq);
void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
bool with_irqfd);
-void virtio_config_set_guest_notifier_fd_handler(VirtIODevice *vdev,
- bool assign, bool with_irqfd);
int virtio_device_start_ioeventfd(VirtIODevice *vdev);
int virtio_device_grab_ioeventfd(VirtIODevice *vdev);
void virtio_device_release_ioeventfd(VirtIODevice *vdev);
bool virtio_device_ioeventfd_enabled(VirtIODevice *vdev);
EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq);
-EventNotifier *virtio_config_get_guest_notifier(VirtIODevice *vdev);
void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled);
void virtio_queue_host_notifier_read(EventNotifier *n);
void virtio_queue_aio_set_host_notifier_handler(VirtQueue *vq, AioContext *ctx,
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 971e59a663..5d18868d7d 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3494,14 +3494,7 @@ static void virtio_queue_guest_notifier_read(EventNotifier *n)
virtio_irq(vq);
}
}
-static void virtio_config_guest_notifier_read(EventNotifier *n)
-{
- VirtIODevice *vdev = container_of(n, VirtIODevice, config_notifier);
- if (event_notifier_test_and_clear(n)) {
- virtio_notify_config(vdev);
- }
-}
void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
bool with_irqfd)
{
@@ -3518,23 +3511,6 @@ void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
}
}
-void virtio_config_set_guest_notifier_fd_handler(VirtIODevice *vdev,
- bool assign, bool with_irqfd)
-{
- EventNotifier *n;
- n = &vdev->config_notifier;
- if (assign && !with_irqfd) {
- event_notifier_set_handler(n, virtio_config_guest_notifier_read);
- } else {
- event_notifier_set_handler(n, NULL);
- }
- if (!assign) {
- /* Test and clear notifier before closing it,*/
- /* in case poll callback didn't have time to run. */
- virtio_config_guest_notifier_read(n);
- }
-}
-
EventNotifier *virtio_queue_get_guest_notifier(VirtQueue *vq)
{
return &vq->guest_notifier;
@@ -3608,11 +3584,6 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq)
return &vq->host_notifier;
}
-EventNotifier *virtio_config_get_guest_notifier(VirtIODevice *vdev)
-{
- return &vdev->config_notifier;
-}
-
void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled)
{
vq->host_notifier_enabled = enabled;
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 06/10] Revert "vhost-vdpa: add support for config interrupt"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (4 preceding siblings ...)
2022-01-10 21:04 ` [PULL v2 05/10] Revert "virtio: " Michael S. Tsirkin
@ 2022-01-10 21:05 ` Michael S. Tsirkin
2022-01-10 21:05 ` [PULL v2 07/10] Revert "vhost: introduce new VhostOps vhost_set_config_call" Michael S. Tsirkin
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit 634f7c89fbd78f57d00d5d6b39c0ade9df1fe27f.
Fixes: 634f7c89fb ("vhost-vdpa: add support for config interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/vhost-vdpa.c | 7 -------
hw/virtio/trace-events | 1 -
2 files changed, 8 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index ac0cb575fb..04ea43704f 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -734,12 +734,6 @@ static int vhost_vdpa_set_vring_call(struct vhost_dev *dev,
trace_vhost_vdpa_set_vring_call(dev, file->index, file->fd);
return vhost_vdpa_call(dev, VHOST_SET_VRING_CALL, file);
}
-static int vhost_vdpa_set_config_call(struct vhost_dev *dev,
- int fd)
-{
- trace_vhost_vdpa_set_config_call(dev, fd);
- return vhost_vdpa_call(dev, VHOST_VDPA_SET_CONFIG_CALL, &fd);
-}
static int vhost_vdpa_get_features(struct vhost_dev *dev,
uint64_t *features)
@@ -810,5 +804,4 @@ const VhostOps vdpa_ops = {
.vhost_get_device_id = vhost_vdpa_get_device_id,
.vhost_vq_get_addr = vhost_vdpa_vq_get_addr,
.vhost_force_iommu = vhost_vdpa_force_iommu,
- .vhost_set_config_call = vhost_vdpa_set_config_call,
};
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 595ce015ff..f7ad6be5fb 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -53,7 +53,6 @@ vhost_vdpa_get_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRI
vhost_vdpa_set_owner(void *dev) "dev: %p"
vhost_vdpa_vq_get_addr(void *dev, void *vq, uint64_t desc_user_addr, uint64_t avail_user_addr, uint64_t used_user_addr) "dev: %p vq: %p desc_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64
vhost_vdpa_get_iova_range(void *dev, uint64_t first, uint64_t last) "dev: %p first: 0x%"PRIx64" last: 0x%"PRIx64
-vhost_vdpa_set_config_call(void *dev, int fd)"dev: %p fd: %d"
# virtio.c
virtqueue_alloc_element(void *elem, size_t sz, unsigned in_num, unsigned out_num) "elem %p size %zd in_num %u out_num %u"
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 07/10] Revert "vhost: introduce new VhostOps vhost_set_config_call"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (5 preceding siblings ...)
2022-01-10 21:05 ` [PULL v2 06/10] Revert "vhost-vdpa: add support for config interrupt" Michael S. Tsirkin
@ 2022-01-10 21:05 ` Michael S. Tsirkin
2022-01-10 21:05 ` [PULL v2 08/10] Revert "virtio-pci: decouple the single vector from the interrupt process" Michael S. Tsirkin
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit 88062372340d33090b7f089ed3b1a00f530a8914.
Fixes: 8806237234 ("vhost: introduce new VhostOps vhost_set_config_call")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/vhost-backend.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index ff34eb7c8a..81bf3109f8 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -126,8 +126,6 @@ typedef int (*vhost_get_device_id_op)(struct vhost_dev *dev, uint32_t *dev_id);
typedef bool (*vhost_force_iommu_op)(struct vhost_dev *dev);
-typedef int (*vhost_set_config_call_op)(struct vhost_dev *dev,
- int fd);
typedef struct VhostOps {
VhostBackendType backend_type;
vhost_backend_init vhost_backend_init;
@@ -173,7 +171,6 @@ typedef struct VhostOps {
vhost_vq_get_addr_op vhost_vq_get_addr;
vhost_get_device_id_op vhost_get_device_id;
vhost_force_iommu_op vhost_force_iommu;
- vhost_set_config_call_op vhost_set_config_call;
} VhostOps;
int vhost_backend_update_device_iotlb(struct vhost_dev *dev,
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 08/10] Revert "virtio-pci: decouple the single vector from the interrupt process"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (6 preceding siblings ...)
2022-01-10 21:05 ` [PULL v2 07/10] Revert "vhost: introduce new VhostOps vhost_set_config_call" Michael S. Tsirkin
@ 2022-01-10 21:05 ` Michael S. Tsirkin
2022-01-10 21:05 ` [PULL v2 09/10] Revert "virtio-pci: decouple notifier from " Michael S. Tsirkin
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit 316011b8a74e777eb3ba03171cd701a291c28867.
Fixes: 316011b8a7 ("virtio-pci: decouple the single vector from the interrupt process")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-pci.c | 163 +++++++++++++++++++----------------------
1 file changed, 74 insertions(+), 89 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 7201cf3dc1..4bdb6e5694 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -677,6 +677,7 @@ static uint32_t virtio_read_config(PCIDevice *pci_dev,
}
static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
+ unsigned int queue_no,
unsigned int vector)
{
VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
@@ -739,103 +740,87 @@ static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
return 0;
}
-static int kvm_virtio_pci_vector_use_one(VirtIOPCIProxy *proxy, int queue_no)
-{
- unsigned int vector;
- int ret;
- EventNotifier *n;
- PCIDevice *dev = &proxy->pci_dev;
- VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
-
- ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
- if (ret < 0) {
- return ret;
- }
- if (vector >= msix_nr_vectors_allocated(dev)) {
- return 0;
- }
- ret = kvm_virtio_pci_vq_vector_use(proxy, vector);
- if (ret < 0) {
- goto undo;
- }
- /*
- * If guest supports masking, set up irqfd now.
- * Otherwise, delay until unmasked in the frontend.
- */
- if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
- ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
- if (ret < 0) {
- kvm_virtio_pci_vq_vector_release(proxy, vector);
- goto undo;
- }
- }
-
- return 0;
-undo:
-
- vector = virtio_queue_vector(vdev, queue_no);
- if (vector >= msix_nr_vectors_allocated(dev)) {
- return ret;
- }
- if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
- ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
- if (ret < 0) {
- return ret;
- }
- kvm_virtio_pci_irqfd_release(proxy, n, vector);
- }
- return ret;
-}
static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
{
- int queue_no;
- int ret = 0;
- VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
-
- for (queue_no = 0; queue_no < nvqs; queue_no++) {
- if (!virtio_queue_get_num(vdev, queue_no)) {
- return -1;
- }
- ret = kvm_virtio_pci_vector_use_one(proxy, queue_no);
- }
- return ret;
-}
-
-
-static void kvm_virtio_pci_vector_release_one(VirtIOPCIProxy *proxy,
- int queue_no)
-{
- VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
- unsigned int vector;
- EventNotifier *n;
- int ret;
- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
PCIDevice *dev = &proxy->pci_dev;
-
- ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
- if (ret < 0) {
- return;
- }
- if (vector >= msix_nr_vectors_allocated(dev)) {
- return;
- }
- if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
- kvm_virtio_pci_irqfd_release(proxy, n, vector);
- }
- kvm_virtio_pci_vq_vector_release(proxy, vector);
-}
-
-static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
-{
- int queue_no;
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
-
+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
+ unsigned int vector;
+ int ret, queue_no;
+ EventNotifier *n;
for (queue_no = 0; queue_no < nvqs; queue_no++) {
if (!virtio_queue_get_num(vdev, queue_no)) {
break;
}
- kvm_virtio_pci_vector_release_one(proxy, queue_no);
+ ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+ if (ret < 0) {
+ break;
+ }
+ if (vector >= msix_nr_vectors_allocated(dev)) {
+ continue;
+ }
+ ret = kvm_virtio_pci_vq_vector_use(proxy, queue_no, vector);
+ if (ret < 0) {
+ goto undo;
+ }
+ /* If guest supports masking, set up irqfd now.
+ * Otherwise, delay until unmasked in the frontend.
+ */
+ if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
+ ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
+ if (ret < 0) {
+ kvm_virtio_pci_vq_vector_release(proxy, vector);
+ goto undo;
+ }
+ }
+ }
+ return 0;
+
+undo:
+ while (--queue_no >= 0) {
+ vector = virtio_queue_vector(vdev, queue_no);
+ if (vector >= msix_nr_vectors_allocated(dev)) {
+ continue;
+ }
+ if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
+ ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+ if (ret < 0) {
+ break;
+ }
+ kvm_virtio_pci_irqfd_release(proxy, n, vector);
+ }
+ kvm_virtio_pci_vq_vector_release(proxy, vector);
+ }
+ return ret;
+}
+
+static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
+{
+ PCIDevice *dev = &proxy->pci_dev;
+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+ unsigned int vector;
+ int queue_no;
+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
+ EventNotifier *n;
+ int ret ;
+ for (queue_no = 0; queue_no < nvqs; queue_no++) {
+ if (!virtio_queue_get_num(vdev, queue_no)) {
+ break;
+ }
+ ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+ if (ret < 0) {
+ break;
+ }
+ if (vector >= msix_nr_vectors_allocated(dev)) {
+ continue;
+ }
+ /* If guest supports masking, clean up irqfd now.
+ * Otherwise, it was cleaned when masked in the frontend.
+ */
+ if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
+ kvm_virtio_pci_irqfd_release(proxy, n, vector);
+ }
+ kvm_virtio_pci_vq_vector_release(proxy, vector);
}
}
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 09/10] Revert "virtio-pci: decouple notifier from interrupt process"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (7 preceding siblings ...)
2022-01-10 21:05 ` [PULL v2 08/10] Revert "virtio-pci: decouple the single vector from the interrupt process" Michael S. Tsirkin
@ 2022-01-10 21:05 ` Michael S. Tsirkin
2022-01-10 21:05 ` [Virtio-fs] " Michael S. Tsirkin
2022-01-11 11:37 ` [PULL v2 00/10] virtio: revert config interrupt changes Peter Maydell
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Cindy Lu
This reverts commit e3480ef81f6fb61cc9c04e3b5be8b7e84484fc05.
Fixes: e3480ef81f ("virtio-pci: decouple notifier from interrupt process")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-pci.c | 88 +++++++++++++++---------------------------
1 file changed, 31 insertions(+), 57 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 4bdb6e5694..750aa47ec1 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -704,41 +704,29 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy,
}
static int kvm_virtio_pci_irqfd_use(VirtIOPCIProxy *proxy,
- EventNotifier *n,
+ unsigned int queue_no,
unsigned int vector)
{
VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+ VirtQueue *vq = virtio_get_queue(vdev, queue_no);
+ EventNotifier *n = virtio_queue_get_guest_notifier(vq);
return kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, NULL, irqfd->virq);
}
static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy,
- EventNotifier *n ,
+ unsigned int queue_no,
unsigned int vector)
{
+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+ VirtQueue *vq = virtio_get_queue(vdev, queue_no);
+ EventNotifier *n = virtio_queue_get_guest_notifier(vq);
VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
int ret;
ret = kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, n, irqfd->virq);
assert(ret == 0);
}
-static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
- EventNotifier **n, unsigned int *vector)
-{
- VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
- VirtQueue *vq;
-
- if (queue_no == VIRTIO_CONFIG_IRQ_IDX) {
- return -1;
- } else {
- if (!virtio_queue_get_num(vdev, queue_no)) {
- return -1;
- }
- *vector = virtio_queue_vector(vdev, queue_no);
- vq = virtio_get_queue(vdev, queue_no);
- *n = virtio_queue_get_guest_notifier(vq);
- }
- return 0;
-}
static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
{
@@ -747,15 +735,12 @@ static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
unsigned int vector;
int ret, queue_no;
- EventNotifier *n;
+
for (queue_no = 0; queue_no < nvqs; queue_no++) {
if (!virtio_queue_get_num(vdev, queue_no)) {
break;
}
- ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
- if (ret < 0) {
- break;
- }
+ vector = virtio_queue_vector(vdev, queue_no);
if (vector >= msix_nr_vectors_allocated(dev)) {
continue;
}
@@ -767,7 +752,7 @@ static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
* Otherwise, delay until unmasked in the frontend.
*/
if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
- ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
+ ret = kvm_virtio_pci_irqfd_use(proxy, queue_no, vector);
if (ret < 0) {
kvm_virtio_pci_vq_vector_release(proxy, vector);
goto undo;
@@ -783,11 +768,7 @@ undo:
continue;
}
if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
- ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
- if (ret < 0) {
- break;
- }
- kvm_virtio_pci_irqfd_release(proxy, n, vector);
+ kvm_virtio_pci_irqfd_release(proxy, queue_no, vector);
}
kvm_virtio_pci_vq_vector_release(proxy, vector);
}
@@ -801,16 +782,12 @@ static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
unsigned int vector;
int queue_no;
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
- EventNotifier *n;
- int ret ;
+
for (queue_no = 0; queue_no < nvqs; queue_no++) {
if (!virtio_queue_get_num(vdev, queue_no)) {
break;
}
- ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
- if (ret < 0) {
- break;
- }
+ vector = virtio_queue_vector(vdev, queue_no);
if (vector >= msix_nr_vectors_allocated(dev)) {
continue;
}
@@ -818,20 +795,21 @@ static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
* Otherwise, it was cleaned when masked in the frontend.
*/
if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
- kvm_virtio_pci_irqfd_release(proxy, n, vector);
+ kvm_virtio_pci_irqfd_release(proxy, queue_no, vector);
}
kvm_virtio_pci_vq_vector_release(proxy, vector);
}
}
-static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
+static int virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
unsigned int queue_no,
unsigned int vector,
- MSIMessage msg,
- EventNotifier *n)
+ MSIMessage msg)
{
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
+ VirtQueue *vq = virtio_get_queue(vdev, queue_no);
+ EventNotifier *n = virtio_queue_get_guest_notifier(vq);
VirtIOIRQFD *irqfd;
int ret = 0;
@@ -858,15 +836,14 @@ static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
event_notifier_set(n);
}
} else {
- ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
+ ret = kvm_virtio_pci_irqfd_use(proxy, queue_no, vector);
}
return ret;
}
-static void virtio_pci_one_vector_mask(VirtIOPCIProxy *proxy,
+static void virtio_pci_vq_vector_mask(VirtIOPCIProxy *proxy,
unsigned int queue_no,
- unsigned int vector,
- EventNotifier *n)
+ unsigned int vector)
{
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
@@ -877,7 +854,7 @@ static void virtio_pci_one_vector_mask(VirtIOPCIProxy *proxy,
if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
k->guest_notifier_mask(vdev, queue_no, true);
} else {
- kvm_virtio_pci_irqfd_release(proxy, n, vector);
+ kvm_virtio_pci_irqfd_release(proxy, queue_no, vector);
}
}
@@ -887,7 +864,6 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev);
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtQueue *vq = virtio_vector_first_queue(vdev, vector);
- EventNotifier *n;
int ret, index, unmasked = 0;
while (vq) {
@@ -896,8 +872,7 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
break;
}
if (index < proxy->nvqs_with_notifiers) {
- n = virtio_queue_get_guest_notifier(vq);
- ret = virtio_pci_one_vector_unmask(proxy, index, vector, msg, n);
+ ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg);
if (ret < 0) {
goto undo;
}
@@ -913,8 +888,7 @@ undo:
while (vq && unmasked >= 0) {
index = virtio_get_queue_index(vq);
if (index < proxy->nvqs_with_notifiers) {
- n = virtio_queue_get_guest_notifier(vq);
- virtio_pci_one_vector_mask(proxy, index, vector, n);
+ virtio_pci_vq_vector_mask(proxy, index, vector);
--unmasked;
}
vq = virtio_vector_next_queue(vq);
@@ -927,17 +901,15 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector)
VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev);
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
VirtQueue *vq = virtio_vector_first_queue(vdev, vector);
- EventNotifier *n;
int index;
while (vq) {
index = virtio_get_queue_index(vq);
- n = virtio_queue_get_guest_notifier(vq);
if (!virtio_queue_get_num(vdev, index)) {
break;
}
if (index < proxy->nvqs_with_notifiers) {
- virtio_pci_one_vector_mask(proxy, index, vector, n);
+ virtio_pci_vq_vector_mask(proxy, index, vector);
}
vq = virtio_vector_next_queue(vq);
}
@@ -953,17 +925,19 @@ static void virtio_pci_vector_poll(PCIDevice *dev,
int queue_no;
unsigned int vector;
EventNotifier *notifier;
- int ret;
+ VirtQueue *vq;
for (queue_no = 0; queue_no < proxy->nvqs_with_notifiers; queue_no++) {
- ret = virtio_pci_get_notifier(proxy, queue_no, ¬ifier, &vector);
- if (ret < 0) {
+ if (!virtio_queue_get_num(vdev, queue_no)) {
break;
}
+ vector = virtio_queue_vector(vdev, queue_no);
if (vector < vector_start || vector >= vector_end ||
!msix_is_masked(dev, vector)) {
continue;
}
+ vq = virtio_get_queue(vdev, queue_no);
+ notifier = virtio_queue_get_guest_notifier(vq);
if (k->guest_notifier_pending) {
if (k->guest_notifier_pending(vdev, queue_no)) {
msix_set_pending(dev, vector);
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PULL v2 10/10] Revert "virtio: introduce macro IRTIO_CONFIG_IRQ_IDX"
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
@ 2022-01-10 21:05 ` Michael S. Tsirkin
2022-01-10 21:04 ` [PULL v2 02/10] Revert "virtio-mmio: " Michael S. Tsirkin
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:05 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Cindy Lu, Jason Wang, Dr. David Alan Gilbert,
virtio-fs, Gonglei (Arei),
Gerd Hoffmann, Stefan Hajnoczi, Marc-André Lureau
This reverts commit bf1d85c166c19af95dbd27b1faba1d2909732323.
Fixes: bf1d85c166 ("virtio: introduce macro IRTIO_CONFIG_IRQ_IDX")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio.h | 3 ---
hw/display/vhost-user-gpu.c | 6 ------
hw/net/virtio-net.c | 10 ++--------
hw/virtio/vhost-user-fs.c | 6 ------
hw/virtio/vhost-vsock-common.c | 6 ------
hw/virtio/virtio-crypto.c | 6 ------
6 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 605ea79c90..8bab9cfb75 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -67,9 +67,6 @@ typedef struct VirtQueueElement
#define VIRTIO_NO_VECTOR 0xffff
-/* special index value used internally for config irqs */
-#define VIRTIO_CONFIG_IRQ_IDX -1
-
#define TYPE_VIRTIO_DEVICE "virtio-device"
OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index d4a440e815..09818231bd 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -485,9 +485,6 @@ vhost_user_gpu_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VhostUserGPU *g = VHOST_USER_GPU(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_virtqueue_pending(&g->vhost->dev, idx);
}
@@ -496,9 +493,6 @@ vhost_user_gpu_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
{
VhostUserGPU *g = VHOST_USER_GPU(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask);
}
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 5e03c0dd14..cf8ab0f8af 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3168,9 +3168,6 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
}
@@ -3180,11 +3177,8 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
-
- vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
+ vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
+ vdev, idx, mask);
}
static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index 9b0349922e..c595957983 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -161,9 +161,6 @@ static void vuf_guest_notifier_mask(VirtIODevice *vdev, int idx,
{
VHostUserFS *fs = VHOST_USER_FS(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
vhost_virtqueue_mask(&fs->vhost_dev, vdev, idx, mask);
}
@@ -171,9 +168,6 @@ static bool vuf_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VHostUserFS *fs = VHOST_USER_FS(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_virtqueue_pending(&fs->vhost_dev, idx);
}
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index d1b9c027b6..3f3771274e 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -125,9 +125,6 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
{
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
}
@@ -136,9 +133,6 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
{
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
}
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 1d5192f8b4..54f9bbb789 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -948,9 +948,6 @@ static void virtio_crypto_guest_notifier_mask(VirtIODevice *vdev, int idx,
assert(vcrypto->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
cryptodev_vhost_virtqueue_mask(vdev, queue, idx, mask);
}
@@ -961,9 +958,6 @@ static bool virtio_crypto_guest_notifier_pending(VirtIODevice *vdev, int idx)
assert(vcrypto->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return cryptodev_vhost_virtqueue_pending(vdev, queue, idx);
}
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Virtio-fs] [PULL v2 10/10] Revert "virtio: introduce macro IRTIO_CONFIG_IRQ_IDX"
@ 2022-01-10 21:05 ` Michael S. Tsirkin
0 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2022-01-10 21:05 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Cindy Lu, Jason Wang, virtio-fs, Gonglei (Arei),
Gerd Hoffmann, Marc-André Lureau
This reverts commit bf1d85c166c19af95dbd27b1faba1d2909732323.
Fixes: bf1d85c166 ("virtio: introduce macro IRTIO_CONFIG_IRQ_IDX")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio.h | 3 ---
hw/display/vhost-user-gpu.c | 6 ------
hw/net/virtio-net.c | 10 ++--------
hw/virtio/vhost-user-fs.c | 6 ------
hw/virtio/vhost-vsock-common.c | 6 ------
hw/virtio/virtio-crypto.c | 6 ------
6 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 605ea79c90..8bab9cfb75 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -67,9 +67,6 @@ typedef struct VirtQueueElement
#define VIRTIO_NO_VECTOR 0xffff
-/* special index value used internally for config irqs */
-#define VIRTIO_CONFIG_IRQ_IDX -1
-
#define TYPE_VIRTIO_DEVICE "virtio-device"
OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index d4a440e815..09818231bd 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -485,9 +485,6 @@ vhost_user_gpu_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VhostUserGPU *g = VHOST_USER_GPU(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_virtqueue_pending(&g->vhost->dev, idx);
}
@@ -496,9 +493,6 @@ vhost_user_gpu_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
{
VhostUserGPU *g = VHOST_USER_GPU(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask);
}
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 5e03c0dd14..cf8ab0f8af 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3168,9 +3168,6 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
}
@@ -3180,11 +3177,8 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
VirtIONet *n = VIRTIO_NET(vdev);
NetClientState *nc = qemu_get_subqueue(n->nic, vq2q(idx));
assert(n->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
-
- vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
+ vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
+ vdev, idx, mask);
}
static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index 9b0349922e..c595957983 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -161,9 +161,6 @@ static void vuf_guest_notifier_mask(VirtIODevice *vdev, int idx,
{
VHostUserFS *fs = VHOST_USER_FS(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
vhost_virtqueue_mask(&fs->vhost_dev, vdev, idx, mask);
}
@@ -171,9 +168,6 @@ static bool vuf_guest_notifier_pending(VirtIODevice *vdev, int idx)
{
VHostUserFS *fs = VHOST_USER_FS(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_virtqueue_pending(&fs->vhost_dev, idx);
}
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index d1b9c027b6..3f3771274e 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -125,9 +125,6 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
{
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
}
@@ -136,9 +133,6 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
{
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
}
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 1d5192f8b4..54f9bbb789 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -948,9 +948,6 @@ static void virtio_crypto_guest_notifier_mask(VirtIODevice *vdev, int idx,
assert(vcrypto->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return;
- }
cryptodev_vhost_virtqueue_mask(vdev, queue, idx, mask);
}
@@ -961,9 +958,6 @@ static bool virtio_crypto_guest_notifier_pending(VirtIODevice *vdev, int idx)
assert(vcrypto->vhost_started);
- if (idx == VIRTIO_CONFIG_IRQ_IDX) {
- return false;
- }
return cryptodev_vhost_virtqueue_pending(vdev, queue, idx);
}
--
MST
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PULL v2 00/10] virtio: revert config interrupt changes
2022-01-10 21:04 [PULL v2 00/10] virtio: revert config interrupt changes Michael S. Tsirkin
` (9 preceding siblings ...)
2022-01-10 21:05 ` [Virtio-fs] " Michael S. Tsirkin
@ 2022-01-11 11:37 ` Peter Maydell
10 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2022-01-11 11:37 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel
On Mon, 10 Jan 2022 at 21:04, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> Changes from v1:
> added tags to commit logs.
>
> The following changes since commit ca745d2277496464b54fd832c15c45d0227325bb:
>
> tests: acpi: Add updated TPM related tables (2022-01-07 19:30:13 -0500)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to a882b5712373171d3bd53cd82ddab4453ddef468:
>
> Revert "virtio: introduce macro IRTIO_CONFIG_IRQ_IDX" (2022-01-10 16:02:54 -0500)
>
> ----------------------------------------------------------------
> virtio: revert config interrupt changes
>
> Lots of fallout from config interrupt changes. Author wants to rework
> the patches. Let's revert quickly so others don't suffer meanwhile.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 13+ messages in thread