Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5948504rdb; Thu, 14 Dec 2023 04:32:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEn07t4llXej3PBA67fPukP4Wx1yD4HVk/yaX3uUCGX6BTW7htgGklBmYKQkXavzDAbKBL X-Received: by 2002:a05:6358:722:b0:170:c2d0:7225 with SMTP id e34-20020a056358072200b00170c2d07225mr7432087rwj.7.1702557157805; Thu, 14 Dec 2023 04:32:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702557157; cv=none; d=google.com; s=arc-20160816; b=JAbrolfPQlbAf/N8tV+dHVrtZABPk8K04JvbykGszXajMPhJ7Dy5MpgwSgQamh2Xe9 NIdZIM8crZL8bdJ4OguyCvklsl2kowSQG/Lx6P+hbPxJGup7hi2Y8TcQykehPw/bQdZk 6/5K6QHOH2hThW9lAmxNqCpMF3TYHIw0bCvVQ+51t05vzhW9Cpm9UAR/ML+kYmAIGage pY+LVMW84DZOYjbnhMx877+DNFuh9Q7g5naIYXOFZQdOT1yvsR31cmLKMuugXiLX+PO4 ybjbiZPvUKpEBgCd26MEQD/1LGtetBof+zb+my1tGf/rrPSJFRCBPxZPNR0iamdZtcys cH/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=OHs0a9X4fElRxkh1m4Obf7cu50BAmw2Tug+rwqngNXM=; fh=oOBf863YCUz5nxlCZQoxyjaLXR9Zm0DTQlRqUgQrhSo=; b=lWTKPO28/u3gWDgQmPqrJQnewV9mhsQ+UCVOSmLj0LDGGZG37PBCKcQoLKL/38dlUT F3jITL6JcPzC7D0ctixcdRyEijoC0koSriUTA0YPdN7Ua4gKasDWR4Q7PdHs+eThUUrI rKfNyw5OE9QWOCoLy+O1D2YNk2cE/Mx91gtiZb7CE3lj543TObtYp8NJTK+f1QrfuOHi g3+9OEgZpcyL3QjUoxdflBgaaIbm+q/31Ijj84Hl7cq2TJHUaGcfn2piL+C0nSRKDp2M C1Yd4+pD6rykAqi8/4mDvgQRaN2RnlHbGX10zaIseZx6544WMfAquABkWNonYcxmYYJD 2KDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20230601.gappssmtp.com header.s=20230601 header.b=rTUdyDnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y31-20020a056a00181f00b006cd8db77f84si11064908pfa.274.2023.12.14.04.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 04:32:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20230601.gappssmtp.com header.s=20230601 header.b=rTUdyDnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A710C80657FE; Thu, 14 Dec 2023 04:32:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573039AbjLNMc0 (ORCPT + 99 others); Thu, 14 Dec 2023 07:32:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573030AbjLNMcZ (ORCPT ); Thu, 14 Dec 2023 07:32:25 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F33BA11D for ; Thu, 14 Dec 2023 04:32:31 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5ca5b61f101so452065a12.0 for ; Thu, 14 Dec 2023 04:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20230601.gappssmtp.com; s=20230601; t=1702557151; x=1703161951; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OHs0a9X4fElRxkh1m4Obf7cu50BAmw2Tug+rwqngNXM=; b=rTUdyDnx0uZyyMLdBq/39Sz/gjFVrGgpyKLlpYbesZsJXm5qekReLG1fkuAZqUCJxF GJcLI0hl2daTeRGAuY+hjKGgdaF6LaAOoo5WEQU2OXNCFLLam8F4IfFricyUnwirJ6JB uVJrQTwnrn5NDXkcvqnkU2QPAPwvRffrTEZdS2RDIvhSsVyq/8D0S1YEfZIKJprABZ/m zVqvH4wLBJ1Q6UlCt6SCTKN+QS2nrz9BzKEe2FAt3P4qHOrLAsvtW6Q9m9uteXrm2zvi EPF8Q/sNe/RT45dXjJyNhBoctCXiO8U3qSVG0jn5sXLTJxM4RqXAMJQXUdK5i98LnyU5 WSww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702557151; x=1703161951; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OHs0a9X4fElRxkh1m4Obf7cu50BAmw2Tug+rwqngNXM=; b=KNCjd6SXrKl7jpL4y/4vKXJ94c+Aae54fboiLZJygTLyudWDxNnDjc3kn02baXuYDc zk59Fkq3ueVDpBkuDTgxegwOX/Uka0icBH+/8OWiN7qnry1Lb31WBtMoWm+mG/s412bO K7PdXGpeDaycDj0C2d7oLDh/yN0/QCumaO+gynJcYSQkIoL96mgA8Z49eV+azHesBuUT BnPv+AkCN55hnpS0aU3+4nEiJoJTlpKGbCTO385o8laeM8ggeWoP5qRaeZ/U0W7GsqA5 0kvyARTvOSNW8IsyIZE3odzMKqm3QdiqD2N8S51NjfeNtV4WtCIKVNIfhm6vFUig4Mw9 nX6A== X-Gm-Message-State: AOJu0Yznro+ppAnlBxIqfaItL+F95kDhOD0Fb0wRf4s7AEgzihy0Nd5E Y1ZT8GcvqiSKU7MnupUEy8UpxE/pQ45k6nCM7tA4RA== X-Received: by 2002:a17:90a:de94:b0:28b:1fbd:27de with SMTP id n20-20020a17090ade9400b0028b1fbd27demr4566pjv.29.1702557151290; Thu, 14 Dec 2023 04:32:31 -0800 (PST) MIME-Version: 1.0 References: <20231205024310.1593100-1-atishp@rivosinc.com> <20231205024310.1593100-6-atishp@rivosinc.com> In-Reply-To: <20231205024310.1593100-6-atishp@rivosinc.com> From: Anup Patel Date: Thu, 14 Dec 2023 18:02:19 +0530 Message-ID: Subject: Re: [RFC 5/9] RISC-V: Add SBI PMU snapshot definitions To: Atish Patra Cc: linux-kernel@vger.kernel.org, Alexandre Ghiti , Andrew Jones , Atish Patra , Conor Dooley , Guo Ren , Icenowy Zheng , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paul Walmsley , Will Deacon Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 04:32:35 -0800 (PST) On Tue, Dec 5, 2023 at 8:13=E2=80=AFAM Atish Patra wr= ote: > > 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 > > Signed-off-by: Atish Patra LGTM. Reviewed-by: Anup Patel Regards, Anup > --- > arch/riscv/include/asm/sbi.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > 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, > }; > > union sbi_pmu_ctr_info { > @@ -138,6 +139,13 @@ union sbi_pmu_ctr_info { > }; > }; > > +/* 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 > > @@ -234,9 +242,11 @@ enum sbi_pmu_ctr_type { > > /* 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) > > /* Flags defined for counter stop function */ > #define SBI_PMU_STOP_FLAG_RESET (1 << 0) > +#define SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT (1 << 1) > > enum sbi_ext_dbcn_fid { > SBI_EXT_DBCN_CONSOLE_WRITE =3D 0, > -- > 2.34.1 >