El 21/11/22 a las 20:39, Robin Murphy escribió:
Yes, in principle it's possible to quirk a reserved region for a particular device - like intel-iommu does for ISA bridges for instance - however figuring out exactly *where* to reserve might be a lot more tricky if it's not in a fixed place. The other possibility is to use .def_domain_type to quirk the entire device to use an identity domain - like for certain integrated GPUs - but that might depend on the scope of how much you want to trust it and whether there are also other devices in the same IOMMU group.
Well, in theory you can use the TPM2 ACPI table to find the (physical) address of the device. And identity mapping for the domain is then needed. The real issue is that function 7 of the HECI is hidden which is why just patching the ACPI DMAR table doesn't solve it. On the computers I was testing the mapping is fixed though but that might not always be the case.
If anything I'm not sure that the PCI DMA alias quirk really sounds like the most correct thing to do, if the hidden function is doing its own DMA unrelated to whatever function 0 and its driver might do. If I'm understanding the situation correctly, a quirk for the ACPI TPM device in probe_acpi_namespace_devices() (assuming it doesn't have an ANDD entry already) might be more elegant (but admittedly more work).
The ACPI tables I saw did not have any ANDD devices and although my first patch used the ANDD+MTRR approach I was asked to drop that as no further support to MTRRs was going to be added and linux does not support ANDD based MTRRs. Klondike
Attachment:
OpenPGP_0x5608AEA28AAFC0EC.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature