@@ -1423,6 +1423,7 @@ int kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
1423
1423
1424
1424
1425
1425
static int kfd_fill_gpu_cache_info_from_gfx_config (struct kfd_dev * kdev ,
1426
+ bool cache_line_size_missing ,
1426
1427
struct kfd_gpu_cache_info * pcache_info )
1427
1428
{
1428
1429
struct amdgpu_device * adev = kdev -> adev ;
@@ -1437,6 +1438,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1437
1438
CRAT_CACHE_FLAGS_SIMD_CACHE );
1438
1439
pcache_info [i ].num_cu_shared = adev -> gfx .config .gc_num_tcp_per_wpg / 2 ;
1439
1440
pcache_info [i ].cache_line_size = adev -> gfx .config .gc_tcp_cache_line_size ;
1441
+ if (cache_line_size_missing && !pcache_info [i ].cache_line_size )
1442
+ pcache_info [i ].cache_line_size = 128 ;
1440
1443
i ++ ;
1441
1444
}
1442
1445
/* Scalar L1 Instruction Cache per SQC */
@@ -1449,6 +1452,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1449
1452
CRAT_CACHE_FLAGS_SIMD_CACHE );
1450
1453
pcache_info [i ].num_cu_shared = adev -> gfx .config .gc_num_sqc_per_wgp * 2 ;
1451
1454
pcache_info [i ].cache_line_size = adev -> gfx .config .gc_instruction_cache_line_size ;
1455
+ if (cache_line_size_missing && !pcache_info [i ].cache_line_size )
1456
+ pcache_info [i ].cache_line_size = 128 ;
1452
1457
i ++ ;
1453
1458
}
1454
1459
/* Scalar L1 Data Cache per SQC */
@@ -1460,6 +1465,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1460
1465
CRAT_CACHE_FLAGS_SIMD_CACHE );
1461
1466
pcache_info [i ].num_cu_shared = adev -> gfx .config .gc_num_sqc_per_wgp * 2 ;
1462
1467
pcache_info [i ].cache_line_size = adev -> gfx .config .gc_scalar_data_cache_line_size ;
1468
+ if (cache_line_size_missing && !pcache_info [i ].cache_line_size )
1469
+ pcache_info [i ].cache_line_size = 64 ;
1463
1470
i ++ ;
1464
1471
}
1465
1472
/* GL1 Data Cache per SA */
@@ -1472,7 +1479,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1472
1479
CRAT_CACHE_FLAGS_DATA_CACHE |
1473
1480
CRAT_CACHE_FLAGS_SIMD_CACHE );
1474
1481
pcache_info [i ].num_cu_shared = adev -> gfx .config .max_cu_per_sh ;
1475
- pcache_info [i ].cache_line_size = 0 ;
1482
+ if (cache_line_size_missing )
1483
+ pcache_info [i ].cache_line_size = 128 ;
1476
1484
i ++ ;
1477
1485
}
1478
1486
/* L2 Data Cache per GPU (Total Tex Cache) */
@@ -1484,6 +1492,8 @@ static int kfd_fill_gpu_cache_info_from_gfx_config(struct kfd_dev *kdev,
1484
1492
CRAT_CACHE_FLAGS_SIMD_CACHE );
1485
1493
pcache_info [i ].num_cu_shared = adev -> gfx .config .max_cu_per_sh ;
1486
1494
pcache_info [i ].cache_line_size = adev -> gfx .config .gc_tcc_cache_line_size ;
1495
+ if (cache_line_size_missing && !pcache_info [i ].cache_line_size )
1496
+ pcache_info [i ].cache_line_size = 128 ;
1487
1497
i ++ ;
1488
1498
}
1489
1499
/* L3 Data Cache per GPU */
@@ -1569,6 +1579,7 @@ static int kfd_fill_gpu_cache_info_from_gfx_config_v2(struct kfd_dev *kdev,
1569
1579
int kfd_get_gpu_cache_info (struct kfd_node * kdev , struct kfd_gpu_cache_info * * pcache_info )
1570
1580
{
1571
1581
int num_of_cache_types = 0 ;
1582
+ bool cache_line_size_missing = false;
1572
1583
1573
1584
switch (kdev -> adev -> asic_type ) {
1574
1585
case CHIP_KAVERI :
@@ -1692,10 +1703,17 @@ int kfd_get_gpu_cache_info(struct kfd_node *kdev, struct kfd_gpu_cache_info **pc
1692
1703
case IP_VERSION (11 , 5 , 0 ):
1693
1704
case IP_VERSION (11 , 5 , 1 ):
1694
1705
case IP_VERSION (11 , 5 , 2 ):
1706
+ /* Cacheline size not available in IP discovery for gc11.
1707
+ * kfd_fill_gpu_cache_info_from_gfx_config to hard code it
1708
+ */
1709
+ cache_line_size_missing = true;
1710
+ fallthrough ;
1695
1711
case IP_VERSION (12 , 0 , 0 ):
1696
1712
case IP_VERSION (12 , 0 , 1 ):
1697
1713
num_of_cache_types =
1698
- kfd_fill_gpu_cache_info_from_gfx_config (kdev -> kfd , * pcache_info );
1714
+ kfd_fill_gpu_cache_info_from_gfx_config (kdev -> kfd ,
1715
+ cache_line_size_missing ,
1716
+ * pcache_info );
1699
1717
break ;
1700
1718
default :
1701
1719
* pcache_info = dummy_cache_info ;
0 commit comments