Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp9871rdb; Wed, 23 Aug 2023 19:02:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUonc+huXDvu0Kp6MCbNG4xcW5FbnebuD3voAzrO3WO4MUxOZzXUU6+JaLObM0KUcrYlKj X-Received: by 2002:a05:6402:1a46:b0:51d:9db8:8257 with SMTP id bf6-20020a0564021a4600b0051d9db88257mr10760842edb.30.1692842555125; Wed, 23 Aug 2023 19:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692842555; cv=none; d=google.com; s=arc-20160816; b=oY5bQGd5g32eKP003zb0KYc2joX5ag2VZu2jBOy1OPjv1UHOm8ASOYD2NWe7bbDV9t oAY9VlvvGcdLTAAFCh98xRZFBZz0JfWmom3mTvZz4cRmVG9oTPafN1NTvS1+2DxlxrF2 C84ybDz6iOWaCFiPFN/JesuxXp52z/0JCcQtZE/Q61WvlKdh1luwBpbZKbKvnGq2h0I1 HjnlEb+3VmebwKEkpn0bqVnYtg+dVe0Lz/CvkWOD13BCZVC+Qk5DIJW8jE3ePFSfKtSi e80WoezwONBo+g38eLaT8yAQWDFo+Kr43l/Bc+sjUiD5xFpwkM36xXGOXNo/zv5/7K5Q La/A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XvEblMZeKahAJAHVE7xqn9H4vS1H7Y9adjG1/QQxhaM=; fh=Br5Z5x8cyX1Get9xLNj3dh1Us8QVanBl/EzmZ1SbGHc=; b=HsVs9JxohuMxWsEqkUjYckqYVRK03ku688UgWbqI+nIL1jJP+EZa1e4lM/M5zBRJXr C8cxdr31jUnyWm8qU+YyGPwlaBfUsKhT2jcoWep7GTKNCu0Aa5++FDoIHLAuAA7F1gVR T0OASFtv9afSJ6uSGlxhEFPoCpxYln/L6bE4ImqQvi6TdUQNhFuPPM/uVdyE1na7X7Zt oqK0vexoW67LBBpJZS2abG2JeMv/y6mkuT+9NiCS8RroQvZugw3opGn/8CfVK5uUSywl PhKECoqdu2FbikqeokmAAq8/+X6l3ecrOb9o1ONdeeGCzaKFGXZ5xuTvc++xKOlc/KWC 0SlA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020aa7d6d3000000b0052363eee9easi9565527edr.295.2023.08.23.19.02.09; Wed, 23 Aug 2023 19:02:35 -0700 (PDT) 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 S236791AbjHWPHH (ORCPT + 99 others); Wed, 23 Aug 2023 11:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236772AbjHWPHA (ORCPT ); Wed, 23 Aug 2023 11:07:00 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6108FE78; Wed, 23 Aug 2023 08:06:55 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RW8gs0975z4f3m8N; Wed, 23 Aug 2023 23:06:49 +0800 (CST) Received: from ultra.huawei.com (unknown [10.90.53.71]) by APP4 (Coremail) with SMTP id gCh0CgAn_qCIIOZksUWeBQ--.39856S6; Wed, 23 Aug 2023 23:06:49 +0800 (CST) From: Pu Lehui To: linux-riscv@lists.infradead.org, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Palmer Dabbelt , Xu Kuohai , Puranjay Mohan , Pu Lehui , Pu Lehui Subject: [PATCH bpf-next 4/7] riscv, bpf: Support 32-bit offset jmp insn Date: Wed, 23 Aug 2023 23:10:56 +0000 Message-Id: <20230823231059.3363698-5-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230823231059.3363698-1-pulehui@huaweicloud.com> References: <20230823231059.3363698-1-pulehui@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAn_qCIIOZksUWeBQ--.39856S6 X-Coremail-Antispam: 1UD129KBjvdXoW7Wry5Ww4UWF1DWw15WF18Grg_yoWfGwcEkr yxJFWIg398GFs8Xw1UZr4Fvryjkws3GF1DZ34SgFWjkan8X3ZYy34kKr9xX34xur1xtFW3 Zrn3Aayavw4aqjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbQAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVWxJr0_GcWl84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vE x4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I64 8v4I1lFIxGxcIEc7CjxVA2Y2ka0xkIwI1lc7CjxVAaw2AFwI0_Jw0_GFyl42xK82IYc2Ij 64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x 8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE 2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAIcV CF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjTRNL0eDUUUU X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 From: Pu Lehui Add support 32-bit offset jmp instruction for RV64. Signed-off-by: Pu Lehui --- arch/riscv/net/bpf_jit_comp64.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c index d1497182cacf..3d4e9182385d 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -1327,7 +1327,11 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx, /* JUMP off */ case BPF_JMP | BPF_JA: - rvoff = rv_offset(i, off, ctx); + case BPF_JMP32 | BPF_JA: + if (BPF_CLASS(code) == BPF_JMP) + rvoff = rv_offset(i, off, ctx); + else + rvoff = rv_offset(i, imm, ctx); ret = emit_jump_and_link(RV_REG_ZERO, rvoff, true, ctx); if (ret) return ret; -- 2.39.2