temp/arm-trusted-firmware: upgrade to 2.7.0 (MR 3263)

This commit is contained in:
Bobby The Builder 2022-06-28 11:58:20 -04:00 committed by Oliver Smith
parent ba3896f2ae
commit 858c730020
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 24 additions and 171 deletions

View file

@ -1,72 +0,0 @@
From 981a0f37f9c2d8e9cdff5bf34c80c3dd7e1128ae Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 18 Mar 2021 22:55:15 -0500
Subject: [PATCH] allwinner: Choose PSCI states to avoid translation
By aligning the PSCI and SCPI power states, we can avoid some code to
translate between the two. This also makes room for a second retention
state, for future growth.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I26691085f277a96bd405e3305ab0fe390a92b418
---
plat/allwinner/common/include/platform_def.h | 7 ++++---
plat/allwinner/common/sunxi_scpi_pm.c | 17 +++--------------
2 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/plat/allwinner/common/include/platform_def.h b/plat/allwinner/common/include/platform_def.h
index 4893368c2..fc9c966ba 100644
--- a/plat/allwinner/common/include/platform_def.h
+++ b/plat/allwinner/common/include/platform_def.h
@@ -57,9 +57,10 @@
#define PLAT_CSS_SCP_COM_SHARED_MEM_BASE \
(SUNXI_SRAM_A2_BASE + SUNXI_SRAM_A2_SIZE - 0x200)
-#define PLAT_MAX_PWR_LVL_STATES U(2)
-#define PLAT_MAX_RET_STATE U(1)
-#define PLAT_MAX_OFF_STATE U(2)
+/* These states are used directly for SCPI communication. */
+#define PLAT_MAX_PWR_LVL_STATES U(3)
+#define PLAT_MAX_RET_STATE U(2)
+#define PLAT_MAX_OFF_STATE U(3)
#define PLAT_MAX_PWR_LVL U(2)
#define PLAT_NUM_PWR_DOMAINS (U(1) + \
diff --git a/plat/allwinner/common/sunxi_scpi_pm.c b/plat/allwinner/common/sunxi_scpi_pm.c
index 74763ef7e..89c834aa9 100644
--- a/plat/allwinner/common/sunxi_scpi_pm.c
+++ b/plat/allwinner/common/sunxi_scpi_pm.c
@@ -44,17 +44,6 @@
#define SYSTEM_PWR_STATE(state) \
((state)->pwr_domain_state[SYSTEM_PWR_LVL])
-static inline scpi_power_state_t scpi_map_state(plat_local_state_t psci_state)
-{
- if (is_local_state_run(psci_state)) {
- return scpi_power_on;
- }
- if (is_local_state_retn(psci_state)) {
- return scpi_power_retention;
- }
- return scpi_power_off;
-}
-
static void sunxi_cpu_standby(plat_local_state_t cpu_state)
{
u_register_t scr = read_scr_el3();
@@ -87,9 +76,9 @@ static void sunxi_pwr_domain_off(const psci_power_state_t *target_state)
}
scpi_set_css_power_state(read_mpidr(),
- scpi_map_state(cpu_pwr_state),
- scpi_map_state(cluster_pwr_state),
- scpi_map_state(system_pwr_state));
+ cpu_pwr_state,
+ cluster_pwr_state,
+ system_pwr_state);
}
static void sunxi_pwr_domain_on_finish(const psci_power_state_t *target_state)
--
2.33.1

View file

@ -1,85 +0,0 @@
From 75ddf133e308f7ce15af9ecd899079a22c59dcfc Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 18 Mar 2021 23:15:28 -0500
Subject: [PATCH] allwinner: Simplify CPU_SUSPEND power state encoding
Use the encoding recommended by the PSCI specification: four bits for
the power state at each power level.
Since SCPI provides no way to handshake an exit from a standby state,
the only possible standby state is the architectural WFI state. Since
WFI can be used without PSCI, we do not allow passing in standby states.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I4b3b84e5c255ee58a25255a0cab5d7623425086e
---
plat/allwinner/common/sunxi_scpi_pm.c | 36 ++++++++++++---------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/plat/allwinner/common/sunxi_scpi_pm.c b/plat/allwinner/common/sunxi_scpi_pm.c
index 89c834aa9..8dcc54b16 100644
--- a/plat/allwinner/common/sunxi_scpi_pm.c
+++ b/plat/allwinner/common/sunxi_scpi_pm.c
@@ -33,6 +33,9 @@
*/
#define SCP_FIRMWARE_MAGIC 0xb4400012
+#define PLAT_LOCAL_PSTATE_WIDTH U(4)
+#define PLAT_LOCAL_PSTATE_MASK ((U(1) << PLAT_LOCAL_PSTATE_WIDTH) - 1)
+
#define CPU_PWR_LVL MPIDR_AFFLVL0
#define CLUSTER_PWR_LVL MPIDR_AFFLVL1
#define SYSTEM_PWR_LVL MPIDR_AFFLVL2
@@ -126,7 +129,9 @@ static int sunxi_validate_power_state(unsigned int power_state,
psci_power_state_t *req_state)
{
unsigned int power_level = psci_get_pstate_pwrlvl(power_state);
+ unsigned int state_id = psci_get_pstate_id(power_state);
unsigned int type = psci_get_pstate_type(power_state);
+ unsigned int i;
assert(req_state != NULL);
@@ -135,28 +140,19 @@ static int sunxi_validate_power_state(unsigned int power_state,
}
if (type == PSTATE_TYPE_STANDBY) {
- /* Only one retention power state is supported. */
- if (psci_get_pstate_id(power_state) > 0) {
- return PSCI_E_INVALID_PARAMS;
- }
- /* The SoC cannot be suspended without losing state */
- if (power_level == SYSTEM_PWR_LVL) {
- return PSCI_E_INVALID_PARAMS;
- }
- for (unsigned int i = 0; i <= power_level; ++i) {
- req_state->pwr_domain_state[i] = PLAT_MAX_RET_STATE;
- }
- } else {
- /* Only one off power state is supported. */
- if (psci_get_pstate_id(power_state) > 0) {
- return PSCI_E_INVALID_PARAMS;
- }
- for (unsigned int i = 0; i <= power_level; ++i) {
- req_state->pwr_domain_state[i] = PLAT_MAX_OFF_STATE;
- }
+ return PSCI_E_INVALID_PARAMS;
+ }
+
+ /* Pass through the requested PSCI state as-is. */
+ for (i = 0; i <= power_level; ++i) {
+ unsigned int local_pstate = state_id & PLAT_LOCAL_PSTATE_MASK;
+
+ req_state->pwr_domain_state[i] = local_pstate;
+ state_id >>= PLAT_LOCAL_PSTATE_WIDTH;
}
+
/* Higher power domain levels should all remain running */
- for (unsigned int i = power_level + 1; i <= PLAT_MAX_PWR_LVL; ++i) {
+ for (; i <= PLAT_MAX_PWR_LVL; ++i) {
req_state->pwr_domain_state[i] = PSCI_LOCAL_STATE_RUN;
}
--
2.33.1

View file

@ -1,26 +1,39 @@
# Forked for adding rk3399, rk3328 support and crust compatibility
# Contributor: Milan P. Stanić <mps@arvanta.net>
# Contributor: Maxim Karasev <begs@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=arm-trusted-firmware
pkgver=9999
_pkgver=2.6
pkgrel=6
_pkgver=2.7.0
pkgrel=7
pkgdesc="ARM Trusted Firmware-A (TF-A)"
url="https://github.com/ARM-software/arm-trusted-firmware"
arch="aarch64"
license="BSD-3-Clause"
makedepends="dtc openssl-dev gcc-arm-none-eabi"
source="
https://github.com/ARM-software/$pkgname/archive/v$_pkgver/arm-trusted-firmware-$_pkgver.tar.gz
2001-allwinner-Choose-PSCI-states-to-avoid-translation.patch
2002-allwinner-Simplify-CPU_SUSPEND-power-state-encoding.patch
source="https://github.com/ARM-software/arm-trusted-firmware/archive/v$_pkgver/arm-trusted-firmware-v$_pkgver.tar.gz"
options="!check" # No tests
_plats="
sun50i_a64
sun50i_h6
rk3399
rk3328
"
options="!check" # no tests
builddir="$srcdir/$pkgname-$_pkgver"
_plats="sun50i_a64 sun50i_h6 rk3399 rk3328"
build() {
unset LDFLAGS
for plat in $_plats; do
make PLAT=$plat DEBUG=0 bl31
local opts=""
case "$plat" in
sun50i_a64)
opts="SUNXI_SETUP_REGULATORS=0 SUNXI_AMEND_DTB=1"
;;
esac
msg "Building ATF for $plat (opts='$opts')"
make PLAT=$plat bl31 $opts
done
}
@ -39,9 +52,6 @@ package() {
done
}
sha512sums="
8b20964b1b672898268e27424984af0ef9e95b38f426370ed4b802f67fc204db5f467886707dce77e4560548e01777a6c36d4eb801842c7d1f2ff6ca5d9b7dd1 arm-trusted-firmware-2.6.tar.gz
3f8c63941418e44b849f8770704b1570926cbe20522d6957b965afe62c02a55d092b21397603994f3444908376531f13eb28b9716ed10e0d57bae0d9f5713c1a 2001-allwinner-Choose-PSCI-states-to-avoid-translation.patch
15daabe8a55847d23fb5e498353d368773a50ec339786b422a9b21bbc21a7b1185851a0d9dca6832952bcbc71a1c9d08a508323625bcd2b5781955248a43f13d 2002-allwinner-Simplify-CPU_SUSPEND-power-state-encoding.patch
3e1e09bcc69a0f080f91b94d9c8da6dd0b27b86292599c280438d7b6f594017a896af7cfc58d9d22053f77b5daa2faecd51a59505c755eac8493e4e0fd1e9203 arm-trusted-firmware-v2.7.0.tar.gz
"