From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 17 Feb 2015 14:06:55 -0700 Subject: [U-Boot] [PATCH v2 11/12] tegra124: Reserve secure RAM using MC_SECURITY_CFG{0, 1}_0 In-Reply-To: <1a2463987464ef637b09316a4dbb440b7831b07e.1424091289.git.jan.kiszka@siemens.com> References: <1a2463987464ef637b09316a4dbb440b7831b07e.1424091289.git.jan.kiszka@siemens.com> Message-ID: <54E3AD6F.1000305@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 02/16/2015 05:54 AM, Jan Kiszka wrote: > From: Ian Campbell > > These registers can be used to prevent non-secure world from accessing a > megabyte aligned region of RAM, use them to protect the u-boot secure monitor > code. > > At first I tried to do this from s_init(), however this inexplicably causes > u-boot's networking (e.g. DHCP) to fail, while networking under Linux was fine. > > So instead I have added a new weak arch function protect_secure_section() > called from relocate_secure_section() and reserved the region there. This is > better overall since it defers the reservation until after the sec vs. non-sec > decision (which can be influenced by an envvar) has been made when booting the > os. > diff --git a/arch/arm/cpu/tegra-common/ap.c b/arch/arm/cpu/tegra-common/ap.c > +void protect_secure_section(void) > + writel(CONFIG_ARMV7_SECURE_BASE, &mc->mc_security_cfg0); > + writel(CONFIG_ARMV7_SECURE_RESERVE_SIZE>>20, &mc->mc_security_cfg1); Spaces around the >> ?