Message ID | 20220216091307.703-1-adrianhuang0701@gmail.com |
---|---|
State | New |
Headers | show |
Series | [v2,1/1] iommu/vt-d: Fix list_add double add when enabling VMD and scalable mode | expand |
On 2/18/22 4:21 PM, Huang Adrian wrote: >> Another thing I am still concerned is about the context entry setup. >> What does the context entries look like for both VMD and subdevices >> after domain_context_mapping() being called? > pasid_table in struct device_domain_info is NULL because the field > pasid_table is configured in intel_pasid_alloc_table(). > > The following statement in domain_context_mapping_one() is true for > subdevices because the context is configured by the real VMD device > 0000:59:00.5. So, domain_context_mapping() does nothing for > subdevices. > if (context_present(context)) > goto out_unlock; > > Here is the log for your reference with pr_debug() enabled. > > [ 19.063445] pci 0000:59:00.5: Adding to iommu group 42 > ... > [ 22.673502] DMAR: Set context mapping for 59:00.5 > .. > [ 32.089696] vmd 0000:59:00.5: PCI host bridge to bus 10000:80 > [ 32.119452] pci 10000:80:01.0: [8086:352a] type 01 class 0x060400 > [ 32.126302] pci 10000:80:01.0: reg 0x10: [mem 0x00000000-0x0001ffff 64bit] > [ 32.134023] pci 10000:80:01.0: enabling Extended Tags > [ 32.139730] pci 10000:80:01.0: PME# supported from D0 D3hot D3cold > [ 32.160526] DMAR: Set context mapping for 59:00.5 > [ 32.171090] pci 10000:80:01.0: Adding to iommu group 42 > ... That's clear to me now. Thank you very much! Best regards, baolu
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 92fea3fbbb11..5b196cfe9ed2 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2738,7 +2738,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, spin_unlock_irqrestore(&device_domain_lock, flags); /* PASID table is mandatory for a PCI device in scalable mode. */ - if (dev && dev_is_pci(dev) && sm_supported(iommu)) { + if (sm_supported(iommu) && !dev_is_real_dma_subdevice(dev)) { ret = intel_pasid_alloc_table(dev); if (ret) { dev_err(dev, "PASID table allocation failed\n");