* [PATCH 1/7] misc: psci: translate PSCI error codes in smc command @ 2019-11-06 7:10 Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for " Ahmad Fatoum ` (5 more replies) 0 siblings, 6 replies; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum For more usability, translate CPU_ON error codes into the error descriptions found in the PSCI Platform Design Document[1]. [1]: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/cpu/psci.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c index a976ddbb5c65..b02e83986af8 100644 --- a/arch/arm/cpu/psci.c +++ b/arch/arm/cpu/psci.c @@ -248,8 +248,41 @@ void second_entry(void) while (1); } +static const char *psci_xlate_str(long err) +{ + static char errno_string[sizeof "error 0x123456789ABCDEF0"]; + + switch(err) + { + case ARM_PSCI_RET_SUCCESS: + return "Success"; + case ARM_PSCI_RET_NOT_SUPPORTED: + return "Operation not supported"; + case ARM_PSCI_RET_INVAL: + return "Invalid argument"; + case ARM_PSCI_RET_DENIED: + return "Operation not permitted"; + case ARM_PSCI_RET_ALREADY_ON: + return "CPU already on"; + case ARM_PSCI_RET_ON_PENDING: + return "CPU_ON in progress"; + case ARM_PSCI_RET_INTERNAL_FAILURE: + return "Internal failure"; + case ARM_PSCI_RET_NOT_PRESENT: + return "Trusted OS not present on core"; + case ARM_PSCI_RET_DISABLED: + return "CPU is disabled"; + case ARM_PSCI_RET_INVALID_ADDRESS: + return "Bad address"; + } + + sprintf(errno_string, "error 0x%lx", err); + return errno_string; +} + static int do_smc(int argc, char *argv[]) { + long ret; int opt; struct arm_smccc_res res = { .a0 = 0xdeadbee0, @@ -271,7 +304,10 @@ static int do_smc(int argc, char *argv[]) case 'c': arm_smccc_smc(ARM_PSCI_0_2_FN_CPU_ON, 1, (unsigned long)second_entry, 0, 0, 0, 0, 0, &res); - break; + ret = (long)res.a0; + printf("CPU_ON returns with: %s\n", psci_xlate_str(ret)); + if (ret) + return COMMAND_ERROR; } } -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for smc command 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum @ 2019-11-06 7:10 ` Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 3/7] psci: wire in smc command help Ahmad Fatoum ` (4 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum There's already an option to use when debugging PSCI. Instead of requiring users to #define DEBUG 1 as well, have the smc command be usable when CONFIG_ARM_PSCI_DEBUG, not DEBUG is defined. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/cpu/psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c index b02e83986af8..8c5043d83c8c 100644 --- a/arch/arm/cpu/psci.c +++ b/arch/arm/cpu/psci.c @@ -228,7 +228,7 @@ static int armv7_psci_init(void) } device_initcall(armv7_psci_init); -#ifdef DEBUG +#ifdef CONFIG_ARM_PSCI_DEBUG #include <command.h> #include <getopt.h> -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/7] psci: wire in smc command help 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for " Ahmad Fatoum @ 2019-11-06 7:10 ` Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 4/7] misc: implement PSCI client driver Ahmad Fatoum ` (3 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum The smc command has a help defined, but unused. Wire it in, so help smc and smc -invalidoption work as expected. While at it, remove the unimplemented -z option. It's unneeded, because -c turns off the CPU after starting it again already. Also it seems it's not implementable without interprocessor communication, which is probably overkill here. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/cpu/psci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c index 8c5043d83c8c..22ce1dfd0e84 100644 --- a/arch/arm/cpu/psci.c +++ b/arch/arm/cpu/psci.c @@ -291,7 +291,10 @@ static int do_smc(int argc, char *argv[]) .a3 = 0xdeadbee3, }; - while ((opt = getopt(argc, argv, "nicz")) > 0) { + if (argc < 2) + return COMMAND_ERROR_USAGE; + + while ((opt = getopt(argc, argv, "nic")) > 0) { switch (opt) { case 'n': armv7_secure_monitor_install(); @@ -321,7 +324,6 @@ BAREBOX_CMD_HELP_TEXT("Options:") BAREBOX_CMD_HELP_OPT ("-n", "Install secure monitor and switch to nonsecure mode") BAREBOX_CMD_HELP_OPT ("-i", "Show information about installed PSCI version") BAREBOX_CMD_HELP_OPT ("-c", "Start secondary CPU core") -BAREBOX_CMD_HELP_OPT ("-z", "Turn off secondary CPU core") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(smc) -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/7] misc: implement PSCI client driver 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for " Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 3/7] psci: wire in smc command help Ahmad Fatoum @ 2019-11-06 7:10 ` Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 5/7] misc: implement PSCI system reset driver Ahmad Fatoum ` (2 subsequent siblings) 5 siblings, 0 replies; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum System reset on the STM32MP may be done via PSCI when running TF-A as first-stage boot loader. Provide a PSCI client driver to handle this generically. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/Kconfig | 5 ++ arch/arm/cpu/Makefile | 1 + arch/arm/cpu/psci-client.c | 150 ++++++++++++++++++++++++++++++++++++ arch/arm/include/asm/psci.h | 10 ++- 4 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/psci-client.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f82844a83a5e..f4a244ca0628 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -449,6 +449,11 @@ config ARM_PSCI PSCI is used for controlling secondary CPU cores on some systems. Say yes here if you want barebox to service PSCI calls on such systems. +config ARM_PSCI_CLIENT + bool + select ARM_SMCCC + select ARM_PSCI_OF + config ARM_PSCI_DEBUG bool "Enable PSCI debugging" depends on ARM_PSCI diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile index e0b16747ad66..09b3bc2eeab9 100644 --- a/arch/arm/cpu/Makefile +++ b/arch/arm/cpu/Makefile @@ -16,6 +16,7 @@ pbl-$(CONFIG_BOARD_ARM_GENERIC_DT_AARCH64) += board-dt-2nd-aarch64.o obj-pbl-y += setupc$(S64).o cache$(S64).o obj-$(CONFIG_BOOTM_OPTEE) += start-kernel-optee.o +obj-$(CONFIG_ARM_PSCI_CLIENT) += psci-client.o # # Any variants can be called as start-armxyz.S diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c new file mode 100644 index 000000000000..d0b89498acd3 --- /dev/null +++ b/arch/arm/cpu/psci-client.c @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com> + * Copyright (C) 2019 Ahmad Fatoum, Pengutronix + */ + +#include <common.h> +#include <init.h> +#include <driver.h> +#include <asm/psci.h> +#include <asm/secure.h> +#include <linux/arm-smccc.h> + +static u32 version; +int psci_get_version(void) +{ + if (!version) + return -EPROBE_DEFER; + + return version; +} + +static u32 (*psci_invoke_fn)(ulong, ulong, ulong, ulong); + +static int psci_xlate_error(s32 errnum) +{ + switch (errnum) { + case ARM_PSCI_RET_NOT_SUPPORTED: + return -ENOTSUPP; // Operation not supported + case ARM_PSCI_RET_INVAL: + return -EINVAL; // Invalid argument + case ARM_PSCI_RET_DENIED: + return -EPERM; // Operation not permitted + case ARM_PSCI_RET_ALREADY_ON: + return -EBUSY; // CPU already on + case ARM_PSCI_RET_ON_PENDING: + return -EALREADY; // CPU_ON in progress + case ARM_PSCI_RET_INTERNAL_FAILURE: + return -EIO; // Internal failure + case ARM_PSCI_RET_NOT_PRESENT: + return -ESRCH; // Trusted OS not present on core + case ARM_PSCI_RET_DISABLED: + return -ENODEV; // CPU is disabled + case ARM_PSCI_RET_INVALID_ADDRESS: + return -EACCES; // Bad address + default: + return errnum; + }; +} + +int psci_invoke(ulong function, ulong arg0, ulong arg1, ulong arg2, + ulong *result) +{ + ulong ret; + if (!psci_invoke_fn) + return -EPROBE_DEFER; + + ret = psci_invoke_fn(function, arg0, arg1, arg2); + if (result) + *result = ret; + + switch (function) { + case ARM_PSCI_0_2_FN_PSCI_VERSION: + case ARM_PSCI_1_0_FN64_STAT_RESIDENCY: + case ARM_PSCI_1_0_FN64_STAT_COUNT: + /* These don't return an error code */ + return 0; + } + + return psci_xlate_error(ret); +} + +static u32 invoke_psci_fn_hvc(ulong function, ulong arg0, ulong arg1, ulong arg2) +{ + struct arm_smccc_res res; + arm_smccc_hvc(function, arg0, arg1, arg2, 0, 0, 0, 0, &res); + return res.a0; +} + +static u32 invoke_psci_fn_smc(ulong function, ulong arg0, ulong arg1, ulong arg2) +{ + struct arm_smccc_res res; + arm_smccc_smc(function, arg0, arg1, arg2, 0, 0, 0, 0, &res); + return res.a0; +} + +static int of_psci_do_fixup(struct device_node *root, void *context) +{ + return of_psci_fixup(root, *(u32 *)context); +} + +static int __init psci_probe(struct device_d *dev) +{ + const char *method; + ulong of_version; + int ret; + + ret = dev_get_drvdata(dev, (const void **)&of_version); + if (ret) + return -ENODEV; + + ret = of_property_read_string(dev->device_node, "method", &method); + if (ret) { + dev_warn(dev, "missing \"method\" property\n"); + return -ENXIO; + } + + if (!strcmp(method, "hvc")) { + psci_invoke_fn = invoke_psci_fn_hvc; + } else if (!strcmp(method, "smc")) { + psci_invoke_fn = invoke_psci_fn_smc; + } else { + pr_warn("invalid \"method\" property: %s\n", method); + return -EINVAL; + } + + + if (of_version < ARM_PSCI_VER(0,2)) { + version = of_version; + + dev_info(dev, "assuming version %u.%u\n", + version >> 16, version & 0xffff); + } else { + ulong actual_version; + psci_invoke(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, &actual_version); + version = actual_version; + + dev_info(dev, "detected version %u.%u\n", + version >> 16, version & 0xffff); + + if (actual_version != of_version) + of_register_fixup(of_psci_do_fixup, &version); + } + + return 0; +} + +static __maybe_unused struct of_device_id psci_dt_ids[] = { + { .compatible = "arm,psci", .data = (void*)ARM_PSCI_VER(0,1) }, + { .compatible = "arm,psci-0.2", .data = (void*)ARM_PSCI_VER(0,2) }, + { .compatible = "arm,psci-1.0", .data = (void*)ARM_PSCI_VER(1,0) }, + { /* sentinel */ }, +}; + +static struct driver_d psci_driver = { + .name = "psci", + .probe = psci_probe, + .of_compatible = DRV_OF_COMPAT(psci_dt_ids), +}; +coredevice_platform_driver(psci_driver); diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h index f2db967f3a63..6ebad011e775 100644 --- a/arch/arm/include/asm/psci.h +++ b/arch/arm/include/asm/psci.h @@ -18,8 +18,9 @@ #ifndef __ARM_PSCI_H__ #define __ARM_PSCI_H__ -#define ARM_PSCI_VER_1_0 (0x00010000) -#define ARM_PSCI_VER_0_2 (0x00000002) +#define ARM_PSCI_VER(major, minor) (((major) << 16) | (minor)) +#define ARM_PSCI_VER_1_0 ARM_PSCI_VER(1,0) +#define ARM_PSCI_VER_0_2 ARM_PSCI_VER(0,2) /* PSCI 0.1 interface */ #define ARM_PSCI_FN_BASE 0x95c1ba5e @@ -106,6 +107,11 @@ static inline void psci_set_ops(struct psci_ops *ops) } #endif +int psci_invoke(ulong function, ulong arg0, ulong arg1, ulong arg2, + ulong *result); + +int psci_get_version(void); + void psci_cpu_entry(void); #ifdef CONFIG_ARM_PSCI_DEBUG -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/7] misc: implement PSCI system reset driver 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum ` (2 preceding siblings ...) 2019-11-06 7:10 ` [PATCH 4/7] misc: implement PSCI client driver Ahmad Fatoum @ 2019-11-06 7:10 ` Ahmad Fatoum 2019-11-06 9:32 ` Sascha Hauer 2019-11-06 7:10 ` [PATCH 6/7] ARM: stm32mp: select ARM_USE_COMPRESSED_DTB for the whole arch Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 7/7] ARM: dts: stm32mp: report psci v0.2 at least Ahmad Fatoum 5 siblings, 1 reply; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum In cases where firmware provides PSCI >0.1, it may be prudent to use it as backend for reset and poweroff. This driver accomplishes this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/misc/Kconfig | 5 +++ drivers/misc/Makefile | 1 + drivers/misc/psci-sysreset.c | 62 ++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 drivers/misc/psci-sysreset.c diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 0f736f8bded3..0412fcf02aa3 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -35,4 +35,9 @@ config UBOOTVAR While it can be used standalone, it is best when coupled with corresponding filesystem driver. +config PSCI_SYSRESET + bool "PSCI system reset driver" + select ARM_PSCI_CLIENT + depends on CPU_32v7 || CPU_64v8 + endmenu diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index bc1c01ea4d67..0ad158b16d1b 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_SRAM) += sram.o obj-$(CONFIG_STATE_DRV) += state.o obj-$(CONFIG_DEV_MEM) += mem.o obj-$(CONFIG_UBOOTVAR) += ubootvar.o +obj-$(CONFIG_PSCI_SYSRESET) += psci-sysreset.o diff --git a/drivers/misc/psci-sysreset.c b/drivers/misc/psci-sysreset.c new file mode 100644 index 000000000000..d05cbc76f259 --- /dev/null +++ b/drivers/misc/psci-sysreset.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com> + * Copyright (C) 2019 Ahmad Fatoum, Pengutronix + */ + +#define pr_fmt(fmt) "psci-sysreset: " fmt + +#include <common.h> +#include <init.h> +#include <driver.h> +#include <asm/psci.h> +#include <poweroff.h> +#include <restart.h> + +static struct restart_handler restart; + +static void __noreturn psci_invoke_noreturn(int function) +{ + int ret; + + ret = psci_invoke(function, 0, 0, 0, NULL); + + pr_err("psci command failed: %s\n", strerror(-ret)); + hang(); +} + +static void __noreturn psci_poweroff(struct poweroff_handler *handler) +{ + psci_invoke_noreturn(ARM_PSCI_0_2_FN_SYSTEM_OFF); +} + +static void __noreturn psci_restart(struct restart_handler *rst) +{ + psci_invoke_noreturn(ARM_PSCI_0_2_FN_SYSTEM_RESET); +} + +static int __init psci_sysreset_init(void) +{ + int version; + int ret; + + version = psci_get_version(); + if (version < 0) + return version; + + if (version < ARM_PSCI_VER(0,2)) { + pr_debug("Incompatible PSCI version: not registering reset handler\n"); + return 0; + } + + ret = poweroff_handler_register_fn(psci_poweroff); + if (ret) + return ret; + + restart.name = "psci"; + restart.restart = psci_restart; + restart.priority = 400; + + return restart_handler_register(&restart); +} +device_initcall(psci_sysreset_init); -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 5/7] misc: implement PSCI system reset driver 2019-11-06 7:10 ` [PATCH 5/7] misc: implement PSCI system reset driver Ahmad Fatoum @ 2019-11-06 9:32 ` Sascha Hauer 0 siblings, 0 replies; 8+ messages in thread From: Sascha Hauer @ 2019-11-06 9:32 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox On Wed, Nov 06, 2019 at 08:10:32AM +0100, Ahmad Fatoum wrote: > In cases where firmware provides PSCI >0.1, it may be prudent to use it as > backend for reset and poweroff. This driver accomplishes this. > > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > --- > drivers/misc/Kconfig | 5 +++ > drivers/misc/Makefile | 1 + > drivers/misc/psci-sysreset.c | 62 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 68 insertions(+) > create mode 100644 drivers/misc/psci-sysreset.c > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig > index 0f736f8bded3..0412fcf02aa3 100644 > --- a/drivers/misc/Kconfig > +++ b/drivers/misc/Kconfig > @@ -35,4 +35,9 @@ config UBOOTVAR > While it can be used standalone, it is best when coupled > with corresponding filesystem driver. > > +config PSCI_SYSRESET > + bool "PSCI system reset driver" > + select ARM_PSCI_CLIENT > + depends on CPU_32v7 || CPU_64v8 I would rather prefer to be ARM_PSCI_CLIENT a user visible option. > +static int __init psci_sysreset_init(void) > +{ > + int version; > + int ret; > + > + version = psci_get_version(); > + if (version < 0) > + return version; This prints a warning for everyone who has this code enabled but doesn't have psci support. Also you enforce that the psci client driver has to be registered already. I think this code should rather be merged into the psci client driver, there's no need for an additional initcall. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/7] ARM: stm32mp: select ARM_USE_COMPRESSED_DTB for the whole arch 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum ` (3 preceding siblings ...) 2019-11-06 7:10 ` [PATCH 5/7] misc: implement PSCI system reset driver Ahmad Fatoum @ 2019-11-06 7:10 ` Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 7/7] ARM: dts: stm32mp: report psci v0.2 at least Ahmad Fatoum 5 siblings, 0 replies; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Ahmad Fatoum We'll probably be using compressed DTBs for all new boards as well, thus move the ARM_USE_COMPRESSED_DTB, so it's always selected for STM32MP. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/Kconfig | 1 + arch/arm/mach-stm32mp/Kconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f4a244ca0628..d0099113f6f4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -202,6 +202,7 @@ config ARCH_STM32MP select ARCH_HAS_RESET_CONTROLLER select ARM_AMBA select ARM_SMCCC + select ARM_USE_COMPRESSED_DTB config ARCH_VERSATILE bool "ARM Versatile boards (ARM926EJ-S)" diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index 6bf950b23f0f..b30439735e17 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -9,7 +9,6 @@ config ARCH_STM32MP157 config MACH_STM32MP157C_DK2 select ARCH_STM32MP157 - select ARM_USE_COMPRESSED_DTB bool "STM32MP157C-DK2 board" endif -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 7/7] ARM: dts: stm32mp: report psci v0.2 at least 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum ` (4 preceding siblings ...) 2019-11-06 7:10 ` [PATCH 6/7] ARM: stm32mp: select ARM_USE_COMPRESSED_DTB for the whole arch Ahmad Fatoum @ 2019-11-06 7:10 ` Ahmad Fatoum 5 siblings, 0 replies; 8+ messages in thread From: Ahmad Fatoum @ 2019-11-06 7:10 UTC (permalink / raw) To: barebox; +Cc: Michael Olbrich, Ahmad Fatoum ARM TF-A reports compatibility with PSCI v1.1 since v1.5. Upstream ARM TF-A support for STM32MP was introduced with v1.6. It's thus safe to assume that the STM32MP barebox will never have to interact with a secure monitor implementing PSCI v0.1. Overwrite the psci device tree compatible to specify v0.2. This is the first version that implements PSCI_VERSION, which allows the barebox psci client driver selected in this commit to query the actual PSCI version and fix it up into the device tree. This fixes an issue where resetting via PSCI fails in Linux because the upstream device tree compatible: reboot: Restarting system Reboot failed -- System halted Reported-by: Michael Olbrich <mol@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/dts/stm32mp157c.dtsi | 4 ++++ arch/arm/mach-stm32mp/Kconfig | 1 + 2 files changed, 5 insertions(+) diff --git a/arch/arm/dts/stm32mp157c.dtsi b/arch/arm/dts/stm32mp157c.dtsi index 771139c28af0..97c075a020f8 100644 --- a/arch/arm/dts/stm32mp157c.dtsi +++ b/arch/arm/dts/stm32mp157c.dtsi @@ -19,6 +19,10 @@ gpio10 = &gpiok; gpio25 = &gpioz; }; + + psci { + compatible = "arm,psci-0.2"; + }; }; &bsec { diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig index b30439735e17..e74029158223 100644 --- a/arch/arm/mach-stm32mp/Kconfig +++ b/arch/arm/mach-stm32mp/Kconfig @@ -5,6 +5,7 @@ config ARCH_NR_GPIO default 416 config ARCH_STM32MP157 + select PSCI_CLIENT bool config MACH_STM32MP157C_DK2 -- 2.24.0.rc1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-11-06 9:32 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-11-06 7:10 [PATCH 1/7] misc: psci: translate PSCI error codes in smc command Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 2/7] ARM: psci: use CONFIG_ARM_PSCI_DEBUG for " Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 3/7] psci: wire in smc command help Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 4/7] misc: implement PSCI client driver Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 5/7] misc: implement PSCI system reset driver Ahmad Fatoum 2019-11-06 9:32 ` Sascha Hauer 2019-11-06 7:10 ` [PATCH 6/7] ARM: stm32mp: select ARM_USE_COMPRESSED_DTB for the whole arch Ahmad Fatoum 2019-11-06 7:10 ` [PATCH 7/7] ARM: dts: stm32mp: report psci v0.2 at least Ahmad Fatoum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox