[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 13/28] i386: acpi: add IVHD device entry for IOAPI
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 13/28] i386: acpi: add IVHD device entry for IOAPIC |
Date: |
Wed, 24 Oct 2018 20:53:44 -0400 |
From: "Singh, Brijesh" <address@hidden>
When interrupt remapping is enabled, add a special IVHD device
(type IOAPIC).
Signed-off-by: Brijesh Singh <address@hidden>
Acked-by: Peter Xu <address@hidden>
Cc: Peter Xu <address@hidden>
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Marcel Apfelbaum <address@hidden>
Cc: Tom Lendacky <address@hidden>
Cc: Suravee Suthikulpanit <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/i386/acpi-build.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1599caa7c5..1ef396ddbb 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2467,9 +2467,12 @@ build_dmar_q35(GArray *table_data, BIOSLinker *linker)
* IVRS table as specified in AMD IOMMU Specification v2.62, Section 5.2
* accessible here http://support.amd.com/TechDocs/48882_IOMMU.pdf
*/
+#define IOAPIC_SB_DEVID (uint64_t)PCI_BUILD_BDF(0, PCI_DEVFN(0x14, 0))
+
static void
build_amd_iommu(GArray *table_data, BIOSLinker *linker)
{
+ int ivhd_table_len = 28;
int iommu_start = table_data->len;
AMDVIState *s = AMD_IOMMU_DEVICE(x86_iommu_get_default());
@@ -2491,8 +2494,16 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker)
(1UL << 6) | /* PrefSup */
(1UL << 7), /* PPRSup */
1);
+
+ /*
+ * When interrupt remapping is supported, we add a special IVHD device
+ * for type IO-APIC.
+ */
+ if (x86_iommu_get_default()->intr_supported) {
+ ivhd_table_len += 8;
+ }
/* IVHD length */
- build_append_int_noprefix(table_data, 28, 2);
+ build_append_int_noprefix(table_data, ivhd_table_len, 2);
/* DeviceID */
build_append_int_noprefix(table_data, s->devid, 2);
/* Capability offset */
@@ -2516,6 +2527,21 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker)
*/
build_append_int_noprefix(table_data, 0x0000001, 4);
+ /*
+ * Add a special IVHD device type.
+ * Refer to spec - Table 95: IVHD device entry type codes
+ *
+ * Linux IOMMU driver checks for the special IVHD device (type IO-APIC).
+ * See Linux kernel commit 'c2ff5cf5294bcbd7fa50f7d860e90a66db7e5059'
+ */
+ if (x86_iommu_get_default()->intr_supported) {
+ build_append_int_noprefix(table_data,
+ (0x1ull << 56) | /* type IOAPIC */
+ (IOAPIC_SB_DEVID << 40) | /* IOAPIC devid */
+ 0x48, /* special device
*/
+ 8);
+ }
+
build_header(linker, table_data, (void *)(table_data->data + iommu_start),
"IVRS", table_data->len - iommu_start, 1, NULL, NULL);
}
--
MST
- [Qemu-devel] [PULL v2 03/28] intel_iommu: better handling of dmar state switch, (continued)
- [Qemu-devel] [PULL v2 03/28] intel_iommu: better handling of dmar state switch, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 04/28] intel_iommu: move ce fetching out when sync shadow, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 05/28] intel_iommu: handle invalid ce for shadow sync, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 06/28] vhost-user-blk: start vhost when guest kicks, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 08/28] x86_iommu: move vtd_generate_msi_message in common file, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 07/28] x86_iommu: move the kernel-irqchip check in common code, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 09/28] x86_iommu/amd: remove V=1 check from amdvi_validate_dte(), Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 10/28] x86_iommu/amd: make the address space naming consistent with intel-iommu, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 11/28] x86_iommu/amd: Prepare for interrupt remap support, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 12/28] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 13/28] i386: acpi: add IVHD device entry for IOAPIC,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 14/28] x86_iommu/amd: Add interrupt remap support when VAPIC is enabled, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 15/28] x86_iommu/amd: Enable Guest virtual APIC support, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 16/28] MAINTAINERS: list "tests/acpi-test-data" files in ACPI/SMBIOS section, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 17/28] pci-testdev: add optional memory bar, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 18/28] hw/pci-host/x86: extract get_pci_hole64_start_value() helpers, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 19/28] hw/pci-host/x86: extend the 64-bit PCI hole relative to the fw-assigned base, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 21/28] hw/pci-bridge/xio3130: Remove unused functions, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 22/28] hw/pci-bridge/ioh3420: Remove unuseful header, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 23/28] hw/pci: Add missing include, Michael S. Tsirkin, 2018/10/24
- [Qemu-devel] [PULL v2 20/28] tests/bios-tables-test: add 64-bit PCI MMIO aperture round-up test on Q35, Michael S. Tsirkin, 2018/10/24