Skip to content

Commit ed0f2d3

Browse files
authored
Merge pull request #2816 from martin-frbg/silicon
Add basic support for Apple Vortex (ARM64) cpu
2 parents 43a31b7 + 775a872 commit ed0f2d3

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

Makefile.arm64

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ FCOMMON_OPT += -march=armv8.1-a -mtune=thunderx2t99
6666
endif
6767
endif
6868

69+
ifeq ($(CORE), VORTEX)
70+
CCOMMON_OPT += -march=armv8.3-a
71+
FCOMMON_OPT += -march=armv8.3-a
72+
endif
73+
6974
ifeq ($(GCCVERSIONGTEQ9), 1)
7075
ifeq ($(CORE), TSV110)
7176
CCOMMON_OPT += -march=armv8.2-a -mtune=tsv110

TargetList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ THUNDERX
9898
THUNDERX2T99
9999
TSV110
100100
THUNDERX3T110
101+
VORTEX
101102

102103
9.System Z:
103104
ZARCH_GENERIC

cpuid_arm64.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
*****************************************************************************/
2727

2828
#include <string.h>
29+
#ifdef OS_DARWIN
30+
#include <sys/sysctl.h>
31+
int32_t value;
32+
size_t length=sizeof(value);
33+
#endif
2934

3035
#define CPU_UNKNOWN 0
3136
#define CPU_ARMV8 1
@@ -45,6 +50,8 @@
4550
#define CPU_TSV110 9
4651
// Ampere
4752
#define CPU_EMAG8180 10
53+
// Apple
54+
#define CPU_VORTEX 13
4855

4956
static char *cpuname[] = {
5057
"UNKNOWN",
@@ -59,7 +66,8 @@ static char *cpuname[] = {
5966
"TSV110",
6067
"EMAG8180",
6168
"NEOVERSEN1",
62-
"THUNDERX3T110"
69+
"THUNDERX3T110",
70+
"VORTEX"
6371
};
6472

6573
static char *cpuname_lower[] = {
@@ -75,7 +83,8 @@ static char *cpuname_lower[] = {
7583
"tsv110",
7684
"emag8180",
7785
"neoversen1",
78-
"thunderx3t110"
86+
"thunderx3t110",
87+
"vortex"
7988
};
8089

8190
int get_feature(char *search)
@@ -198,6 +207,10 @@ int detect(void)
198207

199208
}
200209
#else
210+
#ifdef DARWIN
211+
sysctlbyname("hw.cpufamily",&value,&length,NULL,0);
212+
if (value ==131287967) return CPU_VORTEX;
213+
#endif
201214
return CPU_ARMV8;
202215
#endif
203216

@@ -247,7 +260,10 @@ int n=0;
247260

248261
printf("#define NUM_CORES %d\n",n);
249262
#endif
250-
263+
#ifdef DARWIN
264+
sysctlbyname("hw.physicalcpu_max",&value,&length,NULL,0);
265+
printf("#define NUM_CORES %d\n",value);
266+
#endif
251267
}
252268

253269

@@ -398,6 +414,19 @@ void get_cpuconfig(void)
398414
printf("#define DTB_DEFAULT_ENTRIES 64 \n");
399415
printf("#define DTB_SIZE 4096 \n");
400416
break;
417+
#ifdef DARWIN
418+
case CPU_VORTEX:
419+
printf("#define VORTEX \n");
420+
sysctlbyname("hw.l1icachesize",&value,&length,NULL,0);
421+
printf("#define L1_CODE_SIZE %d \n",value);
422+
sysctlbyname("hw.cachelinesize",&value,&length,NULL,0);
423+
printf("#define L1_CODE_LINESIZE %d \n",value);
424+
sysctlbyname("hw.l1dcachesize",&value,&length,NULL,0);
425+
printf("#define L1_DATA_SIZE %d \n",value);
426+
sysctlbyname("hw.l2dcachesize",&value,&length,NULL,0);
427+
printf("#define L2_DATA_SIZE %d \n",value);
428+
break;
429+
#endif
401430
}
402431
get_cpucount();
403432
}

kernel/arm64/KERNEL.VORTEX

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include $(KERNELDIR)/KERNEL.ARMV8

0 commit comments

Comments
 (0)