All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
@ 2024-04-05 15:48 Mathieu Poirier
  2024-04-08 14:00 ` Jon Mason
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mathieu Poirier @ 2024-04-05 15:48 UTC (permalink / raw)
  To: jon.mason, ross.burton; +Cc: meta-arm

Initial checking providing support for RMM on QEMU's "virt" machine.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
Changes for V3:
1) Setting RMM_CONFIG default to "" and restricting the compilation of
RMM to "qemuarm64" machines.
2) Removed setting of variable "B"
3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
4) Removed CMAKE_BUILD_PARALLEL_LEVEL
5) Added comment to justify using CROSS_COMPILE
6) Reworked the declaration of SRC_URI and SRCREV
---
 ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
 .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb

diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
new file mode 100644
index 000000000000..7c3e637f0d63
--- /dev/null
+++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
@@ -0,0 +1,56 @@
+From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
+From: Mathieu Poirier <mathieu.poirier@linaro.org>
+Date: Thu, 14 Mar 2024 14:59:30 -0600
+Subject: [PATCH] build(lib): Add extra repositories for system includes
+
+Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
+aarch64-linux-gnu include assert.h and limits.h in a directory that is
+part of their search path.  This is not the case when compiling with
+Yocto where aarch64-poky-linux places those files in the sysroot
+directory of the component being compiled.
+
+Since the sysroot directory of the component is not part of the cmake
+search path, compiling the RMM in Yocto fails.  This patch fixes the
+problem by expanding the search path when needed, allowing the RMM to be
+compiled in Yocto.
+
+Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+---
+ lib/arch/CMakeLists.txt | 3 +++
+ lib/libc/CMakeLists.txt | 5 ++++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
+index d3afc5f2bfc8..a52185f02695 100644
+--- a/lib/arch/CMakeLists.txt
++++ b/lib/arch/CMakeLists.txt
+@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
+ target_include_directories(rmm-lib-arch
+     PUBLIC  "include"
+             "include/${RMM_ARCH}"
++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
++            # Yocto recipe will define this variable as part of the build.
++            ${CMAKE_INCLUDE_PATH}
+     PRIVATE "src/${RMM_ARCH}"
+             "src/include")
+ 
+diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
+index 1631332dbc72..a2adf37f7cb8 100644
+--- a/lib/libc/CMakeLists.txt
++++ b/lib/libc/CMakeLists.txt
+@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
+            rmm-lib-debug)
+ 
+     target_include_directories(rmm-lib-libc SYSTEM
+-        PUBLIC "include")
++        PUBLIC "include"
++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
++        # Yocto recipe will define this variable as part of the build.
++        ${CMAKE_INCLUDE_PATH})
+ 
+     target_sources(rmm-lib-libc
+         PRIVATE "src/abort.c"
+-- 
+2.34.1
+
diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
new file mode 100644
index 000000000000..0726cd3d2497
--- /dev/null
+++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
@@ -0,0 +1,50 @@
+SUMMARY = "RMM Firmware"
+DESCRIPTION = "RMM Firmware for Arm reference platforms"
+LICENSE = "BSD-3-Clause & MIT"
+
+SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
+           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
+          "
+
+SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
+
+LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
+
+inherit deploy cmake
+
+RMM_CONFIG ?= ""
+RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_MACHINE = "qemuarm64"
+
+S = "${WORKDIR}/git"
+
+# Build for debug (set RMM_DEBUG to 1 to activate)
+RMM_DEBUG ?= "0"
+RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
+
+# Handle RMM_DEBUG parameter
+EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
+EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
+
+# Supplement include path
+EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
+
+# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
+# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
+export CROSS_COMPILE="${TARGET_PREFIX}"
+
+do_install() {
+    install -d -m 755 ${D}/firmware
+    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
+}
+
+FILES:${PN} = "/firmware"
+SYSROOT_DIRS += "/firmware"
+
+do_deploy() {
+    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
+}
+
+addtask deploy after do_install
-- 
2.34.1



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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-05 15:48 [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM Mathieu Poirier
@ 2024-04-08 14:00 ` Jon Mason
  2024-04-12 16:20   ` Mathieu Poirier
  2024-04-23 15:50 ` Mathieu Poirier
  2024-05-03 15:06 ` Jon Mason
  2 siblings, 1 reply; 9+ messages in thread
From: Jon Mason @ 2024-04-08 14:00 UTC (permalink / raw)
  To: Mathieu Poirier; +Cc: jon.mason, ross.burton, meta-arm

On Fri, Apr 05, 2024 at 09:48:50AM -0600, Mathieu Poirier wrote:
> Initial checking providing support for RMM on QEMU's "virt" machine.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

LGTM, but I'll give Ross a chance to ack/nack (since he commented on
it before).  

I did notice a COMPAT_MACHINE for qemuarm64 in the recipe below.
Should we integrate this into our CI?  If so, is there an automated
way to test that it is functional?  If not, we can just add it to
qemuarm64.yml and make sure it compiles.

Thanks,
Jon


> ---
> Changes for V3:
> 1) Setting RMM_CONFIG default to "" and restricting the compilation of
> RMM to "qemuarm64" machines.
> 2) Removed setting of variable "B"
> 3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
> 4) Removed CMAKE_BUILD_PARALLEL_LEVEL
> 5) Added comment to justify using CROSS_COMPILE
> 6) Reworked the declaration of SRC_URI and SRCREV
> ---
>  ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
>  .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
>  2 files changed, 106 insertions(+)
>  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
>  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> 
> diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> new file mode 100644
> index 000000000000..7c3e637f0d63
> --- /dev/null
> +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> @@ -0,0 +1,56 @@
> +From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
> +From: Mathieu Poirier <mathieu.poirier@linaro.org>
> +Date: Thu, 14 Mar 2024 14:59:30 -0600
> +Subject: [PATCH] build(lib): Add extra repositories for system includes
> +
> +Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
> +aarch64-linux-gnu include assert.h and limits.h in a directory that is
> +part of their search path.  This is not the case when compiling with
> +Yocto where aarch64-poky-linux places those files in the sysroot
> +directory of the component being compiled.
> +
> +Since the sysroot directory of the component is not part of the cmake
> +search path, compiling the RMM in Yocto fails.  This patch fixes the
> +problem by expanding the search path when needed, allowing the RMM to be
> +compiled in Yocto.
> +
> +Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
> +Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> +---
> + lib/arch/CMakeLists.txt | 3 +++
> + lib/libc/CMakeLists.txt | 5 ++++-
> + 2 files changed, 7 insertions(+), 1 deletion(-)
> +
> +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
> +index d3afc5f2bfc8..a52185f02695 100644
> +--- a/lib/arch/CMakeLists.txt
> ++++ b/lib/arch/CMakeLists.txt
> +@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
> + target_include_directories(rmm-lib-arch
> +     PUBLIC  "include"
> +             "include/${RMM_ARCH}"
> ++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> ++            # Yocto recipe will define this variable as part of the build.
> ++            ${CMAKE_INCLUDE_PATH}
> +     PRIVATE "src/${RMM_ARCH}"
> +             "src/include")
> + 
> +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
> +index 1631332dbc72..a2adf37f7cb8 100644
> +--- a/lib/libc/CMakeLists.txt
> ++++ b/lib/libc/CMakeLists.txt
> +@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
> +            rmm-lib-debug)
> + 
> +     target_include_directories(rmm-lib-libc SYSTEM
> +-        PUBLIC "include")
> ++        PUBLIC "include"
> ++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> ++        # Yocto recipe will define this variable as part of the build.
> ++        ${CMAKE_INCLUDE_PATH})
> + 
> +     target_sources(rmm-lib-libc
> +         PRIVATE "src/abort.c"
> +-- 
> +2.34.1
> +
> diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> new file mode 100644
> index 000000000000..0726cd3d2497
> --- /dev/null
> +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> @@ -0,0 +1,50 @@
> +SUMMARY = "RMM Firmware"
> +DESCRIPTION = "RMM Firmware for Arm reference platforms"
> +LICENSE = "BSD-3-Clause & MIT"
> +
> +SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
> +           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
> +          "
> +
> +SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
> +
> +LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
> +
> +inherit deploy cmake
> +
> +RMM_CONFIG ?= ""
> +RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
> +
> +PACKAGE_ARCH = "${MACHINE_ARCH}"
> +COMPATIBLE_MACHINE = "qemuarm64"
> +
> +S = "${WORKDIR}/git"
> +
> +# Build for debug (set RMM_DEBUG to 1 to activate)
> +RMM_DEBUG ?= "0"
> +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
> +
> +# Handle RMM_DEBUG parameter
> +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
> +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
> +
> +# Supplement include path
> +EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
> +
> +# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
> +# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
> +export CROSS_COMPILE="${TARGET_PREFIX}"
> +
> +do_install() {
> +    install -d -m 755 ${D}/firmware
> +    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
> +}
> +
> +FILES:${PN} = "/firmware"
> +SYSROOT_DIRS += "/firmware"
> +
> +do_deploy() {
> +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> +}
> +
> +addtask deploy after do_install
> -- 
> 2.34.1
> 
> 


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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-08 14:00 ` Jon Mason
@ 2024-04-12 16:20   ` Mathieu Poirier
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Poirier @ 2024-04-12 16:20 UTC (permalink / raw)
  To: Jon Mason; +Cc: jon.mason, ross.burton, meta-arm

On Mon, 8 Apr 2024 at 08:01, Jon Mason <jdmason@kudzu.us> wrote:
>
> On Fri, Apr 05, 2024 at 09:48:50AM -0600, Mathieu Poirier wrote:
> > Initial checking providing support for RMM on QEMU's "virt" machine.
> >
> > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>
> LGTM, but I'll give Ross a chance to ack/nack (since he commented on
> it before).
>
> I did notice a COMPAT_MACHINE for qemuarm64 in the recipe below.

It was a request from Ross to avoid trying to build for other
machines/architectures where RME is not applicable.

> Should we integrate this into our CI?  If so, is there an automated
> way to test that it is functional?  If not, we can just add it to
> qemuarm64.yml and make sure it compiles.
>

Right now using the RMM to spin off a Realm VM depends on patches to
the Linux kernel that have been submitted[1] but still being
discussed.  As such making sure it compiles is probably the best
option.

[1]. https://lore.kernel.org/linux-arm-kernel/20240412084056.1733704-1-steven.price@arm.com/

> Thanks,
> Jon
>
>
> > ---
> > Changes for V3:
> > 1) Setting RMM_CONFIG default to "" and restricting the compilation of
> > RMM to "qemuarm64" machines.
> > 2) Removed setting of variable "B"
> > 3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
> > 4) Removed CMAKE_BUILD_PARALLEL_LEVEL
> > 5) Added comment to justify using CROSS_COMPILE
> > 6) Reworked the declaration of SRC_URI and SRCREV
> > ---
> >  ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
> >  .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
> >  2 files changed, 106 insertions(+)
> >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> >
> > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > new file mode 100644
> > index 000000000000..7c3e637f0d63
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > @@ -0,0 +1,56 @@
> > +From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
> > +From: Mathieu Poirier <mathieu.poirier@linaro.org>
> > +Date: Thu, 14 Mar 2024 14:59:30 -0600
> > +Subject: [PATCH] build(lib): Add extra repositories for system includes
> > +
> > +Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
> > +aarch64-linux-gnu include assert.h and limits.h in a directory that is
> > +part of their search path.  This is not the case when compiling with
> > +Yocto where aarch64-poky-linux places those files in the sysroot
> > +directory of the component being compiled.
> > +
> > +Since the sysroot directory of the component is not part of the cmake
> > +search path, compiling the RMM in Yocto fails.  This patch fixes the
> > +problem by expanding the search path when needed, allowing the RMM to be
> > +compiled in Yocto.
> > +
> > +Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
> > +Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > +---
> > + lib/arch/CMakeLists.txt | 3 +++
> > + lib/libc/CMakeLists.txt | 5 ++++-
> > + 2 files changed, 7 insertions(+), 1 deletion(-)
> > +
> > +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
> > +index d3afc5f2bfc8..a52185f02695 100644
> > +--- a/lib/arch/CMakeLists.txt
> > ++++ b/lib/arch/CMakeLists.txt
> > +@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
> > + target_include_directories(rmm-lib-arch
> > +     PUBLIC  "include"
> > +             "include/${RMM_ARCH}"
> > ++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > ++            # Yocto recipe will define this variable as part of the build.
> > ++            ${CMAKE_INCLUDE_PATH}
> > +     PRIVATE "src/${RMM_ARCH}"
> > +             "src/include")
> > +
> > +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
> > +index 1631332dbc72..a2adf37f7cb8 100644
> > +--- a/lib/libc/CMakeLists.txt
> > ++++ b/lib/libc/CMakeLists.txt
> > +@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
> > +            rmm-lib-debug)
> > +
> > +     target_include_directories(rmm-lib-libc SYSTEM
> > +-        PUBLIC "include")
> > ++        PUBLIC "include"
> > ++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > ++        # Yocto recipe will define this variable as part of the build.
> > ++        ${CMAKE_INCLUDE_PATH})
> > +
> > +     target_sources(rmm-lib-libc
> > +         PRIVATE "src/abort.c"
> > +--
> > +2.34.1
> > +
> > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > new file mode 100644
> > index 000000000000..0726cd3d2497
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > @@ -0,0 +1,50 @@
> > +SUMMARY = "RMM Firmware"
> > +DESCRIPTION = "RMM Firmware for Arm reference platforms"
> > +LICENSE = "BSD-3-Clause & MIT"
> > +
> > +SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
> > +           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
> > +          "
> > +
> > +SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
> > +
> > +LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
> > +
> > +inherit deploy cmake
> > +
> > +RMM_CONFIG ?= ""
> > +RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
> > +
> > +PACKAGE_ARCH = "${MACHINE_ARCH}"
> > +COMPATIBLE_MACHINE = "qemuarm64"
> > +
> > +S = "${WORKDIR}/git"
> > +
> > +# Build for debug (set RMM_DEBUG to 1 to activate)
> > +RMM_DEBUG ?= "0"
> > +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
> > +
> > +# Handle RMM_DEBUG parameter
> > +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
> > +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
> > +
> > +# Supplement include path
> > +EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
> > +
> > +# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
> > +# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
> > +export CROSS_COMPILE="${TARGET_PREFIX}"
> > +
> > +do_install() {
> > +    install -d -m 755 ${D}/firmware
> > +    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
> > +}
> > +
> > +FILES:${PN} = "/firmware"
> > +SYSROOT_DIRS += "/firmware"
> > +
> > +do_deploy() {
> > +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> > +}
> > +
> > +addtask deploy after do_install
> > --
> > 2.34.1
> >
> >


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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-05 15:48 [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM Mathieu Poirier
  2024-04-08 14:00 ` Jon Mason
@ 2024-04-23 15:50 ` Mathieu Poirier
  2024-04-23 18:15   ` Jon Mason
  2024-05-03 15:06 ` Jon Mason
  2 siblings, 1 reply; 9+ messages in thread
From: Mathieu Poirier @ 2024-04-23 15:50 UTC (permalink / raw)
  To: jon.mason, ross.burton; +Cc: meta-arm

Hi Ross and Jon,

Is there anything else you'd like me to modify on this patch?

Thanks,
Mathieu

On Fri, 5 Apr 2024 at 09:48, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
>
> Initial checking providing support for RMM on QEMU's "virt" machine.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> Changes for V3:
> 1) Setting RMM_CONFIG default to "" and restricting the compilation of
> RMM to "qemuarm64" machines.
> 2) Removed setting of variable "B"
> 3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
> 4) Removed CMAKE_BUILD_PARALLEL_LEVEL
> 5) Added comment to justify using CROSS_COMPILE
> 6) Reworked the declaration of SRC_URI and SRCREV
> ---
>  ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
>  .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
>  2 files changed, 106 insertions(+)
>  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
>  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
>
> diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> new file mode 100644
> index 000000000000..7c3e637f0d63
> --- /dev/null
> +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> @@ -0,0 +1,56 @@
> +From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
> +From: Mathieu Poirier <mathieu.poirier@linaro.org>
> +Date: Thu, 14 Mar 2024 14:59:30 -0600
> +Subject: [PATCH] build(lib): Add extra repositories for system includes
> +
> +Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
> +aarch64-linux-gnu include assert.h and limits.h in a directory that is
> +part of their search path.  This is not the case when compiling with
> +Yocto where aarch64-poky-linux places those files in the sysroot
> +directory of the component being compiled.
> +
> +Since the sysroot directory of the component is not part of the cmake
> +search path, compiling the RMM in Yocto fails.  This patch fixes the
> +problem by expanding the search path when needed, allowing the RMM to be
> +compiled in Yocto.
> +
> +Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
> +Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> +---
> + lib/arch/CMakeLists.txt | 3 +++
> + lib/libc/CMakeLists.txt | 5 ++++-
> + 2 files changed, 7 insertions(+), 1 deletion(-)
> +
> +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
> +index d3afc5f2bfc8..a52185f02695 100644
> +--- a/lib/arch/CMakeLists.txt
> ++++ b/lib/arch/CMakeLists.txt
> +@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
> + target_include_directories(rmm-lib-arch
> +     PUBLIC  "include"
> +             "include/${RMM_ARCH}"
> ++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> ++            # Yocto recipe will define this variable as part of the build.
> ++            ${CMAKE_INCLUDE_PATH}
> +     PRIVATE "src/${RMM_ARCH}"
> +             "src/include")
> +
> +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
> +index 1631332dbc72..a2adf37f7cb8 100644
> +--- a/lib/libc/CMakeLists.txt
> ++++ b/lib/libc/CMakeLists.txt
> +@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
> +            rmm-lib-debug)
> +
> +     target_include_directories(rmm-lib-libc SYSTEM
> +-        PUBLIC "include")
> ++        PUBLIC "include"
> ++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> ++        # Yocto recipe will define this variable as part of the build.
> ++        ${CMAKE_INCLUDE_PATH})
> +
> +     target_sources(rmm-lib-libc
> +         PRIVATE "src/abort.c"
> +--
> +2.34.1
> +
> diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> new file mode 100644
> index 000000000000..0726cd3d2497
> --- /dev/null
> +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> @@ -0,0 +1,50 @@
> +SUMMARY = "RMM Firmware"
> +DESCRIPTION = "RMM Firmware for Arm reference platforms"
> +LICENSE = "BSD-3-Clause & MIT"
> +
> +SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
> +           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
> +          "
> +
> +SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
> +
> +LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
> +
> +inherit deploy cmake
> +
> +RMM_CONFIG ?= ""
> +RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
> +
> +PACKAGE_ARCH = "${MACHINE_ARCH}"
> +COMPATIBLE_MACHINE = "qemuarm64"
> +
> +S = "${WORKDIR}/git"
> +
> +# Build for debug (set RMM_DEBUG to 1 to activate)
> +RMM_DEBUG ?= "0"
> +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
> +
> +# Handle RMM_DEBUG parameter
> +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
> +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
> +
> +# Supplement include path
> +EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
> +
> +# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
> +# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
> +export CROSS_COMPILE="${TARGET_PREFIX}"
> +
> +do_install() {
> +    install -d -m 755 ${D}/firmware
> +    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
> +}
> +
> +FILES:${PN} = "/firmware"
> +SYSROOT_DIRS += "/firmware"
> +
> +do_deploy() {
> +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> +}
> +
> +addtask deploy after do_install
> --
> 2.34.1
>


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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-23 15:50 ` Mathieu Poirier
@ 2024-04-23 18:15   ` Jon Mason
  2024-04-24 16:18     ` Mathieu Poirier
  0 siblings, 1 reply; 9+ messages in thread
From: Jon Mason @ 2024-04-23 18:15 UTC (permalink / raw)
  To: Mathieu Poirier; +Cc: jon.mason, ross.burton, meta-arm

On Tue, Apr 23, 2024 at 09:50:14AM -0600, Mathieu Poirier wrote:
> Hi Ross and Jon,
> 
> Is there anything else you'd like me to modify on this patch?

I'm still waiting on Ross to look at it...

I'm planning on pulling it in after the scarthgap release, which
should be in the next week.

Please do keep abreast of the upstream changes, as I'd like for there
to be a CI testcase once that part is sorted out (and I'm counting on
you to add the CI test).

Thanks,
Jon

> 
> Thanks,
> Mathieu
> 
> On Fri, 5 Apr 2024 at 09:48, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
> >
> > Initial checking providing support for RMM on QEMU's "virt" machine.
> >
> > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > ---
> > Changes for V3:
> > 1) Setting RMM_CONFIG default to "" and restricting the compilation of
> > RMM to "qemuarm64" machines.
> > 2) Removed setting of variable "B"
> > 3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
> > 4) Removed CMAKE_BUILD_PARALLEL_LEVEL
> > 5) Added comment to justify using CROSS_COMPILE
> > 6) Reworked the declaration of SRC_URI and SRCREV
> > ---
> >  ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
> >  .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
> >  2 files changed, 106 insertions(+)
> >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> >
> > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > new file mode 100644
> > index 000000000000..7c3e637f0d63
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > @@ -0,0 +1,56 @@
> > +From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
> > +From: Mathieu Poirier <mathieu.poirier@linaro.org>
> > +Date: Thu, 14 Mar 2024 14:59:30 -0600
> > +Subject: [PATCH] build(lib): Add extra repositories for system includes
> > +
> > +Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
> > +aarch64-linux-gnu include assert.h and limits.h in a directory that is
> > +part of their search path.  This is not the case when compiling with
> > +Yocto where aarch64-poky-linux places those files in the sysroot
> > +directory of the component being compiled.
> > +
> > +Since the sysroot directory of the component is not part of the cmake
> > +search path, compiling the RMM in Yocto fails.  This patch fixes the
> > +problem by expanding the search path when needed, allowing the RMM to be
> > +compiled in Yocto.
> > +
> > +Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
> > +Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > +---
> > + lib/arch/CMakeLists.txt | 3 +++
> > + lib/libc/CMakeLists.txt | 5 ++++-
> > + 2 files changed, 7 insertions(+), 1 deletion(-)
> > +
> > +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
> > +index d3afc5f2bfc8..a52185f02695 100644
> > +--- a/lib/arch/CMakeLists.txt
> > ++++ b/lib/arch/CMakeLists.txt
> > +@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
> > + target_include_directories(rmm-lib-arch
> > +     PUBLIC  "include"
> > +             "include/${RMM_ARCH}"
> > ++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > ++            # Yocto recipe will define this variable as part of the build.
> > ++            ${CMAKE_INCLUDE_PATH}
> > +     PRIVATE "src/${RMM_ARCH}"
> > +             "src/include")
> > +
> > +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
> > +index 1631332dbc72..a2adf37f7cb8 100644
> > +--- a/lib/libc/CMakeLists.txt
> > ++++ b/lib/libc/CMakeLists.txt
> > +@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
> > +            rmm-lib-debug)
> > +
> > +     target_include_directories(rmm-lib-libc SYSTEM
> > +-        PUBLIC "include")
> > ++        PUBLIC "include"
> > ++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > ++        # Yocto recipe will define this variable as part of the build.
> > ++        ${CMAKE_INCLUDE_PATH})
> > +
> > +     target_sources(rmm-lib-libc
> > +         PRIVATE "src/abort.c"
> > +--
> > +2.34.1
> > +
> > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > new file mode 100644
> > index 000000000000..0726cd3d2497
> > --- /dev/null
> > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > @@ -0,0 +1,50 @@
> > +SUMMARY = "RMM Firmware"
> > +DESCRIPTION = "RMM Firmware for Arm reference platforms"
> > +LICENSE = "BSD-3-Clause & MIT"
> > +
> > +SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
> > +           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
> > +          "
> > +
> > +SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
> > +
> > +LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
> > +
> > +inherit deploy cmake
> > +
> > +RMM_CONFIG ?= ""
> > +RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
> > +
> > +PACKAGE_ARCH = "${MACHINE_ARCH}"
> > +COMPATIBLE_MACHINE = "qemuarm64"
> > +
> > +S = "${WORKDIR}/git"
> > +
> > +# Build for debug (set RMM_DEBUG to 1 to activate)
> > +RMM_DEBUG ?= "0"
> > +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
> > +
> > +# Handle RMM_DEBUG parameter
> > +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
> > +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
> > +
> > +# Supplement include path
> > +EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
> > +
> > +# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
> > +# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
> > +export CROSS_COMPILE="${TARGET_PREFIX}"
> > +
> > +do_install() {
> > +    install -d -m 755 ${D}/firmware
> > +    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
> > +}
> > +
> > +FILES:${PN} = "/firmware"
> > +SYSROOT_DIRS += "/firmware"
> > +
> > +do_deploy() {
> > +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> > +}
> > +
> > +addtask deploy after do_install
> > --
> > 2.34.1
> >
> 


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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-23 18:15   ` Jon Mason
@ 2024-04-24 16:18     ` Mathieu Poirier
  2024-04-25 14:34       ` Jon Mason
  2024-04-26  7:41       ` [meta-arm] " Mikko Rapeli
  0 siblings, 2 replies; 9+ messages in thread
From: Mathieu Poirier @ 2024-04-24 16:18 UTC (permalink / raw)
  To: Jon Mason; +Cc: jon.mason, ross.burton, meta-arm

On Tue, 23 Apr 2024 at 12:15, Jon Mason <jdmason@kudzu.us> wrote:
>
> On Tue, Apr 23, 2024 at 09:50:14AM -0600, Mathieu Poirier wrote:
> > Hi Ross and Jon,
> >
> > Is there anything else you'd like me to modify on this patch?
>
> I'm still waiting on Ross to look at it...
>

Ok

> I'm planning on pulling it in after the scarthgap release, which
> should be in the next week.
>

Ok

> Please do keep abreast of the upstream changes, as I'd like for there
> to be a CI testcase once that part is sorted out (and I'm counting on
> you to add the CI test).
>

Is there a documented process for CI?  I looked in the README.md, the
documentation and CI folders but found nothing of that sort.  Due to
their similarities, I'll start looking into what is done for Hafnium.

> Thanks,
> Jon
>
> >
> > Thanks,
> > Mathieu
> >
> > On Fri, 5 Apr 2024 at 09:48, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
> > >
> > > Initial checking providing support for RMM on QEMU's "virt" machine.
> > >
> > > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > ---
> > > Changes for V3:
> > > 1) Setting RMM_CONFIG default to "" and restricting the compilation of
> > > RMM to "qemuarm64" machines.
> > > 2) Removed setting of variable "B"
> > > 3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
> > > 4) Removed CMAKE_BUILD_PARALLEL_LEVEL
> > > 5) Added comment to justify using CROSS_COMPILE
> > > 6) Reworked the declaration of SRC_URI and SRCREV
> > > ---
> > >  ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
> > >  .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
> > >  2 files changed, 106 insertions(+)
> > >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > >
> > > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > > new file mode 100644
> > > index 000000000000..7c3e637f0d63
> > > --- /dev/null
> > > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > > @@ -0,0 +1,56 @@
> > > +From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
> > > +From: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > +Date: Thu, 14 Mar 2024 14:59:30 -0600
> > > +Subject: [PATCH] build(lib): Add extra repositories for system includes
> > > +
> > > +Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
> > > +aarch64-linux-gnu include assert.h and limits.h in a directory that is
> > > +part of their search path.  This is not the case when compiling with
> > > +Yocto where aarch64-poky-linux places those files in the sysroot
> > > +directory of the component being compiled.
> > > +
> > > +Since the sysroot directory of the component is not part of the cmake
> > > +search path, compiling the RMM in Yocto fails.  This patch fixes the
> > > +problem by expanding the search path when needed, allowing the RMM to be
> > > +compiled in Yocto.
> > > +
> > > +Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
> > > +Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > +---
> > > + lib/arch/CMakeLists.txt | 3 +++
> > > + lib/libc/CMakeLists.txt | 5 ++++-
> > > + 2 files changed, 7 insertions(+), 1 deletion(-)
> > > +
> > > +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
> > > +index d3afc5f2bfc8..a52185f02695 100644
> > > +--- a/lib/arch/CMakeLists.txt
> > > ++++ b/lib/arch/CMakeLists.txt
> > > +@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
> > > + target_include_directories(rmm-lib-arch
> > > +     PUBLIC  "include"
> > > +             "include/${RMM_ARCH}"
> > > ++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > > ++            # Yocto recipe will define this variable as part of the build.
> > > ++            ${CMAKE_INCLUDE_PATH}
> > > +     PRIVATE "src/${RMM_ARCH}"
> > > +             "src/include")
> > > +
> > > +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
> > > +index 1631332dbc72..a2adf37f7cb8 100644
> > > +--- a/lib/libc/CMakeLists.txt
> > > ++++ b/lib/libc/CMakeLists.txt
> > > +@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
> > > +            rmm-lib-debug)
> > > +
> > > +     target_include_directories(rmm-lib-libc SYSTEM
> > > +-        PUBLIC "include")
> > > ++        PUBLIC "include"
> > > ++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > > ++        # Yocto recipe will define this variable as part of the build.
> > > ++        ${CMAKE_INCLUDE_PATH})
> > > +
> > > +     target_sources(rmm-lib-libc
> > > +         PRIVATE "src/abort.c"
> > > +--
> > > +2.34.1
> > > +
> > > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > > new file mode 100644
> > > index 000000000000..0726cd3d2497
> > > --- /dev/null
> > > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > > @@ -0,0 +1,50 @@
> > > +SUMMARY = "RMM Firmware"
> > > +DESCRIPTION = "RMM Firmware for Arm reference platforms"
> > > +LICENSE = "BSD-3-Clause & MIT"
> > > +
> > > +SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
> > > +           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
> > > +          "
> > > +
> > > +SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
> > > +
> > > +LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
> > > +
> > > +inherit deploy cmake
> > > +
> > > +RMM_CONFIG ?= ""
> > > +RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
> > > +
> > > +PACKAGE_ARCH = "${MACHINE_ARCH}"
> > > +COMPATIBLE_MACHINE = "qemuarm64"
> > > +
> > > +S = "${WORKDIR}/git"
> > > +
> > > +# Build for debug (set RMM_DEBUG to 1 to activate)
> > > +RMM_DEBUG ?= "0"
> > > +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
> > > +
> > > +# Handle RMM_DEBUG parameter
> > > +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
> > > +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
> > > +
> > > +# Supplement include path
> > > +EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
> > > +
> > > +# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
> > > +# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
> > > +export CROSS_COMPILE="${TARGET_PREFIX}"
> > > +
> > > +do_install() {
> > > +    install -d -m 755 ${D}/firmware
> > > +    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
> > > +}
> > > +
> > > +FILES:${PN} = "/firmware"
> > > +SYSROOT_DIRS += "/firmware"
> > > +
> > > +do_deploy() {
> > > +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> > > +}
> > > +
> > > +addtask deploy after do_install
> > > --
> > > 2.34.1
> > >
> >


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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-24 16:18     ` Mathieu Poirier
@ 2024-04-25 14:34       ` Jon Mason
  2024-04-26  7:41       ` [meta-arm] " Mikko Rapeli
  1 sibling, 0 replies; 9+ messages in thread
From: Jon Mason @ 2024-04-25 14:34 UTC (permalink / raw)
  To: Mathieu Poirier; +Cc: jon.mason, ross.burton, meta-arm

On Wed, Apr 24, 2024 at 10:18:37AM -0600, Mathieu Poirier wrote:
> On Tue, 23 Apr 2024 at 12:15, Jon Mason <jdmason@kudzu.us> wrote:
> >
> > On Tue, Apr 23, 2024 at 09:50:14AM -0600, Mathieu Poirier wrote:
> > > Hi Ross and Jon,
> > >
> > > Is there anything else you'd like me to modify on this patch?
> >
> > I'm still waiting on Ross to look at it...
> >
> 
> Ok
> 
> > I'm planning on pulling it in after the scarthgap release, which
> > should be in the next week.
> >
> 
> Ok
> 
> > Please do keep abreast of the upstream changes, as I'd like for there
> > to be a CI testcase once that part is sorted out (and I'm counting on
> > you to add the CI test).
> >
> 
> Is there a documented process for CI?  I looked in the README.md, the
> documentation and CI folders but found nothing of that sort.  Due to
> their similarities, I'll start looking into what is done for Hafnium.

Assuming it can be tested from userspace, standard Yocto test setup
and running can be done.  See:
https://docs.yoctoproject.org/dev/dev-manual/runtime-testing.html

In meta-arm, meta-arm/lib/oeqa/runtime/cases/trusted_services.py
might be an interesting thing to look at.  You can see it running as
part of the qemuarm64-secureboot testing.  For example, 
https://gitlab.com/jonmason00/meta-arm/-/jobs/6708705401

Hopefully this was helpful :)

Thanks,
Jon

> 
> > Thanks,
> > Jon
> >
> > >
> > > Thanks,
> > > Mathieu
> > >
> > > On Fri, 5 Apr 2024 at 09:48, Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
> > > >
> > > > Initial checking providing support for RMM on QEMU's "virt" machine.
> > > >
> > > > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > > ---
> > > > Changes for V3:
> > > > 1) Setting RMM_CONFIG default to "" and restricting the compilation of
> > > > RMM to "qemuarm64" machines.
> > > > 2) Removed setting of variable "B"
> > > > 3) Setting CMAKE_INCLUDE_PATH to ${STAGING_INCDIR}
> > > > 4) Removed CMAKE_BUILD_PARALLEL_LEVEL
> > > > 5) Added comment to justify using CROSS_COMPILE
> > > > 6) Reworked the declaration of SRC_URI and SRCREV
> > > > ---
> > > >  ...tra-repositories-for-system-includes.patch | 56 +++++++++++++++++++
> > > >  .../trusted-firmware-rmm_0.4.bb               | 50 +++++++++++++++++
> > > >  2 files changed, 106 insertions(+)
> > > >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > > >  create mode 100644 meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > > >
> > > > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > > > new file mode 100644
> > > > index 000000000000..7c3e637f0d63
> > > > --- /dev/null
> > > > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/files/0001-build-lib-Add-extra-repositories-for-system-includes.patch
> > > > @@ -0,0 +1,56 @@
> > > > +From bc7dbac20a6674eb2834bd6176665f1a2ae42edc Mon Sep 17 00:00:00 2001
> > > > +From: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > > +Date: Thu, 14 Mar 2024 14:59:30 -0600
> > > > +Subject: [PATCH] build(lib): Add extra repositories for system includes
> > > > +
> > > > +Toolchains such as aarch64-none-elf, aarch64-none-linux-gnu and
> > > > +aarch64-linux-gnu include assert.h and limits.h in a directory that is
> > > > +part of their search path.  This is not the case when compiling with
> > > > +Yocto where aarch64-poky-linux places those files in the sysroot
> > > > +directory of the component being compiled.
> > > > +
> > > > +Since the sysroot directory of the component is not part of the cmake
> > > > +search path, compiling the RMM in Yocto fails.  This patch fixes the
> > > > +problem by expanding the search path when needed, allowing the RMM to be
> > > > +compiled in Yocto.
> > > > +
> > > > +Upstream-Status: Backport [bc7dbac20a6674eb2834bd6176665f1a2ae42edc]
> > > > +Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > > +---
> > > > + lib/arch/CMakeLists.txt | 3 +++
> > > > + lib/libc/CMakeLists.txt | 5 ++++-
> > > > + 2 files changed, 7 insertions(+), 1 deletion(-)
> > > > +
> > > > +diff --git a/lib/arch/CMakeLists.txt b/lib/arch/CMakeLists.txt
> > > > +index d3afc5f2bfc8..a52185f02695 100644
> > > > +--- a/lib/arch/CMakeLists.txt
> > > > ++++ b/lib/arch/CMakeLists.txt
> > > > +@@ -12,6 +12,9 @@ target_link_libraries(rmm-lib-arch
> > > > + target_include_directories(rmm-lib-arch
> > > > +     PUBLIC  "include"
> > > > +             "include/${RMM_ARCH}"
> > > > ++            # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > > > ++            # Yocto recipe will define this variable as part of the build.
> > > > ++            ${CMAKE_INCLUDE_PATH}
> > > > +     PRIVATE "src/${RMM_ARCH}"
> > > > +             "src/include")
> > > > +
> > > > +diff --git a/lib/libc/CMakeLists.txt b/lib/libc/CMakeLists.txt
> > > > +index 1631332dbc72..a2adf37f7cb8 100644
> > > > +--- a/lib/libc/CMakeLists.txt
> > > > ++++ b/lib/libc/CMakeLists.txt
> > > > +@@ -12,7 +12,10 @@ if(NOT RMM_ARCH STREQUAL fake_host)
> > > > +            rmm-lib-debug)
> > > > +
> > > > +     target_include_directories(rmm-lib-libc SYSTEM
> > > > +-        PUBLIC "include")
> > > > ++        PUBLIC "include"
> > > > ++        # The CMAKE_INCLUDE_PATH is included here for Yocto builds.  the
> > > > ++        # Yocto recipe will define this variable as part of the build.
> > > > ++        ${CMAKE_INCLUDE_PATH})
> > > > +
> > > > +     target_sources(rmm-lib-libc
> > > > +         PRIVATE "src/abort.c"
> > > > +--
> > > > +2.34.1
> > > > +
> > > > diff --git a/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > > > new file mode 100644
> > > > index 000000000000..0726cd3d2497
> > > > --- /dev/null
> > > > +++ b/meta-arm/recipes-bsp/trusted-firmware-rmm/trusted-firmware-rmm_0.4.bb
> > > > @@ -0,0 +1,50 @@
> > > > +SUMMARY = "RMM Firmware"
> > > > +DESCRIPTION = "RMM Firmware for Arm reference platforms"
> > > > +LICENSE = "BSD-3-Clause & MIT"
> > > > +
> > > > +SRC_URI = "gitsm://git.trustedfirmware.org/TF-RMM/tf-rmm.git;protocol=https;branch=main \
> > > > +           file://0001-build-lib-Add-extra-repositories-for-system-includes.patch \
> > > > +          "
> > > > +
> > > > +SRCREV = "0a02656945d69757b0779192cebb9b41dd9037d1"
> > > > +
> > > > +LIC_FILES_CHKSUM += "file://docs/about/license.rst;md5=1375c7c641558198ffe401c2a799d79b"
> > > > +
> > > > +inherit deploy cmake
> > > > +
> > > > +RMM_CONFIG ?= ""
> > > > +RMM_CONFIG:qemuarm64 = "qemu_virt_defcfg"
> > > > +
> > > > +PACKAGE_ARCH = "${MACHINE_ARCH}"
> > > > +COMPATIBLE_MACHINE = "qemuarm64"
> > > > +
> > > > +S = "${WORKDIR}/git"
> > > > +
> > > > +# Build for debug (set RMM_DEBUG to 1 to activate)
> > > > +RMM_DEBUG ?= "0"
> > > > +RMM_BUILD_MODE ?= "${@bb.utils.contains('RMM_DEBUG', '1', 'Debug', 'Release', d)}"
> > > > +
> > > > +# Handle RMM_DEBUG parameter
> > > > +EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=${RMM_BUILD_MODE}"
> > > > +EXTRA_OECMAKE += "-DRMM_CONFIG=${RMM_CONFIG}"
> > > > +
> > > > +# Supplement include path
> > > > +EXTRA_OECMAKE += "-DCMAKE_INCLUDE_PATH=${STAGING_INCDIR}"
> > > > +
> > > > +# When compiling for Aarch64 on non-native hosts, the RMM code base gets its
> > > > +# toolchain from CROSS_COMPILE rather than CMAKE_TOOLCHAIN_FILE
> > > > +export CROSS_COMPILE="${TARGET_PREFIX}"
> > > > +
> > > > +do_install() {
> > > > +    install -d -m 755 ${D}/firmware
> > > > +    install -m 0644 ${B}/${RMM_BUILD_MODE}/* ${D}/firmware/
> > > > +}
> > > > +
> > > > +FILES:${PN} = "/firmware"
> > > > +SYSROOT_DIRS += "/firmware"
> > > > +
> > > > +do_deploy() {
> > > > +    cp -rf ${D}/firmware/* ${DEPLOYDIR}/
> > > > +}
> > > > +
> > > > +addtask deploy after do_install
> > > > --
> > > > 2.34.1
> > > >
> > >
> 


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

* Re: [meta-arm] [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-24 16:18     ` Mathieu Poirier
  2024-04-25 14:34       ` Jon Mason
@ 2024-04-26  7:41       ` Mikko Rapeli
  1 sibling, 0 replies; 9+ messages in thread
From: Mikko Rapeli @ 2024-04-26  7:41 UTC (permalink / raw)
  To: mathieu.poirier; +Cc: Jon Mason, jon.mason, ross.burton, meta-arm

Hi,

On Wed, Apr 24, 2024 at 10:18:37AM -0600, Mathieu Poirier via lists.yoctoproject.org wrote:
> On Tue, 23 Apr 2024 at 12:15, Jon Mason <jdmason@kudzu.us> wrote:
> > Please do keep abreast of the upstream changes, as I'd like for there
> > to be a CI testcase once that part is sorted out (and I'm counting on
> > you to add the CI test).
> >
> 
> Is there a documented process for CI?  I looked in the README.md, the
> documentation and CI folders but found nothing of that sort.  Due to
> their similarities, I'll start looking into what is done for Hafnium.

I had similar questions after breaking thing:

.gitlab-ci.yml and ci directories have the magic build and test matrix.

For example qemuarm64-secureboot machine build and tests are run with
this command which Ross showed me over irc:

$ kas build ci/qemuarm64-secureboot.yml:ci/testimage.yml

To debug the build and test environment you can run:

$ kas shell ci/qemuarm64-secureboot.yml:ci/testimage.yml

and then there to check how image and other variables
are formed:

$ bitbake -e core-image-base | less

To boot into the image shell manually (testimage does this automatically):

$ runqemu slirp nographic novga core-image-base

The ci/testimge.yml config runs oeqa runtime tests which
are defined TEST_SUITES variable. Tests live in
${LAYER}/lib/oeqa/runtime/cases/ as .py files, and
basically execute commands on the booted qemu target with
ssh. Often tests need additional binaries on target image
which are installed via IMAGE_INSTALL variable in kas config
files for the machine, and then test, which is part of
TEST_SUITES variable, just runs the binaries and checks
return values.

https://docs.yoctoproject.org/dev/singleindex.html#running-tests

Hope this helps,

-Mikko


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

* Re: [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
  2024-04-05 15:48 [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM Mathieu Poirier
  2024-04-08 14:00 ` Jon Mason
  2024-04-23 15:50 ` Mathieu Poirier
@ 2024-05-03 15:06 ` Jon Mason
  2 siblings, 0 replies; 9+ messages in thread
From: Jon Mason @ 2024-05-03 15:06 UTC (permalink / raw)
  To: meta-arm, ross.burton, Mathieu Poirier


On Fri, 05 Apr 2024 09:48:50 -0600, Mathieu Poirier wrote:
> Initial checking providing support for RMM on QEMU's "virt" machine.
> 
> 

Applied, thanks!

[1/1] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM
      commit: e043bc48844b17686e2f189126f80f53706c4caf

Best regards,
-- 
Jon Mason <jon.mason@arm.com>


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

end of thread, other threads:[~2024-05-03 15:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 15:48 [PATCH v3] arm/trusted-firmware-rmm: Add bitbake, include and patch file for RMM Mathieu Poirier
2024-04-08 14:00 ` Jon Mason
2024-04-12 16:20   ` Mathieu Poirier
2024-04-23 15:50 ` Mathieu Poirier
2024-04-23 18:15   ` Jon Mason
2024-04-24 16:18     ` Mathieu Poirier
2024-04-25 14:34       ` Jon Mason
2024-04-26  7:41       ` [meta-arm] " Mikko Rapeli
2024-05-03 15:06 ` Jon Mason

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.