drm/amdgpu: Add kgd/kfd interface to support scratch memory v2
v2: * Shortened headline * Removed write_config_static_mem, it gets initialized by gfx_v?_0_gpu_init * Renamed alloc_memory_of_scratch to set_scratch_backing_va * Made set_scratch_backing_va a void function * Documented set_scratch_backing in kgd_kfd_interface.h Signed-off-by: Moses Reuben <moses.reuben@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
Родитель
111159b58d
Коммит
09e56abbc6
|
@ -135,6 +135,8 @@ static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
|
||||||
static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid);
|
static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid);
|
||||||
|
|
||||||
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type);
|
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type);
|
||||||
|
static void set_scratch_backing_va(struct kgd_dev *kgd,
|
||||||
|
uint64_t va, uint32_t vmid);
|
||||||
|
|
||||||
static const struct kfd2kgd_calls kfd2kgd = {
|
static const struct kfd2kgd_calls kfd2kgd = {
|
||||||
.init_gtt_mem_allocation = alloc_gtt_mem,
|
.init_gtt_mem_allocation = alloc_gtt_mem,
|
||||||
|
@ -159,7 +161,8 @@ static const struct kfd2kgd_calls kfd2kgd = {
|
||||||
.get_atc_vmid_pasid_mapping_pasid = get_atc_vmid_pasid_mapping_pasid,
|
.get_atc_vmid_pasid_mapping_pasid = get_atc_vmid_pasid_mapping_pasid,
|
||||||
.get_atc_vmid_pasid_mapping_valid = get_atc_vmid_pasid_mapping_valid,
|
.get_atc_vmid_pasid_mapping_valid = get_atc_vmid_pasid_mapping_valid,
|
||||||
.write_vmid_invalidate_request = write_vmid_invalidate_request,
|
.write_vmid_invalidate_request = write_vmid_invalidate_request,
|
||||||
.get_fw_version = get_fw_version
|
.get_fw_version = get_fw_version,
|
||||||
|
.set_scratch_backing_va = set_scratch_backing_va,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
|
struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
|
||||||
|
@ -652,6 +655,16 @@ static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid)
|
||||||
WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
|
WREG32(mmVM_INVALIDATE_REQUEST, 1 << vmid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_scratch_backing_va(struct kgd_dev *kgd,
|
||||||
|
uint64_t va, uint32_t vmid)
|
||||||
|
{
|
||||||
|
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
|
||||||
|
|
||||||
|
lock_srbm(kgd, 0, 0, 0, vmid);
|
||||||
|
WREG32(mmSH_HIDDEN_PRIVATE_BASE_VMID, va);
|
||||||
|
unlock_srbm(kgd);
|
||||||
|
}
|
||||||
|
|
||||||
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type)
|
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
|
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
|
||||||
|
|
|
@ -94,6 +94,8 @@ static uint16_t get_atc_vmid_pasid_mapping_pasid(struct kgd_dev *kgd,
|
||||||
uint8_t vmid);
|
uint8_t vmid);
|
||||||
static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid);
|
static void write_vmid_invalidate_request(struct kgd_dev *kgd, uint8_t vmid);
|
||||||
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type);
|
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type);
|
||||||
|
static void set_scratch_backing_va(struct kgd_dev *kgd,
|
||||||
|
uint64_t va, uint32_t vmid);
|
||||||
|
|
||||||
static const struct kfd2kgd_calls kfd2kgd = {
|
static const struct kfd2kgd_calls kfd2kgd = {
|
||||||
.init_gtt_mem_allocation = alloc_gtt_mem,
|
.init_gtt_mem_allocation = alloc_gtt_mem,
|
||||||
|
@ -120,12 +122,14 @@ static const struct kfd2kgd_calls kfd2kgd = {
|
||||||
.get_atc_vmid_pasid_mapping_valid =
|
.get_atc_vmid_pasid_mapping_valid =
|
||||||
get_atc_vmid_pasid_mapping_valid,
|
get_atc_vmid_pasid_mapping_valid,
|
||||||
.write_vmid_invalidate_request = write_vmid_invalidate_request,
|
.write_vmid_invalidate_request = write_vmid_invalidate_request,
|
||||||
.get_fw_version = get_fw_version
|
.get_fw_version = get_fw_version,
|
||||||
|
.set_scratch_backing_va = set_scratch_backing_va,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
|
struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
|
||||||
{
|
{
|
||||||
return (struct kfd2kgd_calls *)&kfd2kgd;
|
return (struct kfd2kgd_calls *)&kfd2kgd;
|
||||||
|
return (struct kfd2kgd_calls *)&kfd2kgd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)
|
static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)
|
||||||
|
@ -573,6 +577,16 @@ static uint32_t kgd_address_watch_get_offset(struct kgd_dev *kgd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_scratch_backing_va(struct kgd_dev *kgd,
|
||||||
|
uint64_t va, uint32_t vmid)
|
||||||
|
{
|
||||||
|
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
|
||||||
|
|
||||||
|
lock_srbm(kgd, 0, 0, 0, vmid);
|
||||||
|
WREG32(mmSH_HIDDEN_PRIVATE_BASE_VMID, va);
|
||||||
|
unlock_srbm(kgd);
|
||||||
|
}
|
||||||
|
|
||||||
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type)
|
static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
|
struct amdgpu_device *adev = (struct amdgpu_device *) kgd;
|
||||||
|
|
|
@ -128,6 +128,9 @@ struct kgd2kfd_shared_resources {
|
||||||
*
|
*
|
||||||
* @get_fw_version: Returns FW versions from the header
|
* @get_fw_version: Returns FW versions from the header
|
||||||
*
|
*
|
||||||
|
* @set_scratch_backing_va: Sets VA for scratch backing memory of a VMID.
|
||||||
|
* Only used for no cp scheduling mode
|
||||||
|
*
|
||||||
* This structure contains function pointers to services that the kgd driver
|
* This structure contains function pointers to services that the kgd driver
|
||||||
* provides to amdkfd driver.
|
* provides to amdkfd driver.
|
||||||
*
|
*
|
||||||
|
@ -199,6 +202,8 @@ struct kfd2kgd_calls {
|
||||||
|
|
||||||
uint16_t (*get_fw_version)(struct kgd_dev *kgd,
|
uint16_t (*get_fw_version)(struct kgd_dev *kgd,
|
||||||
enum kgd_engine_type type);
|
enum kgd_engine_type type);
|
||||||
|
void (*set_scratch_backing_va)(struct kgd_dev *kgd,
|
||||||
|
uint64_t va, uint32_t vmid);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче