#include <linux/firmware.h>
#include <drm/drm_exec.h>
#include "amdgpu_mes.h"
#include "amdgpu.h"
#include "soc15_common.h"
#include "amdgpu_mes_ctx.h"
#define AMDGPU_MES_MAX_NUM_OF_QUEUES_PER_PROCESS …
#define AMDGPU_ONE_DOORBELL_SIZE …
int amdgpu_mes_doorbell_process_slice(struct amdgpu_device *adev)
{ … }
static int amdgpu_mes_kernel_doorbell_get(struct amdgpu_device *adev,
int ip_type, uint64_t *doorbell_index)
{ … }
static void amdgpu_mes_kernel_doorbell_free(struct amdgpu_device *adev,
uint32_t doorbell_index)
{ … }
static int amdgpu_mes_doorbell_init(struct amdgpu_device *adev)
{ … }
static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)
{ … }
static void amdgpu_mes_doorbell_free(struct amdgpu_device *adev)
{ … }
int amdgpu_mes_init(struct amdgpu_device *adev)
{ … }
void amdgpu_mes_fini(struct amdgpu_device *adev)
{ … }
static void amdgpu_mes_queue_free_mqd(struct amdgpu_mes_queue *q)
{ … }
int amdgpu_mes_create_process(struct amdgpu_device *adev, int pasid,
struct amdgpu_vm *vm)
{ … }
void amdgpu_mes_destroy_process(struct amdgpu_device *adev, int pasid)
{ … }
int amdgpu_mes_add_gang(struct amdgpu_device *adev, int pasid,
struct amdgpu_mes_gang_properties *gprops,
int *gang_id)
{ … }
int amdgpu_mes_remove_gang(struct amdgpu_device *adev, int gang_id)
{ … }
int amdgpu_mes_suspend(struct amdgpu_device *adev)
{ … }
int amdgpu_mes_resume(struct amdgpu_device *adev)
{ … }
static int amdgpu_mes_queue_alloc_mqd(struct amdgpu_device *adev,
struct amdgpu_mes_queue *q,
struct amdgpu_mes_queue_properties *p)
{ … }
static void amdgpu_mes_queue_init_mqd(struct amdgpu_device *adev,
struct amdgpu_mes_queue *q,
struct amdgpu_mes_queue_properties *p)
{ … }
int amdgpu_mes_add_hw_queue(struct amdgpu_device *adev, int gang_id,
struct amdgpu_mes_queue_properties *qprops,
int *queue_id)
{ … }
int amdgpu_mes_remove_hw_queue(struct amdgpu_device *adev, int queue_id)
{ … }
int amdgpu_mes_map_legacy_queue(struct amdgpu_device *adev,
struct amdgpu_ring *ring)
{ … }
int amdgpu_mes_unmap_legacy_queue(struct amdgpu_device *adev,
struct amdgpu_ring *ring,
enum amdgpu_unmap_queues_action action,
u64 gpu_addr, u64 seq)
{ … }
uint32_t amdgpu_mes_rreg(struct amdgpu_device *adev, uint32_t reg)
{ … }
int amdgpu_mes_wreg(struct amdgpu_device *adev,
uint32_t reg, uint32_t val)
{ … }
int amdgpu_mes_reg_write_reg_wait(struct amdgpu_device *adev,
uint32_t reg0, uint32_t reg1,
uint32_t ref, uint32_t mask)
{ … }
int amdgpu_mes_reg_wait(struct amdgpu_device *adev, uint32_t reg,
uint32_t val, uint32_t mask)
{ … }
int amdgpu_mes_set_shader_debugger(struct amdgpu_device *adev,
uint64_t process_context_addr,
uint32_t spi_gdbg_per_vmid_cntl,
const uint32_t *tcp_watch_cntl,
uint32_t flags,
bool trap_en)
{ … }
int amdgpu_mes_flush_shader_debugger(struct amdgpu_device *adev,
uint64_t process_context_addr)
{ … }
static void
amdgpu_mes_ring_to_queue_props(struct amdgpu_device *adev,
struct amdgpu_ring *ring,
struct amdgpu_mes_queue_properties *props)
{ … }
#define DEFINE_AMDGPU_MES_CTX_GET_OFFS_ENG(_eng) …
int amdgpu_mes_ctx_get_offs(struct amdgpu_ring *ring, unsigned int id_offs)
{ … }
int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
int queue_type, int idx,
struct amdgpu_mes_ctx_data *ctx_data,
struct amdgpu_ring **out)
{ … }
void amdgpu_mes_remove_ring(struct amdgpu_device *adev,
struct amdgpu_ring *ring)
{ … }
uint32_t amdgpu_mes_get_aggregated_doorbell_index(struct amdgpu_device *adev,
enum amdgpu_mes_priority_level prio)
{ … }
int amdgpu_mes_ctx_alloc_meta_data(struct amdgpu_device *adev,
struct amdgpu_mes_ctx_data *ctx_data)
{ … }
void amdgpu_mes_ctx_free_meta_data(struct amdgpu_mes_ctx_data *ctx_data)
{ … }
int amdgpu_mes_ctx_map_meta_data(struct amdgpu_device *adev,
struct amdgpu_vm *vm,
struct amdgpu_mes_ctx_data *ctx_data)
{ … }
int amdgpu_mes_ctx_unmap_meta_data(struct amdgpu_device *adev,
struct amdgpu_mes_ctx_data *ctx_data)
{ … }
static int amdgpu_mes_test_create_gang_and_queues(struct amdgpu_device *adev,
int pasid, int *gang_id,
int queue_type, int num_queue,
struct amdgpu_ring **added_rings,
struct amdgpu_mes_ctx_data *ctx_data)
{ … }
static int amdgpu_mes_test_queues(struct amdgpu_ring **added_rings)
{ … }
int amdgpu_mes_self_test(struct amdgpu_device *adev)
{ … }
int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)
{ … }
#if defined(CONFIG_DEBUG_FS)
static int amdgpu_debugfs_mes_event_log_show(struct seq_file *m, void *unused)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
#endif
void amdgpu_debugfs_mes_event_log_init(struct amdgpu_device *adev)
{ … }