drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c- Extension
.c- Size
- 27191 bytes
- Lines
- 916
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hdrm/drm_print.hdrm/drm_debugfs.hxe_debugfs.hxe_device.hxe_gt.hxe_gt_debugfs.hxe_gt_sriov_pf_config.hxe_gt_sriov_pf_control.hxe_gt_sriov_pf_debugfs.hxe_gt_sriov_pf_helpers.hxe_gt_sriov_pf_migration.hxe_gt_sriov_pf_monitor.hxe_gt_sriov_pf_policy.hxe_gt_sriov_pf_service.hxe_guc.hxe_pm.hxe_sriov_pf.hxe_sriov_pf_provision.h
Detected Declarations
struct config_blob_datafunction extract_vfidfunction pf_add_policy_attrsfunction sched_groups_infofunction sched_groups_openfunction sched_groups_writefunction sched_groups_config_showfunction sched_groups_config_writefunction sched_group_engines_readfunction pf_add_sched_groupsfunction set_thresholdfunction get_thresholdfunction pf_add_config_attrsfunction control_writefunction control_readfunction config_blob_openfunction config_blob_readfunction config_blob_writefunction config_blob_releasefunction pf_add_compat_attrsfunction pf_populate_gtfunction xe_gt_sriov_pf_debugfs_populatefunction pf_add_linksfunction xe_gt_sriov_pf_debugfs_register
Annotated Snippet
static const struct file_operations sched_groups_fops = {
.owner = THIS_MODULE,
.open = sched_groups_open,
.read = seq_read,
.write = sched_groups_write,
.llseek = seq_lseek,
.release = single_release,
};
static int sched_groups_config_show(struct seq_file *m, void *data,
void (*get)(struct xe_gt *, unsigned int, u32 *, u32))
{
struct drm_printer p = drm_seq_file_printer(m);
unsigned int vfid = extract_vfid(m->private);
struct xe_gt *gt = extract_gt(m->private);
u32 values[GUC_MAX_SCHED_GROUPS];
bool first = true;
u8 group;
get(gt, vfid, values, ARRAY_SIZE(values));
for (group = 0; group < ARRAY_SIZE(values); group++) {
drm_printf(&p, "%s%u", first ? "" : ",", values[group]);
first = false;
}
drm_puts(&p, "\n");
return 0;
}
static ssize_t sched_groups_config_write(struct file *file, const char __user *ubuf,
size_t size, loff_t *pos,
int (*set)(struct xe_gt *, unsigned int, u32 *, u32))
{
struct dentry *parent = file_inode(file)->i_private;
unsigned int vfid = extract_vfid(parent);
struct xe_gt *gt = extract_gt(parent);
u32 values[GUC_MAX_SCHED_GROUPS];
int *input __free(kfree) = NULL;
u32 count;
int ret;
int i;
if (*pos)
return -ESPIPE;
if (!size)
return -ENODATA;
ret = parse_int_array_user(ubuf, min(size, GUC_MAX_SCHED_GROUPS * sizeof(u32)), &input);
if (ret)
return ret;
count = input[0];
if (count > GUC_MAX_SCHED_GROUPS)
return -E2BIG;
for (i = 0; i < count; i++) {
if (input[i + 1] < 0 || input[i + 1] > S32_MAX)
return -EINVAL;
values[i] = input[i + 1];
}
guard(xe_pm_runtime)(gt_to_xe(gt));
ret = set(gt, vfid, values, count);
return ret < 0 ? ret : size;
}
#define DEFINE_SRIOV_GT_GRP_CFG_DEBUGFS_ATTRIBUTE(CONFIG) \
static int sched_groups_##CONFIG##_show(struct seq_file *m, void *data) \
{ \
return sched_groups_config_show(m, data, \
xe_gt_sriov_pf_config_get_groups_##CONFIG); \
} \
\
static int sched_groups_##CONFIG##_open(struct inode *inode, struct file *file) \
{ \
return single_open(file, sched_groups_##CONFIG##_show, \
inode->i_private); \
} \
\
static ssize_t sched_groups_##CONFIG##_write(struct file *file, \
const char __user *ubuf, \
size_t size, loff_t *pos) \
{ \
return sched_groups_config_write(file, ubuf, size, pos, \
Annotation
- Immediate include surface: `linux/debugfs.h`, `drm/drm_print.h`, `drm/drm_debugfs.h`, `xe_debugfs.h`, `xe_device.h`, `xe_gt.h`, `xe_gt_debugfs.h`, `xe_gt_sriov_pf_config.h`.
- Detected declarations: `struct config_blob_data`, `function extract_vfid`, `function pf_add_policy_attrs`, `function sched_groups_info`, `function sched_groups_open`, `function sched_groups_write`, `function sched_groups_config_show`, `function sched_groups_config_write`, `function sched_group_engines_read`, `function pf_add_sched_groups`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.