drivers/gpu/drm/xe/xe_validation.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_validation.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_validation.h- Extension
.h- Size
- 6701 bytes
- Lines
- 193
- 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/dma-resv.hlinux/types.hlinux/rwsem.h
Detected Declarations
struct drm_execstruct drm_gem_objectstruct drm_gpuvm_execstruct xe_devicestruct xe_validation_devicestruct xe_val_flagsstruct xe_validation_ctxfunction xe_validation_lockdepfunction xe_validation_lockdepfunction xe_validation_device_init
Annotated Snippet
struct xe_validation_device {
struct rw_semaphore lock;
};
/**
* struct xe_val_flags - Flags for xe_validation_ctx_init().
* @exclusive: Start the validation transaction by locking out all other validators.
* @no_block: Don't block on initialization.
* @interruptible: Block interruptible if blocking. Implies initializing the drm_exec
* context with the DRM_EXEC_INTERRUPTIBLE_WAIT flag.
* @exec_ignore_duplicates: Initialize the drm_exec context with the
* DRM_EXEC_IGNORE_DUPLICATES flag.
*/
struct xe_val_flags {
u32 exclusive :1;
u32 no_block :1;
u32 interruptible :1;
u32 exec_ignore_duplicates :1;
};
/**
* struct xe_validation_ctx - A struct drm_exec subclass with support for
* exhaustive eviction
* @exec: The drm_exec object base class. Note that we use a pointer instead of
* embedding to avoid diamond inheritance.
* @val: The exhaustive eviction domain.
* @val_flags: Copy of the struct xe_val_flags passed to xe_validation_ctx_init.
* @lock_held: Whether The domain lock is currently held.
* @lock_held_exclusive: Whether the domain lock is held in exclusive mode.
* @request_exclusive: Whether to lock exclusively (write mode) the next time
* the domain lock is locked.
* @exec_flags: The drm_exec flags used for drm_exec (re-)initialization.
* @nr: The drm_exec nr parameter used for drm_exec (re-)initialization.
*/
struct xe_validation_ctx {
struct drm_exec *exec;
struct xe_validation_device *val;
struct xe_val_flags val_flags;
bool lock_held;
bool lock_held_exclusive;
bool request_exclusive;
u32 exec_flags;
unsigned int nr;
};
int xe_validation_ctx_init(struct xe_validation_ctx *ctx, struct xe_validation_device *val,
struct drm_exec *exec, const struct xe_val_flags flags);
int xe_validation_exec_lock(struct xe_validation_ctx *ctx, struct drm_gpuvm_exec *vm_exec,
struct xe_validation_device *val);
void xe_validation_ctx_fini(struct xe_validation_ctx *ctx);
bool xe_validation_should_retry(struct xe_validation_ctx *ctx, int *ret);
/**
* xe_validation_retry_on_oom() - Retry on oom in an xe_validaton transaction
* @_ctx: Pointer to the xe_validation_ctx
* @_ret: The current error value possibly holding -ENOMEM
*
* Use this in way similar to drm_exec_retry_on_contention().
* If @_ret contains -ENOMEM the transaction is restarted once in a way that
* blocks other transactions and allows exhastive eviction. If the transaction
* was already restarted once, Just return the -ENOMEM. May also set
* _ret to -EINTR if not retrying and waits are interruptible.
* May only be used within a drm_exec_until_all_locked() loop.
*/
#define xe_validation_retry_on_oom(_ctx, _ret) \
do { \
if (xe_validation_should_retry(_ctx, _ret)) \
drm_exec_retry((_ctx)->exec); \
} while (0)
/**
* xe_validation_device_init - Initialize a struct xe_validation_device
* @val: The xe_validation_device to init.
*/
static inline void
xe_validation_device_init(struct xe_validation_device *val)
{
init_rwsem(&val->lock);
}
/*
* Make guard() and scoped_guard() work with xe_validation_ctx
* so that we can exit transactions without caring about the
* cleanup.
*/
DEFINE_CLASS(xe_validation, struct xe_validation_ctx *,
if (_T) xe_validation_ctx_fini(_T);,
Annotation
- Immediate include surface: `linux/dma-resv.h`, `linux/types.h`, `linux/rwsem.h`.
- Detected declarations: `struct drm_exec`, `struct drm_gem_object`, `struct drm_gpuvm_exec`, `struct xe_device`, `struct xe_validation_device`, `struct xe_val_flags`, `struct xe_validation_ctx`, `function xe_validation_lockdep`, `function xe_validation_lockdep`, `function xe_validation_device_init`.
- 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.