1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-04-20 11:29:54 +00:00

atp: initial layer

meta-atp layer provides support for building AMBA Adaptive Traffic
Profiles (ATP) Engine. It provides the following recipes:

- ATP Engine native standalone build.
- ATP Engine with gem5 as host platform.
- ATP Linux kernel modules.
- ATP Linux user API.
- ATP Linux tests.

The layer provides a "gem5-atp-arm64" machine with ATP device and
adapter support.

Change-Id: Ib86c7502d62d5707d0d4bbdd7d179f231cf96f57
Signed-off-by: Adrian Herrera <adrian.herrera@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Adrian Herrera
2021-04-22 13:51:54 +01:00
committed by Jon Mason
parent f723b6b593
commit bcbd365cfe
16 changed files with 261 additions and 0 deletions

76
meta-atp/README.md Normal file
View File

@@ -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
```

9
meta-atp/conf/layer.conf Normal file
View File

@@ -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 = "gatesgarth hardknott"

View File

@@ -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"

View File

@@ -0,0 +1,17 @@
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}"
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

View File

@@ -0,0 +1,9 @@
ATP_SRC = "git://github.com/ARM-software/ATP-Engine.git;protocol=https"
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}"

View File

@@ -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"

View File

@@ -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 $@

View File

@@ -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}
}

View File

@@ -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

View File

@@ -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}
}

View File

@@ -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
}

View File

@@ -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"

View File

@@ -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"

View File

@@ -0,0 +1 @@
# CONFIG_FTRACE is not set

View File

@@ -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

View File

@@ -0,0 +1,2 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-5.4:"
SRC_URI += "file://no_ftrace.cfg file://smmuv3.cfg"