Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Fix the exported always on CU bitmap

Newer asics with 4 SEs are not able to fit the entire bitmask in the
original field, use an array instead.

v2: keep cu_ao_mask for backward compatibility.

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Flora Cui and committed by
Alex Deucher
dbfe85ea 552c8f76

+24 -7
+5 -2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1028 1028 }; 1029 1029 1030 1030 struct amdgpu_cu_info { 1031 - uint32_t number; /* total active CU number */ 1032 - uint32_t ao_cu_mask; 1033 1031 uint32_t max_waves_per_simd; 1034 1032 uint32_t wave_front_size; 1035 1033 uint32_t max_scratch_slots_per_cu; 1036 1034 uint32_t lds_size; 1035 + 1036 + /* total active CU number */ 1037 + uint32_t number; 1038 + uint32_t ao_cu_mask; 1039 + uint32_t ao_cu_bitmap[4][4]; 1037 1040 uint32_t bitmap[4][4]; 1038 1041 }; 1039 1042
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 67 67 * - 3.15.0 - Export more gpu info for gfx9 68 68 * - 3.16.0 - Add reserved vmid support 69 69 * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS. 70 + * - 3.18.0 - Export gpu always on cu bitmap 70 71 */ 71 72 #define KMS_DRIVER_MAJOR 3 72 - #define KMS_DRIVER_MINOR 17 73 + #define KMS_DRIVER_MINOR 18 73 74 #define KMS_DRIVER_PATCHLEVEL 0 74 75 75 76 int amdgpu_vram_limit = 0;
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 594 594 dev_info.cu_active_number = adev->gfx.cu_info.number; 595 595 dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask; 596 596 dev_info.ce_ram_size = adev->gfx.ce_ram_size; 597 + memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0], 598 + sizeof(adev->gfx.cu_info.ao_cu_bitmap)); 597 599 memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0], 598 600 sizeof(adev->gfx.cu_info.bitmap)); 599 601 dev_info.vram_type = adev->mc.vram_type;
+3 -1
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
··· 3535 3535 mask <<= 1; 3536 3536 } 3537 3537 active_cu_number += counter; 3538 - ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 3538 + if (i < 2 && j < 2) 3539 + ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 3540 + cu_info->ao_cu_bitmap[i][j] = ao_bitmap; 3539 3541 } 3540 3542 } 3541 3543
+3 -1
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
··· 5427 5427 mask <<= 1; 5428 5428 } 5429 5429 active_cu_number += counter; 5430 - ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 5430 + if (i < 2 && j < 2) 5431 + ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 5432 + cu_info->ao_cu_bitmap[i][j] = ao_bitmap; 5431 5433 } 5432 5434 } 5433 5435 gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
+3 -1
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 7087 7087 mask <<= 1; 7088 7088 } 7089 7089 active_cu_number += counter; 7090 - ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 7090 + if (i < 2 && j < 2) 7091 + ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 7092 + cu_info->ao_cu_bitmap[i][j] = ao_bitmap; 7091 7093 } 7092 7094 } 7093 7095 gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
+3 -1
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
··· 4459 4459 mask <<= 1; 4460 4460 } 4461 4461 active_cu_number += counter; 4462 - ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 4462 + if (i < 2 && j < 2) 4463 + ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8)); 4464 + cu_info->ao_cu_bitmap[i][j] = ao_bitmap; 4463 4465 } 4464 4466 } 4465 4467 gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
+3
include/uapi/drm/amdgpu_drm.h
··· 764 764 __u64 max_memory_clock; 765 765 /* cu information */ 766 766 __u32 cu_active_number; 767 + /* NOTE: cu_ao_mask is INVALID, DON'T use it */ 767 768 __u32 cu_ao_mask; 768 769 __u32 cu_bitmap[4][4]; 769 770 /** Render backend pipe mask. One render backend is CB+DB. */ ··· 819 818 /* max gs wavefront per vgt*/ 820 819 __u32 max_gs_waves_per_vgt; 821 820 __u32 _pad1; 821 + /* always on cu bitmap */ 822 + __u32 cu_ao_bitmap[4][4]; 822 823 }; 823 824 824 825 struct drm_amdgpu_info_hw_ip {