• Henrik Grimler's avatar
    ARM: exynos: only do SMC_CMD_CPU1BOOT call on Exynos4 · 534aaa18
    Henrik Grimler authored
    
    
    On Exynos5 the call is simply ignored by most variants of the
    trustzone firmware.  However, on some devices it instead causes the
    device to hang, so let's avoid the call for the SoCs where it should
    not be needed.
    
    To see that the call is ignored, we can look into sboot/tzsw.  On most
    of the Exynos{4,5} devices the part of sboot/tzsw that seem to handle
    the secure monitor calls is quite easy to recognise, the SMC number is
    compared to known ones, and if equal it branches to the relevant
    function.  In assembly this looks something like:
    
    ;-- handle_smc:
    0x00000514      650070e3       cmn r0, 0x65
    0x00000518      0a00000a       beq loc.smc_cmd_reg
    0x0000051c      010070e3       cmn r0, 1
    0x00000520      6c00000a       beq loc.smc_cmd_init
    0x00000524      020070e3       cmn r0, 2
    0x00000528      6b00000a       beq loc.smc_cmd_info
    0x0000052c      030070e3       cmn r0, 3
    0x00000530      6e00000a       beq loc.smc_cmd_sleep
    0x00000534      060070e3       cmn r0, 6
    0x00000538      ae00000a       beq loc.smc_cmd_save_state
    0x0000053c      070070e3       cmn r0, 7
    0x00000540      b400000a       beq loc.smc_cmd_standby
    0x00000544      2b01001a       bne loc.smc_return_minus1
    
    where above example is from exynos5420-arndale-octa.  As can be seen
    the case where r0 is 4 (i.e. SMC_CMD_CPU1BOOT) is not handled.  The
    annotations are taken from github.com/hsnaves/exynos5410-firmware,
    where a large part of the exynos5410 trustzone firmware has been
    reverse-engineered.
    Signed-off-by: default avatarHenrik Grimler <henrik@grimler.se>
    Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
    Link: https://lore.kernel.org/r/20220118185746.299832-3-henrik@grimler.se
    
    Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    534aaa18
firmware.c 5.94 KB