From patchwork Sat Mar 10 14:59:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10273589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6982F601A0 for ; Sat, 10 Mar 2018 15:00:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44C1D29B7E for ; Sat, 10 Mar 2018 15:00:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3702929B84; Sat, 10 Mar 2018 15:00:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BAC8A29B7E for ; Sat, 10 Mar 2018 15:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=x2z3PXlD7rOwTfywvb8T5CYI/tyspKJQBqdJjzFv65A=; b=Mdc ajAuJviQepA0OWRsfAd6YcagpcS3h1h2caKPXxf7mSJwDRtIg1oHxRg+N9TytuyWf1irAXwe6c1EE sBq4AQJEQvQtvd1+x1e5tVMLwE5XnnKoC6U0YqFh2dU5OSLF8DsM9u6cuHIMPgblgBJqVWi1BGtRk 8leZTdxiZHj8UyuvqoA+ai/DcYerMweSK2HrILP5WqnUZREClmuI2K7C2m8tpivsSaTfIqgDGw3lw DLuRgbAHOq0G9nQ8pahQAMdTEl+b/hY3YRaD20Ift5+hTAN4we8E+yNhEiiAotGDVcYdL1WgwHey+ D+mWrV5fRVFtEAf/ZYHg5EeGNnd2+bA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eufyX-0007Ow-V1; Sat, 10 Mar 2018 14:59:57 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eufyT-0007Nw-MV for linux-arm-kernel@lists.infradead.org; Sat, 10 Mar 2018 14:59:55 +0000 Received: by mail-wr0-x243.google.com with SMTP id n12so468575wra.2 for ; Sat, 10 Mar 2018 06:59:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=UgSk4nVSSf1WFdrcsSw/QBovpxNMOSzj8rUKs6nn7co=; b=aSp99tPFAPgIg7k38IYrohK5ostHf1B1I3JEMoVlLURCdPzA3pX8mdU1WhnzU0tpVN rXeIzT79krzABhjoeziqdsg/MgZQ+pUm/8lLnPjebDOKu8CdmaKZqVjbCgCb5HCUQy5r kpuyb8LV0UFzbMf0q6Lsh37IMDY5bfDLKBRyA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UgSk4nVSSf1WFdrcsSw/QBovpxNMOSzj8rUKs6nn7co=; b=h+LZCBeIxEy3vb/4KJfbK7342mg2uTNrPu+ujq4+Tf7sjP66X/5BQm9YMcB5rrM+j6 TC+brMjnSPvt6Q97ndH8p1TJ17Fx0idP9qhLVnr/JOFudsTHGvdrgKU5J+geUh/cmGf3 6QtQX4R/5Vtim5sIxXPTvo/W2686USlTG99lRjt83omup7qzoXQYFcu1FD9a+6L6Bo36 olzOhvMrbdFLWvJXcu0wFMwJUgE8yGDCQ4B0Bj05YZBfBSMxFWdPQd5GG2Z/brSfRrwW 4wrjdRIBMo710VrUDvtA9JeEKysvM3t9hPsXtMsz50WEw3/MwkPo8A/DaiYGy2whu5k+ /JCg== X-Gm-Message-State: AElRT7FfPO//yLdBOyDaopNedVZxZ6xyajils73c/B6pPjUwOm7I3GCw ZIVj4L7RwqWfnvTLxIR8Kng8lewkX5s= X-Google-Smtp-Source: AG47ELvL4HUxQJTCDIX3ibonALqf4Tj5j+Y3x/N1D6os7bGVhOMNYeguSqvflRhIhmrGppLo9dGkUQ== X-Received: by 10.223.136.236 with SMTP id g41mr1737573wrg.103.1520693978628; Sat, 10 Mar 2018 06:59:38 -0800 (PST) Received: from localhost.localdomain ([105.148.128.186]) by smtp.gmail.com with ESMTPSA id k47sm939232wrk.41.2018.03.10.06.59.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Mar 2018 06:59:37 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com Subject: [PATCH] arm64: asm: drop special versions of adr_l/ldr_l/str_l for modules Date: Sat, 10 Mar 2018 14:59:29 +0000 Message-Id: <20180310145929.6797-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180310_065953_849643_73DC5ED0 X-CRM114-Status: GOOD ( 13.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we started keeping modules within 4 GB of the core kernel in all cases, we no longer need to special case the adr_l/ldr_l/str_l macros for modules to deal with them being loaded farther away. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/assembler.h | 34 ++------------------ 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 3c78835bba94..053d83e8db6f 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -202,25 +202,15 @@ lr .req x30 // link register /* * Pseudo-ops for PC-relative adr/ldr/str , where - * is within the range +/- 4 GB of the PC when running - * in core kernel context. In module context, a movz/movk sequence - * is used, since modules may be loaded far away from the kernel - * when KASLR is in effect. + * is within the range +/- 4 GB of the PC. */ /* * @dst: destination register (64 bit wide) * @sym: name of the symbol */ .macro adr_l, dst, sym -#ifndef MODULE adrp \dst, \sym add \dst, \dst, :lo12:\sym -#else - movz \dst, #:abs_g3:\sym - movk \dst, #:abs_g2_nc:\sym - movk \dst, #:abs_g1_nc:\sym - movk \dst, #:abs_g0_nc:\sym -#endif .endm /* @@ -231,7 +221,6 @@ lr .req x30 // link register * the address */ .macro ldr_l, dst, sym, tmp= -#ifndef MODULE .ifb \tmp adrp \dst, \sym ldr \dst, [\dst, :lo12:\sym] @@ -239,15 +228,6 @@ lr .req x30 // link register adrp \tmp, \sym ldr \dst, [\tmp, :lo12:\sym] .endif -#else - .ifb \tmp - adr_l \dst, \sym - ldr \dst, [\dst] - .else - adr_l \tmp, \sym - ldr \dst, [\tmp] - .endif -#endif .endm /* @@ -257,28 +237,18 @@ lr .req x30 // link register * while needs to be preserved. */ .macro str_l, src, sym, tmp -#ifndef MODULE adrp \tmp, \sym str \src, [\tmp, :lo12:\sym] -#else - adr_l \tmp, \sym - str \src, [\tmp] -#endif .endm /* - * @dst: Result of per_cpu(sym, smp_processor_id()), can be SP for - * non-module code + * @dst: Result of per_cpu(sym, smp_processor_id()) (can be SP) * @sym: The name of the per-cpu variable * @tmp: scratch register */ .macro adr_this_cpu, dst, sym, tmp -#ifndef MODULE adrp \tmp, \sym add \dst, \tmp, #:lo12:\sym -#else - adr_l \dst, \sym -#endif alternative_if_not ARM64_HAS_VIRT_HOST_EXTN mrs \tmp, tpidr_el1 alternative_else