RE: [PATCH v2 2/8] iommu/vt-d: Improve iommu_enable_pci_caps()

From: Tian, Kevin
Date: Thu Nov 10 2022 - 22:45:13 EST


> From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> Sent: Tuesday, November 8, 2022 3:34 PM
>
> The PCI subsystem triggers WARN() if a feature is repeatedly enabled.
> This improves iommu_enable_pci_caps() to avoid unnecessary kernel
> traces through checking and enabling. This also adds kernel messages
> if any feature enabling results in failure. It is worth noting that
> PRI depends on ATS. This adds a check as well.

Cannot we have a helper to check whether this device has been attached
to any domain? If no in the blocking path then disable PCI caps. If no
in the attaching path then enable PCI caps.

I just didn't get the point of leaving them enabled while the device can
not do any DMA at all.