[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c
From: |
Jean-Philippe Brucker |
Subject: |
[PATCH v4 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c |
Date: |
Fri, 1 Oct 2021 18:33:54 +0100 |
We're about to need this check for a third vIOMMU, virtio-iommu, which
doesn't inherit X86IOMMUState as it doesn't support IRQ remapping and is
a virtio device. Move the check into the pre_plug callback to be shared
by all three vIOMMUs.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
hw/i386/pc.c | 10 +++++++++-
hw/i386/x86-iommu.c | 6 ------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 557d49c9f8..789ccb6ef4 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1367,6 +1367,13 @@ static void pc_virtio_md_pci_unplug(HotplugHandler
*hotplug_dev,
static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
+ if (object_dynamic_cast(OBJECT(dev), TYPE_X86_IOMMU_DEVICE) &&
+ x86_iommu_get_default()) {
+ error_setg(errp, "QEMU does not support multiple vIOMMUs "
+ "for x86 yet.");
+ return;
+ }
+
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
pc_memory_pre_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
@@ -1428,7 +1435,8 @@ static HotplugHandler
*pc_get_hotplug_handler(MachineState *machine,
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) ||
object_dynamic_cast(OBJECT(dev), TYPE_CPU) ||
object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
- object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_X86_IOMMU_DEVICE)) {
return HOTPLUG_HANDLER(machine);
}
diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c
index 86ad03972e..550e551993 100644
--- a/hw/i386/x86-iommu.c
+++ b/hw/i386/x86-iommu.c
@@ -84,12 +84,6 @@ static void x86_iommu_set_default(X86IOMMUState *x86_iommu)
{
assert(x86_iommu);
- if (x86_iommu_default) {
- error_report("QEMU does not support multiple vIOMMUs "
- "for x86 yet.");
- exit(1);
- }
-
x86_iommu_default = x86_iommu;
}
--
2.33.0
- [PATCH v4 05/11] hw/arm/virt: Use object_property_set instead of qdev_prop_set, (continued)
- [PATCH v4 05/11] hw/arm/virt: Use object_property_set instead of qdev_prop_set, Jean-Philippe Brucker, 2021/10/01
- [PATCH v4 04/11] hw/arm/virt: Reject instantiation of multiple IOMMUs, Jean-Philippe Brucker, 2021/10/01
- [PATCH v4 07/11] pc: Allow instantiating a virtio-iommu device, Jean-Philippe Brucker, 2021/10/01
- [PATCH v4 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c,
Jean-Philippe Brucker <=
- [PATCH v4 02/11] hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu, Jean-Philippe Brucker, 2021/10/01
- [PATCH v4 09/11] tests/acpi: add test cases for VIOT, Jean-Philippe Brucker, 2021/10/01
- [PATCH v4 08/11] tests/acpi: allow updates of VIOT expected data files, Jean-Philippe Brucker, 2021/10/01