Re: [PATCH v3 5/5] pci: Suspend iommu function prior to resetting a device

Nicolin Chen
2025-08-22T06:14:30Z

On Wed, Aug 20, 2025 at 11:18:52AM +0800, Ethan Zhao wrote:
> On 8/20/2025 5:59 AM, Nicolin Chen wrote:
> > b) multiple pci_devs; single RID
> >
> > In this case, FLR only resets one device, while the IOMMU-
> > level reset will block the entire RID (i.e. all devices),
> > since they share the single translation tunnel. This could
> > break the siblings, if they aren't also being reset along.

> Yup, such alias devices might not have ATS cap. because of they
> are PCI devices or they share the RID(BDF), so checking ATS cap
> condition might be useful here to skip the prepare()/done()

Yea, I agree, yet I think we need it to be "sure" than "might"?

So perhaps we should check alias too. Given that all alias devices
in this case share the same RID and reside in the same iommu_group,
we could iterate the group devices for pci_devs_are_dma_aliases().

> > > 2. Reset PF when its VFs are actvie.
> >
> > c) multiple pci_devs with their own RIDs
> >
> > In this case, either FLR or IOMMU only resets the PF. That
> > being said, VFs might be affected since PF is resetting?
> > If there is an issue, I don't see it coming from the IOMMU-
> > level reset..

> Each of the PF and its VFs has it owns RID(BDF), but the VFs' life
> depends on the living of PF, resetting PF, means all its VFs are
> lost.
>
> There is no processing logic about PF and its VFs in FLR() yet.
> my understanding the upper layer callers should consider the
> complexity of such case.
>
> While we introducing the connection of IOMMU & device in FLR(),
> seems we brought some of the logic from the outside to the inside
> part.
>
> One method might we don't handle PF either by explicit checking its
> VF configuration existing to skip prepare()/done() ? till we have
> much clearer handling logic about it.

That sounds a good one to start with.

The prepare()/done() functions can internally bypass for devices:

if (!pci_ats_supported(pci_dev) || pci_sriov_get_totalvfs(pci_dev))
return 0;
/* And check alias too */

Thanks
Nicolin