Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1445446rdb; Fri, 16 Feb 2024 17:06:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZPZh6M44FL8nPwdzoB6OnJCsfue/bn3rcoG3Pjfa5yMBfWly5FYqV5MBsqFpNGmpaEev7ZLFCASc+sHOMyKxY+uinAUsx3rM9RL8abg== X-Google-Smtp-Source: AGHT+IF+9OMAchZbhLeVerrAIz6TZHYDwQ+Xt/U7dvkfkIGCj6FERSQDNADBnr7RU1EuUk5zJDuF X-Received: by 2002:a05:6a00:17a6:b0:6df:dde5:6029 with SMTP id s38-20020a056a0017a600b006dfdde56029mr8403758pfg.19.1708131975791; Fri, 16 Feb 2024 17:06:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708131975; cv=pass; d=google.com; s=arc-20160816; b=q6n5H/La4K5DxUqMH0ZMQXzEZ1v0k0540RHkUGl1VhsOXedurzHlbeoEZgfv1S7IJq UVhdjaK4ztlwMUQ3a8kvMAYwJuS6/Ze4HrVnBHKVB1OuKBapVsG9/fhKp2UM9rRnITpp ffWC7t0dzVehrCPIOFpO59M3Ywnf7IPO5naEP3Hgei8IFATeSrbOHOmv/poANRlTUqbX oemWpirOvKE266H7tM4AlNd5aO782x6tHuzj5ufkTgjmijeBEatsA5XjHKNSa2j1vaSd vqqO3L4XVL3RgNLn5v2tzvuCG12uxRPOiuyPmcbJplmUfQZ8L7SiCuVgm2rQ5gfxwjUf cNGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5vDBckQYWb4Du0H7yzxJq6wilfl8k4fp2vqlUJD6o0E=; fh=VCn6lt55QOKjzv0Hbz5VO3vbW0BxeXx0oGBGk4MoX4I=; b=Kd4obsWxENyz5f4tzYL7WUynf4jygBlWexTmPeaL2RD3c5AazKuD1smHhX9I1VSJil nGsxNMlzFPB9vg5rP7enBzIOMDEqSDPLtI7206aW8XYds4yDS3HUKiy6iARXwbqzNbUF g+mbD7l8KZxa7/yYZM5HnWadCceZcO1/ksOo9gas76xGPSrWg1rHdme58E7FXexxBPlA DZMXtCiu2SYlU+pfBMxSkbl39XdgpKFfcPLC0N5+8ocNCiKNBXC8XfI3Ao4p+kWOEGgy /2gLUIUfRAUEoNxLLc1KLNcX5JDjXqHasId2A5Ds+cGehgv9R5dfYopWSGqcYm92HpQL LNrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=zRcBWut3; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-69616-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69616-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cp17-20020a056a00349100b006e0fc47cd84si737716pfb.28.2024.02.16.17.06.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 17:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69616-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=zRcBWut3; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-69616-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69616-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4BCFC281C7A for ; Sat, 17 Feb 2024 01:06:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7656A3D960; Sat, 17 Feb 2024 00:59:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="zRcBWut3" Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB38B39855 for ; Sat, 17 Feb 2024 00:59:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708131547; cv=none; b=sHAJuAKB/ar7Z8ZFHT9S5IacPJjkU/H0gU0zQjpztqLt2IXaSIIH6eKoNlLglw8qPyQpHD/qciGu39BEAiNF6RBFfYybNz4lweSIkq3wRve51Kzikl4byfrqGPm1YP0JCSGGGaID3Y8VAo1lUh4EeZ2MRUhm7G6yoVAaFhSxZig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708131547; c=relaxed/simple; bh=Ya/XJ2BT1y/8netb6r38TrbSiZPgoHRnwGgVEj7mjLI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tbZBF4KKpMDg5xw9Xg6WHDflYAAekNwg5JCWzx6j+/X0wuJldGjk8gG6Nhjed08y1OtsEXHK67idEK+UUEl44hmESzwOE6UUu5S2S2GhdTSoQ20MxoRUx6N4Bsw2ytmoY8qAQtlPzSnGiN7VhS6EU9Lt+qm/fLYwaDv5sX+Xs8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=zRcBWut3; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c0d59a219dso1575027b6e.0 for ; Fri, 16 Feb 2024 16:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1708131544; x=1708736344; darn=vger.kernel.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=5vDBckQYWb4Du0H7yzxJq6wilfl8k4fp2vqlUJD6o0E=; b=zRcBWut3qUJoRlhpLenL/xuQkn+Otm0lxoDneVn8x+LMh07BjbeAjVhfxRNJcMI9rz RV+jICeQq3nXoKGvqWX4kzQnv990v5r6FjOI3b++PkVzYlOuqd7KVWFXSzOCZeAFTc2r GVRBVXwv0bcYIqHbcWgF6wwAB97bW7944wPAx6Ass+57ffTQVWV2OFmyLlDp5A7rRdwK VyG8qNZavf4f5HsAoFB6NYKuBzIf3J9TiTZ5oHYmWFDKCwiCgToGMUiV1aFG9XMpqd2I 1706Whong9dVsYQtugESgecqqgUIN6BIoH6EK6pnBuoevnmFSmhGTYK/Qp7tR8zRPKgo ClKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708131544; x=1708736344; 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=5vDBckQYWb4Du0H7yzxJq6wilfl8k4fp2vqlUJD6o0E=; b=FkTUWJrWi2seOFTFF0w6BjSmw4hDed4jcq9Pk0MRrEPH034NQ97dHFjJUSUtesTEiQ zKoMiV0we2U2x9D6ZxsuRDaMw1h4MyzsBEs0wzmHn5BEZWZGfRlKbazwhyxTCPz/QohQ m36cJXJgNduBv4RBKNjg1cf2veKpCnEohYih9ZxVkyN4TKh57vgxTSWjohaDW8BsAxwP uMt9yl8UDqckTOlbcoc02njrY/Lcj1tDS/B2NRzfFaPJAg+Q926Lut2eeZTAU3T+0LXf W3LA5oXQKKEHkZJFHqHuaYKIg9vqWCiD1wVq1Mra1rj6knLF7xqVN4T5nIgj6JXeAhhK IHig== X-Gm-Message-State: AOJu0YxRfmYZ0L2Q3slckK01eyHqEXIsOJ44s1CMwXlzTxCJ24zDITX8 lrnjqPgtLSmVVhMGVdG/R8BCUJNuDtBX1sERZK2NrXTD9VgqhU/jJNLRhwb5HoO1aEORUGclhNQ q X-Received: by 2002:a05:6870:478a:b0:21e:698f:5c91 with SMTP id c10-20020a056870478a00b0021e698f5c91mr3327913oaq.41.1708131544105; Fri, 16 Feb 2024 16:59:04 -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.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:59:03 -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?q?Cl=C3=A9ment=20L=C3=A9ger?= , 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 19/20] RISC-V: Add hwprobe support for Counter delegation extensions Date: Fri, 16 Feb 2024 16:57:37 -0800 Message-Id: <20240217005738.3744121-20-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Even though the counter delegation extensions are all S-mode extension, perf tool can use it decide whether it wants to map standard events or not. Remapping is not required for if SBI PMU is being used for hardware events. Signed-off-by: Atish Patra --- Documentation/arch/riscv/hwprobe.rst | 10 ++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 4 ++++ arch/riscv/kernel/sys_hwprobe.c | 3 +++ 3 files changed, 17 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index b2bcc9eed9aa..77fa0ed09366 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -188,6 +188,16 @@ The following keys are defined: manual starting from commit 95cf1f9 ("Add changes requested by Ved during signoff") + * :c:macro:`RISCV_HWPROBE_EXT_SMCDELEG`: The Smcdeleg extension is supported as + defined in the RISC-V Counter Delegation extension manual starting from + commit ff61c1f ("switch to v1.0.0 and frozen") + * :c:macro:`RISCV_HWPROBE_EXT_SSCCFG`: The Ssccfg extension is supported as + defined in the RISC-V Counter Delegation extension manual starting from + commit ff61c1f ("switch to v1.0.0 and frozen") + * :c:macro:`RISCV_HWPROBE_EXT_SSCSRIND`: The Sscsrind extension is supported as + defined in the RISC-V Indirect CSR extension manual starting from + commit a28625c ("mark spec as frozen") + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 9f2a8e3ff204..fb7c6bd6822a 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -59,6 +59,10 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) +#define RISCV_HWPROBE_EXT_SSCSRIND (1ULL << 36) +#define RISCV_HWPROBE_EXT_SMCDELEG (1ULL << 37) +#define RISCV_HWPROBE_EXT_SSCCFG (1ULL << 38) + #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index a7c56b41efd2..befb6582b1ce 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -111,6 +111,9 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZTSO); EXT_KEY(ZACAS); EXT_KEY(ZICOND); + EXT_KEY(SSCSRIND); + EXT_KEY(SMCDELEG); + EXT_KEY(SSCCFG); if (has_vector()) { EXT_KEY(ZVBB); -- 2.34.1