hw/i386/pc: Remove x86_iommu_get_type()
To generate the IOMMU ACPI table, acpi-build.c can use base QEMU types instead of a special IommuType value. Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Message-Id: <20211026182024.2642038-3-jean-philippe@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
1f85d74ac5
commit
867e9c9f4c
|
@ -2488,6 +2488,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||||
PCMachineState *pcms = PC_MACHINE(machine);
|
PCMachineState *pcms = PC_MACHINE(machine);
|
||||||
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||||
X86MachineState *x86ms = X86_MACHINE(machine);
|
X86MachineState *x86ms = X86_MACHINE(machine);
|
||||||
|
X86IOMMUState *iommu = x86_iommu_get_default();
|
||||||
GArray *table_offsets;
|
GArray *table_offsets;
|
||||||
unsigned facs, dsdt, rsdt, fadt;
|
unsigned facs, dsdt, rsdt, fadt;
|
||||||
AcpiPmInfo pm;
|
AcpiPmInfo pm;
|
||||||
|
@ -2604,17 +2605,14 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||||
build_mcfg(tables_blob, tables->linker, &mcfg, x86ms->oem_id,
|
build_mcfg(tables_blob, tables->linker, &mcfg, x86ms->oem_id,
|
||||||
x86ms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
if (x86_iommu_get_default()) {
|
if (object_dynamic_cast(OBJECT(iommu), TYPE_AMD_IOMMU_DEVICE)) {
|
||||||
IommuType IOMMUType = x86_iommu_get_type();
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
if (IOMMUType == TYPE_AMD) {
|
build_amd_iommu(tables_blob, tables->linker, x86ms->oem_id,
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
x86ms->oem_table_id);
|
||||||
build_amd_iommu(tables_blob, tables->linker, x86ms->oem_id,
|
} else if (object_dynamic_cast(OBJECT(iommu), TYPE_INTEL_IOMMU_DEVICE)) {
|
||||||
x86ms->oem_table_id);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
} else if (IOMMUType == TYPE_INTEL) {
|
build_dmar_q35(tables_blob, tables->linker, x86ms->oem_id,
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
x86ms->oem_table_id);
|
||||||
build_dmar_q35(tables_blob, tables->linker, x86ms->oem_id,
|
|
||||||
x86ms->oem_table_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (machine->nvdimms_state->is_enabled) {
|
if (machine->nvdimms_state->is_enabled) {
|
||||||
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
|
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
|
||||||
|
|
|
@ -1538,7 +1538,6 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
AMDVIState *s = AMD_IOMMU_DEVICE(dev);
|
AMDVIState *s = AMD_IOMMU_DEVICE(dev);
|
||||||
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
|
|
||||||
MachineState *ms = MACHINE(qdev_get_machine());
|
MachineState *ms = MACHINE(qdev_get_machine());
|
||||||
PCMachineState *pcms = PC_MACHINE(ms);
|
PCMachineState *pcms = PC_MACHINE(ms);
|
||||||
X86MachineState *x86ms = X86_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);
|
amdvi_uint64_equal, g_free, g_free);
|
||||||
|
|
||||||
/* This device should take care of IOMMU PCI properties */
|
/* This device should take care of IOMMU PCI properties */
|
||||||
x86_iommu->type = TYPE_AMD;
|
|
||||||
if (!qdev_realize(DEVICE(&s->pci), &bus->qbus, errp)) {
|
if (!qdev_realize(DEVICE(&s->pci), &bus->qbus, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3806,9 +3806,6 @@ static void vtd_realize(DeviceState *dev, Error **errp)
|
||||||
X86MachineState *x86ms = X86_MACHINE(ms);
|
X86MachineState *x86ms = X86_MACHINE(ms);
|
||||||
PCIBus *bus = pcms->bus;
|
PCIBus *bus = pcms->bus;
|
||||||
IntelIOMMUState *s = INTEL_IOMMU_DEVICE(dev);
|
IntelIOMMUState *s = INTEL_IOMMU_DEVICE(dev);
|
||||||
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
|
|
||||||
|
|
||||||
x86_iommu->type = TYPE_INTEL;
|
|
||||||
|
|
||||||
if (!vtd_decide_config(s, errp)) {
|
if (!vtd_decide_config(s, errp)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -36,8 +36,3 @@ bool x86_iommu_ir_supported(X86IOMMUState *s)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IommuType x86_iommu_get_type(void)
|
|
||||||
{
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
|
@ -98,11 +98,6 @@ X86IOMMUState *x86_iommu_get_default(void)
|
||||||
return x86_iommu_default;
|
return x86_iommu_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
IommuType x86_iommu_get_type(void)
|
|
||||||
{
|
|
||||||
return x86_iommu_default->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void x86_iommu_realize(DeviceState *dev, Error **errp)
|
static void x86_iommu_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
|
X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);
|
||||||
|
|
|
@ -33,12 +33,6 @@ OBJECT_DECLARE_TYPE(X86IOMMUState, X86IOMMUClass, X86_IOMMU_DEVICE)
|
||||||
typedef struct X86IOMMUIrq X86IOMMUIrq;
|
typedef struct X86IOMMUIrq X86IOMMUIrq;
|
||||||
typedef struct X86IOMMU_MSIMessage X86IOMMU_MSIMessage;
|
typedef struct X86IOMMU_MSIMessage X86IOMMU_MSIMessage;
|
||||||
|
|
||||||
typedef enum IommuType {
|
|
||||||
TYPE_INTEL,
|
|
||||||
TYPE_AMD,
|
|
||||||
TYPE_NONE
|
|
||||||
} IommuType;
|
|
||||||
|
|
||||||
struct X86IOMMUClass {
|
struct X86IOMMUClass {
|
||||||
SysBusDeviceClass parent;
|
SysBusDeviceClass parent;
|
||||||
/* Intel/AMD specific realize() hook */
|
/* Intel/AMD specific realize() hook */
|
||||||
|
@ -71,7 +65,6 @@ struct X86IOMMUState {
|
||||||
OnOffAuto intr_supported; /* Whether vIOMMU supports IR */
|
OnOffAuto intr_supported; /* Whether vIOMMU supports IR */
|
||||||
bool dt_supported; /* Whether vIOMMU supports DT */
|
bool dt_supported; /* Whether vIOMMU supports DT */
|
||||||
bool pt_supported; /* Whether vIOMMU supports pass-through */
|
bool pt_supported; /* Whether vIOMMU supports pass-through */
|
||||||
IommuType type; /* IOMMU type - AMD/Intel */
|
|
||||||
QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */
|
QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,11 +133,6 @@ struct X86IOMMU_MSIMessage {
|
||||||
*/
|
*/
|
||||||
X86IOMMUState *x86_iommu_get_default(void);
|
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
|
* x86_iommu_iec_register_notifier - register IEC (Interrupt Entry
|
||||||
* Cache) notifiers
|
* Cache) notifiers
|
||||||
|
|
Loading…
Reference in New Issue