From patchwork Tue Feb 18 17:34:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 3673561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AFAD1BF13A for ; Tue, 18 Feb 2014 17:36:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 500392016C for ; Tue, 18 Feb 2014 17:36:22 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2ACB02015E for ; Tue, 18 Feb 2014 17:36:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFoa5-0004UU-HF; Tue, 18 Feb 2014 17:35:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFoZs-0007Kn-If; Tue, 18 Feb 2014 17:35:28 +0000 Received: from galois.linutronix.de ([2001:470:1f0b:db:abcd:42:0:1]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFoZp-0007Id-EJ for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2014 17:35:26 +0000 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1WFoZS-0006wF-D8; Tue, 18 Feb 2014 18:35:02 +0100 From: Sebastian Andrzej Siewior To: Dinh Nguyen Subject: [PATCH] arm: socfpga: reserve the region at start of phys mem Date: Tue, 18 Feb 2014 18:34:57 +0100 Message-Id: <1392744897-6384-1-git-send-email-bigeasy@linutronix.de> X-Mailer: git-send-email 1.9.0.rc3 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140218_123525_728049_1A7C398A X-CRM114-Status: GOOD ( 10.29 ) X-Spam-Score: -2.5 (--) Cc: Sebastian Andrzej Siewior , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SMP bringup code copies trampline code to the physical location 0x0. If somebody allocated memory from this location then it will be overwritten. This patch reserves the few bytes so that it won't be used by the memory allocator. Signed-off-by: Sebastian Andrzej Siewior --- arch/arm/mach-socfpga/socfpga.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index a9050e6..2ba992a 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -315,6 +316,17 @@ static void __init socfpga_cyclone5_init(void) socfpga_soc_device_init(); } +static void __init socfmpga_smp_reserve(void) +{ +#ifdef CONFIG_SMP + int trampoline_size = &secondary_trampoline_end - &secondary_trampoline; + int ret; + + ret = memblock_reserve(0, trampoline_size); + WARN_ON(ret); +#endif +} + static const char *altera_dt_match[] = { "altr,socfpga", NULL @@ -327,4 +339,5 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA") .init_machine = socfpga_cyclone5_init, .restart = socfpga_cyclone5_restart, .dt_compat = altera_dt_match, + .reserve = socfmpga_smp_reserve, MACHINE_END