Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2097948rwb; Sun, 15 Jan 2023 09:09:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYaseTVZmguXbToi2kXNcyShpHCy5uGFckyqqA5YFTFitmZ+5hCM1zmoD6MR0jv9SzAW8w X-Received: by 2002:a05:6402:500d:b0:499:b604:4de6 with SMTP id p13-20020a056402500d00b00499b6044de6mr8097580eda.25.1673802550613; Sun, 15 Jan 2023 09:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673802550; cv=none; d=google.com; s=arc-20160816; b=Aq3h3pzCcLrJJ2zNCGy2pHbwQLdkbaMPFJOV8my0KAeqsuYG+B9FEU0lefXoMo+trO RVR1TQGmt2CvopOWqF1/lSPBiGUaQSZKJU1+Y/E6sqYPOeO2ts8KwTnT1FTUQ8kR1xwY v3lNXpNTYzVgRuj4fCdM0JHQZfsp5lJBEWMMVZu/cXO4wpyvZZ2dsxnh31BcO/jaPHkZ ywcSnewRxQ2yv78Jlo5XQkNrIFaaKNks1M1w4gyreUK4NRhTAyixtc+4rKlczS46r1Sc //42G988Vx3NB6eSCCzdlg6yAhEWnVo2XUrsjAj3Gb2pu0AVccQDErbJFPZHCSTkYkgX ig8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Pg2vROAzuQxMqu3EEHZpvajx0vlJWmtKfg57qrni+Uw=; b=zT14jdCuJPfjZlfclNmMdFqLcVD8XuI321hlOPTAdpATr2QRzKZlod2tqYI0SH2WeG fM8G4+RAp2Jztb+lzwFl2bQjdbdYa1tu2JSgXO8FTMBmVYu5S4pSAmCvXLAL4nzRNwdc q4p3usn7M8ofVM86xm5YnOWJLW/ELR2+MNrtmQo16FF8IwUJeTvfpWYY4BgYpYahyO7d xTGRzRfiFpIaicUbLD/ikF76BysdU9DecKrm4bWdkvhjeJhHCa5s7ZU0vMe01epbdV2U PmWpFZ8eXes2KFXwRhw4Kd3nlvWIxqxI5RjIsvYP4RmbS29DRy4FGZVz/RG5BkB3en+j rg5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PQKd8QgV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402359200b00461dc830100si6823626edc.452.2023.01.15.09.08.50; Sun, 15 Jan 2023 09:09:10 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PQKd8QgV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbjAOQiq (ORCPT + 52 others); Sun, 15 Jan 2023 11:38:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbjAOQil (ORCPT ); Sun, 15 Jan 2023 11:38:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72CB1C65D for ; Sun, 15 Jan 2023 08:38:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0D81F60C84 for ; Sun, 15 Jan 2023 16:38:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C396C433D2; Sun, 15 Jan 2023 16:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673800709; bh=4CyV238BW6buQA/dtLPqJucBf3kAZWi8xQWfny1Z+yo=; h=From:To:Cc:Subject:Date:From; b=PQKd8QgV6dvP8P301dN0tE5afY5Wm9uXtm+/6WQV/iWzp3Quxx3vYQySiASSvQkC8 FbvHfLy3VREXlVn3JNf7LMLvT3+/BEylZzY+rGg3X6wuXE478LUha2AhQ7sFYLGRsO te+kkuWk3/HQbnnCxT48UeZ40o1MWVccAXniOAknsm15KuZGIZtjabm3Ve35IFKYbL KfxFbd7dkb9FjyWnU5IUXHNu1pQixVEnTdIdfCbYmBLkaJJncgU2IIOFzduzy4wrad EJAkjJ5AF7alpCje0fvesrGUlJNOQBVzNXfBV+/fjBS5h+hN/4BKMaR9wKO7OKl/WV 8sEGJ3CBR/DGg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Jones , Heiko Stuebner Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: alternative: proceed one more instruction for auipc/jalr pair Date: Mon, 16 Jan 2023 00:28:11 +0800 Message-Id: <20230115162811.3146-1-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 If we patched auipc + jalr pair, we'd better proceed one more instruction. Andrew pointed out "There's not a problem now, since we're only adding a fixup for jal, not jalr, but we should future-proof this and there's no reason to revisit an already fixed-up instruction anyway." Signed-off-by: Jisheng Zhang Suggested-by: Andrew Jones --- arch/riscv/kernel/alternative.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/kernel/alternative.c b/arch/riscv/kernel/alternative.c index fc341b69bf62..2354c69dc7d1 100644 --- a/arch/riscv/kernel/alternative.c +++ b/arch/riscv/kernel/alternative.c @@ -122,6 +122,7 @@ void riscv_alternative_fix_offsets(void *alt_ptr, unsigned int len, riscv_alternative_fix_auipc_jalr(alt_ptr + i * sizeof(u32), insn, insn2, patch_offset); + i++; } if (riscv_insn_is_jal(insn)) { -- 2.38.1