acpi: enable INTR for DMAR report structure

In ACPI DMA remapping report structure, enable INTR flag when specified.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Peter Xu 2016-07-14 13:56:14 +08:00 committed by Michael S. Tsirkin
parent 1121e0afdc
commit d46114f9ec
2 changed files with 15 additions and 1 deletions

View File

@ -59,6 +59,7 @@
#include "qapi/qmp/qint.h" #include "qapi/qmp/qint.h"
#include "qom/qom-qobject.h" #include "qom/qom-qobject.h"
#include "hw/i386/x86-iommu.h"
#include "hw/acpi/ipmi.h" #include "hw/acpi/ipmi.h"
@ -2454,6 +2455,10 @@ build_mcfg_q35(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info)
build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL, NULL); build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL, NULL);
} }
/*
* VT-d spec 8.1 DMA Remapping Reporting Structure
* (version Oct. 2014 or later)
*/
static void static void
build_dmar_q35(GArray *table_data, BIOSLinker *linker) build_dmar_q35(GArray *table_data, BIOSLinker *linker)
{ {
@ -2461,10 +2466,17 @@ build_dmar_q35(GArray *table_data, BIOSLinker *linker)
AcpiTableDmar *dmar; AcpiTableDmar *dmar;
AcpiDmarHardwareUnit *drhd; AcpiDmarHardwareUnit *drhd;
uint8_t dmar_flags = 0;
X86IOMMUState *iommu = x86_iommu_get_default();
assert(iommu);
if (iommu->intr_supported) {
dmar_flags |= 0x1; /* Flags: 0x1: INT_REMAP */
}
dmar = acpi_data_push(table_data, sizeof(*dmar)); dmar = acpi_data_push(table_data, sizeof(*dmar));
dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1; dmar->host_address_width = VTD_HOST_ADDRESS_WIDTH - 1;
dmar->flags = 0; /* No intr_remap for now */ dmar->flags = dmar_flags;
/* DMAR Remapping Hardware Unit Definition structure */ /* DMAR Remapping Hardware Unit Definition structure */
drhd = acpi_data_push(table_data, sizeof(*drhd)); drhd = acpi_data_push(table_data, sizeof(*drhd));

View File

@ -44,6 +44,8 @@
#define VTD_HOST_ADDRESS_WIDTH 39 #define VTD_HOST_ADDRESS_WIDTH 39
#define VTD_HAW_MASK ((1ULL << VTD_HOST_ADDRESS_WIDTH) - 1) #define VTD_HAW_MASK ((1ULL << VTD_HOST_ADDRESS_WIDTH) - 1)
#define DMAR_REPORT_F_INTR (1)
typedef struct VTDContextEntry VTDContextEntry; typedef struct VTDContextEntry VTDContextEntry;
typedef struct VTDContextCacheEntry VTDContextCacheEntry; typedef struct VTDContextCacheEntry VTDContextCacheEntry;
typedef struct IntelIOMMUState IntelIOMMUState; typedef struct IntelIOMMUState IntelIOMMUState;