summaryrefslogtreecommitdiff
path: root/lib/power_management/suspend/tftf_suspend.c
AgeCommit message (Collapse)Author
2018-10-30warp7: Add workaround to skip suspend SMClinaro-warp7Jun Nie
Add workaround to skip suspend SMC because warp7 does not support suspend yet due to lack of LPDDR3 configuration to DDR controller. Signed-off-by: Jun Nie <jun.nie@linaro.org>
2017-11-23Ensure that PSTATE is updated right after a changeAntonio Nino Diaz
It is needed to add a isb after modifying PSTATE.{D,A,I,F} so that the effects are seen immediately. For example, this is useful to make sure that pending interrupt are handled as soon as the interrupts are enabled. Some definitions in `include/lib/aarch64/arch_helpers.h` have been moved inside the file so that isb() is defined before it is used. This commit makes it unnecesary to have a isb() after any of the functions modified by this file, so all isb() after them have been removed across the whole codebase. The fact that the old version of the functions needed a isb() made it easy to introduce bugs, as it was easy to forget about the isb(). There are some cases in the codebase as well, that are now fixed. Change-Id: If9f9335f8889f2e23900307eb6a6236143577e10 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2016-09-26AArch32: Cater for PSCI SMC Function IDsSoby Mathew
At present, the SMC function ID constants are explicitly suffixed for AArch64. This patch renames them so that they appear architecture-agnostic. The final value of these constants however are defined according to the architecture TFTF is built for. Test cases which use these macros have been modified accordingly. Change-Id: I0ad64003908683dfda472e66135fdce0ffe66897
2016-09-26AArch32: Rework the suspend frameworkSoby Mathew
This patch adds AArch32 support for the suspend framework. The `asm_tftf_suspend.S` which was AArch64 specific is now moved in the `aarch64` folder. Also the suspend test case for AFFLVL3 is now modified to skip in AArch32 build because it is not a valid affinity level for AArch32. Change-Id: I74aa0034f3a7785b996606f523b09bb92c35bfd1
2016-09-26AArch32: Rework SMC helpersSoby Mathew
This patch introduces SMC framework for AArch32. The existing SMC helper functions have been made architecture-agnostic. The `smc64_args` structure is renamed to just `smc_args`. Similarly the `smc64_ret_values` is renamed to `smc_ret_values`. All the users of the SMC helpers are also modified in this patch. This patch also removes the `noinline` directive from the function prototype of `asm_tftf_smc64()`. This is because this assembly function is a separate compilation unit and the compiler cannot inline it anyway hence making the `noinline` directive redundant. Change-Id: I6fc34fc95dc7c0ac030113e43f681dff8d2d7ccf
2016-04-27Fix TFTF timer tests on FVP Foundation modelAntonio Nino Diaz
When running the TFTF timer test cases on FVP Foundation model sometimes they hang. This only happens when the TFTF is built in debug mode. For the test case stress_test_timer_framework() the following happens: do_stress_test() consists of a loop in which a timer is set up, then the CPU enters suspend mode and the timer IRQ wakes the CPU up. The instant the timers wake up is a random instant based on the current system timer plus a random delay. The reason they failed is that, in debug mode, the debug output sometimes takes too long to complete, as printing text to the console can take a relatively long time. As the Foundation model is using the --use-real-time option, this effect was magnified. During this time, the timer IRQ is sometimes handled, preventing the CPU from waking up. When compiling in release mode, this output isn't printed, so the CPU has enough time to enter suspend mode before the interrupt. IRQs are now masked when trying to enter suspend mode. That way, even if it takes some time to actually enter suspend mode, an early interrupt will become pending and the CPU just won't be able to enter suspend mode. An extra API called `tftf_program_timer_and_suspend` has been added to make it easier to develop other test cases where the CPU may enter suspend mode and a timer is supposed to wake it up. The timer framework used to unconditionally disable IRQs upon entry and enabling them upon exit. This means that IRQs used to always be unmasked, even in the case where they were masked upon entry. This behaviour has been fixed to preserve the DAIF flags instead (their state is saved upon entry and restored upon exit). The test, disabled in a previous commit, has been enabled again. Change-Id: Ia86619a7f30483d77029e583c94265993f578a0f
2016-02-04Introduce GIC context save and restore functionalitySoby Mathew
This patch defines a set of APIs that help to save and restore the GIC state during suspend use cases. Earlier, the GIC was reinitialized by suspend framework and then the appropriate SGI state was restored by the SGI framework. Now the save and restore infrastructure is within the GIC driver and the framework invokes the appropriate save/restore functions of the ARM GIC layer. Change-Id: I7086316b50db09665886d2b31d1bec641568b6b5
2016-02-04Introduce the ARM GIC layer and refactor GICv2 driverSoby Mathew
The TFTF assumed that the GIC driver architecture is v2.0 and made inherent assumptions about the same in the framework. In order to add support for GICv3 systems, this assumption needs to be removed and a new ARM GIC layer is introduced which abstracts the GIC Architecture details. The `arm_gic.c` and `arm_gic.h` contain the prototypes and definitions for this new layer. Also the GICv2 driver is refactored such that all the functionality is contained within the driver and the driver is accessed through well defined API. This essentially means that the GICv2 specific functionality present earlier in the interrupt framework and SGI framework is now removed. Also certain functionality of GICv2 like clearing the interrupt target register (GICD_ITARGETSR) to leave an interrupt untargeted cannot be supported generically in GICv3 and hence it is removed. The timer framework, which made use of this feature, is modified to not use it anymore. All the framework and testcases are modified to use the ARM GIC layer rather than the GICv2 driver directly. The functionality common across GICv3 and GICv2 drivers are defined in gic_common.c. Change-Id: Idf50fa14be42cb4dfb507087e340b0404e681e98
2015-12-16Re-initialize console on resuming from system suspendamobal01
The TFTF code should not assume that the console will be initialized by Trusted Firmware. This patch re-initializes the console after resuming from system suspend in TFTF Change-Id: I1b421a1b94816f718a2c90b60d397db0f3720496
2015-10-27Support save and restore of timer, SGI and GIC contextSoby Mathew
This patch adds support to save and restore context of system timer, SGI and GIC registers. This is required for system suspend test cases as the state of these components need to be saved and restored. Change-Id: I647f5491a3e6f11259a3256555f6970b8bbd8dfe
2015-10-27Rework the CPU suspend framework to support system suspendSoby Mathew
This patch adds support for suspending and restoring the system context to the existing TFTF suspend helpers. The suspend test cases are also modified to use the new helpers. Change-Id: I1816ae5280476e8fbe7fddc7790dc53d14581470
2015-02-16Add support and rationalize output to different log levelsVikram Kanigiri
This patch adds support for different log levels and sets the default log level of 20 and 40 for release and debug builds respectively. It also differentiates the current printed logs into different log levels. Change-Id: I845074f45ddb2b11c9844f0b082f776b9944c4d9
2014-12-11Add some debug prints when entering/resuming from suspend stateSandrine Bailleux
Change-Id: I291e0dc6d3e8056052b7c57a4b38df7a4d02cdbf
2014-11-24Fix return type of PSCI CPU hotplug & idle wrappersSandrine Bailleux
As per the PSCI specification, CPU_ON, CPU_OFF and CPU_SUSPEND calls return signed 32-bit integers. This patch fixes the return type of PSCI CPU hotplug & idle wrappers when appropriate. Change-Id: Iaa8b61695f1dd289893e7f409edb2964d3ca0988
2014-10-23Prefix SMC functions IDs constants by 'SMC_'Sandrine Bailleux
The idea is to easily recognise SMC functions IDs constants and other SMC-related constants like specific bits of SMC arguments. Also rename VERSION SMC calls into REVISION to be aligned with the terms used in the SMCCC. Change-Id: I2c05c49b567db28d871a69565afa4ef226bea596
2014-10-21Restructure framework's directory hierarchySandrine Bailleux
This is a first, rough attempt at cleaning the framework's directory hierarchy. Basically, almost everything is moved to individual directories under lib/. What's left under framework/ are the core features of the framework, i.e. things that test cases won't ever need. This patch also introduces some cleanups. The following functions are removed: - tftf_platform_get_time() We'll need such a function in the future to measure tests execution time but there's no reason for it to be platform-specific, we can use the Generic Timer instead when we get to it. Tracked by GENFW-506. - tftf_platform_reset() We'll need a function to reset the platform in the future but at the moment it is not used. Tracked by GENFW-500. - tftf_platform_core_whoami() Not needed. A CPU can just call read_mpidr_el1() to get its MPID, then platform_get_core_pos() to get the corresponding linear ID. See GENFW-483. - tftf_is_core_enabled() Superseded by plat_get_aff_state(). - tftf_core_participates_in_testcase() Superseded by the platform API to query the platform topology. Move the following defintions out of framework/helpers.c: - Move mp_printf() in lib/utils/mp_printf.c - Move MMU functions into plat_common.c as default implementations of these platform functions. What's left in helpers.c then are helper functions to write test results into NVM so rename the file into nvm_results_helpers.c. Remove bl_common.h as it contains only Trusted Firmware specific definitions. Rename tests_api.h into tftf_lib.h. Also move some of its declarations into new header files: irq.h, systimer.h, sgi.h. Remove tftf_common.h and move its declarations to tftf_lib.h. Rename rt_services/ into runtime_services/. The test cases' directory hierarchy needs to be restructured as well, this will come in a subsequent patch. Change-Id: I143c4c888586301594f6b6339d6e48cbbd817570