drivers/gpu/drm/xe/xe_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_debugfs.c- Extension
.c- Size
- 15795 bytes
- Lines
- 620
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xe_debugfs.hlinux/debugfs.hlinux/fault-inject.hlinux/string_helpers.hdrm/drm_debugfs.hregs/xe_pmt.hxe_bo.hxe_device.hxe_force_wake.hxe_gt.hxe_gt_debugfs.hxe_gt_printk.hxe_guc_ads.hxe_hw_engine.hxe_mmio.hxe_pm.hxe_psmi.hxe_pxp_debugfs.hxe_sriov.hxe_sriov_pf_debugfs.hxe_sriov_vf.hxe_step.hxe_tile_debugfs.hxe_vsec.hxe_wa.hxe_bo_evict.hxe_migrate.hxe_vm.h
Detected Declarations
function read_residency_counterfunction print_engine_class_maskfunction print_engine_maskfunction for_each_hw_enginefunction infofunction sriov_infofunction workaroundsfunction workaround_infofunction dgfx_pkg_residencies_showfunction dgfx_pcie_link_residencies_showfunction forcewake_openfunction forcewake_releasefunction wedged_mode_showfunction __wedged_mode_set_reset_policyfunction wedged_mode_set_reset_policyfunction wedged_mode_needs_policy_updatefunction wedged_mode_setfunction page_reclaim_hw_assist_showfunction page_reclaim_hw_assist_setfunction atomic_svm_timeslice_ms_showfunction atomic_svm_timeslice_ms_setfunction min_run_period_lr_ms_showfunction min_run_period_lr_ms_setfunction min_run_period_pf_ms_showfunction min_run_period_pf_ms_setfunction disable_late_binding_showfunction disable_late_binding_setfunction xe_debugfs_register
Annotated Snippet
static const struct file_operations forcewake_all_fops = {
.owner = THIS_MODULE,
.open = forcewake_open,
.release = forcewake_release,
};
static ssize_t wedged_mode_show(struct file *f, char __user *ubuf,
size_t size, loff_t *pos)
{
struct xe_device *xe = file_inode(f)->i_private;
char buf[32];
int len = 0;
len = scnprintf(buf, sizeof(buf), "%d\n", xe->wedged.mode);
return simple_read_from_buffer(ubuf, size, pos, buf, len);
}
static int __wedged_mode_set_reset_policy(struct xe_gt *gt, enum xe_wedged_mode mode)
{
bool enable_engine_reset;
int ret;
enable_engine_reset = (mode != XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET);
ret = xe_guc_ads_scheduler_policy_toggle_reset(>->uc.guc.ads,
enable_engine_reset);
if (ret)
xe_gt_err(gt, "Failed to update GuC ADS scheduler policy (%pe)\n", ERR_PTR(ret));
return ret;
}
static int wedged_mode_set_reset_policy(struct xe_device *xe, enum xe_wedged_mode mode)
{
struct xe_gt *gt;
int ret;
u8 id;
guard(xe_pm_runtime)(xe);
for_each_gt(gt, xe, id) {
ret = __wedged_mode_set_reset_policy(gt, mode);
if (ret) {
if (id > 0) {
xe->wedged.inconsistent_reset = true;
drm_err(&xe->drm, "Inconsistent reset policy state between GTs\n");
}
return ret;
}
}
xe->wedged.inconsistent_reset = false;
return 0;
}
static bool wedged_mode_needs_policy_update(struct xe_device *xe, enum xe_wedged_mode mode)
{
if (xe->wedged.inconsistent_reset)
return true;
if (xe->wedged.mode == mode)
return false;
if (xe->wedged.mode == XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET ||
mode == XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET)
return true;
return false;
}
static ssize_t wedged_mode_set(struct file *f, const char __user *ubuf,
size_t size, loff_t *pos)
{
struct xe_device *xe = file_inode(f)->i_private;
u32 wedged_mode;
ssize_t ret;
ret = kstrtouint_from_user(ubuf, size, 0, &wedged_mode);
if (ret)
return ret;
ret = xe_device_validate_wedged_mode(xe, wedged_mode);
if (ret)
return ret;
if (wedged_mode_needs_policy_update(xe, wedged_mode)) {
ret = wedged_mode_set_reset_policy(xe, wedged_mode);
if (ret)
return ret;
}
Annotation
- Immediate include surface: `xe_debugfs.h`, `linux/debugfs.h`, `linux/fault-inject.h`, `linux/string_helpers.h`, `drm/drm_debugfs.h`, `regs/xe_pmt.h`, `xe_bo.h`, `xe_device.h`.
- Detected declarations: `function read_residency_counter`, `function print_engine_class_mask`, `function print_engine_mask`, `function for_each_hw_engine`, `function info`, `function sriov_info`, `function workarounds`, `function workaround_info`, `function dgfx_pkg_residencies_show`, `function dgfx_pcie_link_residencies_show`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.