css: Ensure PSCI system off/reset is not interrupted
authordp-arm <dimitris.papastamos@arm.com>
Tue, 11 Apr 2017 10:48:49 +0000 (11:48 +0100)
committerdp-arm <dimitris.papastamos@arm.com>
Thu, 20 Apr 2017 14:05:21 +0000 (15:05 +0100)
If there is a pending interrupt, it is possible for the AP to come out
of the final WFI before SCP has a chance to act on it.  Prevent this
by disabling the GIC CPU interface before issuing a WFI.

Previously, SCP would not wait on WFI before taking an action but
would shut down the core or system regardless.

Change-Id: Ib0bcf69a515d540ed4f73c11e40ec7c863e39c92
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
plat/arm/css/drivers/scp/css_pm_scpi.c

index e22504d1d4a0842f05785f1e01b2ff0473c81ef0..3b643e6692d5ea617dca950c0ec37b310ec832d9 100644 (file)
@@ -32,6 +32,7 @@
 #include <assert.h>
 #include <css_pm.h>
 #include <debug.h>
+#include <plat_arm.h>
 #include "../scpi/css_scpi.h"
 #include "css_scp.h"
 
@@ -134,6 +135,12 @@ void __dead2 css_scp_sys_shutdown(void)
 {
        uint32_t response;
 
+       /*
+        * Disable GIC CPU interface to prevent pending interrupt
+        * from waking up the AP from WFI.
+        */
+       plat_arm_gic_cpuif_disable();
+
        /* Send the power down request to the SCP */
        response = scpi_sys_power_state(scpi_system_shutdown);
 
@@ -153,6 +160,12 @@ void __dead2 css_scp_sys_reboot(void)
 {
        uint32_t response;
 
+       /*
+        * Disable GIC CPU interface to prevent pending interrupt
+        * from waking up the AP from WFI.
+        */
+       plat_arm_gic_cpuif_disable();
+
        /* Send the system reset request to the SCP */
        response = scpi_sys_power_state(scpi_system_reboot);