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

drm/xe/pf: Show VFs LMEM provisioning summary over debugfs

While we can already view individual VF LMEM provisioning using
lmem_quota debugfs attribute, we want to have unified way to show
summary across all VFs, like we do for GGTT or GuC doorbells/IDs.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241021201506.1771-1-michal.wajdeczko@intel.com

+41
+35
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
··· 2377 2377 } 2378 2378 2379 2379 /** 2380 + * xe_gt_sriov_pf_config_print_lmem - Print LMEM configurations. 2381 + * @gt: the &xe_gt 2382 + * @p: the &drm_printer 2383 + * 2384 + * Print LMEM allocations across all VFs. 2385 + * VFs without LMEM allocation are skipped. 2386 + * 2387 + * This function can only be called on PF. 2388 + * Return: 0 on success or a negative error code on failure. 2389 + */ 2390 + int xe_gt_sriov_pf_config_print_lmem(struct xe_gt *gt, struct drm_printer *p) 2391 + { 2392 + unsigned int n, total_vfs = xe_sriov_pf_get_totalvfs(gt_to_xe(gt)); 2393 + const struct xe_gt_sriov_config *config; 2394 + char buf[10]; 2395 + 2396 + xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); 2397 + mutex_lock(xe_gt_sriov_pf_master_mutex(gt)); 2398 + 2399 + for (n = 1; n <= total_vfs; n++) { 2400 + config = &gt->sriov.pf.vfs[n].config; 2401 + if (!config->lmem_obj) 2402 + continue; 2403 + 2404 + string_get_size(config->lmem_obj->size, 1, STRING_UNITS_2, 2405 + buf, sizeof(buf)); 2406 + drm_printf(p, "VF%u:\t%zu\t(%s)\n", 2407 + n, config->lmem_obj->size, buf); 2408 + } 2409 + 2410 + mutex_unlock(xe_gt_sriov_pf_master_mutex(gt)); 2411 + return 0; 2412 + } 2413 + 2414 + /** 2380 2415 * xe_gt_sriov_pf_config_print_available_ggtt - Print available GGTT ranges. 2381 2416 * @gt: the &xe_gt 2382 2417 * @p: the &drm_printer
+1
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h
··· 65 65 int xe_gt_sriov_pf_config_print_ggtt(struct xe_gt *gt, struct drm_printer *p); 66 66 int xe_gt_sriov_pf_config_print_ctxs(struct xe_gt *gt, struct drm_printer *p); 67 67 int xe_gt_sriov_pf_config_print_dbs(struct xe_gt *gt, struct drm_printer *p); 68 + int xe_gt_sriov_pf_config_print_lmem(struct xe_gt *gt, struct drm_printer *p); 68 69 69 70 int xe_gt_sriov_pf_config_print_available_ggtt(struct xe_gt *gt, struct drm_printer *p); 70 71
+5
drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
··· 82 82 .data = xe_gt_sriov_pf_config_print_dbs, 83 83 }, 84 84 { 85 + "lmem_provisioned", 86 + .show = xe_gt_debugfs_simple_show, 87 + .data = xe_gt_sriov_pf_config_print_lmem, 88 + }, 89 + { 85 90 "runtime_registers", 86 91 .show = xe_gt_debugfs_simple_show, 87 92 .data = xe_gt_sriov_pf_service_print_runtime,