Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp446274rdb; Sat, 16 Dec 2023 15:54:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHR+LVbr4IfVp/H32pjkqq5lU8+WaBZbJQFBHCOwH9VhIanh4OMXP7wSIB5EQebl0B4g/ar X-Received: by 2002:aa7:8602:0:b0:6d5:5c89:a9e9 with SMTP id p2-20020aa78602000000b006d55c89a9e9mr476157pfn.68.1702770894034; Sat, 16 Dec 2023 15:54:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702770894; cv=none; d=google.com; s=arc-20160816; b=VBAkQeDsOxRzODL4RdMoz0JG+4LMXDHX3RPkiW5xgE3FPmT3oN8d4nbTMX1ShkIVqt pVAEEjDEghsUne5OSm/3dnRMMAjkeEax4rjpsnw570RQHYaMfYAWigPQ8PUMD/8LFc/S 32TS3qJKq++Cz0+iKf92iDYPNawqwvG8q5aCwOq28ozbZbw/C7SA/j9uG6LxyjZiUSuL XEWcSE+fgdXtPyhuEjX/Wbv/RWs1TbjaQhsHzXXMzFjGjHNFLXyDakfFKkRlWNgaMP6T tK8+56NJdpjucI8SnprfyePf3fwJekSH2tyE5kMjKuY1FscLRZT7w5Zz6j5Pp2EOYpPa mlRA== 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=WntJQyn9d0EfCk0SDSkeTZwQkNZHb3LF+mvl4Xb0xIU=; fh=3AbuYYlxKBQdATOFZVilDZxFPMoRb/WWpLLVN/nlgP4=; b=xPr1AwNpV/0VziKTPLcmUH9Rcxo37/aR5Y3Nx4rf4F+sqDkJ5SJEjfv9JUMs3riHNL QjZO7L0h8/Snrt253ihR3zl9DrCV5Y+xLzzXbcE5qbY/yOPtv949ktN/XfBu6ZMgGCCv GWduy89gYi0Z5QmQovTlU4r8NwzJw5g6bT3PuIKlNabVh2WbDnEN509oGW9+D6wdk2HA AzZO2riaqOYTc5/jYFVXVNVpL6w2BouZTWdv0AApSqXsolFxUx7pzJHjn4MMDDM2/YCH XqCTWNCs9N7GCJdFgfwInx3jA6sNmjHj5LWkCGCOnpfiKpX9W7HB86ti4j9CN4pT0/CP dxmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=wNqrlGwC; spf=pass (google.com: domain of linux-kernel+bounces-2399-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2399-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kq8-20020a056a004b0800b006cdf93d1949si15263352pfb.84.2023.12.16.15.54.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 15:54:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2399-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=wNqrlGwC; spf=pass (google.com: domain of linux-kernel+bounces-2399-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2399-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 B343B284C93 for ; Sat, 16 Dec 2023 23:54:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0782381B2; Sat, 16 Dec 2023 23:54:27 +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="wNqrlGwC" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 2719E37D25 for ; Sat, 16 Dec 2023 23:54:24 +0000 (UTC) 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-lf1-f45.google.com with SMTP id 2adb3069b0e04-50e23c620e8so1355930e87.1 for ; Sat, 16 Dec 2023 15:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1702770863; x=1703375663; 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=WntJQyn9d0EfCk0SDSkeTZwQkNZHb3LF+mvl4Xb0xIU=; b=wNqrlGwC3Sf+PGExqMprov2He6/QVoAfCREWXLMHLXBNgbdhd4fMjmD6zmG9Iy00Q7 d3DUp1fLli3E1l974m3DhCegxkNY7kkumSX8akgCQss4GpuNrhHjPJBUJdyETRcGpOeX 6zbHOmzQMJbHKGx0EYJE8XR0eU5Kmr1u9VumobVNk14AfC6leaN/KKODGpml+Beu/AOH yVYsazmfP8d4K+pIVF6ZPxl7DqM9obhHJyQSV/iwlRX5KWBMwEMlRwvujBggKPbyffnG cpaYFlkwLeYw2gzJueSXplWLad0eId7LpSYxKFezeKwbv4Os0ZIJsnGVpCat/gDxu68U pMSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702770863; x=1703375663; 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=WntJQyn9d0EfCk0SDSkeTZwQkNZHb3LF+mvl4Xb0xIU=; b=Y1y1c0JThpiTtng27dqok/fm+Nc2T4cVxpdQPLUPDBMrJREIbR2zvVT9Tb52lCOpIb gfavEmswGOdn9DRz7l/GcGhhjCUUkIy55OsHJnZK9Tc1P+soV42B1zTg8VEpFfH2qDEH UlMtzhAX0BwdK2fOaEnRq8BUVTL2o6C5osGywZAr3PEZVhishOINTMV0C9dBIYVzZ8F/ O2iBwP89f/QfHCn9lXhLHQ05jeAe10CGJt/ZdkhwD+uflNOdeiTx+lwe7brhd0M8X+IP Ngxhrkq7VNqORlDzNlT4SMQ4MIOqwDo7tKz6r9OzDcGCYADZm2VkVpR/qkDQrNZ0rS+w +UVA== X-Gm-Message-State: AOJu0YyttsSbtzq1Wx/AF3V2l4AUK14VPE5AXp9gFTIvx1AKb3ailimM rrxUPFtPmVR92jMH8bBWLYsbkz9X99QvECbol8QFeOFKKw/zwEgV X-Received: by 2002:a05:6512:b9c:b0:50c:180:2162 with SMTP id b28-20020a0565120b9c00b0050c01802162mr7539695lfv.99.1702770862548; Sat, 16 Dec 2023 15:54:22 -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-3-atishp@rivosinc.com> <20231207-professed-component-84128c06befa@wendy> In-Reply-To: From: Atish Kumar Patra Date: Sat, 16 Dec 2023 15:54:11 -0800 Message-ID: Subject: Re: [RFC 2/9] drivers/perf: riscv: Add a flag to indicate SBI v2.0 support To: Anup Patel Cc: Conor Dooley , linux-kernel@vger.kernel.org, Alexandre Ghiti , Andrew Jones , Atish Patra , 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 14, 2023 at 4:16=E2=80=AFAM Anup Patel wr= ote: > > On Thu, Dec 7, 2023 at 5:39=E2=80=AFPM Conor Dooley wrote: > > > > On Mon, Dec 04, 2023 at 06:43:03PM -0800, Atish Patra wrote: > > > SBI v2.0 added few functions to improve SBI PMU extension. In order > > > to be backward compatible, the driver must use these functions only > > > if SBI v2.0 is available. > > > > > > Signed-off-by: Atish Patra > > > > IMO this does not make sense in a patch of its own and should probably > > be squashed with the first user for it. > > I agree. This patch should be squashed into patch4 where the > flag is first used. > Done. Thanks. > Regards, > Anup > > > > > > --- > > > drivers/perf/riscv_pmu_sbi.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sb= i.c > > > index 16acd4dcdb96..40a335350d08 100644 > > > --- a/drivers/perf/riscv_pmu_sbi.c > > > +++ b/drivers/perf/riscv_pmu_sbi.c > > > @@ -35,6 +35,8 @@ > > > PMU_FORMAT_ATTR(event, "config:0-47"); > > > PMU_FORMAT_ATTR(firmware, "config:63"); > > > > > > +static bool sbi_v2_available; > > > + > > > static struct attribute *riscv_arch_formats_attr[] =3D { > > > &format_attr_event.attr, > > > &format_attr_firmware.attr, > > > @@ -1108,6 +1110,9 @@ static int __init pmu_sbi_devinit(void) > > > return 0; > > > } > > > > > > + if (sbi_spec_version >=3D sbi_mk_version(2, 0)) > > > + sbi_v2_available =3D true; > > > + > > > ret =3D cpuhp_setup_state_multi(CPUHP_AP_PERF_RISCV_STARTING, > > > "perf/riscv/pmu:starting", > > > pmu_sbi_starting_cpu, pmu_sbi_dyi= ng_cpu); > > > -- > > > 2.34.1 > > >