From patchwork Sat Feb 17 00:57:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Atish Kumar Patra X-Patchwork-Id: 13561136 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 3DF1EC48BF6 for ; Sat, 17 Feb 2024 00:58:52 +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: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=oClqW0lxLtDGAeuS02oCQAmlLxctWteJXAlfowKL2rc=; b=Bc86pC33Q/jjYp y1sEJVaaTleLWElzOyA3z4fxbWcg5CTZwvMQ+E2Y96+iU28JB+bHq8vkRRe6eqYMrUF3++pbc8geX KtO/ccWidNP39xSN49kamHHRDXqjeS1sRmb+ovD4qZuh/qjIatMctScXvqoki/zMKz0pGfO2YKcZA 6SHM+Wv/2yYjV8SbN27fMB8P0Z39nE6YF7Jcpi/VuYEvq8QVW9x7r4nGDq4qdItds5ck+BTtnMnmP 5d/ih0QBpwDbxPDL9fHa7ElCa5gpAj8/KsAQ+bLTzw7TUjJR2aYol0UZJA+LfzHoo56RfcjD9xksJ SqNBJPQJ2SdsxGnAOQ1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb92V-00000004IKT-40mc; Sat, 17 Feb 2024 00:58:47 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb92H-00000004I5s-1pR1 for linux-riscv@lists.infradead.org; Sat, 17 Feb 2024 00:58:36 +0000 Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3650dcd38a0so3262605ab.1 for ; Fri, 16 Feb 2024 16:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1708131512; x=1708736312; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8yuqScAnZ2lAjzdM+wGDjNHf/qrm86EPmr1bz136zUM=; b=NUx3StnjFV9aK5ks4d+rp6FajNW4PfQ8JiEs9s1DpdmPVX3PKRU0Gc92OlePmJDiXD CMrrXourUbCYzuIx2EelC5IW1C/7pwVTa3YxEWPyeTyekQoMUdhwTP5/kfT6KmubAWow Uy/MkZNHdUBHgPY3PYwKDnsXf7k5wG6Jy70dtbmh07HbDH4d1/oO/Ih1lerEWc0hzqo6 Jng3v/oPbjesOcIcogxUIGSEI9k0Q7arfEw/YwPPYWp8iqq42wZ6aP/zKKY0LU/ugIkL qVEyD2dKpf5VkhI1SFNWO/OfeMxSDROwJ5n8HmbbpBBWAMX/ek1GKHNwqSrcTiq/19Dt gi4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708131512; x=1708736312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8yuqScAnZ2lAjzdM+wGDjNHf/qrm86EPmr1bz136zUM=; b=DI8g24lUWqcO0yDT53G7/ps65n3tQPJNkWUdcvr8TIz9z5c3CliFXpmORSEp2BvV0r CxBGdTS1AVCWsYjvvw+KeP+/mjhL0nNNGfl+OgaczfzUKmuNDIvLD06xwawJH17l7LWI kY4EuUM8wvFzmZbqZuCb0eovTEBD6164T1kGgSj1dFlk0wCA4VjzaMFU+8m8e5U01F3G 1fb7m7QYLym7ASBOVKG/QbkizBOVXrzRMD0ZmdiEk+8DH8Y/L3Wu4UN5mgVZh6A5xN35 l7hzlj6ZjuNMA5kXYeaJFboQy9z3gVUUuf/nBH626musDpJf3qCqr0lbDGWpU5VEttV0 0uzA== X-Forwarded-Encrypted: i=1; AJvYcCX462E6B1DytiQns52ldguX6gJgd6ca4JL5JQVBBuGLsABepRuKM925RmoFcOg8YC+pHFyo6qAKs2pFbRIVxzogea2C4gJWWv7NQOl6w6E7 X-Gm-Message-State: AOJu0YzW1msfH5FAd7Ecx9kkXe1ienOZ5c8lNM4UMOobidbIu4DwWKR1 TiYj2ur3LG/mFpgYkaoGCLpf6OovkfZK03ALXAKViigWMCrkFL4t82R/1YhEJmU= X-Google-Smtp-Source: AGHT+IHik4QrimZEc7Y58ACfRBjvwhbVJhwuT0U4/D/6aufYBPUmjg3iZ9kYnwtI0QZLKwXDyQ9OOw== X-Received: by 2002:a05:6e02:1069:b0:363:b362:a2bb with SMTP id q9-20020a056e02106900b00363b362a2bbmr5475068ilj.32.1708131512047; Fri, 16 Feb 2024 16:58:32 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d188-20020a6336c5000000b005dc89957e06sm487655pga.71.2024.02.16.16.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:58:31 -0800 (PST) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Adrian Hunter , Alexander Shishkin , Alexandre Ghiti , Andrew Jones , Anup Patel , Arnaldo Carvalho de Melo , Atish Patra , Christian Brauner , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Conor Dooley , devicetree@vger.kernel.org, Evan Green , Guo Ren , Heiko Stuebner , Ian Rogers , Ingo Molnar , James Clark , Jing Zhang , Jiri Olsa , Ji Sheng Teoh , John Garry , Jonathan Corbet , Kan Liang , Krzysztof Kozlowski , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, Ley Foon Tan , linux-doc@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Namhyung Kim , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Rob Herring , Samuel Holland , Weilin Wang , Will Deacon , kaiwenxue1@gmail.com, Yang Jihong Subject: [PATCH RFC 07/20] RISC-V: Add Ssccfg ISA extension definition and parsing Date: Fri, 16 Feb 2024 16:57:25 -0800 Message-Id: <20240217005738.3744121-8-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240217005738.3744121-1-atishp@rivosinc.com> References: <20240217005738.3744121-1-atishp@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240216_165833_763273_8B4C9BA2 X-CRM114-Status: GOOD ( 10.97 ) 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 44df259cc815..5f4401e221ee 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -82,6 +82,8 @@ #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_SSCSRIND 74 #define RISCV_ISA_EXT_SMCSRIND 75 +#define RISCV_ISA_EXT_SSCCFG 76 +#define RISCV_ISA_EXT_SMCDELEG 77 #define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 52ec88dfb004..77cc5dbd73bf 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -300,10 +300,12 @@ 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(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_DATA(sstc, RISCV_ISA_EXT_SSTC), __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL),