From patchwork Fri Jun 21 23:48:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2765141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CDA9DC0AB1 for ; Sat, 22 Jun 2013 00:33:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D40EA201B7 for ; Sat, 22 Jun 2013 00:33:51 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0862201B3 for ; Sat, 22 Jun 2013 00:33:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqB7E-0001Jc-T8; Fri, 21 Jun 2013 23:51:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqB64-00006a-Aa; Fri, 21 Jun 2013 23:50:28 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqB4p-0008RB-OC for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2013 23:49:14 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5LNmh3d014968; Fri, 21 Jun 2013 18:48:43 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5LNmhCb005015; Fri, 21 Jun 2013 18:48:43 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Fri, 21 Jun 2013 18:48:42 -0500 Received: from ula0393909.am.dhcp.ti.com (ula0393909.am.dhcp.ti.com [158.218.103.117]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5LNmPJG025428; Fri, 21 Jun 2013 18:48:42 -0500 From: Santosh Shilimkar To: Subject: [PATCH 4/8] ARM: mm: Pass the constant as an argument to fixup_pv_table() Date: Fri, 21 Jun 2013 19:48:18 -0400 Message-ID: <1371858502-10083-5-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371858502-10083-1-git-send-email-santosh.shilimkar@ti.com> References: <1371858502-10083-1-git-send-email-santosh.shilimkar@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130621_194911_966127_4EDA3F9C X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -8.4 (--------) Cc: nicolas.pitre@linaro.org, linux@arm.linux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, r.sricharan@ti.com, Santosh Shilimkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current fixup_pv_table() API hardcoded the constant to be patched. Make that as an argument to fixup_pv_table() so that different type of instructions can be patched. This is preparatory patch to add the subsequent 64 bit patching. Signed-off-by: Sricharan R Signed-off-by: Santosh Shilimkar --- arch/arm/include/asm/memory.h | 2 ++ arch/arm/kernel/head.S | 3 +-- arch/arm/kernel/module.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 5944092..3d4f79c 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -175,6 +175,8 @@ extern phys_addr_t (*arch_virt_to_idmap) (unsigned long x); extern unsigned long __pv_phys_offset; +extern unsigned long __pv_offset; + #define PHYS_OFFSET __pv_phys_offset #define __pv_stub(from,to,instr,type) \ diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 45e8935..764e83b 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -604,11 +604,10 @@ ENDPROC(__fixup_a_pv_table) ENTRY(fixup_pv_table) stmfd sp!, {r4 - r7, lr} - ldr r2, 2f @ get address of __pv_phys_offset mov r3, #0 @ no offset mov r4, r0 @ r0 = table start add r5, r0, r1 @ r1 = table size - ldr r6, [r2, #4] @ get __pv_offset + mov r6, r2 @ get constant to be patched bl __fixup_a_pv_table ldmfd sp!, {r4 - r7, pc} ENDPROC(fixup_pv_table) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 1e9be5d..1ac071b 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -265,7 +265,7 @@ static const Elf_Shdr *find_mod_section(const Elf32_Ehdr *hdr, return NULL; } -extern void fixup_pv_table(const void *, unsigned long); +extern void fixup_pv_table(const void *, unsigned long, unsigned long); extern void fixup_smp(const void *, unsigned long); int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, @@ -319,7 +319,7 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, #ifdef CONFIG_ARM_PATCH_PHYS_VIRT s = find_mod_section(hdr, sechdrs, ".pv_table"); if (s) - fixup_pv_table((void *)s->sh_addr, s->sh_size); + fixup_pv_table((void *)s->sh_addr, s->sh_size, __pv_offset); #endif s = find_mod_section(hdr, sechdrs, ".alt.smp.init"); if (s && !is_smp())