* [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu
@ 2024-09-27 17:29 Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 1/5] amd_iommu: Rename variable mmio to mr_mmio Santosh Shukla
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Santosh Shukla @ 2024-09-27 17:29 UTC (permalink / raw)
To: qemu-devel
Cc: pbonzini, joao.m.martins, Suravee.Suthikulpanit, vasant.hegde,
mtosatti, mst, marcel.apfelbaum, santosh.shukla,
alejandro.j.jimenez
Series adds following feature support for emulated amd vIOMMU
1) Pass Through(PT) mode
2) Interrupt Remapping(IR) mode
1) PT mode
Introducing the shared 'nodma' memory region that can be aliased
by all the devices in the PT mode. Shared memory with aliasing
approach will help run VM faster when lot of devices attached to
VM.
2) IR mode
Shared IR memory region with aliasing approach proposed for the
reason mentioned in 1). Also add support to invalidate Interrupt
remaping table(IRT).
Series based on e10cd93872c31332b002c933a798ab0bc51705a4
Testing:
1. nvme/fio testing for VM with > 255 vCPU with xtsup=on and x2apic
enabled
2. Windows Server 2022 VM testing for > 255 vCPU.
Change History:
v3:
- Incorporated Alejandro's v2 nits comment.
V2:
- https://lore.kernel.org/qemu-devel/20240916143116.169693-1-santosh.shukla@amd.com/
V1:
- https://lore.kernel.org/all/20240904100257.184851-3-santosh.shukla@amd.com/T/
Suravee Suthikulpanit (5):
amd_iommu: Rename variable mmio to mr_mmio
amd_iommu: Add support for pass though mode
amd_iommu: Use shared memory region for Interrupt Remapping
amd_iommu: Send notification when invalidate interrupt entry cache
amd_iommu: Check APIC ID > 255 for XTSup
hw/i386/acpi-build.c | 4 +-
hw/i386/amd_iommu.c | 98 +++++++++++++++++++++++++++++++++++---------
hw/i386/amd_iommu.h | 5 ++-
3 files changed, 85 insertions(+), 22 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/5] amd_iommu: Rename variable mmio to mr_mmio
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
@ 2024-09-27 17:29 ` Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 2/5] amd_iommu: Add support for pass though mode Santosh Shukla
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Santosh Shukla @ 2024-09-27 17:29 UTC (permalink / raw)
To: qemu-devel
Cc: pbonzini, joao.m.martins, Suravee.Suthikulpanit, vasant.hegde,
mtosatti, mst, marcel.apfelbaum, santosh.shukla,
alejandro.j.jimenez
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Rename the MMIO memory region variable 'mmio' to 'mr_mmio'
so to correctly name align with struct AMDVIState::variable type.
No functional change intended.
Reviewed-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
---
hw/i386/acpi-build.c | 4 ++--
hw/i386/amd_iommu.c | 6 +++---
hw/i386/amd_iommu.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4967aa745902..5c6920f90d05 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2321,7 +2321,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker, const char *oem_id,
/* Capability offset */
build_append_int_noprefix(table_data, s->pci.capab_offset, 2);
/* IOMMU base address */
- build_append_int_noprefix(table_data, s->mmio.addr, 8);
+ build_append_int_noprefix(table_data, s->mr_mmio.addr, 8);
/* PCI Segment Group */
build_append_int_noprefix(table_data, 0, 2);
/* IOMMU info */
@@ -2356,7 +2356,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker, const char *oem_id,
/* Capability offset */
build_append_int_noprefix(table_data, s->pci.capab_offset, 2);
/* IOMMU base address */
- build_append_int_noprefix(table_data, s->mmio.addr, 8);
+ build_append_int_noprefix(table_data, s->mr_mmio.addr, 8);
/* PCI Segment Group */
build_append_int_noprefix(table_data, 0, 2);
/* IOMMU info */
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 464f0b666e69..abb64ea507be 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1598,10 +1598,10 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
x86ms->ioapic_as = amdvi_host_dma_iommu(bus, s, AMDVI_IOAPIC_SB_DEVID);
/* set up MMIO */
- memory_region_init_io(&s->mmio, OBJECT(s), &mmio_mem_ops, s, "amdvi-mmio",
- AMDVI_MMIO_SIZE);
+ memory_region_init_io(&s->mr_mmio, OBJECT(s), &mmio_mem_ops, s,
+ "amdvi-mmio", AMDVI_MMIO_SIZE);
memory_region_add_subregion(get_system_memory(), AMDVI_BASE_ADDR,
- &s->mmio);
+ &s->mr_mmio);
pci_setup_iommu(bus, &amdvi_iommu_ops, s);
amdvi_init(s);
}
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index 73619fe9eaa7..e5c2ae94f243 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -353,7 +353,7 @@ struct AMDVIState {
uint32_t pprlog_head; /* ppr log head */
uint32_t pprlog_tail; /* ppr log tail */
- MemoryRegion mmio; /* MMIO region */
+ MemoryRegion mr_mmio; /* MMIO region */
uint8_t mmior[AMDVI_MMIO_SIZE]; /* read/write MMIO */
uint8_t w1cmask[AMDVI_MMIO_SIZE]; /* read/write 1 clear mask */
uint8_t romask[AMDVI_MMIO_SIZE]; /* MMIO read/only mask */
--
2.43.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/5] amd_iommu: Add support for pass though mode
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 1/5] amd_iommu: Rename variable mmio to mr_mmio Santosh Shukla
@ 2024-09-27 17:29 ` Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 3/5] amd_iommu: Use shared memory region for Interrupt Remapping Santosh Shukla
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Santosh Shukla @ 2024-09-27 17:29 UTC (permalink / raw)
To: qemu-devel
Cc: pbonzini, joao.m.martins, Suravee.Suthikulpanit, vasant.hegde,
mtosatti, mst, marcel.apfelbaum, santosh.shukla,
alejandro.j.jimenez
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Introduce 'nodma' shared memory region to support PT mode
so that for each device, we only create an alias to shared memory
region when DMA-remapping is disabled.
Reviewed-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
---
v3:
- Fixed the indentation of _nodma and _ir at comment section.
hw/i386/amd_iommu.c | 49 ++++++++++++++++++++++++++++++++++++---------
hw/i386/amd_iommu.h | 2 ++
2 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index abb64ea507be..7c7760c57330 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -60,8 +60,9 @@ struct AMDVIAddressSpace {
uint8_t bus_num; /* bus number */
uint8_t devfn; /* device function */
AMDVIState *iommu_state; /* AMDVI - one per machine */
- MemoryRegion root; /* AMDVI Root memory map region */
+ MemoryRegion root; /* AMDVI Root memory map region */
IOMMUMemoryRegion iommu; /* Device's address translation region */
+ MemoryRegion iommu_nodma; /* Alias of shared nodma memory region */
MemoryRegion iommu_ir; /* Device's interrupt remapping region */
AddressSpace as; /* device's corresponding address space */
};
@@ -1412,6 +1413,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
AMDVIState *s = opaque;
AMDVIAddressSpace **iommu_as, *amdvi_dev_as;
int bus_num = pci_bus_num(bus);
+ X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s);
iommu_as = s->address_spaces[bus_num];
@@ -1436,13 +1438,13 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
* Memory region relationships looks like (Address range shows
* only lower 32 bits to make it short in length...):
*
- * |-----------------+-------------------+----------|
- * | Name | Address range | Priority |
- * |-----------------+-------------------+----------+
- * | amdvi_root | 00000000-ffffffff | 0 |
- * | amdvi_iommu | 00000000-ffffffff | 1 |
- * | amdvi_iommu_ir | fee00000-feefffff | 64 |
- * |-----------------+-------------------+----------|
+ * |--------------------+-------------------+----------|
+ * | Name | Address range | Priority |
+ * |--------------------+-------------------+----------+
+ * | amdvi-root | 00000000-ffffffff | 0 |
+ * | amdvi-iommu_nodma | 00000000-ffffffff | 0 |
+ * | amdvi-iommu_ir | fee00000-feefffff | 64 |
+ * |--------------------+-------------------+----------|
*/
memory_region_init_iommu(&amdvi_dev_as->iommu,
sizeof(amdvi_dev_as->iommu),
@@ -1461,7 +1463,25 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
64);
memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0,
MEMORY_REGION(&amdvi_dev_as->iommu),
- 1);
+ 0);
+
+ /* Build the DMA Disabled alias to shared memory */
+ memory_region_init_alias(&amdvi_dev_as->iommu_nodma, OBJECT(s),
+ "amdvi-sys", &s->mr_sys, 0,
+ memory_region_size(&s->mr_sys));
+ memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0,
+ &amdvi_dev_as->iommu_nodma,
+ 0);
+
+ if (!x86_iommu->pt_supported) {
+ memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
+ memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
+ true);
+ } else {
+ memory_region_set_enabled(MEMORY_REGION(&amdvi_dev_as->iommu),
+ false);
+ memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, true);
+ }
}
return &iommu_as[devfn]->as;
}
@@ -1602,6 +1622,17 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
"amdvi-mmio", AMDVI_MMIO_SIZE);
memory_region_add_subregion(get_system_memory(), AMDVI_BASE_ADDR,
&s->mr_mmio);
+
+ /* Create the share memory regions by all devices */
+ memory_region_init(&s->mr_sys, OBJECT(s), "amdvi-sys", UINT64_MAX);
+
+ /* set up the DMA disabled memory region */
+ memory_region_init_alias(&s->mr_nodma, OBJECT(s),
+ "amdvi-nodma", get_system_memory(), 0,
+ memory_region_size(get_system_memory()));
+ memory_region_add_subregion_overlap(&s->mr_sys, 0,
+ &s->mr_nodma, 0);
+
pci_setup_iommu(bus, &amdvi_iommu_ops, s);
amdvi_init(s);
}
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index e5c2ae94f243..be417e51c4dc 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -354,6 +354,8 @@ struct AMDVIState {
uint32_t pprlog_tail; /* ppr log tail */
MemoryRegion mr_mmio; /* MMIO region */
+ MemoryRegion mr_sys;
+ MemoryRegion mr_nodma;
uint8_t mmior[AMDVI_MMIO_SIZE]; /* read/write MMIO */
uint8_t w1cmask[AMDVI_MMIO_SIZE]; /* read/write 1 clear mask */
uint8_t romask[AMDVI_MMIO_SIZE]; /* MMIO read/only mask */
--
2.43.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 3/5] amd_iommu: Use shared memory region for Interrupt Remapping
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 1/5] amd_iommu: Rename variable mmio to mr_mmio Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 2/5] amd_iommu: Add support for pass though mode Santosh Shukla
@ 2024-09-27 17:29 ` Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 4/5] amd_iommu: Send notification when invalidate interrupt entry cache Santosh Shukla
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Santosh Shukla @ 2024-09-27 17:29 UTC (permalink / raw)
To: qemu-devel
Cc: pbonzini, joao.m.martins, Suravee.Suthikulpanit, vasant.hegde,
mtosatti, mst, marcel.apfelbaum, santosh.shukla,
alejandro.j.jimenez
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Use shared memory region for interrupt remapping which can be
aliased by all devices.
Reviewed-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
---
hw/i386/amd_iommu.c | 22 ++++++++++++++--------
hw/i386/amd_iommu.h | 1 +
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 7c7760c57330..9b923f6eb482 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1443,7 +1443,7 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
* |--------------------+-------------------+----------+
* | amdvi-root | 00000000-ffffffff | 0 |
* | amdvi-iommu_nodma | 00000000-ffffffff | 0 |
- * | amdvi-iommu_ir | fee00000-feefffff | 64 |
+ * | amdvi-iommu_ir | fee00000-feefffff | 1 |
* |--------------------+-------------------+----------|
*/
memory_region_init_iommu(&amdvi_dev_as->iommu,
@@ -1454,13 +1454,6 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
memory_region_init(&amdvi_dev_as->root, OBJECT(s),
"amdvi_root", UINT64_MAX);
address_space_init(&amdvi_dev_as->as, &amdvi_dev_as->root, name);
- memory_region_init_io(&amdvi_dev_as->iommu_ir, OBJECT(s),
- &amdvi_ir_ops, s, "amd_iommu_ir",
- AMDVI_INT_ADDR_SIZE);
- memory_region_add_subregion_overlap(&amdvi_dev_as->root,
- AMDVI_INT_ADDR_FIRST,
- &amdvi_dev_as->iommu_ir,
- 64);
memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0,
MEMORY_REGION(&amdvi_dev_as->iommu),
0);
@@ -1472,6 +1465,13 @@ static AddressSpace *amdvi_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
memory_region_add_subregion_overlap(&amdvi_dev_as->root, 0,
&amdvi_dev_as->iommu_nodma,
0);
+ /* Build the Interrupt Remapping alias to shared memory */
+ memory_region_init_alias(&amdvi_dev_as->iommu_ir, OBJECT(s),
+ "amdvi-ir", &s->mr_ir, 0,
+ memory_region_size(&s->mr_ir));
+ memory_region_add_subregion_overlap(MEMORY_REGION(&amdvi_dev_as->iommu),
+ AMDVI_INT_ADDR_FIRST,
+ &amdvi_dev_as->iommu_ir, 1);
if (!x86_iommu->pt_supported) {
memory_region_set_enabled(&amdvi_dev_as->iommu_nodma, false);
@@ -1633,6 +1633,12 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
memory_region_add_subregion_overlap(&s->mr_sys, 0,
&s->mr_nodma, 0);
+ /* set up the Interrupt Remapping memory region */
+ memory_region_init_io(&s->mr_ir, OBJECT(s), &amdvi_ir_ops,
+ s, "amdvi-ir", AMDVI_INT_ADDR_SIZE);
+ memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST,
+ &s->mr_ir, 1);
+
pci_setup_iommu(bus, &amdvi_iommu_ops, s);
amdvi_init(s);
}
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index be417e51c4dc..e0dac4d9a96c 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -356,6 +356,7 @@ struct AMDVIState {
MemoryRegion mr_mmio; /* MMIO region */
MemoryRegion mr_sys;
MemoryRegion mr_nodma;
+ MemoryRegion mr_ir;
uint8_t mmior[AMDVI_MMIO_SIZE]; /* read/write MMIO */
uint8_t w1cmask[AMDVI_MMIO_SIZE]; /* read/write 1 clear mask */
uint8_t romask[AMDVI_MMIO_SIZE]; /* MMIO read/only mask */
--
2.43.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 4/5] amd_iommu: Send notification when invalidate interrupt entry cache
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
` (2 preceding siblings ...)
2024-09-27 17:29 ` [PATCH v3 3/5] amd_iommu: Use shared memory region for Interrupt Remapping Santosh Shukla
@ 2024-09-27 17:29 ` Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 5/5] amd_iommu: Check APIC ID > 255 for XTSup Santosh Shukla
2024-10-09 6:05 ` [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Shukla, Santosh
5 siblings, 0 replies; 8+ messages in thread
From: Santosh Shukla @ 2024-09-27 17:29 UTC (permalink / raw)
To: qemu-devel
Cc: pbonzini, joao.m.martins, Suravee.Suthikulpanit, vasant.hegde,
mtosatti, mst, marcel.apfelbaum, santosh.shukla,
alejandro.j.jimenez
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
In order to support AMD IOMMU interrupt remapping emulation with PCI
pass-through devices, QEMU needs to notify VFIO when guest IOMMU driver
updates and invalidate the guest interrupt remapping table (IRT), and
communicate information so that the host IOMMU driver can update
the shadowed interrupt remapping table in the host IOMMU.
Therefore, send notification when guest IOMMU emulates the IRT
invalidation commands.
Reviewed-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
---
v3:
- Fixed the typos in patch description.
hw/i386/amd_iommu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 9b923f6eb482..38297376e7a9 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -431,6 +431,12 @@ static void amdvi_complete_ppr(AMDVIState *s, uint64_t *cmd)
trace_amdvi_ppr_exec();
}
+static void amdvi_intremap_inval_notify_all(AMDVIState *s, bool global,
+ uint32_t index, uint32_t mask)
+{
+ x86_iommu_iec_notify_all(X86_IOMMU_DEVICE(s), global, index, mask);
+}
+
static void amdvi_inval_all(AMDVIState *s, uint64_t *cmd)
{
if (extract64(cmd[0], 0, 60) || cmd[1]) {
@@ -438,6 +444,9 @@ static void amdvi_inval_all(AMDVIState *s, uint64_t *cmd)
s->cmdbuf + s->cmdbuf_head);
}
+ /* Notify global invalidation */
+ amdvi_intremap_inval_notify_all(s, true, 0, 0);
+
amdvi_iotlb_reset(s);
trace_amdvi_all_inval();
}
@@ -486,6 +495,9 @@ static void amdvi_inval_inttable(AMDVIState *s, uint64_t *cmd)
return;
}
+ /* Notify global invalidation */
+ amdvi_intremap_inval_notify_all(s, true, 0, 0);
+
trace_amdvi_intr_inval();
}
--
2.43.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 5/5] amd_iommu: Check APIC ID > 255 for XTSup
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
` (3 preceding siblings ...)
2024-09-27 17:29 ` [PATCH v3 4/5] amd_iommu: Send notification when invalidate interrupt entry cache Santosh Shukla
@ 2024-09-27 17:29 ` Santosh Shukla
2024-10-09 6:05 ` [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Shukla, Santosh
5 siblings, 0 replies; 8+ messages in thread
From: Santosh Shukla @ 2024-09-27 17:29 UTC (permalink / raw)
To: qemu-devel
Cc: pbonzini, joao.m.martins, Suravee.Suthikulpanit, vasant.hegde,
mtosatti, mst, marcel.apfelbaum, santosh.shukla,
alejandro.j.jimenez
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
The XTSup mode enables x2APIC support for AMD IOMMU, which is needed
to support vcpu w/ APIC ID > 255.
Reviewed-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
---
v3:
- Fixed the typos: s/xt/xtsup at error_report()
hw/i386/amd_iommu.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 38297376e7a9..13af7211e11d 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -32,6 +32,7 @@
#include "trace.h"
#include "hw/i386/apic-msidef.h"
#include "hw/qdev-properties.h"
+#include "kvm/kvm_i386.h"
/* used AMD-Vi MMIO registers */
const char *amdvi_mmio_low[] = {
@@ -1651,6 +1652,16 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
memory_region_add_subregion_overlap(&s->mr_sys, AMDVI_INT_ADDR_FIRST,
&s->mr_ir, 1);
+ /* AMD IOMMU with x2APIC mode requires xtsup=on */
+ if (x86ms->apic_id_limit > 255 && !s->xtsup) {
+ error_report("AMD IOMMU with x2APIC confguration requires xtsup=on");
+ exit(EXIT_FAILURE);
+ }
+ if (s->xtsup && kvm_irqchip_is_split() && !kvm_enable_x2apic()) {
+ error_report("AMD IOMMU xtsup=on requires support on the KVM side");
+ exit(EXIT_FAILURE);
+ }
+
pci_setup_iommu(bus, &amdvi_iommu_ops, s);
amdvi_init(s);
}
--
2.43.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
` (4 preceding siblings ...)
2024-09-27 17:29 ` [PATCH v3 5/5] amd_iommu: Check APIC ID > 255 for XTSup Santosh Shukla
@ 2024-10-09 6:05 ` Shukla, Santosh
2024-10-28 10:26 ` Shukla, Santosh
5 siblings, 1 reply; 8+ messages in thread
From: Shukla, Santosh @ 2024-10-09 6:05 UTC (permalink / raw)
To: qemu-devel, pbonzini
Cc: joao.m.martins, Suravee.Suthikulpanit, vasant.hegde, mtosatti,
mst, marcel.apfelbaum, alejandro.j.jimenez
Ping?
Gentle reminder.
Thanks,
Santosh
On 9/27/2024 10:59 PM, Santosh Shukla wrote:
> Series adds following feature support for emulated amd vIOMMU
> 1) Pass Through(PT) mode
> 2) Interrupt Remapping(IR) mode
>
> 1) PT mode
> Introducing the shared 'nodma' memory region that can be aliased
> by all the devices in the PT mode. Shared memory with aliasing
> approach will help run VM faster when lot of devices attached to
> VM.
>
> 2) IR mode
> Shared IR memory region with aliasing approach proposed for the
> reason mentioned in 1). Also add support to invalidate Interrupt
> remaping table(IRT).
>
> Series based on e10cd93872c31332b002c933a798ab0bc51705a4
>
> Testing:
> 1. nvme/fio testing for VM with > 255 vCPU with xtsup=on and x2apic
> enabled
> 2. Windows Server 2022 VM testing for > 255 vCPU.
>
> Change History:
>
> v3:
> - Incorporated Alejandro's v2 nits comment.
>
> V2:
> - https://lore.kernel.org/qemu-devel/20240916143116.169693-1-santosh.shukla@amd.com/
>
> V1:
> - https://lore.kernel.org/all/20240904100257.184851-3-santosh.shukla@amd.com/T/
>
> Suravee Suthikulpanit (5):
> amd_iommu: Rename variable mmio to mr_mmio
> amd_iommu: Add support for pass though mode
> amd_iommu: Use shared memory region for Interrupt Remapping
> amd_iommu: Send notification when invalidate interrupt entry cache
> amd_iommu: Check APIC ID > 255 for XTSup
>
> hw/i386/acpi-build.c | 4 +-
> hw/i386/amd_iommu.c | 98 +++++++++++++++++++++++++++++++++++---------
> hw/i386/amd_iommu.h | 5 ++-
> 3 files changed, 85 insertions(+), 22 deletions(-)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu
2024-10-09 6:05 ` [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Shukla, Santosh
@ 2024-10-28 10:26 ` Shukla, Santosh
0 siblings, 0 replies; 8+ messages in thread
From: Shukla, Santosh @ 2024-10-28 10:26 UTC (permalink / raw)
To: qemu-devel, pbonzini
Cc: joao.m.martins, Suravee.Suthikulpanit, vasant.hegde, mtosatti,
mst, marcel.apfelbaum, alejandro.j.jimenez
Hi there,
Ping? Appreciate any further review comment or series is OK to pull, Please let me know.
Thank you!
Santosh
On 10/9/2024 11:35 AM, Shukla, Santosh wrote:
>
> Ping?
> Gentle reminder.
>
> Thanks,
> Santosh
>
> On 9/27/2024 10:59 PM, Santosh Shukla wrote:
>> Series adds following feature support for emulated amd vIOMMU
>> 1) Pass Through(PT) mode
>> 2) Interrupt Remapping(IR) mode
>>
>> 1) PT mode
>> Introducing the shared 'nodma' memory region that can be aliased
>> by all the devices in the PT mode. Shared memory with aliasing
>> approach will help run VM faster when lot of devices attached to
>> VM.
>>
>> 2) IR mode
>> Shared IR memory region with aliasing approach proposed for the
>> reason mentioned in 1). Also add support to invalidate Interrupt
>> remaping table(IRT).
>>
>> Series based on e10cd93872c31332b002c933a798ab0bc51705a4
>>
>> Testing:
>> 1. nvme/fio testing for VM with > 255 vCPU with xtsup=on and x2apic
>> enabled
>> 2. Windows Server 2022 VM testing for > 255 vCPU.
>>
>> Change History:
>>
>> v3:
>> - Incorporated Alejandro's v2 nits comment.
>>
>> V2:
>> - https://lore.kernel.org/qemu-devel/20240916143116.169693-1-santosh.shukla@amd.com/
>>
>> V1:
>> - https://lore.kernel.org/all/20240904100257.184851-3-santosh.shukla@amd.com/T/
>>
>> Suravee Suthikulpanit (5):
>> amd_iommu: Rename variable mmio to mr_mmio
>> amd_iommu: Add support for pass though mode
>> amd_iommu: Use shared memory region for Interrupt Remapping
>> amd_iommu: Send notification when invalidate interrupt entry cache
>> amd_iommu: Check APIC ID > 255 for XTSup
>>
>> hw/i386/acpi-build.c | 4 +-
>> hw/i386/amd_iommu.c | 98 +++++++++++++++++++++++++++++++++++---------
>> hw/i386/amd_iommu.h | 5 ++-
>> 3 files changed, 85 insertions(+), 22 deletions(-)
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-10-28 10:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 17:29 [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 1/5] amd_iommu: Rename variable mmio to mr_mmio Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 2/5] amd_iommu: Add support for pass though mode Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 3/5] amd_iommu: Use shared memory region for Interrupt Remapping Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 4/5] amd_iommu: Send notification when invalidate interrupt entry cache Santosh Shukla
2024-09-27 17:29 ` [PATCH v3 5/5] amd_iommu: Check APIC ID > 255 for XTSup Santosh Shukla
2024-10-09 6:05 ` [PATCH v3 0/5] Interrupt Remap support for emulated amd viommu Shukla, Santosh
2024-10-28 10:26 ` Shukla, Santosh
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).