drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h
Extension
.h
Size
6939 bytes
Lines
223
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct amdgpu_xcp_res_details {
	enum amdgpu_xcp_res_id id;
	u8 num_inst;
	u8 num_shared;
	struct kobject kobj;
};

struct amdgpu_xcp_cfg {
	u8 mode;
	struct amdgpu_xcp_res_details xcp_res[AMDGPU_XCP_RES_MAX];
	u8 num_res;
	struct amdgpu_xcp_mgr *xcp_mgr;
	struct kobject kobj;
	u16 compatible_nps_modes;
};

struct amdgpu_xcp_ip_funcs {
	int (*prepare_suspend)(void *handle, uint32_t inst_mask);
	int (*suspend)(void *handle, uint32_t inst_mask);
	int (*prepare_resume)(void *handle, uint32_t inst_mask);
	int (*resume)(void *handle, uint32_t inst_mask);
};

struct amdgpu_xcp_ip {
	struct amdgpu_xcp_ip_funcs *ip_funcs;
	uint32_t inst_mask;

	enum AMDGPU_XCP_IP_BLOCK ip_id;
	bool valid;
};

struct amdgpu_xcp {
	struct amdgpu_xcp_ip ip[AMDGPU_XCP_MAX_BLOCKS];

	uint8_t id;
	uint8_t mem_id;
	bool valid;
	atomic_t	ref_cnt;
	struct drm_device *ddev;
	struct drm_device *rdev;
	struct drm_device *pdev;
	struct drm_driver *driver;
	struct drm_vma_offset_manager *vma_offset_manager;
	struct amdgpu_sched	gpu_sched[AMDGPU_HW_IP_NUM][AMDGPU_RING_PRIO_MAX];
	struct amdgpu_xcp_mgr *xcp_mgr;
	struct kobject kobj;
	uint64_t unique_id;
};

struct amdgpu_xcp_mgr {
	struct amdgpu_device *adev;
	struct mutex xcp_lock;
	struct amdgpu_xcp_mgr_funcs *funcs;

	struct amdgpu_xcp xcp[MAX_XCP];
	uint8_t num_xcps;
	int8_t mode;

	 /* Used to determine KFD memory size limits per XCP */
	unsigned int num_xcp_per_mem_partition;
	struct amdgpu_xcp_cfg *xcp_cfg;
	uint32_t supp_xcp_modes;
	uint32_t avail_xcp_modes;
	/* used to determin KFD memory alloc mode for each partition */
	uint32_t mem_alloc_mode;
};

struct amdgpu_xcp_mgr_funcs {
	int (*switch_partition_mode)(struct amdgpu_xcp_mgr *xcp_mgr, int mode,
				     int *num_xcps);
	int (*query_partition_mode)(struct amdgpu_xcp_mgr *xcp_mgr);
	int (*get_ip_details)(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id,
			      enum AMDGPU_XCP_IP_BLOCK ip_id,
			      struct amdgpu_xcp_ip *ip);
	int (*get_xcp_mem_id)(struct amdgpu_xcp_mgr *xcp_mgr,
			      struct amdgpu_xcp *xcp, uint8_t *mem_id);
	int (*get_xcp_res_info)(struct amdgpu_xcp_mgr *xcp_mgr,
				int mode,
				struct amdgpu_xcp_cfg *xcp_cfg);
	int (*prepare_suspend)(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
	int (*suspend)(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
	int (*prepare_resume)(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
	int (*resume)(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
};

int amdgpu_xcp_prepare_suspend(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
int amdgpu_xcp_suspend(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
int amdgpu_xcp_prepare_resume(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);
int amdgpu_xcp_resume(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id);

Annotation

Implementation Notes