From patchwork Fri Dec 20 07:43:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hao X-Patchwork-Id: 303934 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id EFA622C03A5 for ; Fri, 20 Dec 2013 18:44:34 +1100 (EST) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2DE5C2C020A for ; Fri, 20 Dec 2013 18:44:05 +1100 (EST) Received: by mail-pa0-f49.google.com with SMTP id kx10so2282165pab.36 for ; Thu, 19 Dec 2013 23:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=pjeNiV91TseWbfxXszIteL+N49MJTwtswX1SrgmERsg=; b=yGj5cScNAT1NqMcwjV5xTBW5rG4SQQomLxLRiRfEutad14dpSOt5p3e489iemcOMgd ldFAv/cpgjSNzkqBw2U4ugqmoCZeag0U+WGbq0qXperWpt1v8szYK4OgoBtnHuEULtf3 z1gs3Z4RwuIafICNwARqSpNg41mwuF2/UAqsDZq6BGvdNxxr+5BlXLJA/QY2KNnmPJKq PL6GOmvTANk1uINCQC46NShBVZtpzSneGShpEDtW4sU/zzXxGtEXKhiiPGzk1E/7VeKY qCUA4urdJKFP+x1GmFq3MVLKylPc/itC6Pdxr+TxB4kRUHpNoXFYt7LH84hVt580NnAs P1/A== X-Received: by 10.68.239.70 with SMTP id vq6mr6734249pbc.152.1387525442486; Thu, 19 Dec 2013 23:44:02 -0800 (PST) Received: from pek-khao-d1.corp.ad.wrs.com ([1.202.252.122]) by mx.google.com with ESMTPSA id sx8sm16054180pab.5.2013.12.19.23.43.49 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Dec 2013 23:44:00 -0800 (PST) Date: Fri, 20 Dec 2013 15:43:39 +0800 From: Kevin Hao To: Scott Wood Subject: Re: [v3, 3/7] powerpc: enable the relocatable support for the fsl booke 32bit kernel Message-ID: <20131220074339.GA23977@pek-khao-d1.corp.ad.wrs.com> References: <1375838315-27797-4-git-send-email-haokexin@gmail.com> <20131218234825.GA6959@home.buserror.net> MIME-Version: 1.0 In-Reply-To: <20131218234825.GA6959@home.buserror.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: linuxppc X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Dec 18, 2013 at 05:48:25PM -0600, Scott Wood wrote: > On Wed, Aug 07, 2013 at 09:18:31AM +0800, Kevin Hao wrote: > > This is based on the codes in the head_44x.S. The difference is that > > the init tlb size we used is 64M. With this patch we can only load the > > kernel at address between memstart_addr ~ memstart_addr + 64M. We will > > fix this restriction in the following patches. > > Which following patch fixes the restriction? With all seven patches > applied, I was still only successful booting within 64M of memstart_addr. There is bug in this patch series when booting above the 64M. It seems that I missed to test this previously. Sorry for that. With the following change I can boot the kernel at 0x5000000. I will do more test and then create a new spin to merge this change and rebase on the latest kernel. Thanks for the review. Kevin > > -Scott diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 048d716ae706..ce0c7d7db6c3 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c @@ -171,11 +171,10 @@ unsigned long calc_cam_sz(unsigned long ram, unsigned long virt, return 1UL << camsize; } -unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx) +static unsigned long map_mem_in_cams_addr(phys_addr_t phys, unsigned long virt, + unsigned long ram, int max_cam_idx) { int i; - unsigned long virt = PAGE_OFFSET; - phys_addr_t phys = memstart_addr; unsigned long amount_mapped = 0; /* Calculate CAM values */ @@ -195,6 +194,14 @@ unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx) return amount_mapped; } +unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx) +{ + unsigned long virt = PAGE_OFFSET; + phys_addr_t phys = memstart_addr; + + return map_mem_in_cams_addr(phys, virt, ram, max_cam_idx); +} + #ifdef CONFIG_PPC32 #if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS) @@ -289,7 +296,11 @@ notrace void __init relocate_init(u64 dt_ptr, phys_addr_t start) is_second_reloc = 1; n = switch_to_as1(); /* map a 64M area for the second relocation */ - map_mem_in_cams(0x4000000UL, CONFIG_LOWMEM_CAM_NUM); + if (memstart_addr > start) + map_mem_in_cams(0x4000000, CONFIG_LOWMEM_CAM_NUM); + else + map_mem_in_cams_addr(start, PAGE_OFFSET - offset, + 0x4000000, CONFIG_LOWMEM_CAM_NUM); restore_to_as0(n, offset, __va(dt_ptr)); /* We should never reach here */ panic("Relocation error");