Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9986171rwr; Fri, 12 May 2023 02:02:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jc84L4Uss29vOxGCytRMjhahyaq+2Ep7w41N2BOPHQ0Kv43qzE6zeOkmzx2o5UmzG3Bz3 X-Received: by 2002:a05:6a21:7891:b0:101:73a9:1680 with SMTP id bf17-20020a056a21789100b0010173a91680mr15573571pzc.8.1683882168371; Fri, 12 May 2023 02:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683882168; cv=none; d=google.com; s=arc-20160816; b=hutG4JCCpiY6vfJSvAaZMhDBQ7t/WG71NBi9Yj8yDx3PZnsihDLsT6LXvKzmTr0Ndn T8E7jxCp1pTe0ciKXv0UYWnkIDMbCFlxAdF40RF/9719nzkSZWCHgIywedluXOMRsCft zof0JWSf1Bi6so16iB+Q/p04gciVpWokhLCZIVZBaBNk4nXUSkdXbJD3EB337h0ApJ9K 1Diwp1YIkhwXTji1wol2JsaW59IWAoi6Yxsqot6YQAE5WGdmoYDmKAZ+DUUhImDlA9+C rbIntK1vv/nEj+trMH6wU17bVOwsdmOlwf6uG7OjP6FGAfbkNGVQOhz4M7V0v3KzwZcf 3y3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hbhrF1vaRRoJzYyea1JBFcTA2VAH3WkbBcvliTXkyWM=; b=n6znspQSpxhqPb/JPYpnwSq0fB+Bq4oLRdsWR79z0/RDt4NADX7PhCmzRPUwM7hUzF Ex7s/uFtHWYgrdldeJUNbTiqkMV5EWf78A0g9VwtflwG2Vwd2NeIQkPPa98EEmsWp+87 eGpfUyJQZDOhJ6xmv10t/uY6H9SM2gtxsXHCrQ1JHLZZZHfKhUODiEmOTYZsOJQcRWTz xkVyCw5WZEBEEz9xTvK9On/L9C61VxM7UH4PFm/qA/J8KPMaLdAZYgDbuV9wooYXmI8S JD6U1lrx6HENjZDpaS9Zqd375tJFP1Qu5Xb++qEj0tT0CTD43xRzD9OmqiQ783+sRUDf EVcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=acVr4rEp; 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 bs6-20020a632806000000b0052c885da612si8426048pgb.366.2023.05.12.02.02.32; Fri, 12 May 2023 02:02:48 -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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=acVr4rEp; 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 S240226AbjELI5O (ORCPT + 99 others); Fri, 12 May 2023 04:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbjELI5H (ORCPT ); Fri, 12 May 2023 04:57:07 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076C010A3D for ; Fri, 12 May 2023 01:56:58 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f315735514so312634185e9.1 for ; Fri, 12 May 2023 01:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1683881816; x=1686473816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hbhrF1vaRRoJzYyea1JBFcTA2VAH3WkbBcvliTXkyWM=; b=acVr4rEpZzh5BDTE3sCn1nL2V53Rd6FEEhr9YcXuVFfaaqCmyAiwlO95PasYfT0SGj kGR1ZV2BHmTa2qKvGMrDop8XWV7YinIqdDnGqQQT74v6MaiI5j7pik4jo+/fqg21x6f0 YOS1AvpcZbF6yUuI/szDxFNTKKScZXq+a/zfEYSFViTnUDJdJ1o3AV440ACM5WinqbA8 N/jROH4LvspGZDwgbqPZoypXDcNLEuNf+RYM0lESX4aGNXX0YNItu2rVcEGI8MUL3qDh lexX4ho58ebwc2SbO9qrSxysj8oD6C6z3V6mt7Uq7e5Oo7aQxDVJW6zfRgi0o8Kp+MwO 2M9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683881816; x=1686473816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hbhrF1vaRRoJzYyea1JBFcTA2VAH3WkbBcvliTXkyWM=; b=fNAWfudBtJWFIdszOGRu3uaUMIVflAC+Xg1fhws8iRz5qp9PBnyfA07wLg9Jdw3Kaq pQVVSOmhqk99uDTelSwOw4ErsJQ+p5F73/7E0QMtEIXm1zmqGUvTSw2eKEbRsw1kK4zY +lLsFGqQg8NJoqFoxJ66OYkKc4Dkn/ASzb9x80AVTkip5lhXkFYGMt5YN/4d1u9V6YyC M4aGMsBnWUxQxaSuiHPvIj9ESG1dZmsXa5RQbm1OIDXVLzIyXKpfaxOxYybKopNnOKDB h1XstxEZjOkAWKCanHUTBXimpPAkzFkjMr7oIfYFu0GR0mNgEYklA7/l7JY79fHI4nb1 wKeA== X-Gm-Message-State: AC+VfDz+bqXOA5BlJfM3MXlptw3a8MLykM0tTQXcXoNnVZHrLeT9uw+Y Qp4FZhokpXQNXtMrpdzQ+utvwQ== X-Received: by 2002:a05:600c:4f45:b0:3f4:2bcf:e19 with SMTP id m5-20020a05600c4f4500b003f42bcf0e19mr8250663wmq.8.1683881816508; Fri, 12 May 2023 01:56:56 -0700 (PDT) Received: from alex-rivos.home (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id s7-20020a1cf207000000b003e91b9a92c9sm27963429wmc.24.2023.05.12.01.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 01:56:56 -0700 (PDT) From: Alexandre Ghiti To: 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 , Andrew Jones , 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 Cc: Alexandre Ghiti Subject: [PATCH v2 03/10] riscv: Make legacy counter enum match the HW numbering Date: Fri, 12 May 2023 10:53:14 +0200 Message-Id: <20230512085321.13259-4-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230512085321.13259-1-alexghiti@rivosinc.com> References: <20230512085321.13259-1-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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 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 +}; static bool pmu_init_done; -- 2.37.2