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

drm/xe/vf: Expose SR-IOV VF attributes to GT debugfs

For debug purposes we might want to view actual VF configuration
(including GGTT range, LMEM size, number of GuC contexts IDs or
doorbells) and the negotiated ABI versions (with GuC and PF).

Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240516110546.2216-7-michal.wajdeczko@intel.com

+90
+1
drivers/gpu/drm/xe/Makefile
··· 156 156 # graphics virtualization (SR-IOV) support 157 157 xe-y += \ 158 158 xe_gt_sriov_vf.o \ 159 + xe_gt_sriov_vf_debugfs.o \ 159 160 xe_guc_relay.o \ 160 161 xe_memirq.o \ 161 162 xe_sriov.o
+3
drivers/gpu/drm/xe/xe_gt_debugfs.c
··· 16 16 #include "xe_gt.h" 17 17 #include "xe_gt_mcr.h" 18 18 #include "xe_gt_sriov_pf_debugfs.h" 19 + #include "xe_gt_sriov_vf_debugfs.h" 19 20 #include "xe_gt_topology.h" 20 21 #include "xe_hw_engine.h" 21 22 #include "xe_lrc.h" ··· 307 306 308 307 if (IS_SRIOV_PF(xe)) 309 308 xe_gt_sriov_pf_debugfs_register(gt, root); 309 + else if (IS_SRIOV_VF(xe)) 310 + xe_gt_sriov_vf_debugfs_register(gt, root); 310 311 }
+72
drivers/gpu/drm/xe/xe_gt_sriov_vf_debugfs.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* 3 + * Copyright © 2023-2024 Intel Corporation 4 + */ 5 + 6 + #include <linux/debugfs.h> 7 + 8 + #include <drm/drm_debugfs.h> 9 + 10 + #include "xe_gt_debugfs.h" 11 + #include "xe_gt_sriov_vf.h" 12 + #include "xe_gt_sriov_vf_debugfs.h" 13 + #include "xe_gt_types.h" 14 + #include "xe_sriov.h" 15 + 16 + /* 17 + * /sys/kernel/debug/dri/0/ 18 + * ├── gt0 19 + * │   ├── vf 20 + * │   │   ├── self_config 21 + * │   │   ├── abi_versions 22 + * │   │   ├── runtime_regs 23 + */ 24 + 25 + static const struct drm_info_list vf_info[] = { 26 + { 27 + "self_config", 28 + .show = xe_gt_debugfs_simple_show, 29 + .data = xe_gt_sriov_vf_print_config, 30 + }, 31 + { 32 + "abi_versions", 33 + .show = xe_gt_debugfs_simple_show, 34 + .data = xe_gt_sriov_vf_print_version, 35 + }, 36 + #if defined(CONFIG_DRM_XE_DEBUG) || defined(CONFIG_DRM_XE_DEBUG_SRIOV) 37 + { 38 + "runtime_regs", 39 + .show = xe_gt_debugfs_simple_show, 40 + .data = xe_gt_sriov_vf_print_runtime, 41 + }, 42 + #endif 43 + }; 44 + 45 + /** 46 + * xe_gt_sriov_vf_debugfs_register - Register SR-IOV VF specific entries in GT debugfs. 47 + * @gt: the &xe_gt to register 48 + * @root: the &dentry that represents the GT directory 49 + * 50 + * Register SR-IOV VF entries that are GT related and must be shown under GT debugfs. 51 + */ 52 + void xe_gt_sriov_vf_debugfs_register(struct xe_gt *gt, struct dentry *root) 53 + { 54 + struct xe_device *xe = gt_to_xe(gt); 55 + struct drm_minor *minor = xe->drm.primary; 56 + struct dentry *vfdentry; 57 + 58 + xe_assert(xe, IS_SRIOV_VF(xe)); 59 + xe_assert(xe, root->d_inode->i_private == gt); 60 + 61 + /* 62 + * /sys/kernel/debug/dri/0/ 63 + * ├── gt0 64 + * │   ├── vf 65 + */ 66 + vfdentry = debugfs_create_dir("vf", root); 67 + if (IS_ERR(vfdentry)) 68 + return; 69 + vfdentry->d_inode->i_private = gt; 70 + 71 + drm_debugfs_create_files(vf_info, ARRAY_SIZE(vf_info), vfdentry, minor); 72 + }
+14
drivers/gpu/drm/xe/xe_gt_sriov_vf_debugfs.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2023-2024 Intel Corporation 4 + */ 5 + 6 + #ifndef _XE_GT_SRIOV_VF_DEBUGFS_H_ 7 + #define _XE_GT_SRIOV_VF_DEBUGFS_H_ 8 + 9 + struct xe_gt; 10 + struct dentry; 11 + 12 + void xe_gt_sriov_vf_debugfs_register(struct xe_gt *gt, struct dentry *root); 13 + 14 + #endif