summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/psci.c
Commit message (Collapse)AuthorAgeFilesLines
* ARM: psci: make PSCI method a of_psci_fixup parameterAhmad Fatoum2022-11-071-1/+1
| | | | | | | | | | | | | | We currently assume PSCI fixups to always be of method smc, but this is not true when barebox fixes up the node while running under QEMU. In preparation for handling QEMU boot properly when psci-client driver is enabled, give of_psci_fixup an extra parameter. No functional change. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20221105121154.3716964-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: fix NULL pointer dereference on CPU idleAhmad Fatoum2020-10-021-1/+1
| | | | | | | | We guard against cpu_off being NULL, but dereference cpu_suspend instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* arm/cpu: Replace license and copyright boilerplate by SPDX identfiersUwe Kleine-König2020-07-141-10/+1
| | | | | | | | | | | | | This adapts all files that were identifed by licensecheck (https://salsa.debian.org/build-common-team/licensecheck.git) as licensed under the GPL. While touching these files also do some minor comment reformatting to get some uniform layout. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/randfixes'Sascha Hauer2019-12-101-0/+1
|\
| * ARM: psci: declare locally used functions as staticLucas Stach2019-12-021-1/+1
| | | | | | | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: psci: factor out smc command into commands/Ahmad Fatoum2019-11-191-105/+0
|/ | | | | | | | | | | So far, the smc command was only usable when barebox also provides the secure monitor. It's useful to have it when barebox is a PSCI consumer as well to test whether the secure monitor works. Factor out the code into commands/ in preparation to do so. No functional change. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: wire in smc command helpAhmad Fatoum2019-11-071-2/+4
| | | | | | | | | | | | | 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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: use CONFIG_ARM_PSCI_DEBUG for smc commandAhmad Fatoum2019-11-071-1/+1
| | | | | | | | | 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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: translate PSCI error codes in smc commandAhmad Fatoum2019-11-071-1/+37
| | | | | | | | | | 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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: fix erroneous call of ->system_reset on system_offAhmad Fatoum2019-07-041-3/+3
| | | | | | | | | | | | | Both psci_system_reset and psci_system_off call psci_ops->system_reset, which seems like a copy-paste error as there is an unused ->system_off as well. Adjust psci_system_off to use ->system_off instead. This won't matter for the existing i.MX7 PSCI implementation because it defines neither callback, but it will for the upcoming STM32MP PSCI support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: factor out of_psci_fixup() to separate fileSascha Hauer2019-05-131-21/+6
| | | | | | | | | of_psci_fixup() can be used by code which doesn't use the barebox psci implementation, but provides its own PSCI compatible firmware. Factor it out to a separate file to compile it independently of the barebox PSCI implementation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: unify asm/arm-smccc.h and linux/arm-smccc.hSascha Hauer2019-05-131-1/+1
| | | | | | | | | | Since 2c20674f0c ("ARM: Add code to support SMCCC on AArch64") we have both arch/arm/include/asm/arm-smccc.h and include/linux/arm-smccc.h. The latter was introduced with Kernel commit 680a0873e ("arm: kernel: Add SMC structure parameter") included, so we have to add the parameter for ARM32 aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: Avoid missing prototypes warningSascha Hauer2018-11-121-0/+7
| | | | | | | | Avoid missing prototypes warning by adding prototypes. Since these functions are called from assembly add the prototypes to the C file directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: Remove unused code in psci_entry()Andrey Smirnov2018-06-181-6/+0
| | | | | | | | Remove what looks like a leftover code that doesn't appear to be referenced anywhere. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci command: Add to misc groupSascha Hauer2017-12-011-2/+3
| | | | | | | Explicitly add psci command to the misc group to get rid of the warning that the command has no group. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Use of_property_write_string() where appropriateSascha Hauer2017-03-301-4/+2
| | | | | | | Replace users which use of_set_property() to set a property to a string with of_property_write_string(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX7: Add PSCI supportSascha Hauer2017-02-131-0/+13
| | | | | | | This adds the SoC specific PSCI bits for i.MX7. Based on the corresponding U-Boot code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: Add PSCI supportSascha Hauer2017-02-131-0/+298
This patch contains the barebox implementation for the ARM "Power State Coordination Interface" (PSCI). The interface is aimed at the generalization of code in the following power management scenarios: * Core idle management. * Dynamic addition and removal of cores, and secondary core boot. * big.LITTLE migration. * System shutdown and reset. In practice, all that's currently implemented is a way to enable the secondary core one some SoCs. With PSCI the Kernel is either started in nonsecure or in Hypervisor mode and PSCI is used to apply power to the secondary cores. The start mode is passed in the global.bootm.secure_state variable. This enum can contain "secure" (Kernel is started in secure mode, means no PSCI), "nonsecure" (Kernel is started in nonsecure mode, PSCI available) or "hyp" (Kernel is started in hyp mode, meaning it can support virtualization). We currently only support putting the secure monitor code into SDRAM, which means we always steal some amount of memory from the Kernel. To keep things simple for now we simply keep the whole barebox binary in memory The PSCI support has been tested on i.MX7 only so far. The only supported operations are CPU_ON and CPU_OFF. The PSCI and secure monitor code is based on the corresponding U-Boot code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>