From 03e3614ae6a7506e3c1f98d73287bf4eef7fc766 Mon Sep 17 00:00:00 2001 From: Allen Kay Date: Wed, 6 Apr 2011 09:11:02 +0100 Subject: [PATCH] [VTD] Fixes to ACPI DMAR flag checks. * platform_supports_{intremap,x2apic} should not be marked __init as they are used during S3 resume. * DMAR flags should be taken from the table passed to acpi_parse_dmar() -- this is the trusted copy of the DMAR, when running in TXT mode. Signed-off-by: Allen Kay --- xen/drivers/passthrough/vtd/dmar.c | 10 +++------- xen/drivers/passthrough/vtd/extern.h | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index aadbe1b058..26e1305954 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -675,6 +675,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table) int ret = 0; dmar = (struct acpi_table_dmar *)table; + dmar_flags = dmar->flags; if ( !iommu_enabled ) { @@ -762,12 +763,7 @@ out: int __init acpi_dmar_init(void) { - struct acpi_table_dmar *dmar; - acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_table); - dmar = (struct acpi_table_dmar *) dmar_table; - dmar_flags = dmar->flags; - return parse_dmar_table(acpi_parse_dmar); } @@ -787,7 +783,7 @@ void acpi_dmar_zap(void) dmar_table->checksum -= 'X'-'D'; } -int __init platform_supports_intremap(void) +int platform_supports_intremap(void) { unsigned int flags = 0; @@ -795,7 +791,7 @@ int __init platform_supports_intremap(void) return ((dmar_flags & flags) == DMAR_INTR_REMAP); } -int __init platform_supports_x2apic(void) +int platform_supports_x2apic(void) { unsigned int flags = 0; diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h index a9c3f1c339..60b7ac44f2 100644 --- a/xen/drivers/passthrough/vtd/extern.h +++ b/xen/drivers/passthrough/vtd/extern.h @@ -119,7 +119,7 @@ void vtd_ops_preamble_quirk(struct iommu* iommu); void vtd_ops_postamble_quirk(struct iommu* iommu); void me_wifi_quirk(struct domain *domain, u8 bus, u8 devfn, int map); void pci_vtd_quirk(struct pci_dev *pdev); -int __init platform_supports_intremap(void); -int __init platform_supports_x2apic(void); +int platform_supports_intremap(void); +int platform_supports_x2apic(void); #endif // _VTD_EXTERN_H_ -- 2.39.5