All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
To: will@kernel.org
Cc: andre.przywara@arm.com, alexandru.elisei@arm.com,
	kvm@vger.kernel.org, suzuki.poulose@arm.com, sashal@kernel.org,
	jean-philippe@linaro.org
Subject: [PATCH kvmtool v2 01/12] virtio/pci: Delete MSI routes
Date: Fri,  1 Jul 2022 15:24:23 +0100	[thread overview]
Message-ID: <20220701142434.75170-2-jean-philippe.brucker@arm.com> (raw)
In-Reply-To: <20220701142434.75170-1-jean-philippe.brucker@arm.com>

On exit_vq() and device reset, remove the MSI routes that were set up at
runtime.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
---
 virtio/pci.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/virtio/pci.c b/virtio/pci.c
index 1a549314..9b710852 100644
--- a/virtio/pci.c
+++ b/virtio/pci.c
@@ -60,6 +60,13 @@ static int virtio_pci__add_msix_route(struct virtio_pci *vpci, u32 vec)
 	return gsi;
 }
 
+static void virtio_pci__del_msix_route(struct virtio_pci *vpci, u32 gsi)
+{
+	struct msi_msg msg = { 0 };
+
+	irq__update_msix_route(vpci->kvm, gsi, &msg);
+}
+
 static void virtio_pci__ioevent_callback(struct kvm *kvm, void *param)
 {
 	struct virtio_pci_ioevent_param *ioeventfd = param;
@@ -128,6 +135,9 @@ static void virtio_pci_exit_vq(struct kvm *kvm, struct virtio_device *vdev,
 	u32 mmio_addr = virtio_pci__mmio_addr(vpci);
 	u16 port_addr = virtio_pci__port_addr(vpci);
 
+	virtio_pci__del_msix_route(vpci, vpci->gsis[vq]);
+	vpci->gsis[vq] = 0;
+	vpci->vq_vector[vq] = VIRTIO_MSI_NO_VECTOR;
 	ioeventfd__del_event(mmio_addr + VIRTIO_PCI_QUEUE_NOTIFY, vq);
 	ioeventfd__del_event(port_addr + VIRTIO_PCI_QUEUE_NOTIFY, vq);
 	virtio_exit_vq(kvm, vdev, vpci->dev, vq);
@@ -623,6 +633,10 @@ int virtio_pci__reset(struct kvm *kvm, struct virtio_device *vdev)
 	unsigned int vq;
 	struct virtio_pci *vpci = vdev->virtio;
 
+	virtio_pci__del_msix_route(vpci, vpci->config_gsi);
+	vpci->config_gsi = 0;
+	vpci->config_vector = VIRTIO_MSI_NO_VECTOR;
+
 	for (vq = 0; vq < vdev->ops->get_vq_count(kvm, vpci->dev); vq++)
 		virtio_pci_exit_vq(kvm, vdev, vq);
 
-- 
2.36.1


  reply	other threads:[~2022-07-01 14:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 14:24 [PATCH kvmtool v2 00/12] Virtio v1 support Jean-Philippe Brucker
2022-07-01 14:24 ` Jean-Philippe Brucker [this message]
2022-07-01 14:24 ` [PATCH kvmtool v2 02/12] virtio: Extract init_vq() for PCI and MMIO Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 03/12] virtio/pci: Make doorbell offset dynamic Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 04/12] virtio/pci: Use the correct eventfd for vhost notification Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 05/12] virtio/net: Set vhost backend after queue address Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 06/12] virtio: Prepare for more feature bits Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 07/12] virtio: Move PCI transport to pci-legacy Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 08/12] virtio: Add support for modern virtio-pci Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 09/12] virtio: Move MMIO transport to mmio-legacy Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 10/12] virtio: Add support for modern virtio-mmio Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 11/12] virtio/pci: Initialize all vectors to VIRTIO_MSI_NO_VECTOR Jean-Philippe Brucker
2022-07-01 14:24 ` [PATCH kvmtool v2 12/12] virtio/pci: Remove VIRTIO_PCI_F_SIGNAL_MSI Jean-Philippe Brucker
2022-07-01 15:41 ` [PATCH kvmtool v2 00/12] Virtio v1 support Will Deacon

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=20220701142434.75170-2-jean-philippe.brucker@arm.com \
    --to=jean-philippe.brucker@arm.com \
    --cc=alexandru.elisei@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=jean-philippe@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.