diff --git a/Makefile.arm64 b/Makefile.arm64 index 33e76d01db..4379f2a0b5 100644 --- a/Makefile.arm64 +++ b/Makefile.arm64 @@ -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 diff --git a/TargetList.txt b/TargetList.txt index 904dbe8047..3bbabe30f6 100644 --- a/TargetList.txt +++ b/TargetList.txt @@ -81,4 +81,5 @@ ARMV5 ARMV8 CORTEXA57 VULCAN +THUNDERX diff --git a/cpuid_arm64.c b/cpuid_arm64.c index f074f9b0a7..e36213e17b 100644 --- a/cpuid_arm64.c +++ b/cpuid_arm64.c @@ -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) @@ -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)) { @@ -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 ; @@ -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; } } diff --git a/getarch.c b/getarch.c index 41c181e9ee..336faa62f9 100644 --- a/getarch.c +++ b/getarch.c @@ -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 " \ @@ -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 " \ @@ -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) || \ diff --git a/kernel/arm64/KERNEL.THUNDERX b/kernel/arm64/KERNEL.THUNDERX new file mode 100644 index 0000000000..e3efef1f5f --- /dev/null +++ b/kernel/arm64/KERNEL.THUNDERX @@ -0,0 +1 @@ +include $(KERNELDIR)/KERNEL.ARMV8 diff --git a/param.h b/param.h index 3860f43d77..31388fe320 100644 --- a/param.h +++ b/param.h @@ -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