Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] pm: device link between PF and VF permanently lost on first VF unbind --
commit 2785e7a8d2421554408eee0ed2983e10f0090091 Author: David Zhang <[email protected]> accel/amdxdna: Link SR-IOV VFs for power management sequencing This commit adds PM device links between the Physical Function (PF) and Virtual Functions (VFs) when SR-IOV is enabled. This ensures proper PM sequencing so that VFs are suspended before the PF, and the PF is resumed before VFs. > diff --git a/drivers/accel/amdxdna/aie4_sriov.c > b/drivers/accel/amdxdna/aie4_sriov.c > index 0eea28f626763..bfea6ff00ec04 100644 > --- a/drivers/accel/amdxdna/aie4_sriov.c > +++ b/drivers/accel/amdxdna/aie4_sriov.c [ ... ] > +static int aie4_link_vf(struct amdxdna_dev *xdna, struct pci_dev *pdev_vf) > +{ > + struct pci_dev *pdev_pf = to_pci_dev(xdna->ddev.dev); > + struct device_link *link; > + > + link = device_link_add(&pdev_vf->dev, /* consumer = VF */ > + &pdev_pf->dev, /* supplier = PF */ > + DL_FLAG_PM_RUNTIME | > DL_FLAG_AUTOREMOVE_CONSUMER); [Severity: High] Could this device link be permanently lost on the first VF driver unbind? The DL_FLAG_AUTOREMOVE_CONSUMER flag automatically deletes the device link when the consumer (VF) driver unbinds. Since the link is only created by the PF driver during aie4_sriov_start() when SR-IOV is first enabled, it appears it won't be recreated if a driver is subsequently re-bound to the VF. If an administrator unbinds and rebinds a VF driver, would the missing PM device link allow the PM core to runtime-suspend the PF while the newly-bound VF is actively using it? Removing DL_FLAG_AUTOREMOVE_CONSUMER might ensure the link remains tied to the device lifecycle instead. > + if (!link) { > + XDNA_ERR(xdna, "Failed to link VF %s", pci_name(pdev_vf)); > + return -EINVAL; > + } > + > + XDNA_DBG(xdna, "Linked VF %s", pci_name(pdev_vf)); > + return 0; > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=17
