From: Igor Mammedov <imammedo@redhat.com> To: Jean-Philippe Brucker <jean-philippe@linaro.org> Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, jasowang@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, peterx@redhat.com, shannon.zhaosl@gmail.com, qemu-arm@nongnu.org, ani@anisinha.ca, pbonzini@redhat.com, eric.auger@redhat.com Subject: Re: [PATCH v5 02/12] hw/i386/pc: Remove x86_iommu_get_type() Date: Thu, 21 Oct 2021 15:29:51 +0200 [thread overview] Message-ID: <20211021152951.6582b98f@redhat.com> (raw) In-Reply-To: <20211020172745.620101-3-jean-philippe@linaro.org> On Wed, 20 Oct 2021 18:27:36 +0100 Jean-Philippe Brucker <jean-philippe@linaro.org> wrote: > To generate the IOMMU ACPI table, acpi-build.c can use base QEMU types > instead of a special IommuType value. > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Reviewed-by: Igor Mammedov <imammedo@redhat.com> > --- > include/hw/i386/x86-iommu.h | 12 ------------ > hw/i386/acpi-build.c | 20 +++++++++----------- > hw/i386/amd_iommu.c | 2 -- > hw/i386/intel_iommu.c | 3 --- > hw/i386/x86-iommu-stub.c | 5 ----- > hw/i386/x86-iommu.c | 5 ----- > 6 files changed, 9 insertions(+), 38 deletions(-) > > diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h > index 9de92d33a1..5ba0c056d6 100644 > --- a/include/hw/i386/x86-iommu.h > +++ b/include/hw/i386/x86-iommu.h > @@ -33,12 +33,6 @@ OBJECT_DECLARE_TYPE(X86IOMMUState, X86IOMMUClass, X86_IOMMU_DEVICE) > typedef struct X86IOMMUIrq X86IOMMUIrq; > typedef struct X86IOMMU_MSIMessage X86IOMMU_MSIMessage; > > -typedef enum IommuType { > - TYPE_INTEL, > - TYPE_AMD, > - TYPE_NONE > -} IommuType; > - > struct X86IOMMUClass { > SysBusDeviceClass parent; > /* Intel/AMD specific realize() hook */ > @@ -71,7 +65,6 @@ struct X86IOMMUState { > OnOffAuto intr_supported; /* Whether vIOMMU supports IR */ > bool dt_supported; /* Whether vIOMMU supports DT */ > bool pt_supported; /* Whether vIOMMU supports pass-through */ > - IommuType type; /* IOMMU type - AMD/Intel */ > QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */ > }; > > @@ -140,11 +133,6 @@ struct X86IOMMU_MSIMessage { > */ > X86IOMMUState *x86_iommu_get_default(void); > > -/* > - * x86_iommu_get_type - get IOMMU type > - */ > -IommuType x86_iommu_get_type(void); > - > /** > * x86_iommu_iec_register_notifier - register IEC (Interrupt Entry > * Cache) notifiers > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 81418b7911..ab49e799ff 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -2488,6 +2488,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) > PCMachineState *pcms = PC_MACHINE(machine); > PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); > X86MachineState *x86ms = X86_MACHINE(machine); > + X86IOMMUState *iommu = x86_iommu_get_default(); > GArray *table_offsets; > unsigned facs, dsdt, rsdt, fadt; > AcpiPmInfo pm; > @@ -2604,17 +2605,14 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) > build_mcfg(tables_blob, tables->linker, &mcfg, x86ms->oem_id, > x86ms->oem_table_id); > } > - if (x86_iommu_get_default()) { > - IommuType IOMMUType = x86_iommu_get_type(); > - if (IOMMUType == TYPE_AMD) { > - acpi_add_table(table_offsets, tables_blob); > - build_amd_iommu(tables_blob, tables->linker, x86ms->oem_id, > - x86ms->oem_table_id); > - } else if (IOMMUType == TYPE_INTEL) { > - acpi_add_table(table_offsets, tables_blob); > - build_dmar_q35(tables_blob, tables->linker, x86ms->oem_id, > - x86ms->oem_table_id); > - } > + if (object_dynamic_cast(OBJECT(iommu), TYPE_AMD_IOMMU_DEVICE)) { > + acpi_add_table(table_offsets, tables_blob); > + build_amd_iommu(tables_blob, tables->linker, x86ms->oem_id, > + x86ms->oem_table_id); > + } else if (object_dynamic_cast(OBJECT(iommu), TYPE_INTEL_IOMMU_DEVICE)) { > + acpi_add_table(table_offsets, tables_blob); > + build_dmar_q35(tables_blob, tables->linker, x86ms->oem_id, > + x86ms->oem_table_id); > } > if (machine->nvdimms_state->is_enabled) { > nvdimm_build_acpi(table_offsets, tables_blob, tables->linker, > diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c > index 9242a0d3ed..91fe34ae58 100644 > --- a/hw/i386/amd_iommu.c > +++ b/hw/i386/amd_iommu.c > @@ -1538,7 +1538,6 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp) > { > int ret = 0; > AMDVIState *s = AMD_IOMMU_DEVICE(dev); > - X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev); > MachineState *ms = MACHINE(qdev_get_machine()); > PCMachineState *pcms = PC_MACHINE(ms); > X86MachineState *x86ms = X86_MACHINE(ms); > @@ -1548,7 +1547,6 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp) > amdvi_uint64_equal, g_free, g_free); > > /* This device should take care of IOMMU PCI properties */ > - x86_iommu->type = TYPE_AMD; > if (!qdev_realize(DEVICE(&s->pci), &bus->qbus, errp)) { > return; > } > diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c > index 75f075547f..c27b20090e 100644 > --- a/hw/i386/intel_iommu.c > +++ b/hw/i386/intel_iommu.c > @@ -3806,9 +3806,6 @@ static void vtd_realize(DeviceState *dev, Error **errp) > X86MachineState *x86ms = X86_MACHINE(ms); > PCIBus *bus = pcms->bus; > IntelIOMMUState *s = INTEL_IOMMU_DEVICE(dev); > - X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev); > - > - x86_iommu->type = TYPE_INTEL; > > if (!vtd_decide_config(s, errp)) { > return; > diff --git a/hw/i386/x86-iommu-stub.c b/hw/i386/x86-iommu-stub.c > index c5ba077f9d..781b5ff922 100644 > --- a/hw/i386/x86-iommu-stub.c > +++ b/hw/i386/x86-iommu-stub.c > @@ -36,8 +36,3 @@ bool x86_iommu_ir_supported(X86IOMMUState *s) > { > return false; > } > - > -IommuType x86_iommu_get_type(void) > -{ > - abort(); > -} > diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c > index 86ad03972e..dc968c7a53 100644 > --- a/hw/i386/x86-iommu.c > +++ b/hw/i386/x86-iommu.c > @@ -98,11 +98,6 @@ X86IOMMUState *x86_iommu_get_default(void) > return x86_iommu_default; > } > > -IommuType x86_iommu_get_type(void) > -{ > - return x86_iommu_default->type; > -} > - > static void x86_iommu_realize(DeviceState *dev, Error **errp) > { > X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
next prev parent reply other threads:[~2021-10-21 13:32 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-20 17:27 [PATCH v5 00/12] virtio-iommu: Add ACPI support Jean-Philippe Brucker 2021-10-20 17:27 ` [PATCH v5 01/12] hw/acpi: Add VIOT table Jean-Philippe Brucker 2021-10-20 17:27 ` [PATCH v5 02/12] hw/i386/pc: Remove x86_iommu_get_type() Jean-Philippe Brucker 2021-10-21 9:02 ` Eric Auger 2021-10-21 13:29 ` Igor Mammedov [this message] 2021-10-20 17:27 ` [PATCH v5 03/12] hw/i386/pc: Move IOMMU singleton into PCMachineState Jean-Philippe Brucker 2021-10-21 9:02 ` Eric Auger 2021-10-21 13:34 ` Igor Mammedov 2021-10-20 17:27 ` [PATCH v5 04/12] hw/i386/pc: Allow instantiating a virtio-iommu device Jean-Philippe Brucker 2021-10-21 13:47 ` Igor Mammedov 2021-10-25 11:23 ` Jean-Philippe Brucker 2021-10-20 17:27 ` [PATCH v5 05/12] hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu Jean-Philippe Brucker 2021-10-21 13:49 ` Igor Mammedov 2021-10-20 17:27 ` [PATCH v5 06/12] hw/arm/virt: Remove device tree restriction " Jean-Philippe Brucker 2021-10-21 13:53 ` Igor Mammedov 2021-10-20 17:27 ` [PATCH v5 07/12] hw/arm/virt: Reject instantiation of multiple IOMMUs Jean-Philippe Brucker 2021-10-21 13:54 ` Igor Mammedov 2021-10-20 17:27 ` [PATCH v5 08/12] hw/arm/virt: Use object_property_set instead of qdev_prop_set Jean-Philippe Brucker 2021-10-20 17:27 ` [PATCH v5 09/12] tests/acpi: allow updates of VIOT expected data files Jean-Philippe Brucker 2021-10-21 9:02 ` Eric Auger 2021-10-21 14:00 ` Igor Mammedov 2021-10-20 17:27 ` [PATCH v5 10/12] tests/acpi: add test cases for VIOT Jean-Philippe Brucker 2021-10-21 9:02 ` Eric Auger 2021-10-26 9:47 ` Jean-Philippe Brucker 2021-10-21 9:02 ` Eric Auger 2021-10-20 17:27 ` [PATCH v5 11/12] tests/acpi: add expected blob for VIOT test on virt machine Jean-Philippe Brucker 2021-10-20 17:27 ` [PATCH v5 12/12] tests/acpi: add expected blobs for VIOT test on q35 machine Jean-Philippe Brucker
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=20211021152951.6582b98f@redhat.com \ --to=imammedo@redhat.com \ --cc=ani@anisinha.ca \ --cc=ehabkost@redhat.com \ --cc=eric.auger@redhat.com \ --cc=jasowang@redhat.com \ --cc=jean-philippe@linaro.org \ --cc=mst@redhat.com \ --cc=pbonzini@redhat.com \ --cc=peter.maydell@linaro.org \ --cc=peterx@redhat.com \ --cc=qemu-arm@nongnu.org \ --cc=qemu-devel@nongnu.org \ --cc=richard.henderson@linaro.org \ --cc=shannon.zhaosl@gmail.com \ --subject='Re: [PATCH v5 02/12] hw/i386/pc: Remove x86_iommu_get_type()' \ /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
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).