drivers/gpu/drm/xe/xe_device.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_device.c- Extension
.c- Size
- 39837 bytes
- Lines
- 1515
- 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.
- 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
xe_device.hlinux/aperture.hlinux/delay.hlinux/fault-inject.hlinux/units.hdrm/drm_client.hdrm/drm_gem_ttm_helper.hdrm/drm_ioctl.hdrm/drm_managed.hdrm/drm_pagemap_util.hdrm/drm_print.hkunit/static_stub.huapi/drm/xe_drm.hdisplay/xe_display.hinstructions/xe_gpu_commands.hregs/xe_gt_regs.hregs/xe_regs.hxe_bo.hxe_bo_evict.hxe_configfs.hxe_debugfs.hxe_defaults.hxe_devcoredump.hxe_device_sysfs.hxe_dma_buf.hxe_drm_client.hxe_drv.hxe_exec.hxe_exec_queue.hxe_force_wake.hxe_ggtt.hxe_gt.h
Detected Declarations
function xe_file_openfunction xe_file_destroyfunction xe_file_getfunction xe_file_putfunction xe_file_closefunction xe_drm_ioctlfunction xe_drm_compat_ioctlfunction barrier_openfunction barrier_closefunction barrier_release_dummy_pagefunction barrier_faultfunction xe_pci_barrier_mmapfunction xe_mmapfunction xe_is_xe_filefunction xe_device_is_admin_onlyfunction xe_device_destroyfunction xe_device_createfunction xe_device_init_earlyfunction xe_driver_flr_disabledfunction __xe_driver_flrfunction xe_driver_flrfunction xe_driver_flr_finifunction xe_device_sanitizefunction xe_set_dma_infofunction assert_lmem_readyfunction vf_update_device_infofunction xe_device_vram_allocfunction xe_device_probe_earlyfunction probe_has_flat_ccsfunction generationfunction xe_device_wedged_finifunction xe_device_probefunction for_each_gtfunction for_each_tilefunction for_each_tilefunction for_each_tilefunction for_each_gtfunction xe_device_removefunction xe_device_shutdownfunction xe_device_wmbfunction tdf_request_syncfunction for_each_gt_with_typefunction xe_device_is_l2_flush_optimizedfunction xe_device_l2_flushfunction xe_device_td_flushfunction xe_device_ccs_bytesfunction xe_device_assert_mem_accessfunction xe_device_snapshot_print
Annotated Snippet
static const struct file_operations xe_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release_noglobal,
.unlocked_ioctl = xe_drm_ioctl,
.mmap = xe_mmap,
.poll = drm_poll,
.read = drm_read,
.compat_ioctl = xe_drm_compat_ioctl,
.llseek = noop_llseek,
#ifdef CONFIG_PROC_FS
.show_fdinfo = drm_show_fdinfo,
#endif
.fop_flags = FOP_UNSIGNED_OFFSET,
};
/**
* xe_is_xe_file() - Is the file an xe device file?
* @file: The file.
*
* Checks whether the file is opened against
* an xe device.
*
* Return: %true if an xe file, %false if not.
*/
bool xe_is_xe_file(const struct file *file)
{
return file->f_op == &xe_driver_fops;
}
static const struct drm_driver regular_driver = {
.driver_features =
XE_DISPLAY_DRIVER_FEATURES |
DRIVER_GEM |
DRIVER_RENDER | DRIVER_SYNCOBJ |
DRIVER_SYNCOBJ_TIMELINE | DRIVER_GEM_GPUVA,
.open = xe_file_open,
.postclose = xe_file_close,
.gem_prime_import = xe_gem_prime_import,
.dumb_create = xe_bo_dumb_create,
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
#ifdef CONFIG_PROC_FS
.show_fdinfo = xe_drm_client_fdinfo,
#endif
.ioctls = xe_ioctls,
.num_ioctls = ARRAY_SIZE(xe_ioctls),
.fops = &xe_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.major = DRIVER_MAJOR,
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,
XE_DISPLAY_DRIVER_OPS,
};
#ifdef CONFIG_PCI_IOV
static const struct drm_ioctl_desc xe_ioctls_admin_only[] = {
DRM_IOCTL_DEF_DRV(XE_DEVICE_QUERY, xe_query_ioctl, DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(XE_OBSERVATION, xe_observation_ioctl, DRM_RENDER_ALLOW),
};
static const struct drm_driver admin_only_driver = {
.driver_features =
XE_DISPLAY_DRIVER_FEATURES |
DRIVER_GEM | DRIVER_RENDER | DRIVER_GEM_GPUVA,
.open = xe_file_open,
.postclose = xe_file_close,
.ioctls = xe_ioctls_admin_only,
.num_ioctls = ARRAY_SIZE(xe_ioctls_admin_only),
.fops = &xe_driver_fops,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.major = DRIVER_MAJOR,
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,
XE_DISPLAY_DRIVER_OPS,
};
/**
* xe_device_is_admin_only() - Check whether device is admin only or not.
* @xe: the &xe_device to check
*
* Return: true if the device is admin only, false otherwise.
*/
bool xe_device_is_admin_only(const struct xe_device *xe)
{
KUNIT_STATIC_STUB_REDIRECT(xe_device_is_admin_only, xe);
return xe->drm.driver == &admin_only_driver;
Annotation
- Immediate include surface: `xe_device.h`, `linux/aperture.h`, `linux/delay.h`, `linux/fault-inject.h`, `linux/units.h`, `drm/drm_client.h`, `drm/drm_gem_ttm_helper.h`, `drm/drm_ioctl.h`.
- Detected declarations: `function xe_file_open`, `function xe_file_destroy`, `function xe_file_get`, `function xe_file_put`, `function xe_file_close`, `function xe_drm_ioctl`, `function xe_drm_compat_ioctl`, `function barrier_open`, `function barrier_close`, `function barrier_release_dummy_page`.
- 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.