On Fri, Feb 18, 2022 at 10:30 AM Lu Baolu <[email protected]> wrote:
>
> On 2/16/22 5:13 PM, Adrian Huang wrote:
> > pci_real_dma_dev() in pci_for_each_dma_alias() gets the real dma device
> > which is the VMD device 0000:59:00.5. However, pte of the VMD device
> > 0000:59:00.5 has been configured during this message "pci 0000:59:00.5:
> > Adding to iommu group 42". So, the status -EBUSY is returned when
> > configuring pasid entry for device 10000:80:01.0.
>
> So the VMD subdevice (pci 10000:80:01.0) is an alias device of the "pci
> 0000:59:00.5", and it uses the Source-ID of "pci 0000:59:00.5" for DMA
> transactions. Do I understand it right? If so, it makes sense to skip
> setting up pasid entry for VMD subdevices.
Yes, your understanding is correct.
> 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
...
-- Adrian
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu