[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c
From: |
Eric Auger |
Subject: |
Re: [PATCH v4 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c |
Date: |
Tue, 5 Oct 2021 13:41:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
Hi jean,
On 10/1/21 7:33 PM, Jean-Philippe Brucker wrote:
> 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>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Eric
> ---
> 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;
> }
>
- [PATCH v4 00/11] virtio-iommu: Add ACPI support, Jean-Philippe Brucker, 2021/10/01
- [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 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c, Jean-Philippe Brucker, 2021/10/01
- Re: [PATCH v4 06/11] hw/i386: Move vIOMMU uniqueness check into pc.c,
Eric Auger <=
- [PATCH v4 01/11] hw/acpi: Add VIOT table, 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 07/11] pc: Allow instantiating a virtio-iommu device, Jean-Philippe Brucker, 2021/10/01