From: Cindy Lu <lulu@redhat.com>
To: lulu@redhat.com, mst@redhat.com, jasowang@redhat.com,
qemu-devel@nongnu.org
Subject: [RFC 2/2] virtio-pci: check if the configure interrupt enable
Date: Wed, 27 Mar 2024 09:22:15 +0800 [thread overview]
Message-ID: <20240327012905.70188-3-lulu@redhat.com> (raw)
In-Reply-To: <20240327012905.70188-1-lulu@redhat.com>
If config_irq_enabled is not true, it means that configure interrupt is
not supported. Therefore, the config vector will not be handled during
the interrupt process.
Signed-off-by: Cindy Lu <lulu@redhat.com>
---
hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index e433879542..36ad7da206 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1065,7 +1065,7 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
vq = virtio_vector_next_queue(vq);
}
/* unmask config intr */
- if (vector == vdev->config_vector) {
+ if ((vector == vdev->config_vector) && (true == vdev->config_irq_enabled)) {
n = virtio_config_get_guest_notifier(vdev);
ret = virtio_pci_one_vector_unmask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector,
msg, n);
@@ -1111,7 +1111,7 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector)
vq = virtio_vector_next_queue(vq);
}
- if (vector == vdev->config_vector) {
+ if ((vector == vdev->config_vector) && (true == vdev->config_irq_enabled)) {
n = virtio_config_get_guest_notifier(vdev);
virtio_pci_one_vector_mask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector, n);
}
@@ -1147,21 +1147,24 @@ static void virtio_pci_vector_poll(PCIDevice *dev,
}
}
/* 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)) {
+ if (true == vdev->config_irq_enabled) {
+ 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);
}
- } else if (event_notifier_test_and_clear(notifier)) {
- msix_set_pending(dev, vector);
}
}
@@ -1282,9 +1285,11 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
if (r < 0) {
goto config_assign_error;
}
- r = kvm_virtio_pci_vector_config_use(proxy);
- if (r < 0) {
- goto config_error;
+ if (true == vdev->config_irq_enabled) {
+ r = kvm_virtio_pci_vector_config_use(proxy);
+ if (r < 0) {
+ goto config_error;
+ }
}
}
--
2.43.0
next prev parent reply other threads:[~2024-03-27 1:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 1:22 [RFC 0/2] disable the configuration interrupt for the unsupported device Cindy Lu
2024-03-27 1:22 ` [RFC 1/2] virtio-net: disable the configure interrupt for not support device Cindy Lu
2024-03-27 2:54 ` Jason Wang
2024-03-27 1:22 ` Cindy Lu [this message]
2024-03-27 3:05 ` [RFC 0/2] disable the configuration interrupt for the unsupported device Jason Wang
2024-03-27 6:02 ` Cindy Lu
2024-03-27 7:54 ` Jason Wang
2024-03-27 8:28 ` Cindy Lu
2024-03-27 9:12 ` Jason Wang
2024-03-27 9:12 ` Jason Wang
2024-03-27 9:43 ` Cindy Lu
2024-03-28 4:14 ` Jason Wang
2024-03-28 7:07 ` Cindy Lu
2024-03-27 9:32 ` Cindy Lu
2024-03-28 4:12 ` Jason Wang
2024-03-29 3:02 ` Cindy Lu
2024-03-29 3:27 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240327012905.70188-3-lulu@redhat.com \
--to=lulu@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).