Skip to contentSkip to conversation

atp: initial layer

PATCH New Ross Burton 1 participant 2 messages Apr 22, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 atp: initial layer

From: Adrian Herrera <[email protected]>

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
---
 meta-atp/README.md                            | 76 +++++++++++++++++++
 meta-atp/conf/layer.conf                      |  9 +++
 meta-atp/conf/machine/gem5-atp-arm64.conf     | 11 +++
 .../recipes-devtools/atp/atp-native_3.1.bb    | 17 +++++
 .../recipes-devtools/atp/atp-source_3.1.inc   |  9 +++
 .../gem5/gem5-aarch64-dtb.bbappend            |  3 +
 .../gem5-aarch64-native/start-gem5-atp.sh     | 13 ++++
 .../gem5/gem5-aarch64-native_20.bbappend      | 24 ++++++
 .../gem5/gem5-m5ops/m5-readfile.sh            |  9 +++
 .../gem5/gem5-m5ops_20.bbappend               | 14 ++++
 meta-atp/recipes-kernel/atp/atp-module_3.1.bb | 24 ++++++
 meta-atp/recipes-kernel/atp/atp-test_3.1.bb   | 21 +++++
 meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb   | 24 ++++++
 .../linux/linux-yocto-5.4/no_ftrace.cfg       |  1 +
 .../linux/linux-yocto-5.4/smmuv3.cfg          |  4 +
 .../linux/linux-yocto_5.4.bbappend            |  2 +
 16 files changed, 261 insertions(+)
 create mode 100644 meta-atp/README.md
 create mode 100644 meta-atp/conf/layer.conf
 create mode 100644 meta-atp/conf/machine/gem5-atp-arm64.conf
 create mode 100644 meta-atp/recipes-devtools/atp/atp-native_3.1.bb
 create mode 100644 meta-atp/recipes-devtools/atp/atp-source_3.1.inc
 create mode 100644 meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend
 create mode 100755 meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh
 create mode 100644 meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend
 create mode 100755 meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh
 create mode 100644 meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend
 create mode 100644 meta-atp/recipes-kernel/atp/atp-module_3.1.bb
 create mode 100644 meta-atp/recipes-kernel/atp/atp-test_3.1.bb
 create mode 100644 meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb
 create mode 100644 meta-atp/recipes-kernel/linux/linux-yocto-5.4/no_ftrace.cfg
 create mode 100644 meta-atp/recipes-kernel/linux/linux-yocto-5.4/smmuv3.cfg
 create mode 100644 meta-atp/recipes-kernel/linux/linux-yocto_5.4.bbappend
meta-atp/README.md new file +76 -0
new file mode 100644
index 0000000..15d0e29
@@ -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
+```
meta-atp/conf/layer.conf new file +9 -0
new file mode 100644
index 0000000..3c03a62
@@ -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"
meta-atp/conf/machine/gem5-atp-arm64.conf new file +11 -0
new file mode 100644
index 0000000..d5fe22a
@@ -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"
meta-atp/recipes-devtools/atp/atp-native_3.1.bb new file +17 -0
new file mode 100644
index 0000000..bb51988
@@ -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
meta-atp/recipes-devtools/atp/atp-source_3.1.inc new file +9 -0
new file mode 100644
index 0000000..e5442c9
@@ -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}"
meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend new file +3 -0
new file mode 100644
index 0000000..2b55b89
@@ -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"
meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh new file +13 -0
new file mode 100755
index 0000000..16dac47
@@ -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 $@
meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend new file +24 -0
new file mode 100644
index 0000000..5194ce1
@@ -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}
+}
meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh new file +9 -0
new file mode 100755
index 0000000..44477e9
@@ -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
meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend new file +14 -0
new file mode 100644
index 0000000..34024bf
@@ -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}
+}
meta-atp/recipes-kernel/atp/atp-module_3.1.bb new file +24 -0
new file mode 100644
index 0000000..9820a9d
@@ -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
+}
meta-atp/recipes-kernel/atp/atp-test_3.1.bb new file +21 -0
new file mode 100644
index 0000000..c3f3caa
@@ -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"
meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb new file +24 -0
new file mode 100644
index 0000000..8c793a3
@@ -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"
meta-atp/recipes-kernel/linux/linux-yocto-5.4/no_ftrace.cfg new file +1 -0
new file mode 100644
index 0000000..870eeaf
@@ -0,0 +1 @@
+# CONFIG_FTRACE is not set
meta-atp/recipes-kernel/linux/linux-yocto-5.4/smmuv3.cfg new file +4 -0
new file mode 100644
index 0000000..2d0a87d
@@ -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
meta-atp/recipes-kernel/linux/linux-yocto_5.4.bbappend new file +2 -0
new file mode 100644
index 0000000..701499b
@@ -0,0 +1,2 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-5.4:"
+SRC_URI += "file://no_ftrace.cfg file://smmuv3.cfg"
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 CI: add kas file and job for gem5-atp-arm64

From: Adrian Herrera <[email protected]>

Change-Id Iee0d27c15fe00a4363ed832c06cb502c54299cd5
---
 .gitlab-ci.yml         |  3 +++
 kas/gem5-atp-arm64.yml | 15 +++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 kas/gem5-atp-arm64.yml
.gitlab-ci.yml +3 -0
index d0aa166..bccb63c 100644
@@ -91,6 +91,9 @@ gem5-arm64:
 gem5-arm64-xen:
   extends: .build
 
+gem5-atp-arm64:
+  extends: .build
+
 generic-arm64:
   extends: .build
 
kas/gem5-atp-arm64.yml new file +15 -0
new file mode 100644
index 0000000..95bec61
@@ -0,0 +1,15 @@
+header:
+  version: 9
+  includes:
+    - gem5-arm64.yml
+
+repos:
+  meta-arm:
+    layers:
+      meta-atp:
+
+machine: gem5-atp-arm64
+
+target:
+  - atp-native
+  - core-image-minimal
Signature · 1 line
2.25.1