From patchwork Mon Jun 6 14:57:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 12870484 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 A165CC433EF for ; Mon, 6 Jun 2022 14:59:49 +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:References:In-Reply-To: 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: List-Owner; bh=GwZy45UC/hQJJ7yBpmllwtORvozuGp/E2UGbx3nuog8=; b=TNC3SvRPgJIM++ q96UBfbn+vU0UJdEVnQUpMA6cO9w46nPKhm9ediWoFPQmyF6xufA8VtKllZLEqqVIazKtDPcoDNle PjNPhdKuwAuy+vQnfHlCH0D/1GSGQRSnS9OJVWnwGMF3vdjf/sk0dNS+wd8IUl+2yTbPpPMFLpPwF 4MYylem9NLg6kqReBE2U7w8KQlSjQQ7Z5mRm/1dlx2UGza4B9rtVnRMmNWUNSH7E2qaE9ru2bzuA0 ylZscnryTIp2HJ4tgNuFrYaObaiQTxJ2mz4EurnEWOofd+gz8tXc4prscI4hSqZcArO1KeHlbbeMb uwUeD4aCg5kds17Bfy/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEBR-001d0K-Bb; Mon, 06 Jun 2022 14:58:21 +0000 Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEBN-001czF-Hk for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 14:58:19 +0000 Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3468BFF805; Mon, 6 Jun 2022 14:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1654527495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BdBrGx50GRyG3r2iXeGYuM3SEahX/F4l92MvsJio2dM=; b=XjnSLokHGUTArERJGLhtnibxg1snnzGnkfsUyoYRX1v6AXZ579VkSnaJeFqbCxavsH59FE hoN2tHLT15aPFGvDMKLWnq3k91TEvChLVd7n+hy+SeNhARtA12dmbQxIxroSK5xLsuEMTw lRa/PLirgi5mMeMJuPpHQqKEtrpMG41QKxldxoAxxC6CbxNLDBq0tt9Hpd0UMCa/tx7hiA K988esjV4EZjhGdP5b9+AKVC6+bTQFRKSi0PfEVAAxHJPZ10BSqxfgISOx6b50+LU81EA6 uPG6AX1icU4zK+e/4qqSJG+lNTZQFePgbjABkaZ9fmh3qkHpVCguqiaxKwRerQ== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Russell King , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Thomas Petazzoni Subject: [PATCH 1/2] ARM: at91: add sam_linux_is_in_normal_world() function Date: Mon, 6 Jun 2022 16:57:00 +0200 Message-Id: <20220606145701.185552-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606145701.185552-1-clement.leger@bootlin.com> References: <20220606145701.185552-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_075817_979324_6430560E X-CRM114-Status: GOOD ( 12.13 ) 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 Add sam_linux_is_in_normal_world() which allows to know if Linux is running in the normal world or not. This function is used by code which needs to differentiate the world in which Linux is running. Signed-off-by: Clément Léger --- arch/arm/mach-at91/sam_secure.c | 6 ++++++ arch/arm/mach-at91/sam_secure.h | 1 + 2 files changed, 7 insertions(+) diff --git a/arch/arm/mach-at91/sam_secure.c b/arch/arm/mach-at91/sam_secure.c index 2a01f7a7d13f..1ec8c8b9d119 100644 --- a/arch/arm/mach-at91/sam_secure.c +++ b/arch/arm/mach-at91/sam_secure.c @@ -27,6 +27,12 @@ struct arm_smccc_res sam_smccc_call(u32 fn, u32 arg0, u32 arg1) return res; } +bool sam_linux_is_in_normal_world(void) +{ + /* If optee has been detected, then we are running in normal world */ + return optee_available; +} + void __init sam_secure_init(void) { struct device_node *np; diff --git a/arch/arm/mach-at91/sam_secure.h b/arch/arm/mach-at91/sam_secure.h index 1e7d8b20ba1e..6d8c01f9c5f0 100644 --- a/arch/arm/mach-at91/sam_secure.h +++ b/arch/arm/mach-at91/sam_secure.h @@ -14,5 +14,6 @@ void __init sam_secure_init(void); struct arm_smccc_res sam_smccc_call(u32 fn, u32 arg0, u32 arg1); +bool sam_linux_is_in_normal_world(void); #endif /* SAM_SECURE_H */