Lines Matching defs:xe
26 static void pf_reset_vfs(struct xe_device *xe, unsigned int num_vfs)
31 xe_sriov_pf_control_reset_vf(xe, n);
34 static void pf_link_vfs(struct xe_device *xe, int num_vfs)
36 struct pci_dev *pdev_pf = to_pci_dev(xe->drm.dev);
56 xe_sriov_err(xe, "Cannot find VF%u device, aborting link%s creation!\n",
65 xe_sriov_notice(xe, "Failed linking VF%u\n", n);
71 static void pf_engine_activity_stats(struct xe_device *xe, unsigned int num_vfs, bool enable)
77 for_each_gt(gt, xe, id) {
85 static int resize_vf_vram_bar(struct xe_device *xe, int num_vfs)
87 struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
97 static int pf_prepare_vfs_enabling(struct xe_device *xe)
99 xe_assert(xe, IS_SRIOV_PF(xe));
101 return xe_sriov_pf_arm_guard(xe, &xe->sriov.pf.guard_vfs_enabling, false, NULL);
104 static void pf_finish_vfs_enabling(struct xe_device *xe)
106 xe_assert(xe, IS_SRIOV_PF(xe));
108 xe_sriov_pf_disarm_guard(xe, &xe->sriov.pf.guard_vfs_enabling, false, NULL);
111 static int pf_enable_vfs(struct xe_device *xe, int num_vfs)
113 struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
114 int total_vfs = xe_sriov_pf_get_totalvfs(xe);
117 xe_assert(xe, IS_SRIOV_PF(xe));
118 xe_assert(xe, num_vfs > 0);
119 xe_assert(xe, num_vfs <= total_vfs);
120 xe_sriov_dbg(xe, "enabling %u VF%s\n", num_vfs, str_plural(num_vfs));
122 err = xe_sriov_pf_wait_ready(xe);
126 err = pf_prepare_vfs_enabling(xe);
139 xe_pm_runtime_get_noresume(xe);
141 err = xe_sriov_pf_provision_vfs(xe, num_vfs);
145 if (IS_DGFX(xe)) {
146 err = resize_vf_vram_bar(xe, num_vfs);
148 xe_sriov_info(xe, "Failed to set VF LMEM BAR size: %d\n", err);
155 pf_link_vfs(xe, num_vfs);
157 xe_sriov_info(xe, "Enabled %u of %u VF%s\n",
160 xe_sriov_pf_sysfs_link_vfs(xe, num_vfs);
162 pf_engine_activity_stats(xe, num_vfs, true);
167 xe_sriov_pf_unprovision_vfs(xe, num_vfs);
168 xe_pm_runtime_put(xe);
169 pf_finish_vfs_enabling(xe);
171 xe_sriov_notice(xe, "Failed to enable %u VF%s (%pe)\n",
176 static int pf_disable_vfs(struct xe_device *xe)
178 struct device *dev = xe->drm.dev;
182 xe_assert(xe, IS_SRIOV_PF(xe));
183 xe_sriov_dbg(xe, "disabling %u VF%s\n", num_vfs, str_plural(num_vfs));
188 pf_engine_activity_stats(xe, num_vfs, false);
190 xe_sriov_pf_sysfs_unlink_vfs(xe, num_vfs);
194 pf_reset_vfs(xe, num_vfs);
196 xe_sriov_pf_unprovision_vfs(xe, num_vfs);
199 xe_pm_runtime_put(xe);
201 pf_finish_vfs_enabling(xe);
203 xe_sriov_info(xe, "Disabled %u VF%s\n", num_vfs, str_plural(num_vfs));
221 struct xe_device *xe = pdev_to_xe_device(pdev);
224 if (!IS_SRIOV_PF(xe))
230 if (num_vfs > xe_sriov_pf_get_totalvfs(xe))
236 xe_pm_runtime_get(xe);
238 ret = pf_enable_vfs(xe, num_vfs);
240 ret = pf_disable_vfs(xe);
241 xe_pm_runtime_put(xe);
257 struct xe_device *xe = pdev_to_xe_device(pdev);
259 xe_assert(xe, dev_is_pf(&pdev->dev));
260 xe_assert(xe, vfid);
261 xe_assert(xe, vfid <= pci_sriov_get_totalvfs(pdev));