From patchwork Wed Feb 22 03:16:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youling Tang X-Patchwork-Id: 60323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp357734wrd; Tue, 21 Feb 2023 19:17:48 -0800 (PST) X-Google-Smtp-Source: AK7set+1cOGTWrRkRixIQYC9Fk75Ai30NmLyu7Ik8wVsAw5EXNcf1cOnRvMVV04EPQSgsrI7j5jy X-Received: by 2002:a17:903:11d1:b0:19b:3b4:3af5 with SMTP id q17-20020a17090311d100b0019b03b43af5mr10726249plh.34.1677035867749; Tue, 21 Feb 2023 19:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677035867; cv=none; d=google.com; s=arc-20160816; b=H32WZhdkmuWaBpmf2heWGnc1PAQgzEnDcHHzsizHCMhaBZ6WfBk2RWFK/zyhE0dtH+ Ryfuj85J3GaNpidyHY33SC9ynlrhpJS59gM6w/6K6P9bsJiMStiOhld0Y2BrDKe22L7j xW4ilZXULdGACgYoDyNLNb+ML/nZZzOrGzF02rXcqiBfklXlbCIbRsj0WiIUsL7k2auK 4A7e/pS/bdx98Cq0mh9p7AjWNbNtgQFq1CyWmFHWDmc67QtP4eo3K9QjIh63XFXP6h7j GUMQR5VdXLePXuGhB19AJFsF4KuhLDtsJP1oFEga5AOI9kdJ0wer2TdP8AypduFfX5vf Wffw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=rBuRZdvQEJmDjpxFh02nHVQvCNbgqeNT+PEATilh7Oo=; b=hS7EXNfbRGbpZ4KOQ4vUsmrrrhopCBSjeq9wxaqF/IZg+gWdMkOegLBi+zhdYSYQNa 4RK70YWPX/hvDRaZOo2iufiiQK3jccpNPlT7e2VdzvMWH4ANatN43rhrvCJ9wytcY8yi 8UtWSTLMK2RUQ2uy5bkLkIsvTBx9P/Ql3Ni3ppQz3R5F+FVPUwlPtdUtGakEeV6fjZbh qLD/6Zqhez9KKhJ+myX96BE1tUgFgGu/xRuw65N2s2ZH4hkd9KJDXv7Atzu+dI4gZHjp Bt2B5bgYIuL3IISAgyycl0/tYZ+Js1Akvx1mnjftHJXsFfvPaDZzcJmHKtY0KMV3LQp1 Ipmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170902da8e00b0019a9611ed87si11148741plx.444.2023.02.21.19.17.34; Tue, 21 Feb 2023 19:17:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbjBVDQ7 (ORCPT + 99 others); Tue, 21 Feb 2023 22:16:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbjBVDQu (ORCPT ); Tue, 21 Feb 2023 22:16:50 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 903AE2CC7A for ; Tue, 21 Feb 2023 19:16:48 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8BxYU8fifVjSW8DAA--.1524S3; Wed, 22 Feb 2023 11:16:47 +0800 (CST) Received: from bogon.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxUuUbifVj9l84AA--.2774S3; Wed, 22 Feb 2023 11:16:47 +0800 (CST) From: Youling Tang To: Huacai Chen , Xi Ruoyao , Jinyang He Cc: Xuerui Wang , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/5] LoongArch: Use la.pcrel instead of la.abs when it's trivially possible Date: Wed, 22 Feb 2023 11:16:39 +0800 Message-Id: <1677035803-7932-2-git-send-email-tangyouling@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1677035803-7932-1-git-send-email-tangyouling@loongson.cn> References: <1677035803-7932-1-git-send-email-tangyouling@loongson.cn> X-CM-TRANSID: AQAAf8DxUuUbifVj9l84AA--.2774S3 X-CM-SenderInfo: 5wdqw5prxox03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Wryxtr1DCr4xAr1DJFW3trb_yoW5JFWUpr nxZr1kJFW8WFn3A34Dt34UurWDJ3Wqgw1ag3ZIkFyrZr42qF1UXr1kAryDZFyjqayrGay0 gF1rG39IqF4UJ37anT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r4j6F4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr 0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8l38UUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758499562224558272?= X-GMAIL-MSGID: =?utf-8?q?1758499562224558272?= From: Xi Ruoyao Let's start to kill la.abs inpreparation for the subsequent support of the PIE kernel. Signed-off-by: Xi Ruoyao --- arch/loongarch/include/asm/stackframe.h | 2 +- arch/loongarch/include/asm/uaccess.h | 1 - arch/loongarch/kernel/entry.S | 2 +- arch/loongarch/kernel/head.S | 2 +- arch/loongarch/mm/tlbex.S | 3 +-- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/loongarch/include/asm/stackframe.h b/arch/loongarch/include/asm/stackframe.h index 4ca953062b5b..7deb043ce387 100644 --- a/arch/loongarch/include/asm/stackframe.h +++ b/arch/loongarch/include/asm/stackframe.h @@ -90,7 +90,7 @@ .endm .macro set_saved_sp stackp temp temp2 - la.abs \temp, kernelsp + la.pcrel \temp, kernelsp #ifdef CONFIG_SMP LONG_ADD \temp, \temp, u0 #endif diff --git a/arch/loongarch/include/asm/uaccess.h b/arch/loongarch/include/asm/uaccess.h index 255899d4a7c3..0d22991ae430 100644 --- a/arch/loongarch/include/asm/uaccess.h +++ b/arch/loongarch/include/asm/uaccess.h @@ -22,7 +22,6 @@ extern u64 __ua_limit; #define __UA_ADDR ".dword" -#define __UA_LA "la.abs" #define __UA_LIMIT __ua_limit /* diff --git a/arch/loongarch/kernel/entry.S b/arch/loongarch/kernel/entry.S index 55e23b10219f..b940687f27a6 100644 --- a/arch/loongarch/kernel/entry.S +++ b/arch/loongarch/kernel/entry.S @@ -20,7 +20,7 @@ .align 5 SYM_FUNC_START(handle_syscall) csrrd t0, PERCPU_BASE_KS - la.abs t1, kernelsp + la.pcrel t1, kernelsp add.d t1, t1, t0 move t2, sp ld.d sp, t1, 0 diff --git a/arch/loongarch/kernel/head.S b/arch/loongarch/kernel/head.S index 57bada6b4e93..aa6181714ec3 100644 --- a/arch/loongarch/kernel/head.S +++ b/arch/loongarch/kernel/head.S @@ -117,7 +117,7 @@ SYM_CODE_START(smpboot_entry) li.w t0, 0x00 # FPE=0, SXE=0, ASXE=0, BTE=0 csrwr t0, LOONGARCH_CSR_EUEN - la.abs t0, cpuboot_data + la.pcrel t0, cpuboot_data ld.d sp, t0, CPU_BOOT_STACK ld.d tp, t0, CPU_BOOT_TINFO diff --git a/arch/loongarch/mm/tlbex.S b/arch/loongarch/mm/tlbex.S index 58781c6e4191..3dd2a9615cd9 100644 --- a/arch/loongarch/mm/tlbex.S +++ b/arch/loongarch/mm/tlbex.S @@ -24,8 +24,7 @@ move a0, sp REG_S a2, sp, PT_BVADDR li.w a1, \write - la.abs t0, do_page_fault - jirl ra, t0, 0 + bl do_page_fault RESTORE_ALL_AND_RET SYM_FUNC_END(tlb_do_page_fault_\write) .endm