Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ecbf01c authored by David Woodhouse's avatar David Woodhouse
Browse files

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: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 2c992208
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -613,6 +613,8 @@ int __init dmar_table_init(void)
	return 0;
}

static int bios_warned;

int __init check_zero_address(void)
{
	struct acpi_table_dmar *dmar;
@@ -643,6 +645,7 @@ int __init check_zero_address(void)
				     dmi_get_system_info(DMI_BIOS_VENDOR),
				     dmi_get_system_info(DMI_BIOS_VERSION),
				     dmi_get_system_info(DMI_PRODUCT_VERSION));
				bios_warned = 1;
				goto failed;
			}

@@ -662,6 +665,7 @@ int __init check_zero_address(void)
				      dmi_get_system_info(DMI_BIOS_VENDOR),
				      dmi_get_system_info(DMI_BIOS_VERSION),
				      dmi_get_system_info(DMI_PRODUCT_VERSION));
				bios_warned = 1;
				goto failed;
			}
		}
@@ -722,6 +726,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
	int agaw = 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);
	if (!iommu)
		return -ENOMEM;
@@ -738,6 +754,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
	iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);

	if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
		if (!bios_warned) {
			/* Promote an attitude of violence to a BIOS engineer today */
			WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
			     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
@@ -745,6 +762,8 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
			     dmi_get_system_info(DMI_BIOS_VENDOR),
			     dmi_get_system_info(DMI_BIOS_VERSION),
			     dmi_get_system_info(DMI_PRODUCT_VERSION));
			bios_warned = 1;
		}
		goto err_unmap;
	}