@@ -4259,7 +4259,7 @@ static void gfx_v9_4_3_set_gds_init(struct amdgpu_device *adev)
42594259}
42604260
42614261static void gfx_v9_4_3_set_user_cu_inactive_bitmap (struct amdgpu_device * adev ,
4262- u32 bitmap )
4262+ u32 bitmap , int xcc_id )
42634263{
42644264 u32 data ;
42654265
@@ -4269,15 +4269,15 @@ static void gfx_v9_4_3_set_user_cu_inactive_bitmap(struct amdgpu_device *adev,
42694269 data = bitmap << GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_CUS__SHIFT ;
42704270 data &= GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_CUS_MASK ;
42714271
4272- WREG32_SOC15 (GC , GET_INST (GC , 0 ), regGC_USER_SHADER_ARRAY_CONFIG , data );
4272+ WREG32_SOC15 (GC , GET_INST (GC , xcc_id ), regGC_USER_SHADER_ARRAY_CONFIG , data );
42734273}
42744274
4275- static u32 gfx_v9_4_3_get_cu_active_bitmap (struct amdgpu_device * adev )
4275+ static u32 gfx_v9_4_3_get_cu_active_bitmap (struct amdgpu_device * adev , int xcc_id )
42764276{
42774277 u32 data , mask ;
42784278
4279- data = RREG32_SOC15 (GC , GET_INST (GC , 0 ), regCC_GC_SHADER_ARRAY_CONFIG );
4280- data |= RREG32_SOC15 (GC , GET_INST (GC , 0 ), regGC_USER_SHADER_ARRAY_CONFIG );
4279+ data = RREG32_SOC15 (GC , GET_INST (GC , xcc_id ), regCC_GC_SHADER_ARRAY_CONFIG );
4280+ data |= RREG32_SOC15 (GC , GET_INST (GC , xcc_id ), regGC_USER_SHADER_ARRAY_CONFIG );
42814281
42824282 data &= CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_CUS_MASK ;
42834283 data >>= CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_CUS__SHIFT ;
@@ -4290,7 +4290,7 @@ static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev)
42904290static int gfx_v9_4_3_get_cu_info (struct amdgpu_device * adev ,
42914291 struct amdgpu_cu_info * cu_info )
42924292{
4293- int i , j , k , counter , active_cu_number = 0 ;
4293+ int i , j , k , counter , xcc_id , active_cu_number = 0 ;
42944294 u32 mask , bitmap , ao_bitmap , ao_cu_mask = 0 ;
42954295 unsigned disable_masks [4 * 4 ];
42964296
@@ -4309,46 +4309,38 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
43094309 adev -> gfx .config .max_sh_per_se );
43104310
43114311 mutex_lock (& adev -> grbm_idx_mutex );
4312- for (i = 0 ; i < adev -> gfx .config .max_shader_engines ; i ++ ) {
4313- for (j = 0 ; j < adev -> gfx .config .max_sh_per_se ; j ++ ) {
4314- mask = 1 ;
4315- ao_bitmap = 0 ;
4316- counter = 0 ;
4317- gfx_v9_4_3_xcc_select_se_sh (adev , i , j , 0xffffffff , 0 );
4318- gfx_v9_4_3_set_user_cu_inactive_bitmap (
4319- adev , disable_masks [i * adev -> gfx .config .max_sh_per_se + j ]);
4320- bitmap = gfx_v9_4_3_get_cu_active_bitmap (adev );
4321-
4322- /*
4323- * The bitmap(and ao_cu_bitmap) in cu_info structure is
4324- * 4x4 size array, and it's usually suitable for Vega
4325- * ASICs which has 4*2 SE/SH layout.
4326- * But for Arcturus, SE/SH layout is changed to 8*1.
4327- * To mostly reduce the impact, we make it compatible
4328- * with current bitmap array as below:
4329- * SE4,SH0 --> bitmap[0][1]
4330- * SE5,SH0 --> bitmap[1][1]
4331- * SE6,SH0 --> bitmap[2][1]
4332- * SE7,SH0 --> bitmap[3][1]
4333- */
4334- cu_info -> bitmap [i % 4 ][j + i / 4 ] = bitmap ;
4335-
4336- for (k = 0 ; k < adev -> gfx .config .max_cu_per_sh ; k ++ ) {
4337- if (bitmap & mask ) {
4338- if (counter < adev -> gfx .config .max_cu_per_sh )
4339- ao_bitmap |= mask ;
4340- counter ++ ;
4312+ for (xcc_id = 0 ; xcc_id < NUM_XCC (adev -> gfx .xcc_mask ); xcc_id ++ ) {
4313+ for (i = 0 ; i < adev -> gfx .config .max_shader_engines ; i ++ ) {
4314+ for (j = 0 ; j < adev -> gfx .config .max_sh_per_se ; j ++ ) {
4315+ mask = 1 ;
4316+ ao_bitmap = 0 ;
4317+ counter = 0 ;
4318+ gfx_v9_4_3_xcc_select_se_sh (adev , i , j , 0xffffffff , xcc_id );
4319+ gfx_v9_4_3_set_user_cu_inactive_bitmap (
4320+ adev ,
4321+ disable_masks [i * adev -> gfx .config .max_sh_per_se + j ],
4322+ xcc_id );
4323+ bitmap = gfx_v9_4_3_get_cu_active_bitmap (adev , xcc_id );
4324+
4325+ cu_info -> bitmap [xcc_id ][i ][j ] = bitmap ;
4326+
4327+ for (k = 0 ; k < adev -> gfx .config .max_cu_per_sh ; k ++ ) {
4328+ if (bitmap & mask ) {
4329+ if (counter < adev -> gfx .config .max_cu_per_sh )
4330+ ao_bitmap |= mask ;
4331+ counter ++ ;
4332+ }
4333+ mask <<= 1 ;
43414334 }
4342- mask <<= 1 ;
4335+ active_cu_number += counter ;
4336+ if (i < 2 && j < 2 )
4337+ ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8 ));
4338+ cu_info -> ao_cu_bitmap [i ][j ] = ao_bitmap ;
43434339 }
4344- active_cu_number += counter ;
4345- if (i < 2 && j < 2 )
4346- ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8 ));
4347- cu_info -> ao_cu_bitmap [i % 4 ][j + i / 4 ] = ao_bitmap ;
43484340 }
4341+ gfx_v9_4_3_xcc_select_se_sh (adev , 0xffffffff , 0xffffffff , 0xffffffff ,
4342+ xcc_id );
43494343 }
4350- gfx_v9_4_3_xcc_select_se_sh (adev , 0xffffffff , 0xffffffff , 0xffffffff ,
4351- 0 );
43524344 mutex_unlock (& adev -> grbm_idx_mutex );
43534345
43544346 cu_info -> number = active_cu_number ;
0 commit comments