Re: [PATCH 2/2] iommu/vt-d: Remove hardware automatic ATS dependency

Yi Liu
2024-06-24T08:02:35Z

Hi Baolu,

On 2024/6/24 13:25, Lu Baolu wrote:
> If a device is listed in the SATC table with ATC_REQUIRED flag set, it
> indicates that the device has a functional requirement to enable its ATC
> (via the ATS capability) for device operation. However, when IOMMU is
> running in the legacy mode, ATS could be automatically supported by the
> hardware so that the OS has no need to support the ATS functionality.

It seems like if VT-d hw is operating in legacy mode, ATS is enabled
automatically? This is really suprising. Maybe I got it wrongly. Could you
elaborate a bit?

> This is a backward compatibility feature which enables older OSs. Since
> Linux VT-d implementation has already supported ATS features for a long
> time, there is no need to rely on this compatibility hardware. Remove it
> to make the driver future-proof.
>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> drivers/iommu/intel/iommu.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 07e394dfccc1..b63347c8bf5d 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -3056,14 +3056,7 @@ static bool dmar_ats_supported(struct pci_dev *dev, struct intel_iommu *iommu)
> dev = pci_physfn(dev);
> satcu = dmar_find_matched_satc_unit(dev);
> if (satcu)
> - /*
> - * This device supports ATS as it is in SATC table.
> - * When IOMMU is in legacy mode, enabling ATS is done
> - * automatically by HW for the device that requires
> - * ATS, hence OS should not enable this device ATS
> - * to avoid duplicated TLB invalidation.
> - */
> - return !(satcu->atc_required && !sm_supported(iommu));
> + return true;
>
> for (bus = dev->bus; bus; bus = bus->parent) {
> bridge = bus->self;

--
Regards,
Yi Liu