From patchwork Tue Jul 24 01:09:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Chemparathy X-Patchwork-Id: 1415551 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 9606EDFFCF for ; Thu, 6 Sep 2012 15:03:31 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9dWS-0002Ev-QR; Thu, 06 Sep 2012 14:57:39 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1StTdC-0002Z6-AD for linux-arm-kernel@lists.infradead.org; Tue, 24 Jul 2012 01:10:20 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6O19eWM030396; Mon, 23 Jul 2012 20:09:40 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6O19eZ9010275; Mon, 23 Jul 2012 20:09:40 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Mon, 23 Jul 2012 20:09:39 -0500 Received: from ares-ubuntu.am.dhcp.ti.com (ares-ubuntu.am.dhcp.ti.com [158.218.103.17]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6O19drX024608; Mon, 23 Jul 2012 20:09:39 -0500 Received: from a0875269 by ares-ubuntu.am.dhcp.ti.com with local (Exim 4.76) (envelope-from ) id 1StTd5-0002Ui-MW; Mon, 23 Jul 2012 21:09:39 -0400 From: Cyril Chemparathy To: Subject: [RFC 18/23] ARM: add virt_to_idmap for interconnect aliasing Date: Mon, 23 Jul 2012 21:09:20 -0400 Message-ID: <1343092165-9470-19-git-send-email-cyril@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343092165-9470-1-git-send-email-cyril@ti.com> References: <1343092165-9470-1-git-send-email-cyril@ti.com> MIME-Version: 1.0 X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.41 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Mailman-Approved-At: Thu, 06 Sep 2012 10:43:37 -0400 Cc: nico@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, Vitaly Andrianov , Cyril Chemparathy 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 From: Vitaly Andrianov On some PAE systems (e.g. TI Keystone), memory is above the 32-bit addressible limit, and the interconnect provides an aliased view of parts of physical memory in the 32-bit addressible space. This alias is strictly for boot time usage, and is not otherwise usable because of coherency limitations. On such systems, the idmap mechanism needs to take this aliased mapping into account. This patch introduces a virt_to_idmap() macro, which can be used on such sub-architectures to represent the interconnect supported boot time alias. Most other systems would leave this macro untouched, i.e., do a simply virt_to_phys() and nothing more. Signed-off-by: Vitaly Andrianov Signed-off-by: Cyril Chemparathy --- arch/arm/include/asm/memory.h | 9 +++++++++ arch/arm/kernel/smp.c | 4 ++-- arch/arm/mm/idmap.c | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index c330a23..b6b203c 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -235,6 +235,15 @@ static inline void *phys_to_virt(phys_addr_t x) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) /* + * These are for systems that have a hardware interconnect supported alias of + * physical memory for idmap purposes. Most cases should leave these + * untouched. + */ +#ifndef virt_to_idmap +#define virt_to_idmap(x) virt_to_phys(x) +#endif + +/* * Virtual <-> DMA view memory address translations * Again, these are *only* valid on the kernel direct mapped RAM * memory. Use of these is *deprecated* (and that doesn't mean diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index e41e1be..cce630c 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -72,10 +72,10 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) */ secondary_data.stack = task_stack_page(idle) + THREAD_START_SP; - pgdir = virt_to_phys(idmap_pgd); + pgdir = virt_to_idmap(idmap_pgd); secondary_data.pgdir = pgdir >> ARCH_PGD_SHIFT; - pgdir = virt_to_phys(swapper_pg_dir); + pgdir = virt_to_idmap(swapper_pg_dir); secondary_data.swapper_pg_dir = pgdir >> ARCH_PGD_SHIFT; __cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data)); diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index ab88ed4..919cb6e 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c @@ -85,8 +85,8 @@ static int __init init_static_idmap(void) return -ENOMEM; /* Add an identity mapping for the physical address of the section. */ - idmap_start = virt_to_phys((void *)__idmap_text_start); - idmap_end = virt_to_phys((void *)__idmap_text_end); + idmap_start = virt_to_idmap((void *)__idmap_text_start); + idmap_end = virt_to_idmap((void *)__idmap_text_end); pr_info("Setting up static identity map for 0x%llx - 0x%llx\n", (long long)idmap_start, (long long)idmap_end);