[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/6] i386: acpi: add IVHD device entry for IOAPI
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH 4/6] i386: acpi: add IVHD device entry for IOAPIC |
Date: |
Wed, 12 Sep 2018 18:35:10 +0200 |
On Tue, 11 Sep 2018 11:49:47 -0500
Brijesh Singh <address@hidden> wrote:
> When interrupt remapping is enabled, add a special IVHD device
> (type IOAPIC) -- which is typically PCI device 14:0.0. Linux IOMMU driver
> checks for this special device.
>
> 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>
> Signed-off-by: Brijesh Singh <address@hidden>
> ---
> hw/i386/acpi-build.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index e1ee8ae..5c2c638 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2519,6 +2519,7 @@ build_dmar_q35(GArray *table_data, BIOSLinker *linker)
> 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());
>
> @@ -2540,8 +2541,16 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker)
> (1UL << 6) | /* PrefSup */
> (1UL << 7), /* PPRSup */
> 1);
> +
> + /*
> + * When interrupt remapping is enabled, we add a special IVHD device
> + * for type IO-APIC.
> + */
> + if (s->intr_enabled) {
> + 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 */
> @@ -2565,6 +2574,15 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker)
> */
> build_append_int_noprefix(table_data, 0x0000001, 4);
>
> + /*
> + * When interrupt remapping is enabled, Linux IOMMU driver also checks
> + * for special IVHD device (type IO-APIC), which is typically presented
> + * as PCI device 14:00.0.
Probably it shouldn't be a 'typically' device from somewhere but rather address
fetched from corresponding device model QEMU implements.
> + */
> + if (s->intr_enabled) {
> + build_append_int_noprefix(table_data, 0x0100a00000000048, 8);
^^ this is incomprehensible,
where does this magic number comes from and how was it calculated?
> + }
> +
> build_header(linker, table_data, (void *)(table_data->data +
> iommu_start),
> "IVRS", table_data->len - iommu_start, 1, NULL, NULL);
> }
Re: [Qemu-devel] [PATCH 6/6] x86_iommu/amd: Enable Guest virtual APIC support, Igor Mammedov, 2018/09/12
[Qemu-devel] [PATCH 4/6] i386: acpi: add IVHD device entry for IOAPIC, Brijesh Singh, 2018/09/11
Re: [Qemu-devel] [PATCH 4/6] i386: acpi: add IVHD device entry for IOAPIC,
Igor Mammedov <=
[Qemu-devel] [PATCH 1/6] x86_iommu: move the kernel-irqchip check in common code, Brijesh Singh, 2018/09/11
[Qemu-devel] [PATCH 3/6] x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled, Brijesh Singh, 2018/09/11