Taming "BIOS assigned incorrect VT-d unit" warning?

From: Denys Vlasenko
Date: Tue Jun 14 2016 - 10:10:27 EST


I'm are getting some user reports with this warning:

static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev)
{
...
rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0),
0xb0, &vtbar);
vtbar &= 0xffff0000;
/* we know that the this iommu should be at offset 0xa000 from vtbar */
drhd = dmar_find_matched_drhd_unit(pdev);
if (WARN_TAINT_ONCE(!drhd || drhd->reg_base_addr - vtbar != 0xa000,
TAINT_FIRMWARE_WORKAROUND,
"BIOS assigned incorrect VT-d unit for
Intel(R) QuickData Technology device\n"))
pdev->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
}

I experimented a bit and found out that on their machine,
dmar_find_matched_drhd_unit(pdev) returns NULL.

That is, in their case it's not known that
drhd->reg_base_addr - vtbar is wrong.
The warning is actually not true.


I tried a patch

drhd = dmar_find_matched_drhd_unit(pdev);
+ if (!drhd)
+ return;

and the affected machine works after it.

I'm not too familiar with this code.
Is dmar_find_matched_drhd_unit(pdev) == NULL normal?