Hi Jerome,
Thank you, yes this works, I added a 4th change to use the downloaded
toolchain instead of the copy held in Hafnium's prebuilts submodule.
See summary of changes below.
Is there a reason to store the llvm toolchain in $(ROOT) rather than
$(ROOT)/toolchains?
Not really. I suppose the latter would work equally well.
--
Jerome
> Regards,
> Olivier.
>
> commit d122092ec930b38466e369aa61b6f6b4ccaba14c
> Author: Olivier Deprez
olivier.deprez@arm.com
> Date: Tue May 30 10:31:18 2023 +0200
>
> build: use downloaded llvm toolchain to build hafnium
>
> Use the toolchain downloaded by make clang-toolchains rather than the
> toolchain provided in Hafnium prebuilts submodule.
>
> Note the default clang12 toolchain requires:
> sudo apt install libncurses5
>
> Signed-off-by: Olivier Deprez
olivier.deprez@arm.com
>
> diff --git a/qemu_v8.mk b/qemu_v8.mk
> index 65a7a1d..f0ab955 100644
> --- a/qemu_v8.mk
> +++ b/qemu_v8.mk
> @@ -400,7 +400,7 @@ optee-os-clean: optee-os-clean-common
> # Hafnium
>
> ################################################################################
>
> -HAFNIUM_EXPORTS =
> PATH=$(HAFNIUM_PATH)/prebuilts/linux-x64/clang/bin:$(HAFNIUM_PATH)/prebuilts/linux-x64/dtc:$(PATH)
> +HAFNIUM_EXPORTS =
> PATH=$(ROOT)/clang-12.0.0/bin:$(HAFNIUM_PATH)/prebuilts/linux-x64/dtc:$(PATH)
>
> .hafnium_checkout:
> (cd $(HAFNIUM_PATH) && git submodule init && git submodule update)
>
> commit b74289cdba1334954a20c72c7037af81566c9f21
> Author: Olivier Deprez
olivier.deprez@arm.com
> Date: Fri May 12 14:44:31 2023 +0200
>
> tfa: options required to build with TF-A v2.9
>
> For SEL2 SPMC, set ENABLE_FEAT_SEL2=2 ENABLE_FEAT_FGT=2
> as they're not default on the baseline qemu v8.
>
> Signed-off-by: Olivier Deprez
olivier.deprez@arm.com
>
> diff --git a/.hafnium_checkout b/.hafnium_checkout
> new file mode 100644
> index 0000000..e69de29
> diff --git a/qemu_v8.mk b/qemu_v8.mk
> index 0542656..65a7a1d 100644
> --- a/qemu_v8.mk
> +++ b/qemu_v8.mk
> @@ -58,7 +58,7 @@ ifneq ($(filter-out n 1 2 3,$(SPMC_AT_EL)),)
> $(error Unsupported SPMC_AT_EL value $(SPMC_AT_EL))
> endif
>
> -# Option to configure Pointer Authentication for TA's
> +# Option to configure Pointer Authentication for core and TAs
> PAUTH ?= n
>
> # Option to configure Memory Tagging Extension
> @@ -193,7 +193,7 @@ TF_A_FLAGS_SPMC_AT_EL_1 += ENABLE_SME_FOR_NS=0
> ENABLE_SME_FOR_SWD=0
> TF_A_FLAGS_SPMC_AT_EL_1 +=
> QEMU_TOS_FW_CONFIG_DTS=../build/qemu_v8/spmc_el1_manifest.dts
> TF_A_FLAGS_SPMC_AT_EL_1 += SPMC_OPTEE=1
> TF_A_FLAGS_SPMC_AT_EL_1 +=
> QEMU_TOS_FW_CONFIG_DTS=../build/qemu_v8/spmc_el1_manifest.dts
> -TF_A_FLAGS_SPMC_AT_EL_2 = SPD=spmd
> +TF_A_FLAGS_SPMC_AT_EL_2 = SPD=spmd ENABLE_FEAT_SEL2=2 ENABLE_FEAT_FGT=2
> TF_A_FLAGS_SPMC_AT_EL_2 += ENABLE_SPE_FOR_LOWER_ELS=0
> TF_A_FLAGS_SPMC_AT_EL_2 += ENABLE_SME_FOR_NS=0 ENABLE_SME_FOR_SWD=0
> TF_A_FLAGS_SPMC_AT_EL_2 += SP_LAYOUT_FILE=../build/qemu_v8/sp_layout.json
>
> commit 326b604b0c59ed7c0c1fab026435e9ab32e15806
> Author: Olivier Deprez
olivier.deprez@arm.com
> Date: Fri May 12 14:40:55 2023 +0200
>
> build: add qemu enable slirp option
>
> For netdev user command line option.
>
> Requires apt-get install libslirp-dev
>
> Signed-off-by: Olivier Deprez
olivier.deprez@arm.com
>
> diff --git a/common.mk b/common.mk
> index e5f2333..aadaa11 100644
> --- a/common.mk
> +++ b/common.mk
> @@ -448,6 +448,11 @@ edk2-clean-common:
>
> ################################################################################
> QEMU_CONFIGURE_PARAMS_COMMON = --cc="$(CCACHE)gcc"
> --extra-cflags="-Wno-error" \
> --disable-docs
> +
> +#TODO: slirp submodule deprecated from qemu v7.1.2
> +#
>
https://wiki.qemu.org/ChangeLog/7.2#Removal_of_the_.22slirp.22_submodule_.28...
> +QEMU_CONFIGURE_PARAMS_COMMON += --enable-slirp
> +
> QEMU_EXTRA_ARGS +=\
> -object rng-random,filename=/dev/urandom,id=rng0 \
> -device virtio-rng-pci,rng=rng0,max-bytes=1024,period=1000
>
> commit 120c99122fbd2238d64671737db8db672d211634
> Author: Olivier Deprez
olivier.deprez@arm.com
> Date: Mon Mar 13 10:25:12 2023 +0100
>
> qemu: add ns mem ranges to spmc manifest
>
> Per [1], define secure and non-secure memory ranges in the SPMC
> manifest.
>
> [1]
>
https://trustedfirmware-a.readthedocs.io/en/latest/components/secure-partiti...
>
> Signed-off-by: Olivier Deprez
olivier.deprez@arm.com
>
> diff --git a/qemu_v8/spmc_el2_manifest.dts b/qemu_v8/spmc_el2_manifest.dts
> index 7acaa38..80d0d93 100644
> --- a/qemu_v8/spmc_el2_manifest.dts
> +++ b/qemu_v8/spmc_el2_manifest.dts
> @@ -60,8 +60,13 @@
> };
>
> /* VIRT_SECURE_MEM */
> - memory@e000000 {
> + memory@0 {
> device_type = "memory";
> reg = <0x0 0xe000000 0x1000000>;
> };
> +
> + memory@1 {
> + device_type = "ns-memory";
> + reg = <0x0 0x40000000 0x80000000>;
> + };
> };
>
>
>
>
>
>
>
> From: Jérôme Forissier
jerome.forissier@linaro.org
> Sent: 26 May 2023 14:58
> To: Olivier Deprez
Olivier.Deprez@arm.com
> Cc: Jens Wiklander
jens.wiklander@linaro.org;
> hafnium@lists.trustedfirmware.org
hafnium@lists.trustedfirmware.org
> Subject: Re: [Hafnium] Hafnium with QEMU and OP-TEE
>
> Hello Olivier,
>
> On Thu, 25 May 2023 at 18:34, Olivier Deprez
Olivier.Deprez@arm.com
> wrote:
>
> Hi Jens,
>
> I gave a try with fresh TF-A/Hafnium v2.9 and qemu using following shas:
>
> TF-A 60df3d75edb7eae87f51b356c35307e3011202d7
> Hafnium: 0715b8e002cdfb92e6b7efb71128cb24557b70cb
> qemu: b300c134465465385045ab705b68a42699688332
>
> See attached small changes I applied to build directory.
>
> As an out of curiosity question, where do we stand from making the overall
> changes upstream (or is it still in the radar)?
> Do you still think of integrating a CI loop?
>
> (BTW we made progress with the idea of removing the clang toolchain from
> prebuilts submodule
>
https://review.trustedfirmware.org/c/hafnium/prebuilts/+/19954
> We may think of downloading the appropriate LLVM toolchain by make
> toolchains and use it for building..)
>
> FYI there is a "make clang-toolchains" already which currently downloads
> 12.0.
>
> --
> Jerome
>
>
> Regards,
> Olivier.
>
>
>
> From: Jens Wiklander
jens.wiklander@linaro.org
> Sent: 20 February 2023 10:20
> To: Olivier Deprez
Olivier.Deprez@arm.com
> Cc: Jérôme Forissier
jerome.forissier@linaro.org;
> hafnium@lists.trustedfirmware.org
hafnium@lists.trustedfirmware.org
> Subject: Re: [Hafnium] Hafnium with QEMU and OP-TEE
>
> Hi Olivier,
>
> On Fri, Feb 10, 2023 at 6:20 PM Olivier Deprez
Olivier.Deprez@arm.com
> wrote:
> >
> > Hi Jens,
> >
> > I reproduced this setup and works well!
> > Thanks for this brilliant work!
> >
> > I still had to add --enable-slirp to qemu build for some reason..
> >
> > I'm thinking of adding PAuth to the picture.
>
> Makes sense, I've added PAUTH=y to the defaults in this branch.
>
> > BTI might be another one, but I guess it's not easy to enable (for TAs)
> if it requires a bti powered toolchain.
>
> Yes, that's tricky. As Jerome said, we have this in CI but it's not so
> easy to support here.
>
> > See few suggestions below.
>
> Thanks, took everything but BTI.
>
> Cheers,
> Jens