Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1618706rdb; Thu, 7 Dec 2023 04:34:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IErkbs5JX56ZlGZuaQm3sVHiN651bApoRIdYL5umasqrIq0ffFLtDR6jaFf2RqjIR71FReX X-Received: by 2002:a05:6a00:1c87:b0:6ce:7faa:29ad with SMTP id y7-20020a056a001c8700b006ce7faa29admr1916328pfw.10.1701952463505; Thu, 07 Dec 2023 04:34:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701952463; cv=none; d=google.com; s=arc-20160816; b=O3MEHrlWmeLwa7EPabKi0lHH3vs93NujIyqeK785sephC6rFNaGhu1za4uPbngpDin LY+TS8kPcnsc/3LbcSAvsFT2SYmbd4NfyRLoHWwyOKiaucSPe0omfebW8QHb3aUjqGQV qCmJ8GPRAmL678ZZ0xvqNXI+ieTHgawzg8eqgBIweKcImjUMd6E3+Ho1Mp7WZhVtGr4i JioEhlK4/kSV0OKWTZktZVdkJqw+1vAqnn2RhM72BRKRi+zHwYkNcF+qjGKe/l2Y/waP Ef9Oejzp8lpemScglJoANi/Hl0i2eHXEOenOExH9eFusx0W799Gt9U7jTo7LEgKnMZrv hpzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=V2LpZUEJUbdNTSbsQBJ64hnnzniYamfDbJtfW/3uv1Q=; fh=fAP4wR4+b5xKHHBxYiAwn8VIqfOS0ydsoC5bpB/PMWw=; b=cKOinFSuCAKu5pIOSu6IWaKZjeY7lFWMjbtDNhuuX2iNVclKh3+pyU/80QtypYeUlF Fm+hqZVIIAWrNQQiPEQ5DUa7zvuVkOE/uZYS2tjTlVjEZdivxuPADejPeJ2PV6C6LZqm tA+OzWiQQ/9EhqKatRs/PK8yeihr0KA8pmGcM4hujcrUuW5oICAjPUplXuWKPzkpEoKj uw4Ijkjro9ueo/VDCy7V05SjkOLb565qtuzzZGbMNTvYVwpOqnbQvj1RAlYndWjkCunn imjMi/87ht5Qq+2wwI1/1+lWykw/bMsMKNEyMXvmjFM09lrVN5cnhBxWZUDiMFCkduSy 2zvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ABl8+A7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id o9-20020a634e49000000b005c685a3f4acsi1100872pgl.887.2023.12.07.04.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 04:34:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ABl8+A7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F3FD9804C4BB; Thu, 7 Dec 2023 04:34:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbjLGMeH (ORCPT + 99 others); Thu, 7 Dec 2023 07:34:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232554AbjLGMeF (ORCPT ); Thu, 7 Dec 2023 07:34:05 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B28FCD5E; Thu, 7 Dec 2023 04:34:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1701952451; x=1733488451; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=/29bWAHsyxsZQC0+CaHDpJbfrecN2Fa5js7gLIME0cg=; b=ABl8+A7MmkY2hBM2NJ3Nr6Ig74FO6+fdR3q7VdUwkueASYH5ewc/RuK0 KEVlRgklx5OLb1gErZhh6zQXJacSdEP+0FGHJPsMENl7D7KKL757lqLK8 0Auhg094TfheIaO43yDkgYJ6xcGrQeiS2Qlv5igqHAaM2RmloCQ9gDNbH rYM0l36gsbc511LXVfzTrDLEnOede/DAhgwcvDQNMXlbs/3i2/ZnxEFYj t0Qk5DA4KbfwZarmkCSgkXjDwTXJMms6dgsAqHND4xiHS379SlbK1BAGv DTCYXje5X+LXLaY/vD70vnQcd5oOgA9MsqIypMtTh6/x5yvjIVpczGjEA Q==; X-CSE-ConnectionGUID: 5S5swfdoQfujZvrEN0fvmg== X-CSE-MsgGUID: i1Q0FKZETvaelYNIfTFB6g== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.04,256,1695711600"; d="asc'?scan'208";a="12867992" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 07 Dec 2023 05:34:10 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 7 Dec 2023 05:33:54 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 7 Dec 2023 05:33:51 -0700 Date: Thu, 7 Dec 2023 12:33:21 +0000 From: Conor Dooley To: Atish Patra CC: , Alexandre Ghiti , Andrew Jones , Anup Patel , Atish Patra , Guo Ren , Icenowy Zheng , , , , Mark Rutland , Palmer Dabbelt , Paul Walmsley , Will Deacon Subject: Re: [RFC 5/9] RISC-V: Add SBI PMU snapshot definitions Message-ID: <20231207-unpleased-landlord-8383b4c50aca@wendy> References: <20231205024310.1593100-1-atishp@rivosinc.com> <20231205024310.1593100-6-atishp@rivosinc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gTzysXj1uHqZjdds" Content-Disposition: inline In-Reply-To: <20231205024310.1593100-6-atishp@rivosinc.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 07 Dec 2023 04:34:21 -0800 (PST) --gTzysXj1uHqZjdds Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 04, 2023 at 06:43:06PM -0800, Atish Patra wrote: > SBI PMU Snapshot function optimizes the number of traps to > higher privilege mode by leveraging a shared memory between the S/VS-mode > and the M/HS mode. Add the definitions for that extension >=20 > Signed-off-by: Atish Patra > --- > arch/riscv/include/asm/sbi.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h > index f3eeca79a02d..29821addb9b7 100644 > --- a/arch/riscv/include/asm/sbi.h > +++ b/arch/riscv/include/asm/sbi.h > @@ -122,6 +122,7 @@ enum sbi_ext_pmu_fid { > SBI_EXT_PMU_COUNTER_STOP, > SBI_EXT_PMU_COUNTER_FW_READ, > SBI_EXT_PMU_COUNTER_FW_READ_HI, > + SBI_EXT_PMU_SNAPSHOT_SET_SHMEM, > }; > =20 > union sbi_pmu_ctr_info { > @@ -138,6 +139,13 @@ union sbi_pmu_ctr_info { > }; > }; > =20 > +/* Data structure to contain the pmu snapshot data */ > +struct riscv_pmu_snapshot_data { > + uint64_t ctr_overflow_mask; > + uint64_t ctr_values[64]; > + uint64_t reserved[447]; > +}; > + > #define RISCV_PMU_RAW_EVENT_MASK GENMASK_ULL(47, 0) > #define RISCV_PMU_RAW_EVENT_IDX 0x20000 > =20 > @@ -234,9 +242,11 @@ enum sbi_pmu_ctr_type { > =20 > /* Flags defined for counter start function */ > #define SBI_PMU_START_FLAG_SET_INIT_VALUE (1 << 0) > +#define SBI_PMU_START_FLAG_INIT_FROM_SNAPSHOT (1 << 1) > =20 > /* Flags defined for counter stop function */ > #define SBI_PMU_STOP_FLAG_RESET (1 << 0) > +#define SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT (1 << 1) If we can use GENMASK in this file, why can we not use BIT()? > =20 > enum sbi_ext_dbcn_fid { > SBI_EXT_DBCN_CONSOLE_WRITE =3D 0, > --=20 > 2.34.1 >=20 --gTzysXj1uHqZjdds Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZXG7kQAKCRB4tDGHoIJi 0u7BAP98g7gYr0WtICEW4nsKWIrQsLsY6Wc8mDmWrwFalMU4ogEAqbupqAr9KImF qhjdmarFukSX4880Fs+uZ0l+0cWf5w0= =abO+ -----END PGP SIGNATURE----- --gTzysXj1uHqZjdds--