qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: eric.auger@redhat.com
Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com,
	richard.henderson@linaro.org, qemu-devel@nongnu.org,
	shannon.zhaosl@gmail.com,
	Jean-Philippe Brucker <jean-philippe@linaro.org>,
	qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com
Subject: [PATCH v2 5/8] hw/arm/virt: Reject instantiation of multiple IOMMUs
Date: Fri,  3 Sep 2021 16:32:06 +0200	[thread overview]
Message-ID: <20210903143208.2434284-6-jean-philippe@linaro.org> (raw)
In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org>

We do not support instantiating multiple IOMMUs. Before adding a
virtio-iommu, check that no other IOMMU is present. This will detect
both "iommu=smmuv3" machine parameter and another virtio-iommu instance.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
 hw/arm/virt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b4598d3fe6..5ca225291f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2475,6 +2475,11 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
     if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
         PCIDevice *pdev = PCI_DEVICE(dev);
 
+        if (vms->iommu != VIRT_IOMMU_NONE) {
+            error_setg(errp, "virt machine does not support multiple IOMMUs");
+            return;
+        }
+
         vms->iommu = VIRT_IOMMU_VIRTIO;
         vms->virtio_iommu_bdf = pci_get_bdf(pdev);
         create_virtio_iommu_dt_bindings(vms);
-- 
2.33.0



  parent reply	other threads:[~2021-09-03 14:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 14:32 [PATCH v2 0/8] virtio-iommu: Add ACPI support Jean-Philippe Brucker
2021-09-03 14:32 ` [PATCH v2 1/8] acpi: Add VIOT structure definitions Jean-Philippe Brucker
2021-09-06 12:44   ` Eric Auger
2021-09-03 14:32 ` [PATCH v2 2/8] hw/acpi: Add VIOT table Jean-Philippe Brucker
2021-09-06 12:58   ` Eric Auger
2021-09-08  9:52     ` Jean-Philippe Brucker
2021-09-03 14:32 ` [PATCH v2 3/8] hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu Jean-Philippe Brucker
2021-09-06 14:28   ` Eric Auger
2021-09-03 14:32 ` [PATCH v2 4/8] hw/arm/virt: Remove device tree restriction " Jean-Philippe Brucker
2021-09-06 14:38   ` Eric Auger
2021-09-03 14:32 ` Jean-Philippe Brucker [this message]
2021-09-06 14:28   ` [PATCH v2 5/8] hw/arm/virt: Reject instantiation of multiple IOMMUs Eric Auger
2021-09-03 14:32 ` [PATCH v2 6/8] pc: Add VIOT table for virtio-iommu Jean-Philippe Brucker
2021-09-06 15:02   ` Eric Auger
2021-09-08  9:52     ` Jean-Philippe Brucker
2021-09-03 14:32 ` [PATCH v2 7/8] pc: Allow instantiating a virtio-iommu device Jean-Philippe Brucker
2021-09-06 14:57   ` Eric Auger
2021-09-08  9:54     ` Jean-Philippe Brucker
2021-09-08  9:58       ` Eric Auger
2021-09-03 14:32 ` [PATCH v2 8/8] docs: Add '-device virtio-iommu' entry Jean-Philippe Brucker
2021-09-06 14:41   ` Eric Auger
2021-09-06 14:45   ` Daniel P. Berrangé
2021-09-08 10:14     ` Jean-Philippe Brucker
2021-09-06 15:00   ` Eric Auger

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=20210903143208.2434284-6-jean-philippe@linaro.org \
    --to=jean-philippe@linaro.org \
    --cc=ehabkost@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shannon.zhaosl@gmail.com \
    /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).