From patchwork Tue Jan 14 22:57:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 13939649 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 BB69DC02183 for ; Tue, 14 Jan 2025 23:07:20 +0000 (UTC) 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:Cc:To:In-Reply-To:References:Message-Id :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=ez6DD7BB1mNDH3kkd6YuMPL/JMFEGp6F5G5+VC/x7c8=; b=ox7euLdwrnVz2X 325AAmiWh3lXzjRJQ/7n6hikxod1grs/U1ls71F/pRDQ7Rtn5T3vn+SKqKoNvCES6K/l1YesryZw4 Sd2t8nEZ5HMOlM9l+YBtcqIyp2A4Tn6sBmVjdP/oNuqQ3GFT5OL+gcHD6tLisuGRSbV/+gXZZNdso G3fRFUQI/wFUXlYa4hxVWXACs8jeO+ybroXeD6HjH/3ZkuEnEILkubdVjqblqSVmEu14drm1DogrX eY2icKpTu7hTbqihfs0dFQoxgKUmfEfbn5qDjvxMs/2FHisC9GUmWLtXCXwfkrt9Md9IzNyRE5FUx jac7xxwybdlh+waMfvOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXq0C-0000000A2rf-0DAS; Tue, 14 Jan 2025 23:07:16 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXpri-00000009zs8-1dgQ for linux-riscv@lists.infradead.org; Tue, 14 Jan 2025 22:58:31 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-2163bd70069so110770425ad.0 for ; Tue, 14 Jan 2025 14:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1736895510; x=1737500310; 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=UHBW/4ouU2GIhAFqiYMl8UaVRS4Qg5q1P0or7ey9Ju/wBzS8yoI+JA1MSq4FEX8969 BEFgp7qjU5SzTEI1BFLHXKxzsBeHdBNWfcyUhw4YwK3oPwciKuJwuEv5wjf7keUiTRd5 2sK3n2U52WeJ+wcZ/i80ZLSERx81wMmARDgpDSd+qIu8GTxrWy65qTpEv1XFgdqLh3VN iws84/qXFBYr3QW1jf60fncQmxkAxwr8M4Dd61XGmvtWZHmESqu+u8mx4f/743/KHD5z PDpqyTfNvZQgsl9QoDpvm4oMLoJOlIa50xnxlm7Wo1z43JzLsi+hQCu/SzMiZTc6E75X nwhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736895510; x=1737500310; 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=p6Pj+KGBb4NF3s5j38xUGkYZ48u8l/x48FGMZfrjt6Kedr9LKysugu2tECiZdapmjK DmJVueTw70fNpdCeRtircjoCMXD6Onm9tX/FatkqlXt022AzVTa2z4t4CJ/BvSQGgDSd dj1rQXqWQ6pMAqarRAAJ65UH4lAs0k0K8gTVfQicnCs3RWJPg/FH7JRBqUQXpBFku4ZJ I6716VrK5ah7VlQhafqJE5JRkQ5IaImYTUAHw2Db56vm6D5Dzm//s7TT02D1Vr57iI8o /OYDOoudZdWVx1LhKhNV7tKfFAxONB9Nd4MEsC8KUjYgyLBWP3MIafGHdHzAwfxDlCRZ abDA== X-Gm-Message-State: AOJu0YwBYuFPFWdfnAWCBmpe6buHWI8Ww6k2+bfhbWd5pt5CIGQSpziK AArXwRQwuyeP2KHpFUoJqihLWve8pRSFbHKlDC/mbNm0yqXUyFTLrjUjCiCzacY= X-Gm-Gg: ASbGncvsfDa0ncqV+uqe1s1aag4TpcONMu4EhLdW+YzCyqlfHjlisrLffyTvkLmtW0C cBls8fk9GRbofOgfzBQahLB7+j6z/XKnapO7nE2W0e82jEE8D4Lcb1OLvXS4mwKrx2jznfsYhWB R57ozmaazYmKp9ZGeDQNjti56oPjc3ZBF179yyyqKekbh7A9oDGZj05cD24DqpPr8dMLl7ZPN6L pB1eYVFPPbE6s4elmcGlbqtN6siwqGDexbIphKDe7CcBucqVwFYggm0LwvCNrba70/rOQ== X-Google-Smtp-Source: AGHT+IHxXDdAHPYokpxm47ueo2TdVOG0GfdEc0qqp9YuFJCqGs1f9K+cpyt7QXfGQGsnfIi5G6wVOw== X-Received: by 2002:a17:902:e544:b0:216:50c6:6b47 with SMTP id d9443c01a7336-21a8400038bmr426908115ad.46.1736895509814; Tue, 14 Jan 2025 14:58:29 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f10df7asm71746105ad.47.2025.01.14.14.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 14:58:29 -0800 (PST) From: Atish Patra Date: Tue, 14 Jan 2025 14:57:32 -0800 Subject: [PATCH v2 07/21] RISC-V: Add Ssccfg ISA extension definition and parsing MIME-Version: 1.0 Message-Id: <20250114-counter_delegation-v2-7-8ba74cdb851b@rivosinc.com> References: <20250114-counter_delegation-v2-0-8ba74cdb851b@rivosinc.com> In-Reply-To: <20250114-counter_delegation-v2-0-8ba74cdb851b@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, Palmer Dabbelt , 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-20250114_145830_424085_C1041A0C X-CRM114-Status: UNSURE ( 9.87 ) 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 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),