From patchwork Thu Oct 28 16:10:54 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: 12590501 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 D3FDDC433EF for ; Thu, 28 Oct 2021 16:11:16 +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 A1EBE60E8C for ; Thu, 28 Oct 2021 16:11:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A1EBE60E8C 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:References:In-Reply-To: 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: List-Owner; bh=n7FBofelty/qq32cKF6CssX/tKN6DC1VMVL1Xr1PWcE=; b=TX2mx2idBTW6lQ SC/L9Lfz42dolAADxvLpc3A/9cNupB8e9ThBHtyLNL/58Xm84+OXYjw0Jz/V2u76LQLSMNx3rKGpK /pc0PLaDtmltd7GmzUktpFQUDR5+nONS01pESjdHotwbNpbSSQyiCXUfmicgpCblRHDc2dFK+GF4m 9vKRRBOeXjip/fz/BaAI8uew0wiZCJaJ5tRH3GVwGmCCW8oTZv2/Z4b5jCPJ9h+NIdihoFjoxmbw9 kIr+mLPTsQ4eIJAoJ8vIMMlNjqT8q0wOfOATRTFW9OLM2ig1KV5aSBySkxMlaegbRR81qiwjH04l4 vlY+5x+4/7ptCVb//3iA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zi-008Wmt-Py; Thu, 28 Oct 2021 16:11:10 +0000 Received: from mail-lj1-f175.google.com ([209.85.208.175]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zf-008Wjn-DC for linux-riscv@lists.infradead.org; Thu, 28 Oct 2021 16:11:08 +0000 Received: by mail-lj1-f175.google.com with SMTP id h11so11670490ljk.1 for ; Thu, 28 Oct 2021 09:11:07 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=O/AJBEW3vyVrTUMTRP/ONhgseLgot5lKkfZZ3GS+nfA=; b=VL4dM1/DUM//b6LpYqYlFsQsbuCUp07Ez2eVyDtniyFLnGjSJt/gJ/eDxtbWjwbHZW 4Zp9q4iSdQsJg6ksfJRs5SC/TaQUrlirofxNgfdhJSp4DH/NLgGxjv2xKhJ6csEoZ+TJ iUW2KgWHieoongPOAEw7rMF6i4nWFq56Ly2N97+EC9CheWar0+v1wX1XrT0Lbq/4edOO votnwbIvalir9rHKoVRxLhCxUvKcQLFvq8dmd7RG6TeIXacOO/fQPZU+WKdfpFAc4Y6v xU0MsjSxAN590acnIx0xB8m/+qgaR2yerUwmWmEjpKF7OV1ldlMwXaWsvPdtoIeifc7x Q4xA== X-Gm-Message-State: AOAM532NI9zRECnSONoNCI/e9gFUIdeL2HiI6QGHq6JfNC/cMKMoLAgz OJ9rTI+L90czj5ndPe4qNac= X-Google-Smtp-Source: ABdhPJwOcY43NhUimT65dqUn5i4ibaVElLDvmVmk/6S/JSjYT0ktZxz3YwxE28cPmSRryVx3sGI3mw== X-Received: by 2002:a2e:a7c7:: with SMTP id x7mr5647795ljp.8.1635437465726; Thu, 28 Oct 2021 09:11:05 -0700 (PDT) Received: from kladdkakan.. ([193.138.218.162]) by smtp.gmail.com with ESMTPSA id o17sm49680lfo.176.2021.10.28.09.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 09:11:04 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , luke.r.nels@gmail.com, xi.wang@gmail.com, linux-riscv@lists.infradead.org Subject: [PATCH bpf-next v2 1/4] riscv, bpf: Increase the maximum number of iterations Date: Thu, 28 Oct 2021 18:10:54 +0200 Message-Id: <20211028161057.520552-2-bjorn@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211028161057.520552-1-bjorn@kernel.org> References: <20211028161057.520552-1-bjorn@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_091107_470987_49688CEF X-CRM114-Status: GOOD ( 10.38 ) 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 Now that BPF programs can be up to 1M instructions, it is not uncommon that a program requires more than the current 16 iterations to converge. Bump it to 32, which is enough for selftests/bpf, and test_bpf.ko. Signed-off-by: Björn Töpel --- arch/riscv/net/bpf_jit_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c index 7ccc809f2c19..ef9fcf6ea749 100644 --- a/arch/riscv/net/bpf_jit_core.c +++ b/arch/riscv/net/bpf_jit_core.c @@ -11,7 +11,7 @@ #include "bpf_jit.h" /* Number of iterations to try until offsets converge. */ -#define NR_JIT_ITERATIONS 16 +#define NR_JIT_ITERATIONS 32 static int build_body(struct rv_jit_context *ctx, bool extra_pass, int *offset) { From patchwork Thu Oct 28 16:10:55 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: 12590503 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 71578C433EF for ; Thu, 28 Oct 2021 16:11:21 +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 439956058D for ; Thu, 28 Oct 2021 16:11:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 439956058D 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:References:In-Reply-To: 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: List-Owner; bh=80KGFsgh0s8j2Pm9mYh2qpxVtotPS0wQCqmpMwWVXo8=; b=QEYczE9Yb1ryoj v0Cpn4RcbKKsvyUqvMcay9YzG85rYf/PYquP5X0vDgdeIpZPLgyQUMcqvIYWr0irK0SyzM8a+CHWr LRmKpSCV661qs3vYILifRPn5Gel/Z84ipwusPkZsmDYCXusXpkyVeCm28WLjH8JUueOWwtwAm/YHd P5U0VryvgMlLOppnOyHNtJ9uSGHegT3J1zHLHkhjY4wYXSMhYOBMDQ13Yg1h+Zq0w0ZhSvnQRa3kK 3u3WtyDlP7mcR38OJyNEUAU2skrGEvwNNkP7/rNW2mG1ItLYWkcIgaF1FGOvTB8YdbqW6NIFWjCkO nbL6Vl8F56//bL+vFjpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zl-008WoX-6t; Thu, 28 Oct 2021 16:11:13 +0000 Received: from mail-lf1-f53.google.com ([209.85.167.53]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zh-008Wl1-5v for linux-riscv@lists.infradead.org; Thu, 28 Oct 2021 16:11:10 +0000 Received: by mail-lf1-f53.google.com with SMTP id bq11so14652099lfb.10 for ; Thu, 28 Oct 2021 09:11:08 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FpcAIXzIJRZanZR1xOZ449nR9Z4CpuYm3hzQzUAM83c=; b=S3SXrDPTA8H2PqqdsFjTNcFU9aKExZyRuTuEK8qVlZatE8EeImBxYCf5YnA22XVl+r CYH/7tcO5NMXwrAYk+tJ2Q5kQ9QS++mB0G+6XMT7uW22YPsUHgg0BiLGMQEu0eZUGrPm ErPTzg0gptKZnGpBJB6y0TEa4FjjDkuVZNYNFsl5GIT+T4y3s4peTeWL0F0eIe+MRJDh zv4rFH9wTQhbu+TWUYB3ZactzLI9XlmEKy4kfFPWPpi8mbkQU7LQp0fzLANJiJj6ycC8 EjMuxjcr5HFCrPrwNQ0HqnoSnM4Z9xRXtryG/hAsUYrO57g5MmMuK95re+qjmL443Ifu AG+g== X-Gm-Message-State: AOAM531aa2AdY7ek7zNdHH1qApFYcciG6GfJ/AsVmNewtQEggSQxxJ+l Is7+u3SPuDhKP6bQgP9Lrwg= X-Google-Smtp-Source: ABdhPJwdMZ48TKOvgfFiB9guDpW7x1LA1tIS0H2a86m9DxEaEZrPkOpQmOD9kozfq69jLR8FA3Mi2w== X-Received: by 2002:a05:6512:3a89:: with SMTP id q9mr5114900lfu.172.1635437467541; Thu, 28 Oct 2021 09:11:07 -0700 (PDT) Received: from kladdkakan.. ([193.138.218.162]) by smtp.gmail.com with ESMTPSA id o17sm49680lfo.176.2021.10.28.09.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 09:11:06 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , luke.r.nels@gmail.com, xi.wang@gmail.com, linux-riscv@lists.infradead.org Subject: [PATCH bpf-next v2 2/4] tools build: Add RISC-V to HOSTARCH parsing Date: Thu, 28 Oct 2021 18:10:55 +0200 Message-Id: <20211028161057.520552-3-bjorn@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211028161057.520552-1-bjorn@kernel.org> References: <20211028161057.520552-1-bjorn@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_091109_236318_1BF90247 X-CRM114-Status: UNSURE ( 8.67 ) X-CRM114-Notice: Please train this message. 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 Add RISC-V to the HOSTARCH parsing, so that ARCH is "riscv", and not "riscv32" or "riscv64". This affects the perf and libbpf builds, so that arch specific includes are correctly picked up for RISC-V. Signed-off-by: Björn Töpel --- tools/scripts/Makefile.arch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch index b10b7a27c33f..0c6c7f456887 100644 --- a/tools/scripts/Makefile.arch +++ b/tools/scripts/Makefile.arch @@ -4,7 +4,8 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ + -e s/riscv.*/riscv/) ifndef ARCH ARCH := $(HOSTARCH) From patchwork Thu Oct 28 16:10:56 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: 12590505 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 CB4A2C433FE for ; Thu, 28 Oct 2021 16:11:22 +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 9084C6058D for ; Thu, 28 Oct 2021 16:11:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9084C6058D 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:References:In-Reply-To: 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: List-Owner; bh=+CSIH4WpKNfjCwol9IuIC5zNaMvvNmeBafiMnrlfZM8=; b=16SX6zxTQbB9R1 KehrOL27NIO7A3UdveWG9on0QQ6y5LNtf8iED2HiP9LmeJC6G5d1pzClCQ7USY4Bg0HnEKQg6hLS9 J1xJZyDSbHogaevaM8M0bpfXK8ObWJ/jJpfFnUUXKOj05e41h60f1C3SKZqFlI/cgtxGmiMZxGp2q 4wKGjm6WnTp2sIsT/nu9H4ZXAWcJ4FdEYI28h7TfPLqWi9vCawTgI1YuwtfmoIvNLuZxO62aCYvC5 7Ozp50dQ1sJS/eFjZrkKfaPM/YUhfhoGbGVyrU+ITBf1gVTMNLS70gtrFjCdHWtKpudQUG3I8ABPt GdpXk+3lhRZ0O4sN7yaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zo-008Wr2-Im; Thu, 28 Oct 2021 16:11:16 +0000 Received: from mail-lf1-f45.google.com ([209.85.167.45]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zj-008WmT-9z for linux-riscv@lists.infradead.org; Thu, 28 Oct 2021 16:11:12 +0000 Received: by mail-lf1-f45.google.com with SMTP id l13so14683990lfg.6 for ; Thu, 28 Oct 2021 09:11:10 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=DH8yGhC3Nvprfn3hCny0Vjdm/oIXFS546cCDILMHRkQ=; b=EprIL9/DhFLEJhLoXXasUmtN7X0jChhRCO7uiID9n5kRgs9SZtm51sJBXE4kJT+8s4 II2VplEj1TAnLhKwXjnUK4+2wtpd2sl8cNLU5xTYidlmGj1AWrAqVGn+eQ0IPBvqJ1Zm JJ2dO/fdpf3Biwc5p9mFAMVLe15Xg5AdwF8zYqxoVWJ3iTQcXaoJxAHuNtrrCSEa4cOw a+xNhnMQea5I6tjGwseTQCkxjAM59Lxnaq7MR1dc2R+LQ45zoGsOFluiz2fFFZhwfZpL nrXl5bbuqvPh2xV4dcP7NPrQHS00dVGQf5SwDuZasiOWWRE4AQHBjI1bMpwXn3r7Ytgj ltBA== X-Gm-Message-State: AOAM53205SILxiRToOdBGMDUZHAEUZDDx+KGwvtkKLtk04BjiGWaOCx1 nAesUViwCIWFlwWtSoBgdDX0mTP61bQ= X-Google-Smtp-Source: ABdhPJzGcFsQsLLh2iM+XXTTQAAvk5Ijtz1Ynp38QBMLPr3KG5zxCbxkrQLRhXQ1kOc3f2/PH3tnWQ== X-Received: by 2002:a05:6512:230b:: with SMTP id o11mr5589603lfu.490.1635437469642; Thu, 28 Oct 2021 09:11:09 -0700 (PDT) Received: from kladdkakan.. ([193.138.218.162]) by smtp.gmail.com with ESMTPSA id o17sm49680lfo.176.2021.10.28.09.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 09:11:08 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , luke.r.nels@gmail.com, xi.wang@gmail.com, linux-riscv@lists.infradead.org Subject: [PATCH bpf-next v2 3/4] riscv, libbpf: Add RISC-V (RV64) support to bpf_tracing.h Date: Thu, 28 Oct 2021 18:10:56 +0200 Message-Id: <20211028161057.520552-4-bjorn@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211028161057.520552-1-bjorn@kernel.org> References: <20211028161057.520552-1-bjorn@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_091111_375903_1771D957 X-CRM114-Status: UNSURE ( 8.58 ) X-CRM114-Notice: Please train this message. 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 Add macros for 64-bit RISC-V PT_REGS to bpf_tracing.h. Signed-off-by: Björn Töpel --- tools/lib/bpf/bpf_tracing.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index d6bfbe009296..db05a5937105 100644 --- a/tools/lib/bpf/bpf_tracing.h +++ b/tools/lib/bpf/bpf_tracing.h @@ -24,6 +24,9 @@ #elif defined(__TARGET_ARCH_sparc) #define bpf_target_sparc #define bpf_target_defined +#elif defined(__TARGET_ARCH_riscv) + #define bpf_target_riscv + #define bpf_target_defined #else /* Fall back to what the compiler says */ @@ -48,6 +51,9 @@ #elif defined(__sparc__) #define bpf_target_sparc #define bpf_target_defined +#elif defined(__riscv) && __riscv_xlen == 64 + #define bpf_target_riscv + #define bpf_target_defined #endif /* no compiler target */ #endif @@ -288,6 +294,32 @@ struct pt_regs; #define PT_REGS_IP_CORE(x) BPF_CORE_READ((x), pc) #endif +#elif defined(bpf_target_riscv) + +struct pt_regs; +#define PT_REGS_RV const volatile struct user_regs_struct +#define PT_REGS_PARM1(x) (((PT_REGS_RV *)(x))->a0) +#define PT_REGS_PARM2(x) (((PT_REGS_RV *)(x))->a1) +#define PT_REGS_PARM3(x) (((PT_REGS_RV *)(x))->a2) +#define PT_REGS_PARM4(x) (((PT_REGS_RV *)(x))->a3) +#define PT_REGS_PARM5(x) (((PT_REGS_RV *)(x))->a4) +#define PT_REGS_RET(x) (((PT_REGS_RV *)(x))->ra) +#define PT_REGS_FP(x) (((PT_REGS_RV *)(x))->s5) +#define PT_REGS_RC(x) (((PT_REGS_RV *)(x))->a5) +#define PT_REGS_SP(x) (((PT_REGS_RV *)(x))->sp) +#define PT_REGS_IP(x) (((PT_REGS_RV *)(x))->epc) + +#define PT_REGS_PARM1_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), a0) +#define PT_REGS_PARM2_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), a1) +#define PT_REGS_PARM3_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), a2) +#define PT_REGS_PARM4_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), a3) +#define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), a4) +#define PT_REGS_RET_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), ra) +#define PT_REGS_FP_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), fp) +#define PT_REGS_RC_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), a5) +#define PT_REGS_SP_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), sp) +#define PT_REGS_IP_CORE(x) BPF_CORE_READ((PT_REGS_RV *)(x), epc) + #endif #if defined(bpf_target_powerpc) From patchwork Thu Oct 28 16:10:57 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: 12590507 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 E0548C433F5 for ; Thu, 28 Oct 2021 16:11:25 +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 B0D5360E8C for ; Thu, 28 Oct 2021 16:11:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B0D5360E8C 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:References:In-Reply-To: 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: List-Owner; bh=o1bSiAm2EbGz8e8yoVG6mWj611TiH24OvCrTCKRIs08=; b=Ahpjrr8W9jY2eX ZiM1J8hazdwZjRRrRWonpqp6wVPwiXhtq8xqapiPJoFNvUqmWwHmFvvekDMuaansyjt5rq4PS3gY5 hd9Idz83V1ZcSya7Akeh9oAHJ6h6x60ZcHVpyBBRXkAUSDNHBYwSgZ1JuwEP44NosnNil2XxmfO63 kHsHDSstP/eWK0fMs9m6//AX8K3Cw4XZa/ozhCuGBPbAw9aunScmud7Y4PUprux3sLYNsZ9GGcwr2 EvvOQe4KB6Cjs7VHjee8tJpdSh+TKkjKlCIGcUaPM0AOct27FvSFW1gyaGg3k4YiJBnGKUM+lU4OC BMMcYRP7M5JolqwsWN7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zq-008Ws5-Gy; Thu, 28 Oct 2021 16:11:18 +0000 Received: from mail-lj1-f175.google.com ([209.85.208.175]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mg7zk-008Wnn-KZ for linux-riscv@lists.infradead.org; Thu, 28 Oct 2021 16:11:13 +0000 Received: by mail-lj1-f175.google.com with SMTP id e2so11552496ljg.13 for ; Thu, 28 Oct 2021 09:11:12 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=j6s4f8YcjDD+CpjBx7PKIl2wBVCSaaLbyqkYVC2ZnxY=; b=muFFiYv6XP78kLGWtPCpa0nsmqoasXbXdzUFjLKseba5MJaCHBJfUyvZGDaYUPl4wV 7HEc6wMFnXynhPPjQ1uKTedYbEUzi2lAnrvJrldBTAOyGhR902PWULb2XnjgRGGc0/DU OiMT+HKsbzpVSvlR+Ib1jnATlO2n01SBH56kcJART15ZHIDWkgSAcYI/0roDo9B9pCZo ZOdylF/mhamC5dpZ81tR1mvxIH68r1gaVeYfFUAuJmCYaU1hV3Ufobfjr6zkhYmNmCNH SPWZbd5HmDTwD0DI9mAx9jGRiyur104sJPAuEX/DFjsiNmW+sgelezULICQXKOSk3mjY Zw2g== X-Gm-Message-State: AOAM5307qdVyUa74LUvWE/liFKSDRNF1zoECRl0FDuL2CBWPhykvf+Bn CRW3u06C1nnlDj2M2xk89Xc= X-Google-Smtp-Source: ABdhPJw9RfKTCTjLi4ZdAxhCHFhQ9JTLQ3uevQ/FREeI82pyLvcRUqHuDKshzgx3UPpTSz84y1xMrQ== X-Received: by 2002:a2e:a48c:: with SMTP id h12mr5583843lji.221.1635437471276; Thu, 28 Oct 2021 09:11:11 -0700 (PDT) Received: from kladdkakan.. ([193.138.218.162]) by smtp.gmail.com with ESMTPSA id o17sm49680lfo.176.2021.10.28.09.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 09:11:10 -0700 (PDT) From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , luke.r.nels@gmail.com, xi.wang@gmail.com, linux-riscv@lists.infradead.org Subject: [PATCH bpf-next v2 4/4] selftests/bpf: Fix broken riscv build Date: Thu, 28 Oct 2021 18:10:57 +0200 Message-Id: <20211028161057.520552-5-bjorn@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211028161057.520552-1-bjorn@kernel.org> References: <20211028161057.520552-1-bjorn@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211028_091112_696164_98081C21 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. 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 This patch is closely related to commit 6016df8fe874 ("selftests/bpf: Fix broken riscv build"). When clang includes the system include directories, but targeting BPF program, __BITS_PER_LONG defaults to 32, unless explicitly set. Workaround this problem, by explicitly setting __BITS_PER_LONG to __riscv_xlen. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index ac47cf9760fc..88e2a975352b 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -277,7 +277,7 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \ define get_sys_includes $(shell $(1) -v -E - &1 \ | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ -$(shell $(1) -dM -E -