[FOSS_TLK]arm: arm: monitor_vectors: 64-bit TOS_RESTART SMC
Varun Wadekar [Mon, 12 Jan 2015 11:39:26 +0000 (16:39 +0530)]
Convert SMC_TOS_RESTART to 64-bit so as to support 64-bit kernels. We plan
to keep the 32-bit SMC_TOS_RESTART_LEGACY alive until the kernel and TLK
are in sync. Once they are, the _LEGACY SMC would be removed.

Change-Id: I8b684ac5d299b115c7c5261c0b948d16c1f5c1dd
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/715777
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/arm/monitor_vectors.S
include/lib/monitor/monitor_vector.h
platform/tegra/include/platform/platform_tos.h

index d7b43f6..6a6fde5 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <arch/arm/monitor_vectors.h>
 #include <lib/monitor/monitor_vector.h>
+#include <platform/platform_tos.h>
 
 #define L1_CACHE_ALIGN         5
 
@@ -110,19 +111,21 @@ cont_handle_exc:
        SAVE_NONSECURE_STATE r1, r2     @ save NS state
        RESTORE_SECURE_STATE r1, r2     @ restore S state
 
-       ldmia   sp!, {r1-r2}            @ restore scratch regs
-
        /* handle restart SMC */
-       cmp     r0, #(60 << 24)         @ restart SMC?
+       ldr     r1, =SMC_TOS_RESTART_LEGACY
+       cmp     r0, r1                  @ legacy restart SMC?
+       beq     go_restart
+       ldr     r1, =SMC_TOS_RESTART
+       cmp     r0, r1                  @ restart SMC?
        beq     go_restart
 
        /* if returning from FS req, skip CPU save (r1 is still scratch) */
-       stmfd   sp!, {r1}               @ create scratch regs
        mov32   r1, 0x32000009
        cmp     r0, r1                  @ fs completion?
-       ldmia   sp!, {r1}               @ restore scratch regs
        beq     go_restart
 
+       ldmia   sp!, {r1-r2}            @ restore scratch regs
+
        /* save tz_monitor_frame to r0 */
        SAVE_MON_FRAME_TO_ARG mon_stdcall_frame_addr
        adr     r0, mon_stdcall_frame_addr
@@ -137,6 +140,7 @@ return_go_nonsecure:
 
 go_restart:
        /* store new r14/spsr to use after RESTART SMC handling */
+       ldmia   sp!, {r1-r2}            @ restore scratch regs
        adr     r0, mon_stdcall_frame_addr
        ldr     r0, [r0]
        str     r14, [r0, #0x68]
index aab82b3..43dcded 100644 (file)
@@ -120,9 +120,6 @@ void mon_cpu_power_down(int l2_flush);
 #define        SMC_TOS_ADDR_TRANSLATE          (SMC_TOS_SECURE | 0x4)
 #define        SMC_TOS_INIT_SHARED_ADDR        (SMC_TOS_SECURE | 0x5)
 
-/* restart pre-empted SMC handling */
-#define SMC_TOS_RESTART                        (60 << 24)
-
 /* informs the NS world that we were pre-empted by an irq */
 #define SMC_ERR_PREEMPT_BY_IRQ         0xFFFFFFFD
 #define SMC_ERR_PREEMPT_BY_FS          0xFFFFFFFE
index 07c41fd..3abfddd 100644 (file)
 #define SMC_TOS_NS_REG_REQPARAM_BUF            0x72000001
 #define SMC_TOS_INIT_LOGGER                    0x72000002
 #define SMC_TOS_SS_REGISTER_HANDLER            0x72000003
+/* restart pre-empted SMC handling */
+#define SMC_TOS_RESTART                                0x72000100
 
 /* Trusted OS calls (legacy) */
 #define SMC_TOS_NS_REG_REQPARAM_BUF_LEGACY     0x32000002
 #define SMC_TOS_INIT_LOGGER_LEGACY             0x32000007
 #define SMC_TOS_SS_REGISTER_HANDLER_LEGACY     0x32000010
+#define SMC_TOS_RESTART_LEGACY                 (60 << 24)