Lines Matching +full:0 +full:xe
27 static int pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs) in pf_provision_vfs() argument
31 int result = 0, err; in pf_provision_vfs()
33 for_each_gt(gt, xe, id) { in pf_provision_vfs()
43 static void pf_unprovision_vfs(struct xe_device *xe, unsigned int num_vfs) in pf_unprovision_vfs() argument
49 for_each_gt(gt, xe, id) in pf_unprovision_vfs()
54 static void pf_reset_vfs(struct xe_device *xe, unsigned int num_vfs) in pf_reset_vfs() argument
60 for_each_gt(gt, xe, id) in pf_reset_vfs()
65 static struct pci_dev *xe_pci_pf_get_vf_dev(struct xe_device *xe, unsigned int vf_id) in xe_pci_pf_get_vf_dev() argument
67 struct pci_dev *pdev = to_pci_dev(xe->drm.dev); in xe_pci_pf_get_vf_dev()
69 xe_assert(xe, IS_SRIOV_PF(xe)); in xe_pci_pf_get_vf_dev()
77 static void pf_link_vfs(struct xe_device *xe, int num_vfs) in pf_link_vfs() argument
79 struct pci_dev *pdev_pf = to_pci_dev(xe->drm.dev); in pf_link_vfs()
95 pdev_vf = xe_pci_pf_get_vf_dev(xe, n - 1); in pf_link_vfs()
99 xe_sriov_err(xe, "Cannot find VF%u device, aborting link%s creation!\n", in pf_link_vfs()
108 xe_sriov_notice(xe, "Failed linking VF%u\n", n); in pf_link_vfs()
114 static int pf_enable_vfs(struct xe_device *xe, int num_vfs) in pf_enable_vfs() argument
116 struct pci_dev *pdev = to_pci_dev(xe->drm.dev); in pf_enable_vfs()
117 int total_vfs = xe_sriov_pf_get_totalvfs(xe); in pf_enable_vfs()
120 xe_assert(xe, IS_SRIOV_PF(xe)); in pf_enable_vfs()
121 xe_assert(xe, num_vfs > 0); in pf_enable_vfs()
122 xe_assert(xe, num_vfs <= total_vfs); in pf_enable_vfs()
123 xe_sriov_dbg(xe, "enabling %u VF%s\n", num_vfs, str_plural(num_vfs)); in pf_enable_vfs()
134 xe_pm_runtime_get_noresume(xe); in pf_enable_vfs()
136 err = pf_provision_vfs(xe, num_vfs); in pf_enable_vfs()
137 if (err < 0) in pf_enable_vfs()
141 if (err < 0) in pf_enable_vfs()
144 pf_link_vfs(xe, num_vfs); in pf_enable_vfs()
146 xe_sriov_info(xe, "Enabled %u of %u VF%s\n", in pf_enable_vfs()
151 pf_unprovision_vfs(xe, num_vfs); in pf_enable_vfs()
152 xe_pm_runtime_put(xe); in pf_enable_vfs()
154 xe_sriov_notice(xe, "Failed to enable %u VF%s (%pe)\n", in pf_enable_vfs()
159 static int pf_disable_vfs(struct xe_device *xe) in pf_disable_vfs() argument
161 struct device *dev = xe->drm.dev; in pf_disable_vfs()
165 xe_assert(xe, IS_SRIOV_PF(xe)); in pf_disable_vfs()
166 xe_sriov_dbg(xe, "disabling %u VF%s\n", num_vfs, str_plural(num_vfs)); in pf_disable_vfs()
169 return 0; in pf_disable_vfs()
173 pf_reset_vfs(xe, num_vfs); in pf_disable_vfs()
175 pf_unprovision_vfs(xe, num_vfs); in pf_disable_vfs()
178 xe_pm_runtime_put(xe); in pf_disable_vfs()
180 xe_sriov_info(xe, "Disabled %u VF%s\n", num_vfs, str_plural(num_vfs)); in pf_disable_vfs()
181 return 0; in pf_disable_vfs()
189 * This is the Xe implementation of struct pci_driver.sriov_configure callback.
198 struct xe_device *xe = pdev_to_xe_device(pdev); in xe_pci_sriov_configure() local
201 if (!IS_SRIOV_PF(xe)) in xe_pci_sriov_configure()
204 if (num_vfs < 0) in xe_pci_sriov_configure()
207 if (num_vfs > xe_sriov_pf_get_totalvfs(xe)) in xe_pci_sriov_configure()
213 xe_pm_runtime_get(xe); in xe_pci_sriov_configure()
214 if (num_vfs > 0) in xe_pci_sriov_configure()
215 ret = pf_enable_vfs(xe, num_vfs); in xe_pci_sriov_configure()
217 ret = pf_disable_vfs(xe); in xe_pci_sriov_configure()
218 xe_pm_runtime_put(xe); in xe_pci_sriov_configure()