RE: [PATCH 2/2] thunderbolt: Use pre-boot DMA protection on AMD systems

From: Limonciello, Mario
Date: Tue Mar 15 2022 - 12:54:15 EST


[Public]


> On Tue, Mar 15, 2022 at 11:24:55AM -0500, Mario Limonciello wrote:
> > - * handled natively using IOMMU. It is enabled when IOMMU is
> > - * enabled and ACPI DMAR table has DMAR_PLATFORM_OPT_IN set.
> > + * handled natively using IOMMU. It is enabled when the IOMMU is
> > + * enabled and either:
> > + * ACPI DMAR table has DMAR_PLATFORM_OPT_IN set
> > + * or
> > + * ACPI IVRS table has DMA_REMAP bitset
> > */
> > return sprintf(buf, "%d\n",
> > - iommu_present(&pci_bus_type) &&
> dmar_platform_optin());
> > + iommu_present(&pci_bus_type) &&
> > + (dmar_platform_optin() || amd_ivrs_remap_support()));
>
> Yikes. No, the thunderbot code does not have any business poking into
> either dmar_platform_optin or amd_ivrs_remap_support. This needs
> a proper abstration from the IOMMU code.

To make sure I follow your ask - it's to make a new generic iommu function
That would check dmar/ivrs, and switch out thunderbolt domain.c to use the
symbol?

I'm happy to rework that if that is what you want.
Do you have a preferred proposed function name for that?