mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 22:46:40 +07:00
drm/amdgpu: add amdgpu interface to query cu info
Signed-off-by: Flora Cui <flora.cui@amd.com> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
parent
8cce58fe69
commit
ebdebf428a
@ -959,6 +959,7 @@ struct amdgpu_gfx_config {
|
||||
};
|
||||
|
||||
struct amdgpu_cu_info {
|
||||
uint32_t simd_per_cu;
|
||||
uint32_t max_waves_per_simd;
|
||||
uint32_t wave_front_size;
|
||||
uint32_t max_scratch_slots_per_cu;
|
||||
|
@ -304,3 +304,26 @@ uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd)
|
||||
|
||||
return amdgpu_dpm_get_sclk(adev, false) / 100;
|
||||
}
|
||||
|
||||
void get_cu_info(struct kgd_dev *kgd, struct kfd_cu_info *cu_info)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
|
||||
struct amdgpu_cu_info acu_info = adev->gfx.cu_info;
|
||||
|
||||
memset(cu_info, 0, sizeof(*cu_info));
|
||||
if (sizeof(cu_info->cu_bitmap) != sizeof(acu_info.bitmap))
|
||||
return;
|
||||
|
||||
cu_info->cu_active_number = acu_info.number;
|
||||
cu_info->cu_ao_mask = acu_info.ao_cu_mask;
|
||||
memcpy(&cu_info->cu_bitmap[0], &acu_info.bitmap[0],
|
||||
sizeof(acu_info.bitmap));
|
||||
cu_info->num_shader_engines = adev->gfx.config.max_shader_engines;
|
||||
cu_info->num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;
|
||||
cu_info->num_cu_per_sh = adev->gfx.config.max_cu_per_sh;
|
||||
cu_info->simd_per_cu = acu_info.simd_per_cu;
|
||||
cu_info->max_waves_per_simd = acu_info.max_waves_per_simd;
|
||||
cu_info->wave_front_size = acu_info.wave_front_size;
|
||||
cu_info->max_scratch_slots_per_cu = acu_info.max_scratch_slots_per_cu;
|
||||
cu_info->lds_size = acu_info.lds_size;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ uint64_t get_vmem_size(struct kgd_dev *kgd);
|
||||
uint64_t get_gpu_clock_counter(struct kgd_dev *kgd);
|
||||
|
||||
uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd);
|
||||
void get_cu_info(struct kgd_dev *kgd, struct kfd_cu_info *cu_info);
|
||||
|
||||
#define read_user_wptr(mmptr, wptr, dst) \
|
||||
({ \
|
||||
|
@ -200,6 +200,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
|
||||
.get_fw_version = get_fw_version,
|
||||
.set_scratch_backing_va = set_scratch_backing_va,
|
||||
.get_tile_config = get_tile_config,
|
||||
.get_cu_info = get_cu_info
|
||||
};
|
||||
|
||||
struct kfd2kgd_calls *amdgpu_amdkfd_gfx_7_get_functions(void)
|
||||
|
@ -161,6 +161,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
|
||||
.get_fw_version = get_fw_version,
|
||||
.set_scratch_backing_va = set_scratch_backing_va,
|
||||
.get_tile_config = get_tile_config,
|
||||
.get_cu_info = get_cu_info
|
||||
};
|
||||
|
||||
struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
|
||||
|
@ -48,6 +48,8 @@
|
||||
#include "oss/oss_2_0_d.h"
|
||||
#include "oss/oss_2_0_sh_mask.h"
|
||||
|
||||
#define NUM_SIMD_PER_CU 0x4 /* missing from the gfx_7 IP headers */
|
||||
|
||||
#define GFX7_NUM_GFX_RINGS 1
|
||||
#define GFX7_MEC_HPD_SIZE 2048
|
||||
|
||||
@ -5277,6 +5279,11 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
|
||||
|
||||
cu_info->number = active_cu_number;
|
||||
cu_info->ao_cu_mask = ao_cu_mask;
|
||||
cu_info->simd_per_cu = NUM_SIMD_PER_CU;
|
||||
cu_info->max_waves_per_simd = 10;
|
||||
cu_info->max_scratch_slots_per_cu = 32;
|
||||
cu_info->wave_front_size = 64;
|
||||
cu_info->lds_size = 64;
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version gfx_v7_0_ip_block =
|
||||
|
@ -7116,6 +7116,11 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
|
||||
|
||||
cu_info->number = active_cu_number;
|
||||
cu_info->ao_cu_mask = ao_cu_mask;
|
||||
cu_info->simd_per_cu = NUM_SIMD_PER_CU;
|
||||
cu_info->max_waves_per_simd = 10;
|
||||
cu_info->max_scratch_slots_per_cu = 32;
|
||||
cu_info->wave_front_size = 64;
|
||||
cu_info->lds_size = 64;
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version gfx_v8_0_ip_block =
|
||||
|
Loading…
Reference in New Issue
Block a user