From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbbEXPz5 (ORCPT ); Sun, 24 May 2015 11:55:57 -0400 Received: from smtp.csie.ntu.edu.tw ([140.112.30.61]:33244 "EHLO smtp.csie.ntu.edu.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbbEXPzv (ORCPT ); Sun, 24 May 2015 11:55:51 -0400 MIME-Version: 1.0 In-Reply-To: <20150520100831.GE4004@lukather> References: <1431583811-25780-1-git-send-email-wens@csie.org> <1431583811-25780-8-git-send-email-wens@csie.org> <20150520100831.GE4004@lukather> From: Chen-Yu Tsai Date: Sun, 24 May 2015 23:55:22 +0800 Message-ID: Subject: Re: [linux-sunxi] Re: [RFC 7/7] ARM: dts: sun9i: Add secure SRAM node used for MCPM SMP hotplug To: Maxime Ripard Cc: Chen-Yu Tsai , Nicolas Pitre , Dave Martin , linux-arm-kernel , linux-kernel , linux-sunxi , =?UTF-8?Q?Heiko_St=C3=BCbner?= Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2015 at 6:08 PM, Maxime Ripard wrote: > On Thu, May 14, 2015 at 02:10:11PM +0800, Chen-Yu Tsai wrote: >> The A80 stores some magic flags in a portion of the secure SRAM. The >> BROM jumps directly to the software entry point set by the SMP code >> if the flags are set. This is required for CPU0 hotplugging. >> >> Signed-off-by: Chen-Yu Tsai >> --- >> arch/arm/boot/dts/sun9i-a80.dtsi | 20 ++++++++++++++++++++ >> 1 file changed, 20 insertions(+) >> >> diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi >> index 1507bd2a88f0..0695215634d4 100644 >> --- a/arch/arm/boot/dts/sun9i-a80.dtsi >> +++ b/arch/arm/boot/dts/sun9i-a80.dtsi >> @@ -366,6 +366,26 @@ >> */ >> ranges = <0 0 0 0x20000000>; >> >> + sram_b: sram@00020000 { >> + /* 256 KiB secure SRAM at 0x20000 */ >> + compatible = "mmio-sram"; >> + reg = <0x00020000 0x40000>; >> + > > We should probably add a property to that SRAM to tell the driver not > to access it if we're not booted in secure mode. (CC-ing Heiko...) That kind of puts architecture (ARM) dependent code into a platform driver. Furthermore, AFAIK there isn't a safe way to check if we're in secure mode or not. Checking SCR raises an undefined instruction exception in non-secure mode. Can the kernel handle that? I really don't understand this bit well. > Otherwise, bad things might happen. The kernel (or rather the bootloader) boots in secure mode by default, and we don't have any bootloader support to boot into non-secure mode ATM. Couldn't we have the bootloader mark the SRAM as disabled when booting into non-secure when we add that support? ChenYu