From patchwork Tue Dec 11 16:06:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Vincent_Stehl=C3=A9?= X-Patchwork-Id: 205268 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BEA412C007C for ; Wed, 12 Dec 2012 03:07:13 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E9A314A167; Tue, 11 Dec 2012 17:07:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mrTLoQx3n6y3; Tue, 11 Dec 2012 17:07:07 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C0D84A15B; Tue, 11 Dec 2012 17:07:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A09B84A146 for ; Tue, 11 Dec 2012 17:06:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8kATnPRgtQrt for ; Tue, 11 Dec 2012 17:06:58 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id 4ED334A138 for ; Tue, 11 Dec 2012 17:06:57 +0100 (CET) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id qBBG6swx007978; Tue, 11 Dec 2012 10:06:54 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qBBG6smf024675; Tue, 11 Dec 2012 10:06:54 -0600 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Tue, 11 Dec 2012 10:06:54 -0600 Received: from svrhermes.tif.ti.com (svrhermes.tif.ti.com [137.167.130.169]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id qBBG6sr1030701; Tue, 11 Dec 2012 10:06:54 -0600 Received: from unb0919505.tif.ti.com (unb0919505.tif.ti.com [137.167.100.142]) by svrhermes.tif.ti.com (Postfix) with ESMTP id D359237011; Tue, 11 Dec 2012 17:06:53 +0100 (MET) Received: from vstehle by unb0919505.tif.ti.com with local (Exim 4.76) (envelope-from ) id 1TiSM9-0003c1-Bu; Tue, 11 Dec 2012 17:06:53 +0100 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= To: Date: Tue, 11 Dec 2012 17:06:21 +0100 Message-ID: <1355241981-13752-3-git-send-email-v-stehle@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355241981-13752-1-git-send-email-v-stehle@ti.com> References: <50C7549D.5080907@ti.com> <1355241981-13752-1-git-send-email-v-stehle@ti.com> MIME-Version: 1.0 Cc: trini@ti.com Subject: [U-Boot] [PATCH v3 2/2] ARM: OMAP5: redefine arm_setup_identity_mapping X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de We introduce an OMAP5 specific version of arm_setup_identity_mapping(), which makes the first page of the identity mapping invalid. We want to unmap the region near address zero on HS OMAP devices, to avoid speculative accesses. Accessing this region causes security violations, which we want to avoid. Signed-off-by: Vincent Stehlé Cc: Tom Rini --- Changes for v3: - Use definition of __arm_setup_identity_mapping() from asm/cache.h Changes for v2: - Fix missing page_table argument - Add extern definition to fix compilation warning arch/arm/cpu/armv7/omap5/Makefile | 1 + arch/arm/cpu/armv7/omap5/cache-cp15.c | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 arch/arm/cpu/armv7/omap5/cache-cp15.c diff --git a/arch/arm/cpu/armv7/omap5/Makefile b/arch/arm/cpu/armv7/omap5/Makefile index 9b261c4..49c454c 100644 --- a/arch/arm/cpu/armv7/omap5/Makefile +++ b/arch/arm/cpu/armv7/omap5/Makefile @@ -29,6 +29,7 @@ COBJS += hwinit.o COBJS += clocks.o COBJS += emif.o COBJS += sdram.o +COBJS += cache-cp15.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/omap5/cache-cp15.c b/arch/arm/cpu/armv7/omap5/cache-cp15.c new file mode 100644 index 0000000..8e4388c --- /dev/null +++ b/arch/arm/cpu/armv7/omap5/cache-cp15.c @@ -0,0 +1,45 @@ +/* + * (C) Copyright 2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * (C) Copyright 2012 + * Vincent Stehlé, Texas Instruments, v-stehle@ti.com. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +/* OMAP5 specific function to set up the identity mapping. */ +void arm_setup_identity_mapping(u32 *page_table) +{ + /* + * Perform default mapping, which sets up an identity-mapping for all + * 4GB, rw for everyone. + */ + __arm_setup_identity_mapping(page_table); + + /* + * First page (starting at 0x0) is made invalid to avoid speculative + * accesses in secure rom. + * TODO: use second level descriptors for finer grained mapping. + */ + page_table[0] = 0; +}