提交 6ecbf01c 编写于 作者: D David Woodhouse

intel-iommu: Apply BIOS sanity checks for interrupt remapping too.

The BIOS errors where an IOMMU is reported either at zero or a bogus
address are causing problems even when the IOMMU is disabled -- because
interrupt remapping uses the same hardware. Ensure that the checks get
applied for the interrupt remapping initialisation too.

Cc: stable@kernel.org
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 2c992208
...@@ -613,6 +613,8 @@ int __init dmar_table_init(void) ...@@ -613,6 +613,8 @@ int __init dmar_table_init(void)
return 0; return 0;
} }
static int bios_warned;
int __init check_zero_address(void) int __init check_zero_address(void)
{ {
struct acpi_table_dmar *dmar; struct acpi_table_dmar *dmar;
...@@ -643,6 +645,7 @@ int __init check_zero_address(void) ...@@ -643,6 +645,7 @@ int __init check_zero_address(void)
dmi_get_system_info(DMI_BIOS_VENDOR), dmi_get_system_info(DMI_BIOS_VENDOR),
dmi_get_system_info(DMI_BIOS_VERSION), dmi_get_system_info(DMI_BIOS_VERSION),
dmi_get_system_info(DMI_PRODUCT_VERSION)); dmi_get_system_info(DMI_PRODUCT_VERSION));
bios_warned = 1;
goto failed; goto failed;
} }
...@@ -662,6 +665,7 @@ int __init check_zero_address(void) ...@@ -662,6 +665,7 @@ int __init check_zero_address(void)
dmi_get_system_info(DMI_BIOS_VENDOR), dmi_get_system_info(DMI_BIOS_VENDOR),
dmi_get_system_info(DMI_BIOS_VERSION), dmi_get_system_info(DMI_BIOS_VERSION),
dmi_get_system_info(DMI_PRODUCT_VERSION)); dmi_get_system_info(DMI_PRODUCT_VERSION));
bios_warned = 1;
goto failed; goto failed;
} }
} }
...@@ -722,6 +726,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) ...@@ -722,6 +726,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
int agaw = 0; int agaw = 0;
int msagaw = 0; int msagaw = 0;
if (!drhd->reg_base_addr) {
if (!bios_warned) {
WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
"BIOS vendor: %s; Ver: %s; Product Version: %s\n",
dmi_get_system_info(DMI_BIOS_VENDOR),
dmi_get_system_info(DMI_BIOS_VERSION),
dmi_get_system_info(DMI_PRODUCT_VERSION));
bios_warned = 1;
}
return -EINVAL;
}
iommu = kzalloc(sizeof(*iommu), GFP_KERNEL); iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
if (!iommu) if (!iommu)
return -ENOMEM; return -ENOMEM;
...@@ -738,13 +754,16 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) ...@@ -738,13 +754,16 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG); iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) { if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
/* Promote an attitude of violence to a BIOS engineer today */ if (!bios_warned) {
WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n" /* Promote an attitude of violence to a BIOS engineer today */
"BIOS vendor: %s; Ver: %s; Product Version: %s\n", WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
drhd->reg_base_addr, "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
dmi_get_system_info(DMI_BIOS_VENDOR), drhd->reg_base_addr,
dmi_get_system_info(DMI_BIOS_VERSION), dmi_get_system_info(DMI_BIOS_VENDOR),
dmi_get_system_info(DMI_PRODUCT_VERSION)); dmi_get_system_info(DMI_BIOS_VERSION),
dmi_get_system_info(DMI_PRODUCT_VERSION));
bios_warned = 1;
}
goto err_unmap; goto err_unmap;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册