Re: [PATCH 1/1] iommu/vt-d: Restore context entry setup order for aliased devices
From: Baolu Lu
Date: Fri May 16 2025 - 02:15:50 EST
On 5/16/2025 2:11 PM, Yi Liu wrote:
On 2025/5/14 14:05, Lu Baolu wrote:
Commit 2031c469f816 ("iommu/vt-d: Add support for static identity
domain")
changed the context entry setup during domain attachment from a
set-and-check policy to a clear-and-reset approach. This inadvertently
introduced a regression affecting PCI aliased devices behind PCIe-to-PCI
bridges.
I got what the patch does. But just bit confused on the above description.
I didn't see the commit 2031c469f816 mentioned any policy thing on the
context entry setup. To me, the problem looks to be that the info->domain
is no more accurate to be used for checking if any domain is attached after
the above commit. Maybe I missed something. feel free correct me.
The problem was introduced by below change:
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -3691,11 +3691,9 @@ int prepare_domain_attach_device(struct
iommu_domain *domain,
static int intel_iommu_attach_device(struct iommu_domain *domain,
struct device *dev)
{
- struct device_domain_info *info = dev_iommu_priv_get(dev);
int ret;
- if (info->domain)
- device_block_translation(dev);
+ device_block_translation(dev);
And after the introduction of static identity domain, "info->domain ==
NULL" doesn't mean no domain attaching to device anymore. So this patch
uses a specific flag bit to indicate this.
Thanks,
baolu