drm/amdkfd: introduce dummy cache info for property asic
authorjsg <jsg@openbsd.org>
Fri, 31 Mar 2023 02:09:05 +0000 (02:09 +0000)
committerjsg <jsg@openbsd.org>
Fri, 31 Mar 2023 02:09:05 +0000 (02:09 +0000)
From Prike Liang
a5528973c676dad09a1af25cd49e4312238d1428 in linux-6.1.y/6.1.22
fd72e2cb2f9dd2734e8013b3e185a21f0d605d3e in mainline linux

sys/dev/pci/drm/amd/amdkfd/kfd_crat.c

index 8bfdfd0..5e0bad7 100644 (file)
@@ -891,6 +891,54 @@ static struct kfd_gpu_cache_info gc_10_3_6_cache_info[] = {
        },
 };
 
+static struct kfd_gpu_cache_info dummy_cache_info[] = {
+       {
+               /* TCP L1 Cache per CU */
+               .cache_size = 16,
+               .cache_level = 1,
+               .flags = (CRAT_CACHE_FLAGS_ENABLED |
+                               CRAT_CACHE_FLAGS_DATA_CACHE |
+                               CRAT_CACHE_FLAGS_SIMD_CACHE),
+               .num_cu_shared = 1,
+       },
+       {
+               /* Scalar L1 Instruction Cache per SQC */
+               .cache_size = 32,
+               .cache_level = 1,
+               .flags = (CRAT_CACHE_FLAGS_ENABLED |
+                               CRAT_CACHE_FLAGS_INST_CACHE |
+                               CRAT_CACHE_FLAGS_SIMD_CACHE),
+               .num_cu_shared = 2,
+       },
+       {
+               /* Scalar L1 Data Cache per SQC */
+               .cache_size = 16,
+               .cache_level = 1,
+               .flags = (CRAT_CACHE_FLAGS_ENABLED |
+                               CRAT_CACHE_FLAGS_DATA_CACHE |
+                               CRAT_CACHE_FLAGS_SIMD_CACHE),
+               .num_cu_shared = 2,
+       },
+       {
+               /* GL1 Data Cache per SA */
+               .cache_size = 128,
+               .cache_level = 1,
+               .flags = (CRAT_CACHE_FLAGS_ENABLED |
+                               CRAT_CACHE_FLAGS_DATA_CACHE |
+                               CRAT_CACHE_FLAGS_SIMD_CACHE),
+               .num_cu_shared = 6,
+       },
+       {
+               /* L2 Data Cache per GPU (Total Tex Cache) */
+               .cache_size = 2048,
+               .cache_level = 2,
+               .flags = (CRAT_CACHE_FLAGS_ENABLED |
+                               CRAT_CACHE_FLAGS_DATA_CACHE |
+                               CRAT_CACHE_FLAGS_SIMD_CACHE),
+               .num_cu_shared = 6,
+       },
+};
+
 static void kfd_populated_cu_info_cpu(struct kfd_topology_device *dev,
                struct crat_subtype_computeunit *cu)
 {
@@ -1630,7 +1678,10 @@ static int kfd_fill_gpu_cache_info(struct kfd_dev *kdev,
                                kfd_fill_gpu_cache_info_from_gfx_config(kdev, pcache_info);
                        break;
                default:
-                       return -EINVAL;
+                       pcache_info = dummy_cache_info;
+                       num_of_cache_types = ARRAY_SIZE(dummy_cache_info);
+                       pr_warn("dummy cache info is used temporarily and real cache info need update later.\n");
+                       break;
                }
        }