From patchwork Tue Jan 28 13:28:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 3546871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B2D539F382 for ; Tue, 28 Jan 2014 13:29:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99FED20149 for ; Tue, 28 Jan 2014 13:29:13 +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 E5FA520131 for ; Tue, 28 Jan 2014 13:29:11 +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 1W88it-0005R1-23; Tue, 28 Jan 2014 13:29:03 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W88iq-00062V-N5; Tue, 28 Jan 2014 13:29:00 +0000 Received: from moutng.kundenserver.de ([212.227.17.10]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W88im-000623-7R for linux-arm-kernel@lists.infradead.org; Tue, 28 Jan 2014 13:28:58 +0000 Received: from axis700.grange (dslb-178-009-253-092.pools.arcor-ip.net [178.9.253.92]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0MAo9v-1W0gz936k7-00BsNy; Tue, 28 Jan 2014 14:28:28 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 51A4240BB4; Tue, 28 Jan 2014 14:28:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 41C2E40BB3; Tue, 28 Jan 2014 14:28:28 +0100 (CET) Date: Tue, 28 Jan 2014 14:28:28 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Michal Simek Subject: Re: [Q] block / zynq: DMA bouncing In-Reply-To: <52E69E1E.3020202@monstr.eu> Message-ID: References: <20140127170230.GQ15937@n2100.arm.linux.org.uk> <52E69B4E.5010604@monstr.eu> <20140127175231.GU15937@n2100.arm.linux.org.uk> <52E69E1E.3020202@monstr.eu> MIME-Version: 1.0 X-Provags-ID: V02:K0:dk0FPyzgW7cMncqBDHWE90QTMu7YX1VuT+GU5mgw47q 6FcIJdW7CuDBWtxWbb9V2aDnsTzlXLRJ7mBwBalV29TNmgssD8 o9Qli3T58C8Ojk4bPS6ehvhrLDPCg+lr5UWYTAIexwQYQ0osRh zj4jUEzBV6A1t9pVwHLVpMHwhgo+pYw423PpbgjUZK83GhqE/Y pAs/iNj9ked6SrrPM67frycRG/783Y/smktmr6jieMKg11oON0 zRD22F0mV2676/Z3o8DUCDRHTrsj+YtZL6IwowYqNa1SH1VjtL L7jDFHXXU/H0X7L9BzFjtrbvXz8b8wSWfgplPH8p+Sq7qrm41F CfwMYq1SxfN7BZNDuNqiPPHkJ7QbCyAQeOlNiVKZoA+9+lM53Q BabAcQZrcAnbA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140128_082856_489853_FB4DCF49 X-CRM114-Status: GOOD ( 23.59 ) X-Spam-Score: -2.4 (--) Cc: Russell King - ARM Linux , 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: , 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.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, 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 Hi Michal, (trimmed CC a bit) On Mon, 27 Jan 2014, Michal Simek wrote: > On 01/27/2014 06:52 PM, Russell King - ARM Linux wrote: > > On Mon, Jan 27, 2014 at 06:45:50PM +0100, Michal Simek wrote: > >> Why 0x4000? IRC Linux for ARM is using space for any purpose. > >> Russell knows this much better than I. > > > > Probably because as the kernel is loaded at 0x8000, it will place the > > swapper page table at 0x4000, thus covering from 0x4000 upwards. > > Ah yeah swapper. > > > > > Thus, the majority of your un-DMA-able memory will be kernel text or > > swapper page tables. > > Yes, exactly. > 0x0 - 0x4000 - reserving not to be used by DMA > 0x4000 - 0x8000 swapper page table > 0x8000 - 0x80000 kernel text + up Maybe you could submit something like the attached patch upstream. I'm not sure shom you'd like to put as its original author. I put John Linn there as he originally authored commit 5b9f3f2ac8a3e4edae9de7b855f25f757884d84c from Xilinx tree with the same description, as the attached patch. Unfortunately, that commit didn't have an Sob. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ From d00684a6d899048938086c11185c89f082b881e0 Mon Sep 17 00:00:00 2001 From: John Linn Date: Tue, 28 Jan 2014 14:06:45 +0100 Subject: [PATCH] Xilinx: ARM: BSP: prevent DMA into lower memory The DMA zone from 2.6.39 is no longer supported such that a new method was needed. The old method was lost in the move to 3.0 and USB was seeing failures. Signed-off-by: Michal Simek Signed-off-by: Guennadi Liakhovetski --- arch/arm/mach-zynq/common.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 9a7bd13..2d51453 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,22 @@ void __iomem *zynq_scu_base; +/** + * zynq_memory_init() - Initialize special memory + * + * We need to stop things allocating the low memory as DMA can't work in + * the 1st 512K of memory. Using reserve vs remove is not totally clear yet. + */ +static void __init zynq_memory_init(void) +{ + /* + * Reserve the 0-0x4000 addresses (before page tables and kernel) + * which can't be used for DMA + */ + if (!__pa(PAGE_OFFSET)) + memblock_reserve(0, 0x4000); +} + static struct of_device_id zynq_of_bus_ids[] __initdata = { { .compatible = "simple-bus", }, {} @@ -113,5 +130,6 @@ DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") .init_machine = zynq_init_machine, .init_time = zynq_timer_init, .dt_compat = zynq_dt_match, + .reserve = zynq_memory_init, .restart = zynq_system_reset, MACHINE_END -- 1.7.2.5