Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp441460rdb; Sat, 16 Dec 2023 15:34:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJMp/flcLBQSQrZFH5o7oF0Uw2R06t2XpVNLxOjVY6Du2UMG7PiNHvljL/j07W6AJibwf8 X-Received: by 2002:a05:6e02:214b:b0:35d:59a2:127f with SMTP id d11-20020a056e02214b00b0035d59a2127fmr20542503ilv.43.1702769658945; Sat, 16 Dec 2023 15:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702769658; cv=none; d=google.com; s=arc-20160816; b=O7XvBDcjDxsaWE46zS5jP+vBt2Dcg5MZ5sr5fPTiwC0Ej2pp/k/NNVvleuWfMPWuEt zc1y39qtFRzH4893jQZjsZa4oRIhgMQ3cz/Rgyw248PknEAk89/4l5N4W+U2kVDUoICO wJ1TXWbk3q916deff7fIZtk4RkdPcBsHLFQ8AxKY0sBCOdIOEg+EzpKz0ewxgwnpDWZv R4toyWFjoz1jXXs/LQM2FGMicyQ6u6xigalcXaaA5ldXRxQn2kwUqKDft/p45QloD7NU IdwnYZ3Jfx88M6xpMxyTBHHZNCs15zaDokJcfZ0jUimkyutlADUW+X0X5TefTvn+2SlZ a/Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=OFpkZDM6cIT9ckSQvE0/t48hRBP6YwHFDtIgAeFhGig=; fh=zq9kpOyTR1qHLLgYXRs7x+Kiqjs3MBtAU4WywCj+pJc=; b=dtB20RWpTMJxPoGRIz9xK4JQb0HoMl1e4/IGqJBy843cDi0SYuNJe/BpSpQafN/NgB nCi+IjG45LKKo7yax8BEwLTsG4W9mjWyfq6JElKMaVm2nsRWWjliZuMgCxUCPcRHJSyJ /e2Bbh9+LUTGsGt4tEAqj4lEzSYddcvSzgvmWOrIPcywFWPL/TxRQa8CEBgFfeRRkTa1 XjXEhV0ROh54C2FEx/miyj0NnfJsaEVCbsEnkmrxvGg9JlimFtVZuz1BLXKnhieIyy24 VeX0E5qmIYYjagAN5Bfib5M0EX9/0YMtfpW2fj944HH+gkohEpnkxbUZhFC+MD6c2pin ckrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=HMyKsoeU; spf=pass (google.com: domain of linux-kernel+bounces-2396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2396-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c1-20020a170902aa4100b001d1d8b620c0si14795317plr.620.2023.12.16.15.34.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 15:34:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=HMyKsoeU; spf=pass (google.com: domain of linux-kernel+bounces-2396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2396-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C3DD6B23254 for ; Sat, 16 Dec 2023 23:34:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE2D2374F2; Sat, 16 Dec 2023 23:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=atishpatra.org header.i=@atishpatra.org header.b="HMyKsoeU" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 08B21374CA for ; Sat, 16 Dec 2023 23:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=atishpatra.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atishpatra.org Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2c9f413d6b2so19281791fa.1 for ; Sat, 16 Dec 2023 15:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; t=1702769644; x=1703374444; 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=OFpkZDM6cIT9ckSQvE0/t48hRBP6YwHFDtIgAeFhGig=; b=HMyKsoeUE1rilkR6kNH3Fbmd/hQNpprIomguASpuhLjqyZchNfyVxZiiNbtjgM8Zb0 RcQOebKe9qZX0KtvNvjN4EJwF0XBt2gzWvwyfCtLJpkHWUyFP11Pbp0xXFIeamGZooO1 MCGyckG4NwMVOo0gFLFv6PdCVSY4TzbV7Zkbw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702769644; x=1703374444; 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=OFpkZDM6cIT9ckSQvE0/t48hRBP6YwHFDtIgAeFhGig=; b=hx7uWNLiuhzzYs9ABBdBTKFLytWDqTaKKABeiTe4zlxKfTV01KweU3g/aH6uuIlSMt 5urh75zLE04myRI9CWdy4xV2wf0g7dqQKajVq4NRq21ofpUQavNubiIMouu+4wzOWQmL 4bZ5t+R2IKHxT3AlBwr2Kf3oXTu3mSH6wmqv7CK98rvdsxLhHFnS8vY+vN2jUkFaAScO 8M7vex9NNHGgklnBj5DCfphodPBeiSSoN92BtLKljhQ0s4dwEN8OgWV4tvw36XiZCmXA ZX1j3bCnbewUBKSsshS0laYIBhhof+KmEu6Cv6TeBUdEK0KVNk0GiRvyVbLVbA0gYfBH T0Kw== X-Gm-Message-State: AOJu0YwNgXbuUBlIP3jrjE+FdtEMSgn0Tgg8N/uMGBjlzqTRnvkFlEaz 0iapwiDp4oX9g3FWkrkyFasw3bX3A6yym5nN/Ck+sWr8Su7Wapg= X-Received: by 2002:a05:651c:c7:b0:2cc:5e72:17ef with SMTP id 7-20020a05651c00c700b002cc5e7217efmr399673ljr.49.1702769643745; Sat, 16 Dec 2023 15:34:03 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231205024310.1593100-1-atishp@rivosinc.com> <20231205024310.1593100-6-atishp@rivosinc.com> <20231207-unpleased-landlord-8383b4c50aca@wendy> In-Reply-To: <20231207-unpleased-landlord-8383b4c50aca@wendy> From: Atish Patra Date: Sat, 16 Dec 2023 15:33:52 -0800 Message-ID: Subject: Re: [RFC 5/9] RISC-V: Add SBI PMU snapshot definitions To: Conor Dooley Cc: Atish Patra , linux-kernel@vger.kernel.org, Alexandre Ghiti , Andrew Jones , Anup Patel , 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 On Thu, Dec 7, 2023 at 4:34=E2=80=AFAM Conor Dooley wrote: > > 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-mo= de > > and the M/HS mode. Add the definitions for that extension > > > > Signed-off-by: Atish Patra > > --- > > 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) > > If we can use GENMASK in this file, why can we not use BIT()? > Sure. Done. I will change the other ones in a separate patch as well. > > > > enum sbi_ext_dbcn_fid { > > SBI_EXT_DBCN_CONSOLE_WRITE =3D 0, > > -- > > 2.34.1 > > --=20 Regards, Atish