Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp658498rdg; Wed, 11 Oct 2023 01:33:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaP8wmS6TI3914iwUCk5Le3N3znkAZpRJbsImymismjhIuAGJZumzDHXap4JrSzF1CIpWP X-Received: by 2002:a17:90a:5205:b0:268:5575:93d9 with SMTP id v5-20020a17090a520500b00268557593d9mr16934499pjh.10.1697013212090; Wed, 11 Oct 2023 01:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697013212; cv=none; d=google.com; s=arc-20160816; b=uBTVeg0r6Rn/t+G81ORa7TJs2l52EJUx209oeO0ffWjp3ovS/qqsNV7s+rAqKCAisQ SghlOfVrJi0ChShjtD6qFAgsEWnLuDIuj9hWLHGfNfhirzW5jl85xGykRKLSkcC7us5Z iFiZhAjw2nPsIXouMl0/rCIIxoSLoxSMQj1LBOSgyCROovxr1NN/YnDW/nk5G17F2EqI IWhtW089sQeVK+wjBVJjBDeqoKcDmwvh4BM12EBVgkQQ5ST+U3DPGcarnRqEfaQ8uWFy MlcOwjW8qWzhYFmluRaPek2USK6Sl44wkFjW/rPefvlbvYIWfZrtf1lFxjQBLbqV5sVV sJNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=6sgoJ21PNrjl6oZmwFd94ckplkAaJTaQt5UHbdL1LJ8=; fh=DlYutkg/6Wkat5B72kLfp99kToTYZ2djuWDJ1GjZ1/g=; b=XkAxDumWDnDzJ1aOeCQpNzeLR/ML7odje0w9a96mzD7aVxqE5/gY0j6Y3aQJnBsXNj t39mbnP7QjHOOxC4srggNeoWCg5X//AtpySnFb+/UO4PEX/63Cwvw++H8kTZ4+JODbCm AC0yuLD3jzgwkvqCIar63opwaIh8gLOhf+eDsus66676noluZ2V681ro9Rdf2Esb+ugB YPpK1yZVxEtTPiO5Fb/bT8c+E48t3j8xOpzR8RMegJiVnq50IBfYOzkBYX/6aABl2kAp lUNBVJqScAglDwwqzWS9Yfu9xF1urCmpXHE4HtJc/asgnzin0s0qHlOwDcrZdCOfMxT0 ilJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id pg12-20020a17090b1e0c00b002741e78e66asi16862080pjb.153.2023.10.11.01.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A272B80DFA63; Wed, 11 Oct 2023 01:33:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345232AbjJKIdU (ORCPT + 99 others); Wed, 11 Oct 2023 04:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjJKIdS (ORCPT ); Wed, 11 Oct 2023 04:33:18 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4EB694 for ; Wed, 11 Oct 2023 01:33:15 -0700 (PDT) X-QQ-mid: bizesmtp79t1697013121tlm25yi8 Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 11 Oct 2023 16:31:58 +0800 (CST) X-QQ-SSF: 01200000000000B0B000000A0000000 X-QQ-FEAT: C46Rb8GPIEdRSjq04tLpVIm4rBqIg5ZDlkNPqFv6Y1o3yJcnC8ZRmxn2xUPbG 5aqHDTFlNXyfj9EkRqGPEVLCeEME8D4N5AzoJUCDAT3UjzV5Z0ci7+03OQwZkTZLsqT64MD T3ppIzbnyfGx1e8sgzAkoZrig0RpTYyQD70vxYnOf7jHBi+18d9R9W2t1SXwMwkehA42LUA epsjv/QxJYlIW/iExD63iNaVCDclscyD3+WHo4bG0As7W+VaJPI7hyDtJ8Oa8EPnaD3XSoS KixdppXwX0rrquohicpmRPgk0rYlV8M8UJVN2n6X81C8Q48pgjLEM90fTs3637yXkF2X+5w rwxmvRrV2vPyRNqALNrym8K18haX46uW0fzwoZlSB7pU00ib60YvCmV0srlyg== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 15077306528228941013 From: Song Shuai To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor.dooley@microchip.com, lihuafei1@huawei.com, songshuaishuai@tinylab.org, petr.tesarik.ext@huawei.com, duwe@suse.de, ribalda@chromium.org, akpm@linux-foundation.org, keescook@chromium.org, hi@alyssa.is, heiko@sntech.de, alexghiti@rivosinc.com, schwab@suse.de Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org Subject: [PATCH V2 0/2] riscv: kexec: cleanup and fixups Date: Wed, 11 Oct 2023 16:31:30 +0800 Message-Id: <20231011083132.2428720-1-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz4a-0 X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 11 Oct 2023 01:33:29 -0700 (PDT) Changes since V1: https://lore.kernel.org/linux-riscv/20230907103304.590739-1-songshuaishuai@tinylab.org/ - the old Patch2 in V1 had been merged to riscv/fixes, so take it out of this series - Patch1 : replace `.align 2` with `.balign 4` as Andreas suggested - Patch2 : fix the conflict caused by commit a72ab0361110 ("riscv/purgatory: Disable CFI") riscv: kexec: Cleanup riscv_kexec_relocate (Patch1) ================================================== For readability and simplicity, cleanup the riscv_kexec_relocate code: - Re-sort the first 4 `mv` instructions against `riscv_kexec_method()` - Eliminate registers for debugging (s9,s10,s11) and storing const-value (s5,s6) - Replace `jalr` with `jr` for no-link jump riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS (Patch2 : the Patch3 in V1) ========================================================================== With CONFIG_RELOCATABLE enabled, KBUILD_CFLAGS had a -fPIE option and then the purgatory/string.o was built to reference _ctype symbol via R_RISCV_GOT_HI20 relocations which can't be handled by purgatory. As a consequence, the kernel failed kexec_load_file() with: [ 880.386562] kexec_image: The entry point of kernel at 0x80200000 [ 880.388650] kexec_image: Unknown rela relocation: 20 [ 880.389173] kexec_image: Error loading purgatory ret=-8 So remove the -fPIE option for PURGATORY_CFLAGS to generate R_RISCV_PCREL_HI20 relocations type making puragtory work as it was. Song Shuai (2): riscv: kexec: Cleanup riscv_kexec_relocate riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS arch/riscv/kernel/kexec_relocate.S | 54 +++++++++++++----------------- arch/riscv/purgatory/Makefile | 4 +++ 2 files changed, 28 insertions(+), 30 deletions(-) -- 2.20.1