drivers/accel/amdxdna/amdxdna_ctx.h
Source file repositories/reference/linux-study-clean/drivers/accel/amdxdna/amdxdna_ctx.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/accel/amdxdna/amdxdna_ctx.h- Extension
.h- Size
- 6052 bytes
- Lines
- 223
- Domain
- Driver Families
- Bucket
- drivers/accel
- 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/bitfield.hamdxdna_gem.h
Detected Declarations
struct amdxdna_hwctx_privstruct amdxdna_cmd_start_npustruct amdxdna_cmd_chainstruct amdxdna_cmd_preempt_datastruct amdxdna_ctx_healthstruct amdxdna_cmdstruct amdxdna_hwctxstruct amdxdna_drv_cmdstruct app_health_reportstruct amdxdna_sched_jobenum ert_cmd_opcodeenum ert_cmd_stateenum amdxdna_job_opcodefunction amdxdna_cmd_get_opfunction amdxdna_cmd_set_statefunction amdxdna_cmd_get_state
Annotated Snippet
struct amdxdna_cmd_start_npu {
u64 buffer; /* instruction buffer address */
u32 buffer_size; /* size of buffer in bytes */
u32 prop_count; /* properties count */
u32 prop_args[]; /* properties and regular kernel arguments */
};
/*
* Interpretation of the beginning of data payload for ERT_CMD_CHAIN in
* amdxdna_cmd. The rest of the payload in amdxdna_cmd is cmd BO handles.
*/
struct amdxdna_cmd_chain {
u32 command_count;
u32 submit_index;
u32 error_index;
u32 reserved[3];
u64 data[] __counted_by(command_count);
};
/*
* Interpretation of the beginning of data payload for ERT_START_NPU_PREEMPT in
* amdxdna_cmd. The rest of the payload in amdxdna_cmd is regular kernel args.
*/
struct amdxdna_cmd_preempt_data {
u64 inst_buf; /* instruction buffer address */
u64 save_buf; /* save buffer address */
u64 restore_buf; /* restore buffer address */
u32 inst_size; /* size of instruction buffer in bytes */
u32 save_size; /* size of save buffer in bytes */
u32 restore_size; /* size of restore buffer in bytes */
u32 inst_prop_cnt; /* properties count */
u32 prop_args[]; /* properties and regular kernel arguments */
};
#define AMDXDNA_CMD_CTX_HEALTH_V1 1
#define AMDXDNA_CMD_CTX_HEALTH_AIE2 0
struct amdxdna_ctx_health {
u32 version;
u32 npu_gen;
};
/* Exec buffer command header format */
#define AMDXDNA_CMD_STATE GENMASK(3, 0)
#define AMDXDNA_CMD_EXTRA_CU_MASK GENMASK(11, 10)
#define AMDXDNA_CMD_COUNT GENMASK(22, 12)
#define AMDXDNA_CMD_OPCODE GENMASK(27, 23)
struct amdxdna_cmd {
u32 header;
u32 data[];
};
#define INVALID_CU_IDX (~0U)
struct amdxdna_hwctx {
struct amdxdna_client *client;
struct amdxdna_hwctx_priv *priv;
char *name;
u32 id;
u32 max_opc;
u32 num_tiles;
u32 mem_size;
u32 fw_ctx_id;
u32 col_list_len;
u32 *col_list;
u32 start_col;
u32 num_col;
u32 umq_bo_hdl;
u32 doorbell_offset;
u32 num_unused_col;
u32 last_attached_heap;
struct amdxdna_qos_info qos;
struct amdxdna_hwctx_param_config_cu *cus;
u32 syncobj_hdl;
atomic64_t job_submit_cnt;
atomic64_t job_free_cnt ____cacheline_aligned_in_smp;
};
#define drm_job_to_xdna_job(j) \
container_of(j, struct amdxdna_sched_job, base)
enum amdxdna_job_opcode {
DEFAULT_IO,
SYNC_DEBUG_BO,
ATTACH_DEBUG_BO,
DETACH_DEBUG_BO,
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `amdxdna_gem.h`.
- Detected declarations: `struct amdxdna_hwctx_priv`, `struct amdxdna_cmd_start_npu`, `struct amdxdna_cmd_chain`, `struct amdxdna_cmd_preempt_data`, `struct amdxdna_ctx_health`, `struct amdxdna_cmd`, `struct amdxdna_hwctx`, `struct amdxdna_drv_cmd`, `struct app_health_report`, `struct amdxdna_sched_job`.
- Atlas domain: Driver Families / drivers/accel.
- 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.