From patchwork Tue Jan 28 04:59:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Kumar Patra X-Patchwork-Id: 13952015 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 8B3BCC02190 for ; Tue, 28 Jan 2025 05:04:05 +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=utg4Rzpn0R73oy+uIqJTFDUVCdmJloFFggYSSW+GCRo=; b=Xhzxqwxraomx9I Sq/HOYYltGKK2YYv3HqIv3711PmjQN3YQOGel+nA/bO6e9Wnq3eAsGrjOocYF0gJqF9OjaW2MAywG 4dyW/NTPb8RKAoa41C5+SHjF09xAbItRGy+5flPEC1Pp8b24Ize7Bbjn4trnaae7pT/1jMBMrAkBs uZ/YpdCSpb0pdSM/Q/slKYhaV2vgv4KMZycEPFWlWhfy0WZFAwQ+Gzc4nrvyHLLJlVchLi1V5cqZk v5adjFNOyFchIpwCAWC6KcWf1SAWkkcPZnazv5giyEQiH9FZ4rSmDPkSr96XsBYaAC0FPP1w76Dg0 BqlYu7fZ51Ggv6QN/clw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tcdlY-000000045qq-0h6t; Tue, 28 Jan 2025 05:04:00 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tcdhZ-000000044Jo-2hw6 for linux-riscv@lists.infradead.org; Tue, 28 Jan 2025 04:59:57 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2ee8e8e29f6so6896076a91.0 for ; Mon, 27 Jan 2025 20:59:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1738040393; x=1738645193; 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=NxfKG65dTTWELGQSY1XBUvmc4ww6DrMBB5fk3tB2Lpw=; b=Yq3AqBUfNLKFNVT3lypt61S4EdhwvTfZ55N2DukmN72wh/ElsshCYHnQpi5PrSxXK7 uCiE7TFWPTyBkMHwruZ5DcBiLnoVF8v41JCYYlckpk3R/ejYcRKST+Ml/lYLrqel1pq0 Dus47LwTdbtQ5D1q3ed5Ch6VWaeR13eIISpwVHGc9Zw5wscysXd8V1yuS3/Pe2qPbGlH lz3FMBBHBsbt5kVMKoigLIQ+pYAgeKl8nlwNsOa3/1SNl9eSBKcQLBYZxDjkJ+gVgf+N hrY+rH6c+iedWAIF6MYX2zPpLOzWdgmC5zNTjkhyAvqn9hhx/aiOwNOLfSZ6MFDg0BW/ sK/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738040393; x=1738645193; 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=NxfKG65dTTWELGQSY1XBUvmc4ww6DrMBB5fk3tB2Lpw=; b=EPEVHAkkqx2e8m6tfwOotZaAg9WUcXbFBAsj8wvIQ9UcbAthPSKoVJN2IvgjNPW1AU ebsOXVLfzsyau4BP4hh6USHK3zdm+j058yPkEniVKVLy2stG0L0yQw4vATQgBiVOmlc+ ELsfqkdkGif1TNKina//xqVXvip2c1vS9bLn9TEbg++jprTqyvSRRZ0/3ymgh+YLs8N+ B9+r5XJwlR8x/nC/e/Lqb8FVeFko14zM51U9r4Jd/HQGuIAu0iZ3sKBT7WBH3v7e+LIM LJBOOaDNO2Z7dqyO/TuK2dp+R1fmrASLVSjSOCAjYArEcANJqbD6fFHwQirq0hOfAngN 5hZA== X-Gm-Message-State: AOJu0YyEuoBOUURL5cjcba4VXrgn5FMCqfK1nkDXpYocccwKRiARVd2I g3U4CxkxaibqAmWhY/nRD/InoSJMaJsf96syLnFa0NE+kEOrZjBvcqpsJjGw1XE= X-Gm-Gg: ASbGnctz3ljLu6VFNaIHQP2Zd1VOqbqdNej1K9TKMCUSAtGMNEyIwAnmPD01ueOGkUj 8LJXKQ/EtHOa5mMonU/TJoQHUkwoUMlYrKZr3vJQqJWw5gzjUK1rqcJ6cLAE8u9EuXnulENbhQ3 IeOB7gaD9jBXnqdXX9PDhs347NYdkrNAik1aTS7FjMJjbb/hH23WqfYugeXkVhK72wV31K6gAHJ gVzs3E1ZLIAAUAdTt8ksBdgCoFmsEDSS6bkNn8jBxLTs+o1PrxdltbpdwwQG8oMMc8WgbjZwN1M 32FxSZPziwaul22ExeHscO3PNrcNif/1yGSfcrI= X-Google-Smtp-Source: AGHT+IESukFvE4jgQHaD3G8e0OnXfuu3U2xg6/y3jZ2pizirle7LkpWlYPqExckDpakmelWJ9tr/CQ== X-Received: by 2002:a17:90b:4d04:b0:2ee:8619:210b with SMTP id 98e67ed59e1d1-2f782d97e04mr58425837a91.29.1738040392749; Mon, 27 Jan 2025 20:59:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 20:59:52 -0800 (PST) From: Atish Patra Date: Mon, 27 Jan 2025 20:59:43 -0800 Subject: [PATCH v3 02/21] RISC-V: Add Sxcsrind ISA extension CSR definitions MIME-Version: 1.0 Message-Id: <20250127-counter_delegation-v3-2-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 , Kaiwen Xue X-Mailer: b4 0.15-dev-13183 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250127_205953_752382_F08B4D86 X-CRM114-Status: GOOD ( 10.05 ) 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 From: Kaiwen Xue This adds definitions of new CSRs and bits defined in Sxcsrind ISA extension. These CSR enables indirect accesses mechanism to access any CSRs in M-, S-, and VS-mode. The range of the select values and ireg will be define by the ISA extension using Sxcsrind extension. Signed-off-by: Kaiwen Xue Signed-off-by: Atish Patra --- arch/riscv/include/asm/csr.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 37bdea65bbd8..2ad2d492e6b4 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -318,6 +318,12 @@ /* Supervisor-Level Window to Indirectly Accessed Registers (AIA) */ #define CSR_SISELECT 0x150 #define CSR_SIREG 0x151 +/* Supervisor-Level Window to Indirectly Accessed Registers (Sxcsrind) */ +#define CSR_SIREG2 0x152 +#define CSR_SIREG3 0x153 +#define CSR_SIREG4 0x155 +#define CSR_SIREG5 0x156 +#define CSR_SIREG6 0x157 /* Supervisor-Level Interrupts (AIA) */ #define CSR_STOPEI 0x15c @@ -365,6 +371,14 @@ /* VS-Level Window to Indirectly Accessed Registers (H-extension with AIA) */ #define CSR_VSISELECT 0x250 #define CSR_VSIREG 0x251 +/* + * VS-Level Window to Indirectly Accessed Registers (H-extension with Sxcsrind) + */ +#define CSR_VSIREG2 0x252 +#define CSR_VSIREG3 0x253 +#define CSR_VSIREG4 0x255 +#define CSR_VSIREG5 0x256 +#define CSR_VISREG6 0x257 /* VS-Level Interrupts (H-extension with AIA) */ #define CSR_VSTOPEI 0x25c @@ -407,6 +421,12 @@ /* Machine-Level Window to Indirectly Accessed Registers (AIA) */ #define CSR_MISELECT 0x350 #define CSR_MIREG 0x351 +/* Machine-Level Window to Indrecitly Accessed Registers (Sxcsrind) */ +#define CSR_MIREG2 0x352 +#define CSR_MIREG3 0x353 +#define CSR_MIREG4 0x355 +#define CSR_MIREG5 0x356 +#define CSR_MIREG6 0x357 /* Machine-Level Interrupts (AIA) */ #define CSR_MTOPEI 0x35c @@ -452,6 +472,11 @@ # define CSR_IEH CSR_MIEH # define CSR_ISELECT CSR_MISELECT # define CSR_IREG CSR_MIREG +# define CSR_IREG2 CSR_MIREG2 +# define CSR_IREG3 CSR_MIREG3 +# define CSR_IREG4 CSR_MIREG4 +# define CSR_IREG5 CSR_MIREG5 +# define CSR_IREG6 CSR_MIREG6 # define CSR_IPH CSR_MIPH # define CSR_TOPEI CSR_MTOPEI # define CSR_TOPI CSR_MTOPI @@ -477,6 +502,11 @@ # define CSR_IEH CSR_SIEH # define CSR_ISELECT CSR_SISELECT # define CSR_IREG CSR_SIREG +# define CSR_IREG2 CSR_SIREG2 +# define CSR_IREG3 CSR_SIREG3 +# define CSR_IREG4 CSR_SIREG4 +# define CSR_IREG5 CSR_SIREG5 +# define CSR_IREG6 CSR_SIREG6 # define CSR_IPH CSR_SIPH # define CSR_TOPEI CSR_STOPEI # define CSR_TOPI CSR_STOPI