Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp968177rwd; Wed, 31 May 2023 07:49:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5b0cDo2y8PIgYhFvtiR2husWqtl02oQqA6ulC5ZBaCtBsX7MmvfYi7v1YvgsG8gQCVPVDw X-Received: by 2002:a17:902:988d:b0:1a6:45e5:a26a with SMTP id s13-20020a170902988d00b001a645e5a26amr3555795plp.27.1685544568950; Wed, 31 May 2023 07:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685544568; cv=none; d=google.com; s=arc-20160816; b=YOXGVFWPPkpviPR1TDHo3wT0cqSXka03hDnIr6fjvn9YZ314ATX0exgKdHZtMrMNks uMOSr2+1Afn+b5N/7t/nnVk2zwnhEPCfVwF7cvasQwZzn2yn7CzAHq5rpkili/eMT3og caoRnOHJfhCbUT7cNtaRmKMSgZ1cPnhInK7/RoglcHDr3oAhYAebWCYaY3XwAKQTEQVU in3+GGYBA41Db3co1DQFrsfrgadtc0Nu1hZfdbPBH2Q8VjaDSFZazQWC2OQM8k5sLTDY c+g0QfI0vkwupHUEUZwJ4pIJJ5DV1m09DO3JGVKBXJ/KTIt7gxNGT2z+igQPCPcrbrsX j1PQ== 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=xV0p1cILT3YTZiyLBW2gM8L29pLx3no3Au0rCN/fAsw=; b=q2SwLVZjZMI1PQZDPk6jEDeXZoGuphVHWMEoXb/Xduveeh43cHpQii14hzi+lFnqtf DYMSBzNghWTABOc07EiLH7l+FMWXrTLVE1a+xAVLxqsTNNKp1mpXClTEGl3z3vwJBhoK 3gR73fSOHJXTvdOMc2jXBUB05b+9t3D96Ap24lgmml4jqwB7d4QN+gfyv+Z/myp0dQ9t Ju+L51FuaRLo3D1TWI24HdleGiIU+ZgTZUcl8LprX6Tf22EJ+zcAVTJxMzp+eQFqy6mw WAUOQSijc3GdWIXz0zxXvHr5Swa/RHDOCVww1Ub4T6aizUgi1agK84WTWkU4t1PI9UN4 Ourw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=gUF0PwXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je4-20020a170903264400b0019926d9c734si911727plb.602.2023.05.31.07.49.14; Wed, 31 May 2023 07:49:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=gUF0PwXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237537AbjEaOHs (ORCPT + 99 others); Wed, 31 May 2023 10:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237213AbjEaOHb (ORCPT ); Wed, 31 May 2023 10:07:31 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6921D10FF for ; Wed, 31 May 2023 07:03:02 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-51494659d49so6946586a12.3 for ; Wed, 31 May 2023 07:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1685541687; x=1688133687; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xV0p1cILT3YTZiyLBW2gM8L29pLx3no3Au0rCN/fAsw=; b=gUF0PwXYe8VCgDpxtcKPgbxsSJTGNkqXOtSRlywJlkOjfIJ4RSdfa2UVuR44ynbHFw NKNlI0h8WPdCGNa+vUoV2SDzv0cNPY++y1O+tSLD8DyL+GNgS0+nkfGF0a6i3YJH+wNV x4Bp+2sGbToPR2nr3y4lOVew5cRUUf0c0FY3u/GtWzluqFr8GLUv2Nk+8WCV1g20INdO UOcEZhwWwmk9YeNFWiDVZ/Gl2IRFnDzPIDxnaFptnayBtNdH1D8DIsrPvDfelv48ixSU FJeUMC0Jl9ubMq0XnS+bntiTO2K2CBvylp+N3GZIEWWPJ2nplN2VeXy5NQg1vGhN3qCH j4pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685541687; x=1688133687; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xV0p1cILT3YTZiyLBW2gM8L29pLx3no3Au0rCN/fAsw=; b=kbNYjrxgVODehMnYQmfY6UjXfdSG912EtOwkA/VTd+Tw1VouFvc/4I/RENH8Br8iec 76khWssCr4JYCxVWRlTlMvsQM51ewva3qIm5ImJEzM2g2wnYuI8NRgpZlbGcwJNESb+P pzmQU+HywJ99GTIc/m9ylNIHzwp0Dg69+lBybojdEWuGumAhSVvrP2oDwxzxoS2vG1ri tERUler7nWZf3FBwJd8hnRWI2CFKXpM5C44XQI7R5csQ1G2RkdEhnnb9gRAYeIiuNWeY GvJtYRQV2rP3R+6yxqp+u9x4vZwc2WNCgGT2+UjSQf47CmXrMOEouETmovTiNLHtT+Sb ezyQ== X-Gm-Message-State: AC+VfDyhTKY3t8g2bKaJOCMhLFF9t9OsjgVQXUyAw2EuCJKbnwWJus9c /uQ4Jjyk+BDuJVETaDSdHMtQPA== X-Received: by 2002:a17:907:72cb:b0:974:1d8b:ca5e with SMTP id du11-20020a17090772cb00b009741d8bca5emr5212006ejc.14.1685541686880; Wed, 31 May 2023 07:01:26 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id e6-20020a170906504600b00965ac1510f8sm8966578ejk.185.2023.05.31.07.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 07:01:26 -0700 (PDT) Date: Wed, 31 May 2023 16:01:25 +0200 From: Andrew Jones To: Alexandre Ghiti Cc: Jonathan Corbet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Anup Patel , Will Deacon , Rob Herring , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 03/10] riscv: Make legacy counter enum match the HW numbering Message-ID: <20230531-ddb2d631e152526102f41d5e@orel> References: <20230512085321.13259-1-alexghiti@rivosinc.com> <20230512085321.13259-4-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230512085321.13259-4-alexghiti@rivosinc.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On Fri, May 12, 2023 at 10:53:14AM +0200, Alexandre Ghiti wrote: > RISCV_PMU_LEGACY_INSTRET used to be set to 1 whereas the offset of this > hardware counter from CSR_CYCLE is actually 2: make this offset match the > real hw offset so that we can directly expose those values to userspace. > > Signed-off-by: Alexandre Ghiti > --- > drivers/perf/riscv_pmu_legacy.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c > index ca9e20bfc7ac..0d8c9d8849ee 100644 > --- a/drivers/perf/riscv_pmu_legacy.c > +++ b/drivers/perf/riscv_pmu_legacy.c > @@ -12,8 +12,11 @@ > #include > #include > > -#define RISCV_PMU_LEGACY_CYCLE 0 > -#define RISCV_PMU_LEGACY_INSTRET 1 > +enum { > + RISCV_PMU_LEGACY_CYCLE, > + RISCV_PMU_LEGACY_TIME, > + RISCV_PMU_LEGACY_INSTRET > +}; I guess this doesn't hurt, since these are just indices internal to this driver, but it's a bit odd to also have a RISCV_PMU_LEGACY_TIME, when the driver is only for cycle and instret, as its Kconfig help text says. Thanks, drew