drivers/gpu/drm/xe/xe_observation.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_observation.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_observation.c- Extension
.c- Size
- 2787 bytes
- Lines
- 107
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/sysctl.huapi/drm/xe_drm.hxe_eu_stall.hxe_oa.hxe_observation.h
Detected Declarations
function xe_oa_ioctlfunction xe_eu_stall_ioctlfunction xe_observation_ioctlfunction xe_observation_sysctl_registerfunction xe_observation_sysctl_unregister
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2023-2024 Intel Corporation
*/
#include <linux/errno.h>
#include <linux/sysctl.h>
#include <uapi/drm/xe_drm.h>
#include "xe_eu_stall.h"
#include "xe_oa.h"
#include "xe_observation.h"
u32 xe_observation_paranoid = true;
static struct ctl_table_header *sysctl_header;
static int xe_oa_ioctl(struct drm_device *dev, struct drm_xe_observation_param *arg,
struct drm_file *file)
{
switch (arg->observation_op) {
case DRM_XE_OBSERVATION_OP_STREAM_OPEN:
return xe_oa_stream_open_ioctl(dev, arg->param, file);
case DRM_XE_OBSERVATION_OP_ADD_CONFIG:
return xe_oa_add_config_ioctl(dev, arg->param, file);
case DRM_XE_OBSERVATION_OP_REMOVE_CONFIG:
return xe_oa_remove_config_ioctl(dev, arg->param, file);
default:
return -EINVAL;
}
}
static int xe_eu_stall_ioctl(struct drm_device *dev, struct drm_xe_observation_param *arg,
struct drm_file *file)
{
switch (arg->observation_op) {
case DRM_XE_OBSERVATION_OP_STREAM_OPEN:
return xe_eu_stall_stream_open(dev, arg->param, file);
default:
return -EINVAL;
}
}
/**
* xe_observation_ioctl - The top level observation layer ioctl
* @dev: @drm_device
* @data: pointer to struct @drm_xe_observation_param
* @file: @drm_file
*
* The function is called for different observation streams types and
* allows execution of different operations supported by those stream
* types.
*
* Return: 0 on success or a negative error code on failure.
*/
int xe_observation_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
{
struct drm_xe_observation_param *arg = data;
if (arg->extensions)
return -EINVAL;
switch (arg->observation_type) {
case DRM_XE_OBSERVATION_TYPE_OA:
return xe_oa_ioctl(dev, arg, file);
case DRM_XE_OBSERVATION_TYPE_EU_STALL:
return xe_eu_stall_ioctl(dev, arg, file);
default:
return -EINVAL;
}
}
static const struct ctl_table observation_ctl_table[] = {
{
.procname = "observation_paranoid",
.data = &xe_observation_paranoid,
.maxlen = sizeof(xe_observation_paranoid),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
};
/**
* xe_observation_sysctl_register - Register xe_observation_paranoid sysctl
*
* Normally only superuser/root can access observation stream
* data. However, superuser can set xe_observation_paranoid sysctl to 0 to
* allow non-privileged users to also access observation data.
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sysctl.h`, `uapi/drm/xe_drm.h`, `xe_eu_stall.h`, `xe_oa.h`, `xe_observation.h`.
- Detected declarations: `function xe_oa_ioctl`, `function xe_eu_stall_ioctl`, `function xe_observation_ioctl`, `function xe_observation_sysctl_register`, `function xe_observation_sysctl_unregister`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.