From patchwork Sat Jan 8 21:57:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Grimler X-Patchwork-Id: 12707656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CFD9C4332F for ; Sat, 8 Jan 2022 22:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=A+Mo6YTAd1GAtvF5QCBlozQoThUMs48UcJgANrYNnMc=; b=wMPpaHdnvnC6rv Arcs63NOvmZFILfxu9ASEEptTScTe5o+jFpOT+5ASYsDhdPovDEO0honOI5UluJdJ/cXgiq7jGfa2 1n/qf382FemQ7QUgbc6cYJWe+EQEPBL6RJkCwAMiOyvFZuavZqGG1ra0VF8IEbSfMyQu483bSHVmb 6ok/iOMPZ6JI+o5YiAqv5DjjCA1BASdE35PwoUKPaEShXvgf5bvcxeZnul/ajfOaqmV3GxB7cUD8E Vt9FCHGqcKveIQS/PLkVBV1SM+OOMkVAWFMwJiKKQbC02GhC/yYC3BTWjOgv70BCzkzQeV2/E21G1 0OZIhqs6TmwKQBmnsZxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6Jko-0071r9-VU; Sat, 08 Jan 2022 22:00:03 +0000 Received: from h03mx16.reliablemail.org ([173.236.90.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6JkZ-0071l3-Eo for linux-arm-kernel@lists.infradead.org; Sat, 08 Jan 2022 21:59:50 +0000 X-Halon-Out: 4867c19e-70ce-11ec-a67c-00163c72d6d3 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=grimler.se; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ShwrDW4z4GDqIzOjN5Ljw8MomzBvmrs5nZRXEiVBcho=; b=iP4bm7lNgHeCeUIRyvJj1YZ5N5 HAz54rNFAf6HXqeYGCXYj29gPoLheBTUJFpU4zxarE9GpdeVYPjjD35ZfShuguRPruryLJdKAv7Vf LYvvyb8awbwZpw/abRS17gew9HOawws6qUFcjaKkn6z1D+S9uh2fDGBktSiSdTjtDdOe4R6g8Uuk1 nIYT3caOFEiRuSmToAjfh1r44n2T2C2IGZk0oZap57UuAmyT3XFxFsIFKlNsSgd0x0oC/b46YSmu6 fJ9REBiO//btqloXEP5FaKS60cPF9zcjYs39C1Y+w0PXoS8xutnybmVmRouk5rDH9/ZbWwyPqdLia kat7Cb9w==; From: Henrik Grimler To: linux@armlinux.org.uk, krzysztof.kozlowski@canonical.com, m.szyprowski@samsung.com, semen.protsenko@linaro.org, martin.juecker@gmail.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Henrik Grimler Subject: [RFC PATCH 0/1] ARM: exynos: only do SMC_CMD_CPU1BOOT call on Exynos4 Date: Sat, 8 Jan 2022 22:57:32 +0100 Message-Id: <20220108215733.705865-1-henrik@grimler.se> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpsrv07.misshosting.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - grimler.se X-Get-Message-Sender-Via: cpsrv07.misshosting.com: authenticated_id: henrik@grimler.se X-Authenticated-Sender: cpsrv07.misshosting.com: henrik@grimler.se X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220108_135947_816652_9299DC7E X-CRM114-Status: GOOD ( 13.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org I am trying to add support in mainline for a tablet based on Exynos 5420 (Samsung Galaxy Tab S). For this tablet, CCI has to be disabled, and with that the device then hangs during exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0), which is run in the cpu_boot secure-firmware function. If the call is skipped, then four out of eight CPUs are brought up, which is the same as on exynos5420-arndale-octa [1] which also has disabled CCI. Based on Samsung's kernel sources, it seems like the SMC_CMD_CPU1BOOT call is only needed on Exynos4 and Exynos5250 devices [2], on other SoC models the call is skipped. To test if the call seem to do anything, I booted exynos5422-odroid-xu4 with disabled CCI and with or without the SMC_CMD_CPU1BOOT call. The result in both cases were the same: the first four CPUs were brought up. To further investigate if the SMC_CMD_CPU1BOOT call is handled we need to dig into the trustzone firmware. The trustzone firmware used in exynos5410-odroid-xu has been to a large part reverse engineered [3], and by comparing with sboot/tzsw in mainline devices it can be seen that similar trustzone firmware is used in several. Out of those, the SMC_CMD_CPU1BOOT call seem to be only handled in Exynos4 devices. Here's a table summarising the findings for the mainline devices that have a secure-firmware node (Exynos3 devices omitted). An extra 4212 device has been included to get a datapoint for that SoC as well. .----------------------.--------------.--------------.--------------. | Device (exynos-) | Similar tzsw | CPU1BOOT SMC | sboot/tzsw | | | to 5410? | handled? | source | .----------------------.--------------.--------------.--------------. 4212 galaxy tab 3 | yes | yes | T310XXSBQB2 4412-i9300 | yes | yes | I9300XXUGPE1 4412-i9305 | yes | yes | I9305XXUFPB1 4412-itop-elite | not checked | | 4412-n710x | not checked | | 4412-odroid{x,x2,u3} | yes | yes | wiki.odroid.com/_media/en/boot.tar.gz 4412-origen | no | don't know | Linaro's origen hwpack 20130130 4412-p4note-n8010 | not checked | | 4412-trats2 | not checked | | 5410-odroidxu | yes | no | github.com/hsnaves/exynos5410-firmware 5410-smdk5410 | not checked | | 5420-arndale-octa | yes | no | Linaro's arndale-octa hwpack 20140323 5422-odroid-xu{3,4} | yes | no | Hardkernel's u-boot 2020.01 branch "Similar tzsw" above means that the secure monitor calls seem to be handled in the same way as for exynos5410-odroid-xu, in a quite easy-to-spot function (see patch for what it looks like). For the tablet I am actually interested in, the trustzone firmware looks very different, and I have not been able to locate where/how the secure monitor calls are handled. Nevertheless, since the call seem to only be handled in trustzone firmware for Exynos4, and since exynos5422-odroid-xu4 behaves the same with or without this secure monitor call, I *think* it should be safe to only run it on the devices where we know that it is handled. [1] https://krzk.eu/#/builders/32 [2] https://github.com/LineageOS/android_kernel_samsung_exynos5420/blob/cm-14.1/arch/arm/mach-exynos/platsmp.c#L225-L229 [3] https://github.com/hsnaves/exynos5410-firmware Henrik Grimler (1): ARM: exynos: only do SMC_CMD_CPU1BOOT call on Exynos4 arch/arm/mach-exynos/firmware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) base-commit: 3e4d9032d1a223488456f82d05cfe5519962f344 prerequisite-patch-id: f0f30752eb24b3515eee0a8d7bcf043e2cb084ad