From: Cindy Lu <lulu@redhat.com>
To: lulu@redhat.com, mst@redhat.com, jasowang@redhat.com,
qemu-devel@nongnu.org
Subject: [RFC 1/2] virtio-net: disable the configure interrupt for not support device
Date: Wed, 27 Mar 2024 09:22:14 +0800 [thread overview]
Message-ID: <20240327012905.70188-2-lulu@redhat.com> (raw)
In-Reply-To: <20240327012905.70188-1-lulu@redhat.com>
Only the vdpa device support configure interrupt, we need to disable the
configure interrupt process in all other device.
In order to achieve this, I added a check in the virtio_net_device_realize().
When the peer's type is vdpa, the value of config_irq_enabled in the structure
VirtIODevice will set to true.
Signed-off-by: Cindy Lu <lulu@redhat.com>
---
hw/net/virtio-net.c | 5 ++++-
hw/virtio/virtio.c | 1 +
include/hw/virtio/virtio.h | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 80c56f0cfc..3b487864a8 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3749,12 +3749,15 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
nc = qemu_get_queue(n->nic);
nc->rxfilter_notify_enabled = 1;
+ vdev->config_irq_enabled = false;
- if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
+ if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
struct virtio_net_config netcfg = {};
memcpy(&netcfg.mac, &n->nic_conf.macaddr, ETH_ALEN);
vhost_net_set_config(get_vhost_net(nc->peer),
(uint8_t *)&netcfg, 0, ETH_ALEN, VHOST_SET_CONFIG_TYPE_FRONTEND);
+
+ vdev->config_irq_enabled = true;
}
QTAILQ_INIT(&n->rsc_chains);
n->qdev = dev;
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 3a160f86ed..6b52a7190d 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3255,6 +3255,7 @@ void virtio_init(VirtIODevice *vdev, uint16_t device_id, size_t config_size)
virtio_vmstate_change, vdev);
vdev->device_endian = virtio_default_endian();
vdev->use_guest_notifier_mask = true;
+ vdev->config_irq_enabled = false;
}
/*
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index c8f72850bc..a7763b71e0 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -164,6 +164,7 @@ struct VirtIODevice
*/
EventNotifier config_notifier;
bool device_iotlb_enabled;
+ bool config_irq_enabled;
};
struct VirtioDeviceClass {
--
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 ` Cindy Lu [this message]
2024-03-27 2:54 ` [RFC 1/2] virtio-net: disable the configure interrupt for not support device Jason Wang
2024-03-27 1:22 ` [RFC 2/2] virtio-pci: check if the configure interrupt enable Cindy Lu
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-2-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).