Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sairaj Kodilkar <sarunkod@amd.com>
To: "Clément Mathieu--Drif" <clement.mathieu--drif@bull.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Alejandro Jimenez" <alejandro.j.jimenez@oracle.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Sairaj Kodilkar" <sarunkod@amd.com>,
	"Yi Liu" <yi.l.liu@intel.com>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: <Vasant.Hegde@amd.com>, <Suravee.Suthikulpanit@amd.com>
Subject: [PATCH 6/6] x86-iommu: Allow multiple AMD vIOMMU devices
Date: Mon, 30 Nov 2026 15:42:37 +0530	[thread overview]
Message-ID: <20261130101237.1416-7-sarunkod@amd.com> (raw)
In-Reply-To: <20261130101237.1416-1-sarunkod@amd.com>

pc_iommu_pre_plug() used to reject any second vIOMMU unconditionally.
Relax that for TYPE_AMD_IOMMU_DEVICE so several AMD IOMMU instances can
be plugged into the machine.

The check looks at the first vIOMMU as well as the new one, so an AMD
IOMMU cannot be combined with an Intel or virtio IOMMU in either order.
Intel and virtio vIOMMUs are still limited to a single instance.

Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
---
 hw/i386/pc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 1b1101af0c79..21135f984e8c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -56,6 +56,7 @@
 #include "hw/cxl/cxl_host.h"
 #include "hw/usb/usb.h"
 #include "hw/i386/intel_iommu.h"
+#include "amd_iommu.h"
 #include "hw/net/ne2000-isa.h"
 #include "hw/virtio/virtio-iommu.h"
 #include "hw/virtio/virtio-md-pci.h"
@@ -1321,11 +1322,14 @@ static void pc_sp_mem_plug(const HotplugHandler *hotplug_dev,
 static void pc_iommu_pre_plug(PCMachineState *pcms, DeviceState *dev,
                               Error **errp)
 {
+    PCIOMMUEntry *first = QTAILQ_FIRST(&pcms->iommus);
     PCIOMMUEntry *entry;
 
-    if (!QTAILQ_EMPTY(&pcms->iommus)) {
-        error_setg(errp, "QEMU does not support multiple vIOMMUs "
-                   "for x86 yet.");
+    if (first &&
+        !(object_dynamic_cast(OBJECT(dev), TYPE_AMD_IOMMU_DEVICE) &&
+          object_dynamic_cast(OBJECT(first->dev), TYPE_AMD_IOMMU_DEVICE))) {
+        error_setg(errp, "QEMU supports multiple vIOMMUs for x86 only with "
+                   "AMD IOMMU, and they cannot be mixed with other types");
         return;
     }
 
-- 
2.34.1


      parent reply	other threads:[~2026-11-30 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 10:12 [PATCH 0/6] amd_iommu: Add support for multiple AMD vIOMMUs Sairaj Kodilkar
2026-11-30 10:12 ` [PATCH 1/6] hw/i386: Track the IOMMU to which IOAPIC is attached Sairaj Kodilkar
2026-11-30 10:12 ` [PATCH 2/6] i386/kvm: x86_iommu: Introduce per-iommu notify_list_inited flag Sairaj Kodilkar
2026-11-30 10:12 ` [PATCH 3/6] acpi-build: i386/pc: Track vIOMMUs in a list Sairaj Kodilkar
2026-11-30 10:12 ` [PATCH 4/6] amd_iommu: acpi-build: Add support for multiple AMD-IOMMUs Sairaj Kodilkar
2026-11-30 10:12 ` [PATCH 5/6] amd_iommu: Introduce AMDIVRSInfo for shared IVRS construction Sairaj Kodilkar
2026-11-30 10:12 ` Sairaj Kodilkar [this message]

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=20261130101237.1416-7-sarunkod@amd.com \
    --to=sarunkod@amd.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=Vasant.Hegde@amd.com \
    --cc=alejandro.j.jimenez@oracle.com \
    --cc=anisinha@redhat.com \
    --cc=clement.mathieu--drif@bull.com \
    --cc=imammedo@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=yi.l.liu@intel.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