All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] atp: initial layer
@ 2021-04-22 12:51 Ross Burton
  2021-04-22 12:51 ` [PATCH 2/2] CI: add kas file and job for gem5-atp-arm64 Ross Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Ross Burton @ 2021-04-22 12:51 UTC (permalink / raw)
  To: meta-arm

From: Adrian Herrera <adrian.herrera@arm.com>

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

diff --git a/meta-atp/README.md b/meta-atp/README.md
new file mode 100644
index 0000000..15d0e29
--- /dev/null
+++ b/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-atp/conf/layer.conf b/meta-atp/conf/layer.conf
new file mode 100644
index 0000000..3c03a62
--- /dev/null
+++ b/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 = "gatesgarth hardknott"
diff --git a/meta-atp/conf/machine/gem5-atp-arm64.conf b/meta-atp/conf/machine/gem5-atp-arm64.conf
new file mode 100644
index 0000000..d5fe22a
--- /dev/null
+++ b/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-atp/recipes-devtools/atp/atp-native_3.1.bb b/meta-atp/recipes-devtools/atp/atp-native_3.1.bb
new file mode 100644
index 0000000..bb51988
--- /dev/null
+++ b/meta-atp/recipes-devtools/atp/atp-native_3.1.bb
@@ -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
diff --git a/meta-atp/recipes-devtools/atp/atp-source_3.1.inc b/meta-atp/recipes-devtools/atp/atp-source_3.1.inc
new file mode 100644
index 0000000..e5442c9
--- /dev/null
+++ b/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"
+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-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend b/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend
new file mode 100644
index 0000000..2b55b89
--- /dev/null
+++ b/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-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh b/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh
new file mode 100755
index 0000000..16dac47
--- /dev/null
+++ b/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-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend b/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend
new file mode 100644
index 0000000..5194ce1
--- /dev/null
+++ b/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-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh b/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh
new file mode 100755
index 0000000..44477e9
--- /dev/null
+++ b/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-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend b/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend
new file mode 100644
index 0000000..34024bf
--- /dev/null
+++ b/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-atp/recipes-kernel/atp/atp-module_3.1.bb b/meta-atp/recipes-kernel/atp/atp-module_3.1.bb
new file mode 100644
index 0000000..9820a9d
--- /dev/null
+++ b/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-atp/recipes-kernel/atp/atp-test_3.1.bb b/meta-atp/recipes-kernel/atp/atp-test_3.1.bb
new file mode 100644
index 0000000..c3f3caa
--- /dev/null
+++ b/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-atp/recipes-kernel/atp/atp-uapi_3.1.bb b/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb
new file mode 100644
index 0000000..8c793a3
--- /dev/null
+++ b/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-atp/recipes-kernel/linux/linux-yocto-5.4/no_ftrace.cfg b/meta-atp/recipes-kernel/linux/linux-yocto-5.4/no_ftrace.cfg
new file mode 100644
index 0000000..870eeaf
--- /dev/null
+++ b/meta-atp/recipes-kernel/linux/linux-yocto-5.4/no_ftrace.cfg
@@ -0,0 +1 @@
+# CONFIG_FTRACE is not set
diff --git a/meta-atp/recipes-kernel/linux/linux-yocto-5.4/smmuv3.cfg b/meta-atp/recipes-kernel/linux/linux-yocto-5.4/smmuv3.cfg
new file mode 100644
index 0000000..2d0a87d
--- /dev/null
+++ b/meta-atp/recipes-kernel/linux/linux-yocto-5.4/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-atp/recipes-kernel/linux/linux-yocto_5.4.bbappend b/meta-atp/recipes-kernel/linux/linux-yocto_5.4.bbappend
new file mode 100644
index 0000000..701499b
--- /dev/null
+++ b/meta-atp/recipes-kernel/linux/linux-yocto_5.4.bbappend
@@ -0,0 +1,2 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-5.4:"
+SRC_URI += "file://no_ftrace.cfg file://smmuv3.cfg"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] CI: add kas file and job for gem5-atp-arm64
  2021-04-22 12:51 [PATCH 1/2] atp: initial layer Ross Burton
@ 2021-04-22 12:51 ` Ross Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Burton @ 2021-04-22 12:51 UTC (permalink / raw)
  To: meta-arm

From: Adrian Herrera <adrian.herrera@arm.com>

Signed-off-by: Adrian Herrera <adrian.herrera@arm.com>
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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d0aa166..bccb63c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -91,6 +91,9 @@ gem5-arm64:
 gem5-arm64-xen:
   extends: .build
 
+gem5-atp-arm64:
+  extends: .build
+
 generic-arm64:
   extends: .build
 
diff --git a/kas/gem5-atp-arm64.yml b/kas/gem5-atp-arm64.yml
new file mode 100644
index 0000000..95bec61
--- /dev/null
+++ b/kas/gem5-atp-arm64.yml
@@ -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
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-22 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 12:51 [PATCH 1/2] atp: initial layer Ross Burton
2021-04-22 12:51 ` [PATCH 2/2] CI: add kas file and job for gem5-atp-arm64 Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.