arm/hafnium: update to v2.9
PATCH 1/1 arm/hafnium: update to v2.9
Updating to the latest version of hafnium. Also, dropping tc patches, as they are either experimental or a similar feature has been added.
Signed-off-by Jon Mason <[email protected]>
---
...p-timer-register-accesses-using-cnth.patch | 249 ------------------
...vhe-and-disable-branch-protection-fo.patch | 32 ---
...interrupt-controller-register-access.patch | 156 -----------
...GE1_NS-while-mapping-memory-from-NWd.patch | 41 ---
.../recipes-bsp/hafnium/hafnium-tc.inc | 9 -
...ig-native-to-find-the-libssl-headers.patch | 4 +-
...-arm-hafnium-fix-kernel-tool-linking.patch | 2 +-
.../0001-work-around-visibility-issue.patch | 4 +-
.../0002-Fix-build-with-clang-15.patch | 101 -------
.../{hafnium_2.8.bb => hafnium_2.9.bb} | 3 +-
10 files changed, 6 insertions(+), 595 deletions(-)
delete mode 100644 meta-arm-bsp/recipes-bsp/hafnium/files/tc/0001-feat-emulate-cntp-timer-register-accesses-using-cnth.patch
delete mode 100644 meta-arm-bsp/recipes-bsp/hafnium/files/tc/0001-feat-vhe-enable-vhe-and-disable-branch-protection-fo.patch
delete mode 100644 meta-arm-bsp/recipes-bsp/hafnium/files/tc/0002-feat-emulate-interrupt-controller-register-access.patch
delete mode 100644 meta-arm-bsp/recipes-bsp/hafnium/files/tc/0003-feat-vhe-set-STAGE1_NS-while-mapping-memory-from-NWd.patch
delete mode 100644 meta-arm/recipes-bsp/hafnium/hafnium/0002-Fix-build-with-clang-15.patch
rename meta-arm/recipes-bsp/hafnium/{hafnium_2.8.bb => hafnium_2.9.bb} (95%)meta-arm-bsp/recipes-bsp/hafnium/files/tc/0001-feat-emulate-cntp-timer-register-accesses-using-cnth.patch deleted +0 -249
@@ -1,249 +0,0 @@ -From 3bc797e097ef2b29acf36560e4d2bfeec31f8d81 Mon Sep 17 00:00:00 2001 -From: Ben Horgan <[email protected]> -Date: Fri, 4 Mar 2022 16:48:14 +0000 -Subject: [PATCH] feat: emulate cntp timer register accesses using cnthps - -Upstream-Status: Inappropriate [Experimental feature] -Signed-off-by: Ben Horgan <[email protected]> -Change-Id: I67508203273baf3bd8e6be2d99717028db945715 ---- - Makefile | 3 +- - src/arch/aarch64/hypervisor/BUILD.gn | 1 + - src/arch/aarch64/hypervisor/cpu.c | 11 ++- - src/arch/aarch64/hypervisor/handler.c | 6 ++ - src/arch/aarch64/hypervisor/timer_el1.c | 104 ++++++++++++++++++++++++ - src/arch/aarch64/hypervisor/timer_el1.h | 20 +++++ - src/arch/aarch64/msr.h | 8 ++ - 7 files changed, 150 insertions(+), 3 deletions(-) - create mode 100644 src/arch/aarch64/hypervisor/timer_el1.c - create mode 100644 src/arch/aarch64/hypervisor/timer_el1.h - -diff --git a/Makefile b/Makefile -index 95cab9a56bfd..21cca938531d 100644 ---- a/Makefile -+++ b/Makefile -@@ -60,7 +60,8 @@ CHECKPATCH := $(CURDIR)/third_party/linux/scripts/checkpatch.pl \ - # debug_el1.c : uses XMACROS, which checkpatch doesn't understand. - # perfmon.c : uses XMACROS, which checkpatch doesn't understand. - # feature_id.c : uses XMACROS, which checkpatch doesn't understand. --CHECKPATCH_IGNORE := "src/arch/aarch64/hypervisor/debug_el1.c\|src/arch/aarch64/hypervisor/perfmon.c\|src/arch/aarch64/hypervisor/feature_id.c" -+# timer_el1.c : uses XMACROS, which checkpatch doesn't understand. -+CHECKPATCH_IGNORE := "src/arch/aarch64/hypervisor/debug_el1.c\|src/arch/aarch64/hypervisor/perfmon.c\|src/arch/aarch64/hypervisor/feature_id.c\|src/arch/aarch64/hypervisor/timer_el1.c" - - OUT ?= out/$(PROJECT) - OUT_DIR = out/$(PROJECT) -diff --git a/src/arch/aarch64/hypervisor/BUILD.gn b/src/arch/aarch64/hypervisor/BUILD.gn -index 6068d1e8f075..de1a414dac68 100644 ---- a/src/arch/aarch64/hypervisor/BUILD.gn -+++ b/src/arch/aarch64/hypervisor/BUILD.gn -@@ -45,6 +45,7 @@ source_set("hypervisor") { - "handler.c", - "perfmon.c", - "psci_handler.c", -+ "timer_el1.c", - "vm.c", - ] - -diff --git a/src/arch/aarch64/hypervisor/cpu.c b/src/arch/aarch64/hypervisor/cpu.c -index 5e025b596674..edd5df134cfc 100644 ---- a/src/arch/aarch64/hypervisor/cpu.c -+++ b/src/arch/aarch64/hypervisor/cpu.c -@@ -98,13 +98,20 @@ void arch_regs_reset(struct vcpu *vcpu) - if (is_primary) { - /* - * cnthctl_el2 is redefined when VHE is enabled. -- * EL1PCTEN, don't trap phys cnt access. -- * EL1PCEN, don't trap phys timer access. -+ * EL1PCTEN, don't trap phys cnt access. Except when in -+ * secure world without vhe. -+ * EL1PCEN, don't trap phys timer access. Except when in -+ * secure world without vhe. - */ - if (has_vhe_support()) { - cnthctl |= (1U << 10) | (1U << 11); - } else { -+#if SECURE_WORLD == 1 -+ cnthctl &= ~(1U << 0); -+ cnthctl &= ~(1U << 1); -+#else - cnthctl |= (1U << 0) | (1U << 1); -+#endif - } - } - -diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c -index 3422ff7b8265..c495df40f3f5 100644 ---- a/src/arch/aarch64/hypervisor/handler.c -+++ b/src/arch/aarch64/hypervisor/handler.c -@@ -34,6 +34,7 @@ - #include "psci_handler.h" - #include "smc.h" - #include "sysregs.h" -+#include "timer_el1.h" - - /** - * Hypervisor Fault Address Register Non-Secure. -@@ -1295,6 +1296,11 @@ void handle_system_register_access(uintreg_t esr_el2) - inject_el1_sysreg_trap_exception(vcpu, esr_el2); - return; - } -+ } else if (timer_el1_is_register_access(esr_el2)) { -+ if (!timer_el1_process_access(vcpu, vm_id, esr_el2)) { -+ inject_el1_unknown_exception(vcpu, esr_el2); -+ return; -+ } - } else { - inject_el1_sysreg_trap_exception(vcpu, esr_el2); - return; -diff --git a/src/arch/aarch64/hypervisor/timer_el1.c b/src/arch/aarch64/hypervisor/timer_el1.c -new file mode 100644 -index 000000000000..c30e5543f436 ---- /dev/null -+++ b/src/arch/aarch64/hypervisor/timer_el1.c -@@ -0,0 +1,104 @@ -+/* -+ * Copyright 2022 The Hafnium Authors. -+ * -+ * Use of this source code is governed by a BSD-style -+ * license that can be found in the LICENSE file or at -+ * https://opensource.org/licenses/BSD-3-Clause. -+ */ -+ -+#include "timer_el1.h" -+ -+#include "hf/dlog.h" -+ -+#include "msr.h" -+#include "sysregs.h" -+ -+/* -+ * Physical timer (CNTP) register encodings as defined in -+ * table D13-8 of the ARMv8 ARM (DDI0487F). -+ * TYPE, op0, op1, crn, crm, op2 -+ * The register names are the concatenation of -+ * "CNTP_", TYPE and "_EL2". -+ */ -+#define CNTP_REGISTERS \ -+ X(CTL, 3, 3, 14, 2, 1) \ -+ X(CVAL, 3, 3, 14, 2, 2) \ -+ X(TVAL, 3, 3, 14, 2, 0) \ -+ -+bool timer_el1_is_register_access(uintreg_t esr) -+{ -+ uintreg_t sys_register = GET_ISS_SYSREG(esr); -+ bool is_timer_access; -+ switch (sys_register) { -+#define X(type, op0, op1, crn, crm, op2) \ -+ case (GET_ISS_ENCODING(op0, op1, crn, crm, op2)): \ -+ is_timer_access = true; \ -+ break; -+ CNTP_REGISTERS -+#undef X -+ case (GET_ISS_ENCODING(3, 3, 14, 0, 1)): -+ is_timer_access = true; -+ break; -+ default: -+ is_timer_access = false; -+ } -+ -+ return is_timer_access; -+} -+ -+/* Accesses to CNTP timer emulated with CNTHPS */ -+bool timer_el1_process_access(struct vcpu *vcpu, ffa_vm_id_t vm_id, -+ uintreg_t esr) -+{ -+ uintreg_t sys_register = GET_ISS_SYSREG(esr); -+ uintreg_t rt_register = GET_ISS_RT(esr); -+ uintreg_t value; -+ -+ if (ISS_IS_READ(esr)) { -+ switch (sys_register) { -+#define X(type, op0, op1, crn, crm, op2) \ -+ case (GET_ISS_ENCODING(op0, op1, crn, crm, op2)): \ -+ value = read_msr(MSR_CNTHPS_##type##_EL2); \ -+ vcpu->regs.r[rt_register] = value; \ -+ break; -+ CNTP_REGISTERS -+#undef X -+ case (GET_ISS_ENCODING(3, 3, 14, 0, 1)): -+ value = read_msr(cntpct_el0); -+ vcpu->regs.r[rt_register] = value; -+ break; -+ default: -+ dlog_notice( -+ "Unsupported timer register " -+ "read: " -+ "op0=%d, op1=%d, crn=%d, crm=%d, op2=%d, " -+ "rt=%d.\n", -+ GET_ISS_OP0(esr), GET_ISS_OP1(esr), -+ GET_ISS_CRN(esr), GET_ISS_CRM(esr), -+ GET_ISS_OP2(esr), GET_ISS_RT(esr)); -+ break; -+ } -+ } else { -+ value = vcpu->regs.r[rt_register]; -+ switch (sys_register) { -+#define X(type, op0, op1, crn, crm, op2) \ -+ case (GET_ISS_ENCODING(op0, op1, crn, crm, op2)): \ -+ write_msr(MSR_CNTHPS_##type##_EL2, value); \ -+ break; -+ CNTP_REGISTERS -+#undef X -+ default: -+ dlog_notice( -+ "Unsupported timer register " -+ "write: " -+ "op0=%d, op1=%d, crn=%d, crm=%d, op2=%d, " -+ "rt=%d, value=%d.\n", -+ GET_ISS_OP0(esr), GET_ISS_OP1(esr), -+ GET_ISS_CRN(esr), GET_ISS_CRM(esr), -+ GET_ISS_OP2(esr), GET_ISS_RT(esr), value); -+ break; -+ } -+ } -+ -+ return true; -+} -diff --git a/src/arch/aarch64/hypervisor/timer_el1.h b/src/arch/aarch64/hypervisor/timer_el1.h -new file mode 100644 -index 000000000000..04a43b6ca335 ---- /dev/null -+++ b/src/arch/aarch64/hypervisor/timer_el1.h -@@ -0,0 +1,20 @@ -+/* -+ * Copyright 2022 The Hafnium Authors. -+ * -+ * Use of this source code is governed by a BSD-style -+ * license that can be found in the LICENSE file or at -+ * https://opensource.org/licenses/BSD-3-Clause. -+ */ -+ -+#pragma once -+ -+#include "hf/arch/types.h" -+ -+#include "hf/cpu.h" -+ -+#include "vmapi/hf/ffa.h" -+ -+bool timer_el1_is_register_access(uintreg_t esr); -+ -+bool timer_el1_process_access(struct vcpu *vcpu, ffa_vm_id_t vm_id, -+ uintreg_t esr); -diff --git a/src/arch/aarch64/msr.h b/src/arch/aarch64/msr.h -index 6edc39f2af48..bf1a66d1d4c5 100644 ---- a/src/arch/aarch64/msr.h -+++ b/src/arch/aarch64/msr.h -@@ -131,3 +131,11 @@ - #define MSR_ELR_EL12 S3_5_C4_C0_1 - - #endif -+ -+/* -+ * Secure EL2 Physical timer (CNTHPS) register encodings as defined in -+ * table D13-8 of the ARMv8 ARM (DDI0487F). -+ */ -+#define MSR_CNTHPS_CTL_EL2 S3_4_C14_C5_1 -+#define MSR_CNTHPS_CVAL_EL2 S3_4_C14_C5_2 -+#define MSR_CNTHPS_TVAL_EL2 S3_4_C14_C5_0
meta-arm-bsp/recipes-bsp/hafnium/files/tc/0001-feat-vhe-enable-vhe-and-disable-branch-protection-fo.patch deleted +0 -32
@@ -1,32 +0,0 @@ -From 1fef5bd2504ce3a203c56a3b66dba773cd4893c6 Mon Sep 17 00:00:00 2001 -From: Davidson K <[email protected]> -Date: Thu, 8 Sep 2022 10:47:10 +0530 -Subject: [PATCH] feat(vhe): enable vhe and disable branch protection for TC - -Signed-off-by: Davidson K <[email protected]> -Change-Id: I60cd607d9f2bf0114b482980e7ca68e24aaf4d1f -Upstream-Status: Pending [Not submitted to upstream yet] ---- - BUILD.gn | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/BUILD.gn b/BUILD.gn -index cc6a78f4fdb8..acd1f9d1634b 100644 ---- a/BUILD.gn -+++ b/BUILD.gn -@@ -245,7 +245,6 @@ aarch64_toolchains("secure_tc") { - heap_pages = 180 - max_cpus = 8 - max_vms = 16 -- branch_protection = "standard" - toolchain_args = { - plat_ffa = "//src/arch/aarch64/plat/ffa:spmc" - plat_psci = "//src/arch/aarch64/plat/psci:spmc" -@@ -254,6 +253,7 @@ aarch64_toolchains("secure_tc") { - secure_world = "1" - pl011_base_address = "0x7ff80000" - enable_mte = "1" -+ enable_vhe = "1" - plat_log_level = "LOG_LEVEL_INFO" - } - }
meta-arm-bsp/recipes-bsp/hafnium/files/tc/0002-feat-emulate-interrupt-controller-register-access.patch deleted +0 -156
156 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/hafnium/files/tc/0003-feat-vhe-set-STAGE1_NS-while-mapping-memory-from-NWd.patch deleted +0 -41
41 lines not on this page · raw message
meta-arm-bsp/recipes-bsp/hafnium/hafnium-tc.inc +0 -9
@@ -3,15 +3,6 @@ COMPATIBLE_MACHINE = "(tc?)" HAFNIUM_PLATFORM = "secure_tc" -FILESEXTRAPATHS:prepend:tc := "${THISDIR}/files/tc:" - -SRC_URI:append = " \ - file://0001-feat-emulate-cntp-timer-register-accesses-using-cnth.patch \ - file://0002-feat-emulate-interrupt-controller-register-access.patch \ - file://0003-feat-vhe-set-STAGE1_NS-while-mapping-memory-from-NWd.patch \ - file://0001-feat-vhe-enable-vhe-and-disable-branch-protection-fo.patch;patchdir=project/reference \ - " - do_compile() { PATH="${S}/prebuilts/linux-x64/clang/bin:$PATH" oe_runmake -C ${S} }
meta-arm/recipes-bsp/hafnium/hafnium/0001-Use-pkg-config-native-to-find-the-libssl-headers.patch +2 -2
@@ -1,4 +1,4 @@ -From 60b8c4e852cbe76c383d5c495ecc8aeb84b407b6 Mon Sep 17 00:00:00 2001 +From 1c1e7ca2874feaa3e447dce578487d42c226ef46 Mon Sep 17 00:00:00 2001 From: Ross Burton <[email protected]> Date: Sat, 17 Jul 2021 14:38:02 -0500 Subject: [PATCH] Use pkg-config-native to find the libssl headers.
@@ -10,7 +10,7 @@ Signed-off-by: Ross Burton <[email protected]> 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile b/scripts/Makefile -index 9adb6d247..5fe371c7d 100644 +index 9adb6d247818..5fe371c7d7f5 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -3,8 +3,8 @@
meta-arm/recipes-bsp/hafnium/hafnium/0001-arm-hafnium-fix-kernel-tool-linking.patch +1 -1
@@ -1,4 +1,4 @@ -From ef156578c1f7100b339ddfe956ff2cd89d61e0d4 Mon Sep 17 00:00:00 2001 +From c17aabb2535d791a715130f21178946ab9c1e29d Mon Sep 17 00:00:00 2001 From: Ross Burton <[email protected]> Date: Tue, 9 Nov 2021 23:31:22 +0000 Subject: [PATCH] arm/hafnium: fix kernel tool linking
meta-arm/recipes-bsp/hafnium/hafnium/0001-work-around-visibility-issue.patch +2 -2
@@ -1,4 +1,4 @@ -From 4f1ab5944c1042a141a2ce16ec8bf1d12749e41a Mon Sep 17 00:00:00 2001 +From 745294ffa9bb9296eb4250f24dd0ae8115fadd7a Mon Sep 17 00:00:00 2001 From: Jon Mason <[email protected]> Date: Thu, 27 Oct 2022 20:10:09 +0000 Subject: [PATCH] work around visibility issue
@@ -16,7 +16,7 @@ Signed-off-by: Jon Mason <[email protected]> 1 file changed, 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn -index f55560c..d60c3e3 100644 +index f55560c540de..d60c3e37135b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,7 +5,6 @@
meta-arm/recipes-bsp/hafnium/hafnium/0002-Fix-build-with-clang-15.patch deleted +0 -101
101 lines not on this page · raw message
meta-arm/recipes-bsp/hafnium/hafnium_2.9.bb renamed from meta-arm/recipes-bsp/hafnium/hafnium_2.8.bb +1 -2
@@ -15,11 +15,10 @@ inherit deploy python3native pkgconfig ${CLANGNATIVE} SRC_URI = "gitsm://git.trustedfirmware.org/hafnium/hafnium.git;protocol=https;branch=master \ file://0001-arm-hafnium-fix-kernel-tool-linking.patch \ - file://0002-Fix-build-with-clang-15.patch \ file://0001-Use-pkg-config-native-to-find-the-libssl-headers.patch;patchdir=third_party/linux \ file://0001-work-around-visibility-issue.patch;patchdir=third_party/dtc \ " -SRCREV = "b7d27acb9c63a52f8bd8a37d1eee335d4ccfbe93" +SRCREV = "0715b8e002cdfb92e6b7efb71128cb24557b70cb" S = "${WORKDIR}/git" B = "${WORKDIR}/build"
Signature · 1 line
2.30.2
Jon Mason
AppliedQuoted 4 lines · Jon Mason
Updating to the latest version of hafnium. Also, dropping tc patches, as they are either experimental or a similar feature has been added.
Applied, thanks!
[1/1] arm/hafnium: update to v2.9
commit: 26586c3d7c3e14e9246a53ff94d8af0dcac0bf2b
Best regards,
Signature · 1 line
Jon Mason <[email protected]>