From patchwork Sat Dec 25 05:46:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 12699183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 948C5C43217 for ; Sat, 25 Dec 2021 05:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4udd78SG76c3SnBdYZg8lGbhRXTX3nvpSCus0sESmmk=; b=ob/2HOilO7lnsN kQiyRItJB3wjhSZDTAzx4SHZJhYlb/7caKWmnaDdbdkNBX8VtQ5jSazs1iyKx5uKxeEWRcaYyuWFU cZocgaatlCDz2sygNd/KF6f7B9KAZ/oYVIwsrvhg5XpwBQ7pXd3GzZazKCtxBzs48iMTqh+ghxuuc 9fajIhOLR7PAmL95GEDaPHJ/QWBfUEcTyfPE4VgcpOUHVZJlthXNCodqultrJ3A6HckjAqlLaMyYb qeNyfePAUg4Uc1ofoIB25MIqC+yVX2Ya1rck3SQF+YVGn9A303sDlwYlSzgUNvyeJEs8kPT/8QwVz QvfQy1vnsGC++LCwJ+eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0zu5-00EhfM-81; Sat, 25 Dec 2021 05:47:37 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0zu0-00EhdM-V8 for linux-riscv@lists.infradead.org; Sat, 25 Dec 2021 05:47:34 +0000 Received: by mail-qt1-x82a.google.com with SMTP id z9so9084637qtj.9 for ; Fri, 24 Dec 2021 21:47:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bYG08HWhp/w3HJAB/PpsmwbdfV4UxRTXBTvkLs9BXx8=; b=DAfVzeOH11h3mhrP0Y+HZbzxl/rfj9bypDv+mZsXsN7JUSOTs+ZOzDBAnwVu0Cy50y ZqT2MPJXdpl5rJgCYPWxlRlNYLedoBTLdBssuV+7601vhtoshAqvAuMfQpqCaerXsQkV lwjs91s8VH2dQWveiY77BWUrQ5/1CMFG6iah8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bYG08HWhp/w3HJAB/PpsmwbdfV4UxRTXBTvkLs9BXx8=; b=41/owY0CLxe3gpUvKUCdhSWUoxz2o1vll7RyMiSpXTuqSdXiLxalaQVC0xHc81lj/G y/nVea+cwSDM7Ua4org7H5jY+V6t6UAb0P//541KgUIFXcuAdCyM0LIJn47BI4N0sBZn JcGrs4ryFC1NxznPZd/szY6deHwzB3IMr40JdvCXC+eA4PGTJL5Sb2CaIHtDpYeD+jky txpAJ2pMk3VYvUw+Ct7q9LF4RvCftZODTdczeLQM/HXDjcOwngZLyqK76lgxTUhmkLEO eYU7iet5wfm7HDl+FNggEgADIp2TKlYxy6SUOVuaJveaJ0RWEpEjyboOYSoRUcCcoAWO Cnjw== X-Gm-Message-State: AOAM530/qoFpos8/zymgiYgc4JcCu2fKPWpS8MZBovs1d+i4yZ+XdEa0 NOyKy9a6pPT8fxBrQ28UdNkf X-Google-Smtp-Source: ABdhPJzkZUUzVgbSWkYXrQFZQJ+D+n4Ff0PsJTxva9PevrVsU4qfevxCuNB71KsDyixPeCwMJaDfWg== X-Received: by 2002:ac8:5803:: with SMTP id g3mr7732037qtg.317.1640411251970; Fri, 24 Dec 2021 21:47:31 -0800 (PST) Received: from fedora.. (adsl-70-228-75-190.dsl.akrnoh.ameritech.net. [70.228.75.190]) by smtp.gmail.com with ESMTPSA id c7sm8492780qtx.67.2021.12.24.21.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Dec 2021 21:47:31 -0800 (PST) From: Atish Patra X-Google-Original-From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Albert Ou , Atish Patra , Anup Patel , Damien Le Moal , devicetree@vger.kernel.org, Jisheng Zhang , Krzysztof Kozlowski , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Rob Herring Subject: [v5 2/9] RISC-V: Add CSR encodings for all HPMCOUNTERS Date: Fri, 24 Dec 2021 21:46:40 -0800 Message-Id: <20211225054647.1750577-3-atishp@rivosinc.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211225054647.1750577-1-atishp@rivosinc.com> References: <20211225054647.1750577-1-atishp@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211224_214733_029724_3EA56726 X-CRM114-Status: UNSURE ( 6.62 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Atish Patra Linux kernel can directly read these counters as the HPMCOUNTERS CSRs are accessible in S-mode. Signed-off-by: Atish Patra Signed-off-by: Atish Patra Reviewed-by: Anup Patel --- arch/riscv/include/asm/csr.h | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 87ac65696871..e4d369830af4 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -89,9 +89,67 @@ #define CSR_CYCLE 0xc00 #define CSR_TIME 0xc01 #define CSR_INSTRET 0xc02 +#define CSR_HPMCOUNTER3 0xc03 +#define CSR_HPMCOUNTER4 0xc04 +#define CSR_HPMCOUNTER5 0xc05 +#define CSR_HPMCOUNTER6 0xc06 +#define CSR_HPMCOUNTER7 0xc07 +#define CSR_HPMCOUNTER8 0xc08 +#define CSR_HPMCOUNTER9 0xc09 +#define CSR_HPMCOUNTER10 0xc0a +#define CSR_HPMCOUNTER11 0xc0b +#define CSR_HPMCOUNTER12 0xc0c +#define CSR_HPMCOUNTER13 0xc0d +#define CSR_HPMCOUNTER14 0xc0e +#define CSR_HPMCOUNTER15 0xc0f +#define CSR_HPMCOUNTER16 0xc10 +#define CSR_HPMCOUNTER17 0xc11 +#define CSR_HPMCOUNTER18 0xc12 +#define CSR_HPMCOUNTER19 0xc13 +#define CSR_HPMCOUNTER20 0xc14 +#define CSR_HPMCOUNTER21 0xc15 +#define CSR_HPMCOUNTER22 0xc16 +#define CSR_HPMCOUNTER23 0xc17 +#define CSR_HPMCOUNTER24 0xc18 +#define CSR_HPMCOUNTER25 0xc19 +#define CSR_HPMCOUNTER26 0xc1a +#define CSR_HPMCOUNTER27 0xc1b +#define CSR_HPMCOUNTER28 0xc1c +#define CSR_HPMCOUNTER29 0xc1d +#define CSR_HPMCOUNTER30 0xc1e +#define CSR_HPMCOUNTER31 0xc1f #define CSR_CYCLEH 0xc80 #define CSR_TIMEH 0xc81 #define CSR_INSTRETH 0xc82 +#define CSR_HPMCOUNTER3H 0xc83 +#define CSR_HPMCOUNTER4H 0xc84 +#define CSR_HPMCOUNTER5H 0xc85 +#define CSR_HPMCOUNTER6H 0xc86 +#define CSR_HPMCOUNTER7H 0xc87 +#define CSR_HPMCOUNTER8H 0xc88 +#define CSR_HPMCOUNTER9H 0xc89 +#define CSR_HPMCOUNTER10H 0xc8a +#define CSR_HPMCOUNTER11H 0xc8b +#define CSR_HPMCOUNTER12H 0xc8c +#define CSR_HPMCOUNTER13H 0xc8d +#define CSR_HPMCOUNTER14H 0xc8e +#define CSR_HPMCOUNTER15H 0xc8f +#define CSR_HPMCOUNTER16H 0xc90 +#define CSR_HPMCOUNTER17H 0xc91 +#define CSR_HPMCOUNTER18H 0xc92 +#define CSR_HPMCOUNTER19H 0xc93 +#define CSR_HPMCOUNTER20H 0xc94 +#define CSR_HPMCOUNTER21H 0xc95 +#define CSR_HPMCOUNTER22H 0xc96 +#define CSR_HPMCOUNTER23H 0xc97 +#define CSR_HPMCOUNTER24H 0xc98 +#define CSR_HPMCOUNTER25H 0xc99 +#define CSR_HPMCOUNTER26H 0xc9a +#define CSR_HPMCOUNTER27H 0xc9b +#define CSR_HPMCOUNTER28H 0xc9c +#define CSR_HPMCOUNTER29H 0xc9d +#define CSR_HPMCOUNTER30H 0xc9e +#define CSR_HPMCOUNTER31H 0xc9f #define CSR_SSTATUS 0x100 #define CSR_SIE 0x104