Lines Matching defs:xe
23 static unsigned int wanted_max_vfs(struct xe_device *xe)
26 return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev));
30 static int pf_reduce_totalvfs(struct xe_device *xe, int limit)
32 struct device *dev = xe->drm.dev;
38 xe_sriov_notice(xe, "Failed to set number of VFs to %d (%pe)\n",
43 static bool pf_continue_as_native(struct xe_device *xe, const char *why)
45 xe_sriov_dbg(xe, "%s, continuing as native\n", why);
46 pf_reduce_totalvfs(xe, 0);
52 * @xe: the &xe_device to check
59 bool xe_sriov_pf_readiness(struct xe_device *xe)
61 struct device *dev = xe->drm.dev;
64 int newlimit = min_t(u16, wanted_max_vfs(xe), totalvfs);
66 xe_assert(xe, totalvfs <= U16_MAX);
71 if (!xe_device_uc_enabled(xe))
72 return pf_continue_as_native(xe, "Guc submission disabled");
75 return pf_continue_as_native(xe, "all VFs disabled");
77 pf_reduce_totalvfs(xe, newlimit);
79 xe->sriov.pf.device_total_vfs = totalvfs;
80 xe->sriov.pf.driver_max_vfs = newlimit;
87 * @xe: the &xe_device to initialize
91 int xe_sriov_pf_init_early(struct xe_device *xe)
95 xe_assert(xe, IS_SRIOV_PF(xe));
97 xe->sriov.pf.vfs = drmm_kcalloc(&xe->drm, 1 + xe_sriov_pf_get_totalvfs(xe),
98 sizeof(*xe->sriov.pf.vfs), GFP_KERNEL);
99 if (!xe->sriov.pf.vfs)
102 err = drmm_mutex_init(&xe->drm, &xe->sriov.pf.master_lock);
106 err = xe_sriov_pf_migration_init(xe);
110 xe_guard_init(&xe->sriov.pf.guard_vfs_enabling, "vfs_enabling");
112 xe_sriov_pf_service_init(xe);
119 * @xe: the &xe_device to initialize
125 int xe_sriov_pf_init_late(struct xe_device *xe)
131 xe_assert(xe, IS_SRIOV_PF(xe));
133 for_each_gt(gt, xe, id) {
139 err = xe_sriov_pf_sysfs_init(xe);
148 * @xe: the &xe_device to test
154 int xe_sriov_pf_wait_ready(struct xe_device *xe)
160 if (xe_device_wedged(xe))
163 for_each_gt(gt, xe, id) {
174 * @xe: the PF &xe_device
186 int xe_sriov_pf_arm_guard(struct xe_device *xe, struct xe_guard *guard,
194 xe_sriov_dbg(xe, "%s/%s mode denied (%pe) last owner %ps\n",
200 xe_sriov_dbg_verbose(xe, "%s/%s by %ps\n",
208 * @xe: the PF &xe_device
218 void xe_sriov_pf_disarm_guard(struct xe_device *xe, struct xe_guard *guard,
223 xe_sriov_dbg_verbose(xe, "%s/%s by %ps\n",
228 xe_assert_msg(xe, disarmed, "%s/%s not armed? last owner %ps",
234 * @xe: the PF &xe_device
244 int xe_sriov_pf_lockdown(struct xe_device *xe)
246 xe_assert(xe, IS_SRIOV_PF(xe));
248 return xe_sriov_pf_arm_guard(xe, &xe->sriov.pf.guard_vfs_enabling, true,
254 * @xe: the PF &xe_device
259 void xe_sriov_pf_end_lockdown(struct xe_device *xe)
261 xe_assert(xe, IS_SRIOV_PF(xe));
263 xe_sriov_pf_disarm_guard(xe, &xe->sriov.pf.guard_vfs_enabling, true,
269 * @xe: the &xe_device to print info from
274 void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p)
276 struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
278 xe_assert(xe, IS_SRIOV_PF(xe));
280 drm_printf(p, "total: %u\n", xe->sriov.pf.device_total_vfs);
281 drm_printf(p, "supported: %u\n", xe->sriov.pf.driver_max_vfs);