drm/amdgpu: Do not access members of xcp w/o check (v2)
Not all the asic needs xcp. ensure check xcp availabity before accessing its member. v2: add missing change in kfd_topology.c Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Le Ma <le.ma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0409022c15
commit
9a3ce1a7a9
|
@ -429,17 +429,17 @@ uint32_t amdgpu_amdkfd_get_fw_version(struct amdgpu_device *adev,
|
|||
|
||||
void amdgpu_amdkfd_get_local_mem_info(struct amdgpu_device *adev,
|
||||
struct kfd_local_mem_info *mem_info,
|
||||
uint8_t xcp_id)
|
||||
struct amdgpu_xcp *xcp)
|
||||
{
|
||||
memset(mem_info, 0, sizeof(*mem_info));
|
||||
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) {
|
||||
if (xcp) {
|
||||
if (adev->gmc.real_vram_size == adev->gmc.visible_vram_size)
|
||||
mem_info->local_mem_size_public =
|
||||
KFD_XCP_MEMORY_SIZE(adev, xcp_id);
|
||||
KFD_XCP_MEMORY_SIZE(adev, xcp->id);
|
||||
else
|
||||
mem_info->local_mem_size_private =
|
||||
KFD_XCP_MEMORY_SIZE(adev, xcp_id);
|
||||
KFD_XCP_MEMORY_SIZE(adev, xcp->id);
|
||||
} else {
|
||||
mem_info->local_mem_size_public = adev->gmc.visible_vram_size;
|
||||
mem_info->local_mem_size_private = adev->gmc.real_vram_size -
|
||||
|
|
|
@ -233,7 +233,7 @@ uint32_t amdgpu_amdkfd_get_fw_version(struct amdgpu_device *adev,
|
|||
enum kgd_engine_type type);
|
||||
void amdgpu_amdkfd_get_local_mem_info(struct amdgpu_device *adev,
|
||||
struct kfd_local_mem_info *mem_info,
|
||||
uint8_t xcp_id);
|
||||
struct amdgpu_xcp *xcp);
|
||||
uint64_t amdgpu_amdkfd_get_gpu_clock_counter(struct amdgpu_device *adev);
|
||||
|
||||
uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz(struct amdgpu_device *adev);
|
||||
|
|
|
@ -784,7 +784,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
|||
atomic_set(&node->sram_ecc_flag, 0);
|
||||
|
||||
amdgpu_amdkfd_get_local_mem_info(kfd->adev,
|
||||
&node->local_mem_info, node->xcp->id);
|
||||
&node->local_mem_info, node->xcp);
|
||||
|
||||
/* Initialize the KFD node */
|
||||
if (kfd_init_node(node)) {
|
||||
|
|
|
@ -1235,7 +1235,7 @@ static void kfd_fill_mem_clk_max_info(struct kfd_topology_device *dev)
|
|||
* all the banks will report the same mem_clk_max information
|
||||
*/
|
||||
amdgpu_amdkfd_get_local_mem_info(dev->gpu->adev, &local_mem_info,
|
||||
dev->gpu->xcp->id);
|
||||
dev->gpu->xcp);
|
||||
|
||||
list_for_each_entry(mem, &dev->mem_props, list)
|
||||
mem->mem_clk_max = local_mem_info.mem_clk_max;
|
||||
|
|
Loading…
Reference in New Issue