Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/pf: Promote xe_pci_sriov_get_vf_pdev

In the upcoming patch we would like to use this private helper
during preparation of the sysfs links. Promote it.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patch.msgid.link/20251030222348.186658-15-michal.wajdeczko@intel.com

+24 -13
+23 -13
drivers/gpu/drm/xe/xe_pci_sriov.c
··· 30 30 xe_sriov_pf_control_reset_vf(xe, n); 31 31 } 32 32 33 - static struct pci_dev *xe_pci_pf_get_vf_dev(struct xe_device *xe, unsigned int vf_id) 34 - { 35 - struct pci_dev *pdev = to_pci_dev(xe->drm.dev); 36 - 37 - xe_assert(xe, IS_SRIOV_PF(xe)); 38 - 39 - /* caller must use pci_dev_put() */ 40 - return pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus), 41 - pdev->bus->number, 42 - pci_iov_virtfn_devfn(pdev, vf_id)); 43 - } 44 - 45 33 static void pf_link_vfs(struct xe_device *xe, int num_vfs) 46 34 { 47 35 struct pci_dev *pdev_pf = to_pci_dev(xe->drm.dev); ··· 48 60 * enforce correct resume order. 49 61 */ 50 62 for (n = 1; n <= num_vfs; n++) { 51 - pdev_vf = xe_pci_pf_get_vf_dev(xe, n - 1); 63 + pdev_vf = xe_pci_sriov_get_vf_pdev(pdev_pf, n); 52 64 53 65 /* unlikely, something weird is happening, abort */ 54 66 if (!pdev_vf) { ··· 215 227 xe_pm_runtime_put(xe); 216 228 217 229 return ret; 230 + } 231 + 232 + /** 233 + * xe_pci_sriov_get_vf_pdev() - Lookup the VF's PCI device using the VF identifier. 234 + * @pdev: the PF's &pci_dev 235 + * @vfid: VF identifier (1-based) 236 + * 237 + * The caller must decrement the reference count by calling pci_dev_put(). 238 + * 239 + * Return: the VF's &pci_dev or NULL if the VF device was not found. 240 + */ 241 + struct pci_dev *xe_pci_sriov_get_vf_pdev(struct pci_dev *pdev, unsigned int vfid) 242 + { 243 + struct xe_device *xe = pdev_to_xe_device(pdev); 244 + 245 + xe_assert(xe, dev_is_pf(&pdev->dev)); 246 + xe_assert(xe, vfid); 247 + xe_assert(xe, vfid <= pci_sriov_get_totalvfs(pdev)); 248 + 249 + return pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus), 250 + pdev->bus->number, 251 + pci_iov_virtfn_devfn(pdev, vfid - 1)); 218 252 }
+1
drivers/gpu/drm/xe/xe_pci_sriov.h
··· 10 10 11 11 #ifdef CONFIG_PCI_IOV 12 12 int xe_pci_sriov_configure(struct pci_dev *pdev, int num_vfs); 13 + struct pci_dev *xe_pci_sriov_get_vf_pdev(struct pci_dev *pdev, unsigned int vfid); 13 14 #else 14 15 static inline int xe_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) 15 16 {