Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753019AbcCKWwO (ORCPT ); Fri, 11 Mar 2016 17:52:14 -0500 Received: from host.buserror.net ([209.198.135.123]:34224 "EHLO host.buserror.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbcCKWwM (ORCPT ); Fri, 11 Mar 2016 17:52:12 -0500 Date: Fri, 11 Mar 2016 16:51:54 -0600 From: Scott Wood To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Message-ID: <20160311225154.GA30872@home.buserror.net> References: <3c627354c920c564c01cbdb1f960f3e2ed9eac10.1455032446.git.christophe.leroy@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3c627354c920c564c01cbdb1f960f3e2ed9eac10.1455032446.git.christophe.leroy@c-s.fr> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 75.72.173.242 X-SA-Exim-Mail-From: oss@buserror.net X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -15 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Subject: Re: [v8,07/23] powerpc/8xx: Fix vaddr for IMMR early remap X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:57:07 +0000) X-SA-Exim-Scanned: Yes (on host.buserror.net) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2476 Lines: 65 On Tue, Feb 09, 2016 at 05:08:00PM +0100, Christophe Leroy wrote: > Memory: 124428K/131072K available (3748K kernel code, 188K rwdata, > 648K rodata, 508K init, 290K bss, 6644K reserved) > Kernel virtual memory layout: > * 0xfffdf000..0xfffff000 : fixmap > * 0xfde00000..0xfe000000 : consistent mem > * 0xfddf6000..0xfde00000 : early ioremap > * 0xc9000000..0xfddf6000 : vmalloc & ioremap > SLUB: HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 > > Today, IMMR is mapped 1:1 at startup > > Mapping IMMR 1:1 is just wrong because it may overlap with another > area. On most mpc8xx boards it is OK as IMMR is set to 0xff000000 > but for instance on EP88xC board, IMMR is at 0xfa200000 which > overlaps with VM ioremap area > > This patch fixes the virtual address for remapping IMMR with the fixmap > regardless of the value of IMMR. > > The size of IMMR area is 256kbytes (CPM at offset 0, security engine > at offset 128k) so a 512k page is enough > > Signed-off-by: Christophe Leroy > --- > v2: no change > v3: Using fixmap instead of fixed address > v4: Fix a wrong #if notified by kbuild robot > v5: no change > v6: no change > v8: no change > > arch/powerpc/include/asm/fixmap.h | 7 +++++++ > arch/powerpc/kernel/asm-offsets.c | 8 ++++++++ > arch/powerpc/kernel/head_8xx.S | 11 ++++++----- > arch/powerpc/mm/mmu_decl.h | 7 +++++++ > arch/powerpc/sysdev/cpm_common.c | 15 ++++++++++++--- > 5 files changed, 40 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h > index 90f604b..d7dd8fb 100644 > --- a/arch/powerpc/include/asm/fixmap.h > +++ b/arch/powerpc/include/asm/fixmap.h > @@ -51,6 +51,13 @@ enum fixed_addresses { > FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ > FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, > #endif > +#ifdef CONFIG_PPC_8xx > + /* For IMMR we need an aligned 512K area */ > + FIX_IMMR_START, > + FIX_IMMR_TOP = (FIX_IMMR_START - 1 + ((512 * 1024) / PAGE_SIZE)) & > + ~(((512 * 1024) / PAGE_SIZE) - 1), > + FIX_IMMR_BASE = FIX_IMMR_TOP - 1 + ((512 * 1024) / PAGE_SIZE), > +#endif > /* FIX_PCIE_MCFG, */ > __end_of_fixed_addresses > }; This doesn't look correct -- shouldn't the last thing in the 8xx ifdef be the last byte of the IMMR, so that any subsequent fixmap entry would start at the correct location? Also, can standard alignment macros be used? -Scott