Message ID | 20230727141428.962286-4-alexghiti@rivosinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1152681vqo; Thu, 27 Jul 2023 07:48:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFfrTdRxA5uFPbRLN+qHVlfSiPdr3qoWpdvh3W3EzyCNdBxEC9UxrlixXnbvx4W2Ev1Gvls X-Received: by 2002:a05:6a00:2d09:b0:666:a25b:3788 with SMTP id fa9-20020a056a002d0900b00666a25b3788mr5376055pfb.34.1690469308977; Thu, 27 Jul 2023 07:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690469308; cv=none; d=google.com; s=arc-20160816; b=eyz3MYkFyFd3ymlZo10Phqvc2xXGt5WAqNoqkqxmUon9ZIafUmR/beVymMTrmpcj+p b8QJ1N9mmV612Llt05AAK3P103EkURRuPluPWc6SDU5GanWKVvUQVsYI7NV9pAwtI6D8 KmO36bVoFwMRTYoQZsUfjZrL/u4Nu3AYbRAr4VF+VW9uatDEiLr26YeKYVVElhvKcLxB iRy/0a8L7fcVBIpxiWzCJc2MzI6EYwNtjlAMT1oPctW/3zy1Rz4c21IXucVjtldIXux1 DYcJWsGT0Tu1cMLkDtsyn/9NvC/reEt6wHAWs7Qp/xUDmrErDcG9Bm0zlJWT1bxZVECl sr9A== 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=5NmnsqQcLcAcVyns3syLHoHVHQj0n5HXKDOsH4jqkjI=; fh=JaxZGKf0NGxFruMBNweFeRrHWrRBBIwkQ5sLyfk9jAY=; b=myyJ50dqibaUBBFgvudrU8E2Y4OnkCqzq9xA566f1kwNxgeIe9NMaNhJhAAtj0vRmC jOOjcOi5UzQA/MbYUoLyqjkt7KgI+LNsV7mZDKQg4klEkfN8Az8FRlEnq7iDhTVkO8Gk 96lEkiVll+qSKwhBrkomKJ9ONjU+W+zCgdPWqAVY1HfglpUz28hflP65xI/4//6s6zr4 3qDxZznBnPL9ofbvUvvbrJyA5AqhgiRvjfElWsxFZa87iArvh0l+VXcuDR7yrWcnQ5n4 t23ZhBA1M0wsWsTvbXLF3q5h4mv9C/xpNUUyRgZdCw1CBcG/SMot9p/uY64x1go+cyZi /mBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=cw4QPNr+; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a6550c6000000b0055c1fb5a4a9si1280493pgp.661.2023.07.27.07.48.16; Thu, 27 Jul 2023 07:48: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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=cw4QPNr+; 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 S233417AbjG0OSS (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Thu, 27 Jul 2023 10:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbjG0OSQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 27 Jul 2023 10:18:16 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F7A3122 for <linux-kernel@vger.kernel.org>; Thu, 27 Jul 2023 07:18:15 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso11014025e9.2 for <linux-kernel@vger.kernel.org>; Thu, 27 Jul 2023 07:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1690467494; x=1691072294; 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=5NmnsqQcLcAcVyns3syLHoHVHQj0n5HXKDOsH4jqkjI=; b=cw4QPNr+KRTkqBfUl09eVKywkJyVBIIbls5qU6tgjai2Q+mltKyEq6s+YNGOkL0v50 zHgxupgjLcJvEwDqGUK+MpEiGLmjBDydlZdLLFqczKUC/vcJ6p8i4ou2mVIKt8N/K4Cz PQRh0B4EkaM8AJyraBjtd2/Vy6YqPfIAZLXPu9wJ/pcjhMLAiclOGIcH3funcREbZrSk ZDnOY8Jyd6MiUcgKQpBlLJ2R+FVSSi0/WzE7qRm7KQJGUMEVvhTOpX/QQxOv+3Lj2jaK qze77T5yV1Q7OZ2ygxybUCkHJIPHoWcZuwVE+aLzBe/oDFyXUo2dvMc7A0Sdnbi1HnuJ MtIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690467494; x=1691072294; 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=5NmnsqQcLcAcVyns3syLHoHVHQj0n5HXKDOsH4jqkjI=; b=i/KAKdjDlB7FwIUiihZWcyPlhqMG69NRVfDrfsiNfFh7o/By8X3fx36cBE5LL+erfU Xrncyh0Y066cv5zIVcyNaBOEI4PFg7obUCz25xVlnj468x+JpBsJF21u28aItMlsKCWr UySJS49rEMVFaxQoCPpSEA6gE/dZxsTfB4Feb45/ScPKnG5yz3a1Tsi9i0eOHB73wCYr WXHkjGNfbcrgKrKEhZejmX9nb6cCQVpWtKl5c/GCAmpBUCJtEvTTJ+rtUOSn6cTWQ3fK AdQjdoFm5Ndi0tSbEzwltxiEDj202G5iy4EzyUf/hMK6RnJt8ikhF9etqg64my2PlMoH BEYA== X-Gm-Message-State: ABy/qLaDothDGVFKmW4oDYOSQ9yQ7azMfbeSpew6fNorQKqHnJvPkrbB UyH8izEvB9GS2cGz9FhqtsunZQ== X-Received: by 2002:a1c:f704:0:b0:3fa:934c:8356 with SMTP id v4-20020a1cf704000000b003fa934c8356mr1710900wmh.10.1690467493682; Thu, 27 Jul 2023 07:18:13 -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 m22-20020a7bcb96000000b003f91e32b1ebsm4841104wmi.17.2023.07.27.07.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 07:18:13 -0700 (PDT) From: Alexandre Ghiti <alexghiti@rivosinc.com> To: Jonathan Corbet <corbet@lwn.net>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Atish Patra <atishp@atishpatra.org>, Anup Patel <anup@brainfault.org>, Will Deacon <will@kernel.org>, Rob Herring <robh@kernel.org>, Andrew Jones <ajones@ventanamicro.com>, =?utf-8?q?R=C3=A9mi_Denis-Courmont?= <remi@remlab.net>, 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 <alexghiti@rivosinc.com>, Atish Patra <atishp@rivosinc.com> Subject: [PATCH v4 03/10] riscv: Make legacy counter enum match the HW numbering Date: Thu, 27 Jul 2023 16:14:21 +0200 Message-Id: <20230727141428.962286-4-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727141428.962286-1-alexghiti@rivosinc.com> References: <20230727141428.962286-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=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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772585546271298978 X-GMAIL-MSGID: 1772585546271298978 |
Series |
riscv: Allow userspace to directly access perf counters
|
|
Commit Message
Alexandre Ghiti
July 27, 2023, 2:14 p.m. UTC
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 <alexghiti@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> --- drivers/perf/riscv_pmu_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c index ca9e20bfc7ac..6a000abc28bb 100644 --- a/drivers/perf/riscv_pmu_legacy.c +++ b/drivers/perf/riscv_pmu_legacy.c @@ -13,7 +13,7 @@ #include <linux/platform_device.h> #define RISCV_PMU_LEGACY_CYCLE 0 -#define RISCV_PMU_LEGACY_INSTRET 1 +#define RISCV_PMU_LEGACY_INSTRET 2 static bool pmu_init_done;