From patchwork Tue Jan 28 04:59:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Atish Kumar Patra X-Patchwork-Id: 13952023 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B3FBFC0218D for ; Tue, 28 Jan 2025 05:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5mrMIkTEe6NxNBfmJmR1XKICEvWgZ9tUVZlETsQZaOc=; b=NtJ4ryIm3QUTldim6CfBjyV1ld VdyTKPbpmh3a89sRaow0gtJZg6GsT4yU+mvcLfFrwqjQohIFiQsDSQOKvzhr5qDerD1Y6uZ3cpLJ6 hR+ZmDR1l32zau2J4KkZFIuu8TgOUD+49rpBBctfcpiuUgQwXWdN8WUJ8C6+Vc81KwQaG7+st/LuR 2KBjt+ijHxMBZiPrnc5X462dvmlJFzaXY4egJhLkMB74sY8xilNWC9XCVeqfvPiTAIBNIPm8QxxS9 lIuIglEu1IhHkqoIFL6+DouRHKbQ97OBzzEUevr/uudG/VPJy+HezMScfNTwXzFKBHgvWhgNyWuOO UHFxUEyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tcdrw-000000047O6-0WRt; Tue, 28 Jan 2025 05:10:36 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tcdhh-000000044Sw-10QO for linux-arm-kernel@lists.infradead.org; Tue, 28 Jan 2025 05:00:02 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2ee46851b5eso6894860a91.1 for ; Mon, 27 Jan 2025 21:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1738040401; x=1738645201; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5mrMIkTEe6NxNBfmJmR1XKICEvWgZ9tUVZlETsQZaOc=; b=I6q5FTeYHcCzESWR2Mv4qXtXzDhuAITL95N67RVQP63dG+68BbrMSTE8cpk8KcNyMz n+3m+sxTrD5jGkKUrsVLf7x3z5Iqbcxsy/3iSrz83ioO9yw3xKnFpE8yX/qwp2L6G8FV Ek4Ol88+egoill1inF7CN6xzoFlhbfcXXanuXWP7suAE0qWzjO33wNY0vZ9Aej8vD3A3 yC9oaJLk0jmMTzxQMVyu+t4KU4l7/ATbMLPvMu2jUlagZzVe/nv++r8I3rxLNIz9HKXG 8zKQ89lDgXiwEcv75WWKklAfzYlCfMtTxNP9OiC8ZEWkyM+cs4BBsd0NDrvuUoibTnHG R8xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738040401; x=1738645201; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5mrMIkTEe6NxNBfmJmR1XKICEvWgZ9tUVZlETsQZaOc=; b=MkhuhIHf1JV/igEzcYUXJJv6aohws+tGwuw2BJ+uoUgtcgsw2nYClCffvCAOBCbOiQ A4Kt23ZDHAYT6oR1rP21dcFHOLOMZj99evVc71CUIbPT2giH5hv2kqiUP+rlXVaTCcHY uq7XkXZvuDLNGXurzHdBinXLIOT5eHdbwvELiZTD0+ih/ARQMWBkuttir2f8i0dkqYBx jckcnZ7YtGQr9wtT5OE2EPBPXMhQpTLkjr9ltprQeVAGYprGnwXxDB3SyvFpZxloB7SF x14oWkfB9+p3+mYTReahSrggC6Piae7vQSxXMPA/QnsLNZYb2ztzLnBrW5Zejd9yydjT yqyQ== X-Forwarded-Encrypted: i=1; AJvYcCVNpt3aJQgyMcU6M0X7iq5JemhGAVvxdxrBQ2ZYdl+HLnCjA51E8B9rwYcvzg6fYM/7cE+qXcQOj9quv22HQXsX@lists.infradead.org X-Gm-Message-State: AOJu0YwUj9aH7p0EPYOQs9B0ZrH8T2Q0a2x6KMXTt222TbXUPy6REJbg I0c/CCKQT/le6rrNtYw8SDFKe4X8N7uQLqyUV3RY793BOV8HHVAaU8PcOl+H5vw= X-Gm-Gg: ASbGncssar+IkRfV0vH1QQs+1P/eKompidMscw+rFhoyFJ8EWoLZ2EaZILz786M5N4Y +OlvZb7aEBQC/LKu1uh42VJa/2+HacMfP6DWWblJ3xYHvtlYiJHJWZoZ/BSTcFysJjtV48hIiJr XHn41Erk/TcFK6uHszmIwTkmYb0HZLtv0lD9JYLKP+Mr2igfGrfdLOkDjLS/u/StAVjSXSmuKok rQmtfUqdgXRmBWFrOF6h2AKRHhEqsncbxueRwEg0SQgY1Ueg4MBmAfLsv1TXyrYGRw7jyaTMcI0 qqkdjd4H4sjJtyP20A5FFPEUFmgq X-Google-Smtp-Source: AGHT+IH1CyamZ5GxB/LaeGh1+pUXZNcyZ/3f2i2HBGmcLQlGMYAJa1S5yIJT+e6qxkT5U/Ox2SNkIQ== X-Received: by 2002:a17:90b:288a:b0:2ee:bc7b:9237 with SMTP id 98e67ed59e1d1-2f782d35fafmr61340887a91.27.1738040400688; Mon, 27 Jan 2025 21:00:00 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f7ffa5a7f7sm8212776a91.11.2025.01.27.20.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 21:00:00 -0800 (PST) From: Atish Patra Date: Mon, 27 Jan 2025 20:59:48 -0800 Subject: [PATCH v3 07/21] RISC-V: Add Ssccfg ISA extension definition and parsing MIME-Version: 1.0 Message-Id: <20250127-counter_delegation-v3-7-64894d7e16d5@rivosinc.com> References: <20250127-counter_delegation-v3-0-64894d7e16d5@rivosinc.com> In-Reply-To: <20250127-counter_delegation-v3-0-64894d7e16d5@rivosinc.com> To: Paul Walmsley , Palmer Dabbelt , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Anup Patel , Atish Patra , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , weilin.wang@intel.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Conor Dooley , devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Atish Patra X-Mailer: b4 0.15-dev-13183 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250127_210001_332669_CB8C5425 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ssccfg (‘Ss’ for Privileged architecture and Supervisor-level extension, ‘ccfg’ for Counter Configuration) provides access to delegated counters and new supervisor-level state. This patch just enables the definitions and enable parsing. Signed-off-by: Atish Patra --- arch/riscv/include/asm/hwcap.h | 2 ++ arch/riscv/kernel/cpufeature.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 3d6e706fc5b2..2f5ef1dee7ac 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -102,6 +102,8 @@ #define RISCV_ISA_EXT_SVADU 93 #define RISCV_ISA_EXT_SSCSRIND 94 #define RISCV_ISA_EXT_SMCSRIND 95 +#define RISCV_ISA_EXT_SSCCFG 96 +#define RISCV_ISA_EXT_SMCDELEG 97 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index d3259b640115..b584aa2d5bc3 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -390,12 +390,14 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_BUNDLE(zvksg, riscv_zvksg_bundled_exts), __RISCV_ISA_EXT_DATA(zvkt, RISCV_ISA_EXT_ZVKT), __RISCV_ISA_EXT_DATA(smaia, RISCV_ISA_EXT_SMAIA), + __RISCV_ISA_EXT_DATA(smcdeleg, RISCV_ISA_EXT_SMCDELEG), __RISCV_ISA_EXT_DATA(smmpm, RISCV_ISA_EXT_SMMPM), __RISCV_ISA_EXT_SUPERSET(smnpm, RISCV_ISA_EXT_SMNPM, riscv_xlinuxenvcfg_exts), __RISCV_ISA_EXT_DATA(smstateen, RISCV_ISA_EXT_SMSTATEEN), __RISCV_ISA_EXT_DATA(smcsrind, RISCV_ISA_EXT_SMCSRIND), __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), __RISCV_ISA_EXT_DATA(sscsrind, RISCV_ISA_EXT_SSCSRIND), + __RISCV_ISA_EXT_DATA(ssccfg, RISCV_ISA_EXT_SSCCFG), __RISCV_ISA_EXT_DATA(sscofpmf, RISCV_ISA_EXT_SSCOFPMF), __RISCV_ISA_EXT_SUPERSET(ssnpm, RISCV_ISA_EXT_SSNPM, riscv_xlinuxenvcfg_exts), __RISCV_ISA_EXT_DATA(sstc, RISCV_ISA_EXT_SSTC),