From: Henrik Grimler <henrik@grimler.se>
To: semen.protsenko@linaro.org, virag.david003@gmail.com,
martin.juecker@gmail.com, cw00.choi@samsung.com,
m.szyprowski@samsung.com, alim.akhtar@samsung.com,
krzysztof.kozlowski@canonical.com, robh+dt@kernel.org,
devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
~postmarketos/upstreaming@lists.sr.ht
Cc: Henrik Grimler <henrik@grimler.se>
Subject: [PATCH v2 2/3] ARM: exynos: only do SMC_CMD_CPU1BOOT call on Exynos4
Date: Sat, 15 Jan 2022 17:27:02 +0100 [thread overview]
Message-ID: <20220115162703.699347-3-henrik@grimler.se> (raw)
In-Reply-To: <20220115162703.699347-1-henrik@grimler.se>
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: Henrik Grimler <henrik@grimler.se>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
Sent previously as RFC
---
arch/arm/mach-exynos/firmware.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index 2eaf2dbb8e81..2da5b60b59e2 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -60,8 +60,10 @@ static int exynos_cpu_boot(int cpu)
/*
* Exynos3250 doesn't need to send smc command for secondary CPU boot
* because Exynos3250 removes WFE in secure mode.
+ *
+ * On Exynos5 devices the call is ignored by trustzone firmware.
*/
- if (soc_is_exynos3250())
+ if (!soc_is_exynos4210() && !soc_is_exynos4412())
return 0;
/*
--
2.34.1
next prev parent reply other threads:[~2022-01-15 16:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-15 16:27 [PATCH v2 0/3] Add initial support for exynos5420-chagallwifi Henrik Grimler
2022-01-15 16:27 ` [PATCH v2 1/3] dt-bindings: arm: samsung: document chagallwifi board binding Henrik Grimler
2022-02-07 22:04 ` Rob Herring
2022-01-15 16:27 ` Henrik Grimler [this message]
2022-01-15 16:27 ` [PATCH v2 3/3] ARM: dts: Add support for Samsung Chagallwifi Henrik Grimler
2022-01-15 16:37 ` [PATCH v2 0/3] Add initial support for exynos5420-chagallwifi Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220115162703.699347-3-henrik@grimler.se \
--to=henrik@grimler.se \
--cc=alim.akhtar@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=martin.juecker@gmail.com \
--cc=robh+dt@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=virag.david003@gmail.com \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).