diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2022-08-03 16:55:16 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2022-08-03 17:56:03 +0300 |
commit | bec4ebc22c43c1ff5c3fddb820d44a88bd3aebf0 (patch) | |
tree | cd378e3e0eaff8fe11880bd397f41671e2347a39 /meta-arm/meta-atp | |
parent | 79161d7a7126cad324ff0c11a93d8e57d80203ed (diff) | |
download | openbmc-bec4ebc22c43c1ff5c3fddb820d44a88bd3aebf0.tar.xz |
Import 80d60e7 from yoctoproject.org meta-arm
To support ARMv8 SoCs.
meta-arm has several patch files. Since they are maintained by the
upstream meta-arm community, add meta-arm to the ignore list in
run-repotest.
Change-Id: Ia87a2e947bbabd347d256eccc47a343e1c885479
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-arm/meta-atp')
17 files changed, 280 insertions, 0 deletions
diff --git a/meta-arm/meta-atp/README.md b/meta-arm/meta-atp/README.md new file mode 100644 index 0000000000..15d0e29b81 --- /dev/null +++ b/meta-arm/meta-atp/README.md @@ -0,0 +1,76 @@ +# meta-atp layer + +The meta-atp layer supports building environments with traffic generation capabilities based on [AMBA Adaptive Traffic Profiles (ATP)](https://developer.arm.com/documentation/ihi0082/latest). + +## Recipes + +The meta-atp layer supports building the following software components: + +- Arm's implementation of the AMBA ATP specification, namely the [AMBA ATP Engine](https://github.com/ARM-software/ATP-Engine). +- Linux kernel modules and user API (UAPI) for programming ATP devices. +- Integration test suite for verification of kernel modules and UAPI. + +It is also possible to build the AMBA ATP Engine as part of the final [gem5](https://www.gem5.org/) executable. For this, meta-atp extends the `gem5-aarch64-native` recipe to add the AMBA ATP engine code as extra sources. + +## Machines + +The `gem5-atp-arm64` machine extends the `gem5-arm64` machine to instantiate a simulated platform with support for programmable AMBA ATP traffic generation. The platform includes the following models: + +- `ProfileGen` model. This is the adapter layer between gem5 and the AMBA ATP Engine. It is the source of traffic into the gem5 host platform. +- `ATPDevice` model. Software can program it using the Linux kernel modules and UAPI to control traffic generation. + +## Usage + +Users should add the meta-atp layer and layer dependencies to `conf/bblayers.conf`. See `conf/layer.conf` for dependencies. + +### Standalone Engine executable + +Users can build the AMBA ATP Engine as a standalone native executable as follows: + +```bash +bitbake atp-native +``` + +Users can run the executable through standard build scripts: + +```bash +oe-run-native atp-native atpeng [--help | args...] +``` + +## Integration of the Engine in gem5 + +Users should select the `gem5-atp-arm64` platform in their `conf/local.conf` file. + +Users can build the target image of preference, for example: + +```bash +bitbake core-image-minimal +``` + +The resulting gem5 native executable contains the AMBA ATP Engine. The resulting target image contains the kernel modules, UAPI and test suite. + +Users should run the environment as follows: + +```bash +./tmp/deploy/tools/start-gem5-atp.sh +``` + +This script launches a fast simulation to fast-forward Linux boot. Once Linux boot is completed, the fast simulation switches into a detailed simulation for the final usable environment. Users can connect and interact with the environment as follows: + +```bash +oe-run-native gem5-m5term-native m5term <PORT> +``` + +The connection PORT is announced by the deploy script as: + +```bash +system.terminal: Listening for connections on port <PORT> +``` + +This is usually port 3456. + +Users can verify access to the ATP device by running the integration test suite from within the simulated environment as follows: + +```bash +test_atp.out +``` diff --git a/meta-arm/meta-atp/conf/layer.conf b/meta-arm/meta-atp/conf/layer.conf new file mode 100644 index 0000000000..3ec36e8cd2 --- /dev/null +++ b/meta-arm/meta-atp/conf/layer.conf @@ -0,0 +1,9 @@ +BBPATH .= ":${LAYERDIR}" +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "meta-atp" +BBFILE_PATTERN_meta-atp = "^${LAYERDIR}/" + +LAYERDEPENDS_meta-atp = "core openembedded-layer meta-gem5" +LAYERSERIES_COMPAT_meta-atp = "kirkstone" diff --git a/meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf b/meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf new file mode 100644 index 0000000000..d5fe22a7c0 --- /dev/null +++ b/meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf @@ -0,0 +1,11 @@ +require conf/machine/gem5-arm64.conf +MACHINEOVERRIDES =. "gem5-arm64:" + +# Use baremetal_atp.py as machine configuration +GEM5_RUN_PROFILE = "configs/baremetal_atp.py" +# Require m5term +EXTRA_IMAGEDEPENDS += "gem5-m5term-native" +# Require ATP kernel modules, user API and gem5 m5ops +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-atp atp-uapi gem5-m5ops" +# Optionally provide ATP kernel tests +MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "atp-test" diff --git a/meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb b/meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb new file mode 100644 index 0000000000..31b58bf947 --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb @@ -0,0 +1,18 @@ +require atp-source_3.1.inc +inherit pkgconfig native + +SUMMARY = "AMBA ATP Engine: synthetic traffic interface modelling framework" + +S = "${WORKDIR}/git" +SRC_URI = "${ATP_SRC} \ + file://no-werror.patch" + +EXTRA_OEMAKE += "EXTRA_CXX_FLAGS='${CXXFLAGS}' EXTRA_LD_FLAGS='${LDFLAGS}'" + +do_install() { + oe_runmake install +} + +DEPENDS = "protobuf-native cppunit-native" + +addtask addto_recipe_sysroot before do_build diff --git a/meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc b/meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc new file mode 100644 index 0000000000..de24ef8361 --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc @@ -0,0 +1,9 @@ +ATP_SRC = "git://github.com/ARM-software/ATP-Engine.git;protocol=https;branch=master" +ATP_REV = "be1066029d6256626b37be004e2a663fbc29f37e" +ATP_LIC = "BSD-3-Clause-Clear" +ATP_LIC_MD5 = "e836b5992257064f488715d9a59752c3" + +HOMEPAGE ?= "https://github.com/ARM-software/ATP-Engine" +SRCREV ?= "${ATP_REV}" +LICENSE ?= "${ATP_LIC}" +LIC_FILES_CHKSUM ?= "file://LICENSE;md5=${ATP_LIC_MD5}" diff --git a/meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch b/meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch new file mode 100644 index 0000000000..4be143afa7 --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch @@ -0,0 +1,18 @@ +Don't pass -Werror, as new compilers introduce new warnings. + +Upstream-Status: Pending +Signed-off-by: Ross Burton <ross.burton@arm.com> + +diff --git a/Makefile b/Makefile +index c01b120..1d3c30a 100644 +--- a/Makefile ++++ b/Makefile +@@ -18,7 +18,7 @@ PROTOBUF_C_FLAGS:= $(shell pkg-config --cflags protobuf) + CPPUNIT_C_FLAGS := $(shell pkg-config --cflags cppunit) + PROTOBUF_L_FLAGS:= $(shell pkg-config --libs protobuf) + CPPUNIT_L_FLAGS := $(shell pkg-config --libs cppunit) +-CXX_FLAGS := $(PROTOBUF_C_FLAGS) -std=c++11 -Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-variable $(CPPUNIT_C_FLAGS) -fPIC $(EXTRA_CXX_FLAGS) ++CXX_FLAGS := $(PROTOBUF_C_FLAGS) -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable $(CPPUNIT_C_FLAGS) -fPIC $(EXTRA_CXX_FLAGS) + LD_FLAGS := $(PROTOBUF_L_FLAGS) $(CPPUNIT_L_FLAGS) $(EXTRA_LD_FLAGS) + PROTO_SRC_DIR := ./proto/ + PROTO_SRC := $(wildcard $(PROTO_SRC_DIR)tp*.proto) diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend new file mode 100644 index 0000000000..2b55b8928a --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend @@ -0,0 +1,3 @@ +# Export datadir paths for baremetal_atp.py script +export GEM5_DATADIR = "${STAGING_DATADIR_NATIVE}/gem5" +export ATP_DATADIR = "${STAGING_DATADIR_NATIVE}/gem5" diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh new file mode 100755 index 0000000000..16dac47714 --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +source <(bitbake -e gem5-aarch64-native | grep \ + -e "^STAGING_DATADIR_NATIVE=" -e "^DEPLOY_DIR_TOOLS=") + +# Used by baremetal_atp.py +export GEM5_DATADIR=${STAGING_DATADIR_NATIVE}/gem5 +export ATP_DATADIR=${STAGING_DATADIR_NATIVE}/gem5 + +# Fast-forward Linux boot and restore into timing simulation +${DEPLOY_DIR_TOOLS}/start-gem5.sh --checkpoint $@ +${DEPLOY_DIR_TOOLS}/start-gem5.sh --restore-with-cpu TimingSimpleCPU \ + --checkpoint-restore 1 $@ diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend new file mode 100644 index 0000000000..6607f0f8b7 --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend @@ -0,0 +1,24 @@ +require recipes-devtools/atp/atp-source_3.1.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +SRC_URI += "${ATP_SRC};destsuffix=git/atp;name=atp \ + file://start-gem5-atp.sh" +SRCREV_FORMAT = "gem5_atp" +SRCREV_atp = "${ATP_REV}" +LICENSE += "& ${ATP_LIC}" +LIC_FILES_CHKSUM += "file://atp/LICENSE;md5=${ATP_LIC_MD5}" + +EXTRA_OESCONS += "EXTRAS=${S}/atp" + +do_install:append() { + # baremetal_atp.py machine configuration and sample stream.atp file + install -m 644 ${B}/atp/gem5/baremetal_atp.py \ + ${B}/atp/configs/stream.atp \ + ${D}${datadir}/gem5/configs +} + +do_deploy:append() { + # start-gem5-atp.sh launch script + install -m 755 ${WORKDIR}/start-gem5-atp.sh ${DEPLOYDIR} +} diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh new file mode 100755 index 0000000000..44477e9640 --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh @@ -0,0 +1,9 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: m5-readfile +# Required-Start: $all +# Default-Start: 5 +# Description: Enables reading any script at simulation launch time. +### END INIT INFO + +m5 readfile | sh diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend new file mode 100644 index 0000000000..3ba0c3cacd --- /dev/null +++ b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend @@ -0,0 +1,14 @@ +inherit update-rc.d + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +# Add startup script calling m5 readfile for automatic checkpoint and restore +SRC_URI += "file://m5-readfile.sh" + +INITSCRIPT_NAME = "m5-readfile.sh" +INITSCRIPT_PARAMS = "defaults 99" + +do_install:append() { + install -d ${D}/${INIT_D_DIR} + install -m 755 ${WORKDIR}/m5-readfile.sh ${D}/${INIT_D_DIR} +} diff --git a/meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb b/meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb new file mode 100644 index 0000000000..0bf4949b6f --- /dev/null +++ b/meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb @@ -0,0 +1,24 @@ +require recipes-devtools/atp/atp-source_3.1.inc +inherit module + +SUMMARY = "Kernel modules for interacting wih ATP Engine and devices" +SECTION = "kernel/modules" + +S = "${WORKDIR}/git" +SRC_URI = "${ATP_SRC}" + +ATP_MOD_DIR = "linux" + +EXTRA_OEMAKE += "-C ${ATP_MOD_DIR}" + +PROVIDES = "kernel-module-atp" +RPROVIDES:${PN} = "kernel-module-atp" +KERNEL_MODULE_AUTOLOAD += "atp_buffer_manager atp_device" +MODULES_MODULE_SYMVERS_LOCATION = "${ATP_MOD_DIR}" + +do_install:append() { + install -d ${D}${includedir}/linux + install -m 644 ${ATP_MOD_DIR}/atp_buffer_manager_user.h \ + ${ATP_MOD_DIR}/atp_device_user.h \ + ${D}${includedir}/linux +} diff --git a/meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb b/meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb new file mode 100644 index 0000000000..5a3097e0a6 --- /dev/null +++ b/meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb @@ -0,0 +1,21 @@ +require recipes-devtools/atp/atp-source_3.1.inc +inherit package + +SUMMARY = "End-to-end tests evaluating ATP kernel modules service correctness" +SECTION = "kernel/userland" + +S = "${WORKDIR}/git" +SRC_URI = "${ATP_SRC}" + +EXTRA_OEMAKE += "-C linux/test" + +do_compile() { + oe_runmake +} + +do_install() { + oe_runmake DESTDIR=${D} PREFIX=${prefix} install +} + +DEPENDS = "atp-uapi cppunit" +RDEPENDS:${PN} = "atp-uapi" diff --git a/meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb b/meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb new file mode 100644 index 0000000000..8c793a3de9 --- /dev/null +++ b/meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb @@ -0,0 +1,24 @@ +require recipes-devtools/atp/atp-source_3.1.inc +inherit package + +SUMMARY = "User API for accessing services from ATP kernel modules" +SECTION = "kernel/userland" + +S = "${WORKDIR}/git" +SRC_URI = "${ATP_SRC}" + +# Unversioned library +SOLIBS = ".so" +FILES_SOLIBSDEV = "" + +EXTRA_OEMAKE += "-C linux/uapi" + +do_compile() { + oe_runmake KERNEL_HDR_PATH=${STAGING_INCDIR} +} + +do_install() { + oe_runmake DESTDIR=${D} PREFIX=${prefix} install +} + +DEPENDS = "linux-libc-headers kernel-module-atp" diff --git a/meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg b/meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg new file mode 100644 index 0000000000..870eeaf67a --- /dev/null +++ b/meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg @@ -0,0 +1 @@ +# CONFIG_FTRACE is not set diff --git a/meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg b/meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg new file mode 100644 index 0000000000..2d0a87d956 --- /dev/null +++ b/meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg @@ -0,0 +1,4 @@ +CONFIG_IOMMU_IO_PGTABLE=y +CONFIG_IOMMU_IO_PGTABLE_LPAE=y +# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set +CONFIG_ARM_SMMU_V3=y diff --git a/meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend new file mode 100644 index 0000000000..f59f8d44b6 --- /dev/null +++ b/meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +SRC_URI += "file://no_ftrace.cfg file://smmuv3.cfg" |