Skip to content

Commit b982cba

Browse files
committed
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 <[email protected]> Reviewed-by: Marcin Bernatowicz <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent dd1ba62 commit b982cba

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,6 +2376,41 @@ int xe_gt_sriov_pf_config_print_dbs(struct xe_gt *gt, struct drm_printer *p)
23762376
return 0;
23772377
}
23782378

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+
23792414
/**
23802415
* xe_gt_sriov_pf_config_print_available_ggtt - Print available GGTT ranges.
23812416
* @gt: the &xe_gt

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void xe_gt_sriov_pf_config_restart(struct xe_gt *gt);
6565
int xe_gt_sriov_pf_config_print_ggtt(struct xe_gt *gt, struct drm_printer *p);
6666
int xe_gt_sriov_pf_config_print_ctxs(struct xe_gt *gt, struct drm_printer *p);
6767
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);
6869

6970
int xe_gt_sriov_pf_config_print_available_ggtt(struct xe_gt *gt, struct drm_printer *p);
7071

drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ static const struct drm_info_list pf_info[] = {
8181
.show = xe_gt_debugfs_simple_show,
8282
.data = xe_gt_sriov_pf_config_print_dbs,
8383
},
84+
{
85+
"lmem_provisioned",
86+
.show = xe_gt_debugfs_simple_show,
87+
.data = xe_gt_sriov_pf_config_print_lmem,
88+
},
8489
{
8590
"runtime_registers",
8691
.show = xe_gt_debugfs_simple_show,

0 commit comments

Comments
 (0)