Re: [PATCH] iommu/intel: Enable pci capabilities before assigning cache tags

From: Baolu Lu
Date: Tue Jun 25 2024 - 21:11:48 EST


On 6/25/24 9:49 PM, Joel Granados via B4 Relay wrote:
From: Joel Granados<j.granados@xxxxxxxxxxx>

Enable the pci capabilities by calling iommu_enable_pci_caps before we
assign a cache tag. The cache_tag_assign_domain call in
dmar_domain_attach_device uses the device_domain_info->ats_enabled
element to decide on the cache_tag_type value. Therefore ats_enabled
needs to be evaluated before the call to the tag cache assignment.

Signed-off-by: Joel Granados<j.granados@xxxxxxxxxxx>
---
The "what" and "why" are included in the commit message.

Tried to place cache_tag_assign_domain before the early return in
"if(dev_is_real_dma_subdevice(dev))". This means that the call to
iommu_enable_pci_caps landed before the setup functions [1] which is not
an issue as they seem to be orthogonal (I would like to be proven wrong
here).

An alternative to this patch would be to use a different way of checking
if the device is ATS enabled in __cache_tag_assign_domain.

Comments greatly appreciated

Thank you very much for the patch. But we already have a similar patch
which has been picked by Joerg for 6.10-rc.

https://lore.kernel.org/linux-iommu/20240620062940.201786-1-baolu.lu@xxxxxxxxxxxxxxx/

Can you please check whether above patch works for you?

Best regards,
baolu