From patchwork Tue Jul 31 23:04:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Chemparathy X-Patchwork-Id: 1262351 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 6EB4FDF26F for ; Tue, 31 Jul 2012 23:08:34 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SwLVw-0005V0-9h; Tue, 31 Jul 2012 23:06:08 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SwLVN-0005Pk-MB for linux-arm-kernel@lists.infradead.org; Tue, 31 Jul 2012 23:05:34 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6VN5L24014926; Tue, 31 Jul 2012 18:05:21 -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 q6VN5LJ4000312; Tue, 31 Jul 2012 18:05:21 -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; Tue, 31 Jul 2012 18:05:21 -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 q6VN5Loc012405; Tue, 31 Jul 2012 18:05:21 -0500 Received: from a0875269 by ares-ubuntu.am.dhcp.ti.com with local (Exim 4.76) (envelope-from ) id 1SwLVA-0007PC-VV; Tue, 31 Jul 2012 19:05:21 -0400 From: Cyril Chemparathy To: , Subject: [PATCH 18/22] ARM: add virt_to_idmap for interconnect aliasing Date: Tue, 31 Jul 2012 19:04:54 -0400 Message-ID: <1343775898-28345-19-git-send-email-cyril@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343775898-28345-1-git-send-email-cyril@ti.com> References: <1343775898-28345-1-git-send-email-cyril@ti.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 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] Cc: linux@arm.linux.org.uk, arnd@arndb.de, nico@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, 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 0c1b396..4bf47ed 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -231,6 +231,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);