Skip to content

Commit

Permalink
ARM64: Add Cavium THUNDERX Target
Browse files Browse the repository at this point in the history
  • Loading branch information
apinski-cavium authored and Ashwin Sekhar T K committed Jan 10, 2017
1 parent 0b8e876 commit fb200c7
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Makefile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ CCOMMON_OPT += -mtune=vulcan -mcpu=vulcan
FCOMMON_OPT += -mtune=vulcan -mcpu=vulcan
endif

ifeq ($(CORE), THUNDERX)
CCOMMON_OPT += -mtune=thunderx -mcpu=thunderx
FCOMMON_OPT += -mtune=thunderx -mcpu=thunderx
endif
1 change: 1 addition & 0 deletions TargetList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ ARMV5
ARMV8
CORTEXA57
VULCAN
THUNDERX

29 changes: 23 additions & 6 deletions cpuid_arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@
#define CPU_ARMV8 1
#define CPU_CORTEXA57 2
#define CPU_VULCAN 3
#define CPU_THUNDERX 4

static char *cpuname[] = {
"UNKNOWN",
"ARMV8" ,
"CORTEXA57"
"VULCAN"
"CORTEXA57",
"VULCAN",
"THUNDERX"
};

static char *cpuname_lower[] = {
"unknown",
"armv8" ,
"cortexa57"
"vulcan"
"cortexa57",
"vulcan",
"thunderx"
};

int get_feature(char *search)
Expand Down Expand Up @@ -89,9 +92,9 @@ int detect(void)

FILE *infile;
char buffer[512], *p, *cpu_part, *cpu_implementer;
p = (char *) NULL ;
p = (char *) NULL ;

infile = fopen("/proc/cpuinfo", "r");
infile = fopen("/proc/cpuinfo", "r");
while (fgets(buffer, sizeof(buffer), infile)) {

if (!strncmp("CPU part", buffer, 8)) {
Expand All @@ -109,6 +112,8 @@ int detect(void)
return CPU_CORTEXA57;
else if (strstr(cpu_part, "0x516") && strstr(cpu_implementer, "0x42"))
return CPU_VULCAN;
else if (strstr(cpu_part, "0x0a1") && strstr(cpu_implementer, "0x43"))
return CPU_THUNDERX;
}

p = (char *) NULL ;
Expand Down Expand Up @@ -221,6 +226,18 @@ void get_cpuconfig(void)
printf("#define DTB_DEFAULT_ENTRIES 64\n");
printf("#define DTB_SIZE 4096\n");
break;

case CPU_THUNDERX:
printf("#define ARMV8\n");
printf("#define THUNDERX\n");
printf("#define L1_DATA_SIZE 32768\n");
printf("#define L1_DATA_LINESIZE 128\n");
printf("#define L2_SIZE 16777216\n");
printf("#define L2_LINESIZE 128\n");
printf("#define DTB_DEFAULT_ENTRIES 64\n");
printf("#define DTB_SIZE 4096\n");
printf("#define L2_ASSOCIATIVE 16\n");
break;
}
}

Expand Down
18 changes: 16 additions & 2 deletions getarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef FORCE_CORTEXA57
#define FORCE
#define ARCHITECTURE "ARM64"
#define SUBARCHITECTURE "ARMV8"
#define SUBARCHITECTURE "CORTEXA57"
#define SUBDIRNAME "arm64"
#define ARCHCONFIG "-DCORTEXA57 " \
"-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
Expand All @@ -900,7 +900,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef FORCE_VULCAN
#define FORCE
#define ARCHITECTURE "ARM64"
#define SUBARCHITECTURE "ARMV8"
#define SUBARCHITECTURE "VULCAN"
#define SUBDIRNAME "arm64"
#define ARCHCONFIG "-DVULCAN " \
"-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
Expand All @@ -914,6 +914,20 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#else
#endif

#ifdef FORCE_THUNDERX
#define FORCE
#define ARCHITECTURE "ARM64"
#define SUBARCHITECTURE "THUNDERX"
#define SUBDIRNAME "arm64"
#define ARCHCONFIG "-DTHUNDERX " \
"-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
"-DL2_SIZE=16777216 -DL2_LINESIZE=128 -DL2_ASSOCIATIVE=16 " \
"-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 "
#define LIBNAME "thunderx"
#define CORENAME "THUNDERX"
#else
#endif

#ifndef FORCE

#if defined(__powerpc__) || defined(__powerpc) || defined(powerpc) || \
Expand Down
1 change: 1 addition & 0 deletions kernel/arm64/KERNEL.THUNDERX
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(KERNELDIR)/KERNEL.ARMV8
38 changes: 38 additions & 0 deletions param.h
Original file line number Diff line number Diff line change
Expand Up @@ -2423,6 +2423,44 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SYMV_P 16
#endif

#if defined(THUNDERX)
#define SNUMOPT 2
#define DNUMOPT 2

#define GEMM_DEFAULT_OFFSET_A 0
#define GEMM_DEFAULT_OFFSET_B 0
#define GEMM_DEFAULT_ALIGN 0x03fffUL

#define SGEMM_DEFAULT_UNROLL_M 4
#define SGEMM_DEFAULT_UNROLL_N 4

#define DGEMM_DEFAULT_UNROLL_M 2
#define DGEMM_DEFAULT_UNROLL_N 2

#define CGEMM_DEFAULT_UNROLL_M 2
#define CGEMM_DEFAULT_UNROLL_N 2

#define ZGEMM_DEFAULT_UNROLL_M 2
#define ZGEMM_DEFAULT_UNROLL_N 2

#define SGEMM_DEFAULT_P 128
#define DGEMM_DEFAULT_P 128
#define CGEMM_DEFAULT_P 96
#define ZGEMM_DEFAULT_P 64

#define SGEMM_DEFAULT_Q 240
#define DGEMM_DEFAULT_Q 120
#define CGEMM_DEFAULT_Q 120
#define ZGEMM_DEFAULT_Q 120

#define SGEMM_DEFAULT_R 12288
#define DGEMM_DEFAULT_R 8192
#define CGEMM_DEFAULT_R 4096
#define ZGEMM_DEFAULT_R 4096


#define SYMV_P 16
#endif

#if defined(ARMV5)
#define SNUMOPT 2
Expand Down

0 comments on commit fb200c7

Please sign in to comment.