From patchwork Thu Oct 18 13:47:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 1611201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id DFABBDFB34 for ; Thu, 18 Oct 2012 13:50:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TOqSB-0003Fw-JA; Thu, 18 Oct 2012 13:48:03 +0000 Received: from mail-ob0-f177.google.com ([209.85.214.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TOqS8-0003FW-PC for linux-arm-kernel@lists.infradead.org; Thu, 18 Oct 2012 13:48:01 +0000 Received: by mail-ob0-f177.google.com with SMTP id wd20so8894537obb.36 for ; Thu, 18 Oct 2012 06:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=GltQ5aYwslkLwOCDjtNkUQDgV95vxt4hoFtRc90HAxw=; b=lmlSzQPBzH7HAbupXViq/RKh35IV6VS6jxmoj60603oGMYrUreOUfBdm4zq6RihFf/ Q7eaHE14AT+4SHFb4+BMo/uAMmziu3Qal1EP44nXXW7aM5EE1YLHprTO0PQqObdbNdEB U4PESWxYGYbhcd51qJVp2eOZYJsyAOnnVs9F235BaMX0DirFadLk6dUm0mRTN99jGg6k fxk/ZeI0uOZb7RAp6Jbp2uGs2jKGDfmN/cPY/hKWgJRHTmMPbzYlr4oZVZ/YOPQxRWmO ZhDNRVc5NjbfehVeE/t5/vfjHkFJtI1ZKPOB/Y8FWC2USsiS0k5jBRTBmK0BvlHjPRy/ MIZA== Received: by 10.60.20.234 with SMTP id q10mr18927505oee.32.1350568078405; Thu, 18 Oct 2012 06:47:58 -0700 (PDT) Received: from [192.168.1.103] (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPS id t1sm11630142oee.7.2012.10.18.06.47.57 (version=SSLv3 cipher=OTHER); Thu, 18 Oct 2012 06:47:57 -0700 (PDT) Message-ID: <5080088C.9090607@gmail.com> Date: Thu, 18 Oct 2012 08:47:56 -0500 From: Rob Herring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Stephen Warren Subject: Re: [PATCH V2 3/3] ARM: tegra: move debug-macro.S to include/debug References: <1350328024-30485-1-git-send-email-swarren@wwwdotorg.org> <1350328024-30485-3-git-send-email-swarren@wwwdotorg.org> <507EC303.1080000@gmail.com> <507EDB37.1060102@wwwdotorg.org> <507F1F31.2060503@wwwdotorg.org> In-Reply-To: <507F1F31.2060503@wwwdotorg.org> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (robherring2[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Olof Johansson , linux-tegra@vger.kernel.org, Stephen Warren , linux-arm-kernel@lists.infradead.org, Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 10/17/2012 04:12 PM, Stephen Warren wrote: > On 10/17/2012 10:22 AM, Stephen Warren wrote: snip > That implies we really do need to keep the two pieces of code completely > in sync, so a shared header is the right way to go. It also implies that > having duplicate mappings of the same physical address doesn't cause any > immediate obvious catastrophic problems. > > Ways we might avoid files in arch/arm/include/debug having to use > relative include paths to pick up that header are: > > a) Move mach-${mach}/include/mach/iomap.h to iomap-${mach}.h in some > standard include path. > Your goal should be to get rid of iomap.h though... > b) Rework debug-macro.S so that it isn't an include file, but rather a > regular top-level file. In other words, rather than compiling > arch/arm/kernel/debug.S, and having that #include DEBUG_LL_INCLUDE, > instead compile DEBUG_LL_SOURCE (i.e. arch/arm/mach-${mach}/debug.S by > default), and have that #include any common parts (e.g. implementation > of printhex8). This has benefits of: > > b1) arch/arm/mach-${mach}/debug.S is in the mach directory that owns it, > rather than having them all dumped into a common location. > > b2) Can use #include "iomap.h", a non-relative include, to pick up the > shared header > > b3) Perhaps we can simplify the current debug.S e.g. have a common > debug-semihosting.S that contains the semihosting stuff, and only > include that from mach-*/debug.S if that machine uses semihosting, or > similar? > > (b) seems like a lot of work. I don't see any advantage of (a) over just > using the relative include. Agreed. Here is what I mentioned previously. This removes the static mapping from the platforms. This is untested and probably breaks on different DEBUG_LL options. For now, platforms call debug_ll_io_init, but once all platforms are converted, this can be called from devicemaps_init. diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h index 195ac2f..2ece92c 100644 --- a/arch/arm/include/asm/mach/map.h +++ b/arch/arm/include/asm/mach/map.h @@ -40,6 +40,9 @@ extern void iotable_init(struct map_desc *, int); extern void vm_reserve_area_early(unsigned long addr, unsigned long size, void *caller); +extern void debug_ll_addr(unsigned long *paddr, unsigned long *vaddr); +extern void debug_ll_io_init(void); + struct mem_type; extern const struct mem_type *get_mem_type(unsigned int type); /* diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S index 66f711b..93883ed 100644 --- a/arch/arm/kernel/debug.S +++ b/arch/arm/kernel/debug.S @@ -100,6 +100,13 @@ ENTRY(printch) b 1b ENDPROC(printch) +ENTRY(debug_ll_addr) + addruart r2, r3, ip + str r2, [r0] + str r3, [r1] + mov pc, lr +ENDPROC(debug_ll_addr) + #else ENTRY(printascii) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 941dfb9..1c8c7be 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -876,6 +876,20 @@ static void __init pci_reserve_io(void) #define pci_reserve_io() do { } while (0) #endif +void __init debug_ll_io_init(void) +{ + struct map_desc map; + + if (!IS_ENABLED(CONFIG_DEBUG_LL)) + return; + + debug_ll_addr(&map.pfn, &map.virtual); + map.pfn = __phys_to_pfn(map.pfn); + map.length = PAGE_SIZE; + map.type = MT_DEVICE; + create_mapping(&map); +} + static void * __initdata vmalloc_min = (void *)(VMALLOC_END - (240 << 20) - VMALLOC_OFFSET);