Skip to content

Commit 3677b38

Browse files
authored
Merge pull request #4702 from bashimao/detect-nv-grace
Correctly detect ARM Neoverse V2 CPUs.
2 parents c33bc84 + 0050a96 commit 3677b38

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

Makefile.arm64

+10
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ endif
176176
endif
177177
endif
178178

179+
# Detect ARM Neoverse V2.
180+
ifeq ($(CORE), NEOVERSEV2)
181+
ifeq (1, $(filter 1,$(GCCVERSIONGTEQ12) $(ISCLANG)))
182+
CCOMMON_OPT += -march=armv9-a -mtune=neoverse-v2
183+
ifneq ($(F_COMPILER), NAG)
184+
FCOMMON_OPT += -march=armv9-a -mtune=neoverse-v2
185+
endif
186+
endif
187+
endif
188+
179189
# Use a53 tunings because a55 is only available in GCC>=8.1
180190
ifeq ($(CORE), CORTEXA55)
181191
ifeq (1, $(filter 1,$(GCCVERSIONGTEQ7) $(ISCLANG)))

cpuid_arm64.c

+24-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ size_t length64=sizeof(value64);
4646
#define CPU_NEOVERSEN1 11
4747
#define CPU_NEOVERSEV1 16
4848
#define CPU_NEOVERSEN2 17
49+
#define CPU_NEOVERSEV2 24
4950
#define CPU_CORTEXX1 18
5051
#define CPU_CORTEXX2 19
5152
#define CPU_CORTEXA510 20
@@ -91,7 +92,8 @@ static char *cpuname[] = {
9192
"CORTEXA510",
9293
"CORTEXA710",
9394
"FT2000",
94-
"CORTEXA76"
95+
"CORTEXA76",
96+
"NEOVERSEV2"
9597
};
9698

9799
static char *cpuname_lower[] = {
@@ -118,7 +120,8 @@ static char *cpuname_lower[] = {
118120
"cortexa510",
119121
"cortexa710",
120122
"ft2000",
121-
"cortexa76"
123+
"cortexa76",
124+
"neoversev2"
122125
};
123126

124127
int get_feature(char *search)
@@ -213,6 +216,8 @@ int detect(void)
213216
return CPU_CORTEXX2;
214217
else if (strstr(cpu_part, "0xd4e")) //X3
215218
return CPU_CORTEXX2;
219+
else if (strstr(cpu_part, "0xd4f")) //NVIDIA Grace et al.
220+
return CPU_NEOVERSEV2;
216221
else if (strstr(cpu_part, "0xd0b"))
217222
return CPU_CORTEXA76;
218223
}
@@ -425,6 +430,23 @@ void get_cpuconfig(void)
425430
printf("#define DTB_DEFAULT_ENTRIES 48\n");
426431
printf("#define DTB_SIZE 4096\n");
427432
break;
433+
case CPU_NEOVERSEV2:
434+
printf("#define ARMV9\n");
435+
printf("#define %s\n", cpuname[d]);
436+
printf("#define L1_CODE_SIZE 65536\n");
437+
printf("#define L1_CODE_LINESIZE 64\n");
438+
printf("#define L1_CODE_ASSOCIATIVE 4\n");
439+
printf("#define L1_DATA_SIZE 65536\n");
440+
printf("#define L1_DATA_LINESIZE 64\n");
441+
printf("#define L1_DATA_ASSOCIATIVE 4\n");
442+
printf("#define L2_SIZE 1048576\n");
443+
printf("#define L2_LINESIZE 64\n");
444+
printf("#define L2_ASSOCIATIVE 8\n");
445+
// L1 Data TLB = 48 entries
446+
// L2 Data TLB = 2048 entries
447+
printf("#define DTB_DEFAULT_ENTRIES 48\n");
448+
printf("#define DTB_SIZE 4096\n"); // Set to 4096 for symmetry with other configs.
449+
break;
428450
case CPU_CORTEXA510:
429451
case CPU_CORTEXA710:
430452
case CPU_CORTEXX1:

kernel/arm64/KERNEL.NEOVERSEV2

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include $(KERNELDIR)/KERNEL.ARMV8SVE

0 commit comments

Comments
 (0)