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

drm/xe/pf: Promote PF debugfs function to its own file

In upcoming patches, we will build on the PF separate debugfs
tree for all SR-IOV related files and this new code will need
dedicated file. To minimize large diffs later, move existing
function now as-is, so any future modifications will be done
directly in target file.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20250928140029.198847-2-michal.wajdeczko@intel.com

+74 -48
+1
drivers/gpu/drm/xe/Makefile
··· 174 174 xe_lmtt_ml.o \ 175 175 xe_pci_sriov.o \ 176 176 xe_sriov_pf.o \ 177 + xe_sriov_pf_debugfs.o \ 177 178 xe_sriov_pf_service.o 178 179 179 180 # include helpers for tests even when XE is built-in
+1 -1
drivers/gpu/drm/xe/xe_debugfs.c
··· 23 23 #include "xe_psmi.h" 24 24 #include "xe_pxp_debugfs.h" 25 25 #include "xe_sriov.h" 26 - #include "xe_sriov_pf.h" 26 + #include "xe_sriov_pf_debugfs.h" 27 27 #include "xe_sriov_vf.h" 28 28 #include "xe_step.h" 29 29 #include "xe_tile_debugfs.h"
-42
drivers/gpu/drm/xe/xe_sriov_pf.c
··· 146 146 drm_printf(p, "supported: %u\n", xe->sriov.pf.driver_max_vfs); 147 147 drm_printf(p, "enabled: %u\n", pci_num_vf(pdev)); 148 148 } 149 - 150 - static int simple_show(struct seq_file *m, void *data) 151 - { 152 - struct drm_printer p = drm_seq_file_printer(m); 153 - struct drm_info_node *node = m->private; 154 - struct dentry *parent = node->dent->d_parent; 155 - struct xe_device *xe = parent->d_inode->i_private; 156 - void (*print)(struct xe_device *, struct drm_printer *) = node->info_ent->data; 157 - 158 - print(xe, &p); 159 - return 0; 160 - } 161 - 162 - static const struct drm_info_list debugfs_list[] = { 163 - { .name = "vfs", .show = simple_show, .data = xe_sriov_pf_print_vfs_summary }, 164 - { .name = "versions", .show = simple_show, .data = xe_sriov_pf_service_print_versions }, 165 - }; 166 - 167 - /** 168 - * xe_sriov_pf_debugfs_register - Register PF debugfs attributes. 169 - * @xe: the &xe_device 170 - * @root: the root &dentry 171 - * 172 - * Prepare debugfs attributes exposed by the PF. 173 - */ 174 - void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root) 175 - { 176 - struct drm_minor *minor = xe->drm.primary; 177 - struct dentry *parent; 178 - 179 - /* 180 - * /sys/kernel/debug/dri/0/ 181 - * ├── pf 182 - * │   ├── ... 183 - */ 184 - parent = debugfs_create_dir("pf", root); 185 - if (IS_ERR(parent)) 186 - return; 187 - parent->d_inode->i_private = xe; 188 - 189 - drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), parent, minor); 190 - }
-5
drivers/gpu/drm/xe/xe_sriov_pf.h
··· 16 16 bool xe_sriov_pf_readiness(struct xe_device *xe); 17 17 int xe_sriov_pf_init_early(struct xe_device *xe); 18 18 int xe_sriov_pf_wait_ready(struct xe_device *xe); 19 - void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root); 20 19 void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p); 21 20 #else 22 21 static inline bool xe_sriov_pf_readiness(struct xe_device *xe) ··· 26 27 static inline int xe_sriov_pf_init_early(struct xe_device *xe) 27 28 { 28 29 return 0; 29 - } 30 - 31 - static inline void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root) 32 - { 33 30 } 34 31 #endif 35 32
+54
drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* 3 + * Copyright © 2025 Intel Corporation 4 + */ 5 + 6 + #include <linux/debugfs.h> 7 + #include <drm/drm_debugfs.h> 8 + 9 + #include "xe_device_types.h" 10 + #include "xe_sriov_pf.h" 11 + #include "xe_sriov_pf_debugfs.h" 12 + #include "xe_sriov_pf_service.h" 13 + 14 + static int simple_show(struct seq_file *m, void *data) 15 + { 16 + struct drm_printer p = drm_seq_file_printer(m); 17 + struct drm_info_node *node = m->private; 18 + struct dentry *parent = node->dent->d_parent; 19 + struct xe_device *xe = parent->d_inode->i_private; 20 + void (*print)(struct xe_device *, struct drm_printer *) = node->info_ent->data; 21 + 22 + print(xe, &p); 23 + return 0; 24 + } 25 + 26 + static const struct drm_info_list debugfs_list[] = { 27 + { .name = "vfs", .show = simple_show, .data = xe_sriov_pf_print_vfs_summary }, 28 + { .name = "versions", .show = simple_show, .data = xe_sriov_pf_service_print_versions }, 29 + }; 30 + 31 + /** 32 + * xe_sriov_pf_debugfs_register - Register PF debugfs attributes. 33 + * @xe: the &xe_device 34 + * @root: the root &dentry 35 + * 36 + * Prepare debugfs attributes exposed by the PF. 37 + */ 38 + void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root) 39 + { 40 + struct drm_minor *minor = xe->drm.primary; 41 + struct dentry *parent; 42 + 43 + /* 44 + * /sys/kernel/debug/dri/0/ 45 + * ├── pf 46 + * │ ├── ... 47 + */ 48 + parent = debugfs_create_dir("pf", root); 49 + if (IS_ERR(parent)) 50 + return; 51 + parent->d_inode->i_private = xe; 52 + 53 + drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), parent, minor); 54 + }
+18
drivers/gpu/drm/xe/xe_sriov_pf_debugfs.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2025 Intel Corporation 4 + */ 5 + 6 + #ifndef _XE_SRIOV_PF_DEBUGFS_H_ 7 + #define _XE_SRIOV_PF_DEBUGFS_H_ 8 + 9 + struct dentry; 10 + struct xe_device; 11 + 12 + #ifdef CONFIG_PCI_IOV 13 + void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root); 14 + #else 15 + static inline void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root) { } 16 + #endif 17 + 18 + #endif