From patchwork Wed Nov 3 11:54:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 12600661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEF8BC433F5 for ; Wed, 3 Nov 2021 11:55:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 92E9460F5A for ; Wed, 3 Nov 2021 11:55:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 92E9460F5A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=4/s5UwNBFR0c7cz0IqIG2gmWBZJq8/G4qvKS3pakwvc=; b=O1oODdnfSQxmDR 0boXrd2ddoH6UcMDkQ7BJsPdLK6KGjpZP1CYQzXhlf/ehlDrqVfVkypXeRLWVnemfjo4RhnNU4850 IVY6V00GvzTtYYKYlq1TjsUZtck+SbfXrOEFf57KdVZ1flHCoHLCZpJ3ph1H8A6WS3o8pMKZO7QRV E78IJyBbs/0H9xWtDgGNE+kxaWHtgQ8yXez1JBJRWSRRLPydvTdBFIlevo6W0WzoUO201pzRtrVl6 NVxr98Frvz1YF0HmdY7DF/AK4fvfjtnGRQLWeTIOGUdT1sUn8OSHucV+SbpcE56NwrUfUcJgDM79K Guo+AQd2D6qH7zCe+FzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miErb-0051gK-Ud; Wed, 03 Nov 2021 11:55:31 +0000 Received: from mail-lj1-f176.google.com ([209.85.208.176]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miErY-0051eb-V7 for linux-riscv@lists.infradead.org; Wed, 03 Nov 2021 11:55:30 +0000 Received: by mail-lj1-f176.google.com with SMTP id h11so3379523ljk.1 for ; Wed, 03 Nov 2021 04:55:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=11mAUeEzHYo4WofQQnhX6tKzbvv6UrSSLpN/q7XHPV4=; b=XFEc9HEMtERewRMJYAbzLCF8rZP65T6MvWsOvKxd70qnqn1a/OSwdZTthpDvw2obW2 tU8kZRgzZiRc6RY/cO+bi6qK2w7sTA1/IHYwAjQhQ6rkCnP7lG+ru0s83ZV9HCN9OyIg h9iBTKTXwvKs4XECl2fHD/khsTV6Rc/Ru/VRK5bru3j4K6SgZn6rbVXeoh71BGMrerIz mO58TYODVZKsjdhDuPcuFQvpgEXs1NvDIRhh9uaGHakR+PnKxACbxwvLQGB60UvlWDGh FLF+L768CQ6pVh/+xnrPVILT/StpYesFeM8IkF1aVvvspH2GtSIMJb9fw8TVMurfl8Tm 6/tA== X-Gm-Message-State: AOAM5338kU7VPvLTQbKo65Fy9gLZTHwiDYkRHzsq7WkN/RTvnSuWP1wD QpNLwunNT+3z8zpD371M6mw= X-Google-Smtp-Source: ABdhPJyPei1aKTKE69u+FCwdajtiXEz9jxZBU//xdhQs7vcHoF3KS+mS4SShXAwvvND1vpqm4oTlug== X-Received: by 2002:a05:651c:2cf:: with SMTP id f15mr19032566ljo.170.1635940526852; Wed, 03 Nov 2021 04:55:26 -0700 (PDT) Received: from kladdkakan.. (c213-102-90-208.bredband.tele2.se. [213.102.90.208]) by smtp.gmail.com with ESMTPSA id g18sm161890lfv.25.2021.11.03.04.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 04:55:25 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org, tongtiangen@huawei.com Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , luke.r.nels@gmail.com, xi.wang@gmail.com, linux-riscv@lists.infradead.org Subject: [PATCH bpf-next] riscv, bpf: Fix RV32 broken build, and silence RV64 warning Date: Wed, 3 Nov 2021 12:54:53 +0100 Message-Id: <20211103115453.397209-1-bjorn@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_045529_027287_B59375C3 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Commit 252c765bd764 ("riscv, bpf: Add BPF exception tables") only addressed RV64, and broke the RV32 build [1]. Fix by gating the exception tables code with CONFIG_ARCH_RV64I. Further, silence a "-Wmissing-prototypes" warning [2] in the RV64 BPF JIT. [1] https://lore.kernel.org/llvm/202111020610.9oy9Rr0G-lkp@intel.com/ [2] https://lore.kernel.org/llvm/202110290334.2zdMyRq4-lkp@intel.com/ Fixes: 252c765bd764 ("riscv, bpf: Add BPF exception tables") Signed-off-by: Björn Töpel Reviewed-by: Tong Tiangen --- Tong/Daniel: The RV32 build has been broken since Thursday. I'll try to fast-track a bit, and commit a quick-fix for it. Hope that's OK with you, Tong! I've verified the build on my machine using riscv32 GCC 9.3.0 and riscv64 GCC 11.2.0. Björn --- arch/riscv/mm/extable.c | 4 ++-- arch/riscv/net/bpf_jit_comp64.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) base-commit: cc0356d6a02e064387c16a83cb96fe43ef33181e diff --git a/arch/riscv/mm/extable.c b/arch/riscv/mm/extable.c index 18bf338303b6..ddb7d3b99e89 100644 --- a/arch/riscv/mm/extable.c +++ b/arch/riscv/mm/extable.c @@ -11,7 +11,7 @@ #include #include -#ifdef CONFIG_BPF_JIT +#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I) int rv_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs); #endif @@ -23,7 +23,7 @@ int fixup_exception(struct pt_regs *regs) if (!fixup) return 0; -#ifdef CONFIG_BPF_JIT +#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I) if (regs->epc >= BPF_JIT_REGION_START && regs->epc < BPF_JIT_REGION_END) return rv_bpf_fixup_exception(fixup, regs); #endif diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c index 2ca345c7b0bf..f2a779c7e225 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -459,6 +459,8 @@ static int emit_call(bool fixed, u64 addr, struct rv_jit_context *ctx) #define BPF_FIXUP_OFFSET_MASK GENMASK(26, 0) #define BPF_FIXUP_REG_MASK GENMASK(31, 27) +int rv_bpf_fixup_exception(const struct exception_table_entry *ex, + struct pt_regs *regs); int rv_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs) {