aboutsummaryrefslogtreecommitdiffstats
path: root/dpdk
diff options
context:
space:
mode:
authorBrian Brooks <brian.brooks@arm.com>2017-09-06 13:19:48 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2017-09-11 10:13:42 +0000
commita7191840beeb2c3a0f2598707ed1051a9f23c45f (patch)
tree3fa0b6e08565214652b8fde2be5aa8abc2980dd3 /dpdk
parentb2d2fc7f581101261f59708eaf7a8ad5272a56cb (diff)
Improved arm64 chip detection
Use ARMv8 Main ID Register (exposed thru /proc/cpuinfo) to identify the CPU implementor and part number. For further details, see the ARMv8 ARM D7.2.66. Change-Id: I2b0d0b165cda4ab9fc57c645af90e9e354b73f44 Signed-off-by: Brian Brooks <brian.brooks@arm.com> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> Signed-off-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Song Zhu <song.zhu@arm.com>
Diffstat (limited to 'dpdk')
-rw-r--r--dpdk/Makefile57
1 files changed, 46 insertions, 11 deletions
diff --git a/dpdk/Makefile b/dpdk/Makefile
index 4d8dea283b3..afe50c4ba7b 100644
--- a/dpdk/Makefile
+++ b/dpdk/Makefile
@@ -75,29 +75,64 @@ ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686))
DPDK_TARGET ?= $(MACHINE)-native-linuxapp-$(DPDK_CC)
DPDK_MACHINE ?= nhm
DPDK_TUNE ?= core-avx2
+
+##############################################################################
+# ARM64
+##############################################################################
else ifeq ($(MACHINE),aarch64)
export CROSS=""
-ifneq (,$(findstring thunder,$(shell [[ -f /sys/bus/pci/devices/0000:00:01.0/uevent ]] && cat /sys/bus/pci/devices/0000:00:01.0/uevent | grep cavium)))
+DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC)
+DPDK_MACHINE ?= armv8a
+DPDK_TUNE ?= generic
+
+CPU_IMP_ARM = 0x41
+CPU_IMP_CAVIUM = 0x43
+
+CPU_PART_ARM_CORTEX_A53 = 0xd03
+CPU_PART_ARM_CORTEX_A57 = 0xd07
+CPU_PART_ARM_CORTEX_A72 = 0xd08
+CPU_PART_ARM_CORTEX_A73 = 0xd09
+
+CPU_PART_CAVIUM_THUNDERX = 0x0a1
+CPU_PART_CAVIUM_THUNDERX_81XX = 0x0a2
+CPU_PART_CAVIUM_THUNDERX_83XX = 0x0a3
+
+MIDR_IMPLEMENTER=$(shell awk '/implementer/ {print $$4;exit}' /proc/cpuinfo)
+MIDR_PARTNUM=$(shell awk '/part/ {print $$4;exit}' /proc/cpuinfo)
+
+ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_ARM))
##############################################################################
-# Cavium ThunderX
+# Arm Cortex
##############################################################################
-DPDK_TARGET ?= arm64-thunderx-linuxapp-$(DPDK_CC)
-DPDK_MACHINE ?= thunderx
-DPDK_TUNE ?= generic
+CPU_PART_ARM_TUNE := $(CPU_PART_ARM_CORTEX_A53)/cortex-a53 \
+ $(CPU_PART_ARM_CORTEX_A57)/cortex-a57 \
+ $(CPU_PART_ARM_CORTEX_A72)/cortex-a72 \
+ $(CPU_PART_ARM_CORTEX_A73)/cortex-a73
+CPU_TUNE = $(notdir $(filter $(MIDR_PARTNUM)/%,$(CPU_PART_ARM_TUNE)))
+ifneq ($(CPU_TUNE),)
+DPDK_TUNE = $(CPU_TUNE)
else
+$(warning Unknown Arm CPU)
+endif
+
+else ifeq ($(MIDR_IMPLEMENTER),$(CPU_IMP_CAVIUM))
##############################################################################
-# Generic ARM64
+# Cavium ThunderX
##############################################################################
-DPDK_TARGET ?= arm64-armv8a-linuxapp-$(DPDK_CC)
-DPDK_MACHINE ?= armv8a
-DPDK_TUNE ?= generic
+ifneq (,$(findstring $(MIDR_PARTNUM),$(CPU_PART_CAVIUM_THUNDERX) \
+ $(CPU_PART_CAVIUM_THUNDERX_81XX) $(CPU_PART_CAVIUM_THUNDERX_83XX)))
+DPDK_TARGET = arm64-thunderx-linuxapp-$(DPDK_CC)
+DPDK_MACHINE = thunderx
+else
+$(warning Unknown Cavium CPU)
+endif
endif
##############################################################################
-# Unknown platofrm
+# Unknown platform
##############################################################################
else
-$(error unknown platform)
+$(error Unknown platform)
endif
# /proc/cpuinfo does not exist on platforms without a /proc and on some