From nobody Tue Nov 26 22:26:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1704760158; cv=none; d=zohomail.com; s=zohoarc; b=VjI7Lt32ffwmhrEjE9n6tfzCZpeBn2EvPePMox4nd+VSl52urgcH3RVzW/VXgRHHlPhO1eZJyaY+GPRY3gap4kgQ27Y5oKVBMfUPjuHOizpeQ/kVplvnmAq79jm9wfiWObU+S358jJ3SHFrS0SlMmqZ/cFJvpge+TALNlP15ec8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704760158; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:Message-Id:Reply-To:To; bh=CBFb3wD9JrSYCXaN0lwhbhsoKTi8i5JV1Iqt3vza59s=; b=B6OvP0oww1mOUs7OppnBA3xdkIdceaUc93Kd5GwtLTYk809rXt1G3WBeQk+rGRrd/beYY39RO1lA16qdkSbnF9L1ufTYTsTiCKJV9kNOc3OsseD5TEJE7uxB7Uhofo+Go5vEZFUbYMPmbthOb80NFHjyFsdkR2Ny4xLwvRpahVk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704760158215646.320010727793; Mon, 8 Jan 2024 16:29:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMzxK-0001Up-4B; Mon, 08 Jan 2024 19:26:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMzxI-0001Th-TW for qemu-devel@nongnu.org; Mon, 08 Jan 2024 19:26:56 -0500 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMzxE-0001bL-Fa for qemu-devel@nongnu.org; Mon, 08 Jan 2024 19:26:55 -0500 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-2046b2cd2d3so2285139fac.0 for ; Mon, 08 Jan 2024 16:26:51 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id wp12-20020a056871a9cc00b002042cafdc52sm219917oab.2.2024.01.08.16.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 16:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1704760010; x=1705364810; darn=nongnu.org; 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=CBFb3wD9JrSYCXaN0lwhbhsoKTi8i5JV1Iqt3vza59s=; b=I/bRge2T9GmW9Xrt32ZD3g5PkMMkWgEdxyJFJh/VFy/QizpPYtzOa/w0ZWZ5SjM7l/ 2i0gYXkC3bqigyK4Uyp5MrH4/tgfO7sLXd4o635dZLF/8okBFLJCrGg80bYXt/G2LN/k B5wCB8ysIevdMFe3l6gyitXsKrlf+fjA0pDScH4vTsGByt4tmp6sfm2WxDcv13V4zI3D 7mBI2xA+WHs59vYja6QBAJiIz9HoIGYc90Mga/gfLu/iw+mJR/x2o/LdHaDPZZkov1Nm Fy56yFU+msk4/uTeARTY2FmaHDwxOc67Mu/KKGSwkSu0IxbfGMOYZva4yTsS2wdeYwhe KaFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704760010; x=1705364810; 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=CBFb3wD9JrSYCXaN0lwhbhsoKTi8i5JV1Iqt3vza59s=; b=qec2TJxsukT5xQp+7YhSJmbMDVQ8Xjd+b+Sp+NNrAk23s7o1RrIBgvBL+YLtDyPICq VWzI4aCp6WvDV7NWbWiQz/z5ay9yZWKX58uvenSGiK04wuGHLFrPi0bdacTw0jEXb/TP Z5RReesOzBn/XeGZKtvKhgOdPFjACelcjApW6fhogGkEl/tu0iPnAG0ojCH6F4/M5VAs tTNor1yyt0sdILtPUqDrbu6KmvbdlnMpXpsefSjOBJsooQokNBfFGVxkWLb/yYEVgRV+ DHqZ1X9n+DnqPMlfpVoqm2BJhNCGGLBPJdA3hS1hi7oPt+sPyMywOcqq3Si3rjtaJNBl hJcA== X-Gm-Message-State: AOJu0Yz9a+GMjhSxDKbaWPZ7d+1UuevAhmmmnHyf4254ZMpBdIFKuzHu KyxaOHFQIKMjTJTuh4JtrJFdRFIzac08aw== X-Google-Smtp-Source: AGHT+IEpDUvEad/BmYXqSLpVWfxXwSszCAP1wofyOfkB3aIV2PrZ0V/dnhz9QT0g+1zE09IooTLJWw== X-Received: by 2002:a05:6871:2b01:b0:203:ec89:de1e with SMTP id dr1-20020a0568712b0100b00203ec89de1emr6835850oac.58.1704760010602; Mon, 08 Jan 2024 16:26:50 -0800 (PST) From: Atish Patra To: Cc: Kaiwen Xue , Daniel Henrique Barboza , Atish Patra , Alistair Francis , Bin Meng , Liu Zhiwei , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org, Weiwei Li , kaiwenxue1@gmail.com Subject: [PATCH v4 3/5] target/riscv: Add cycle & instret privilege mode filtering definitions Date: Mon, 8 Jan 2024 16:25:52 -0800 Message-Id: <20240109002554.646572-4-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240109002554.646572-1-atishp@rivosinc.com> References: <20240109002554.646572-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::30; envelope-from=atishp@rivosinc.com; helo=mail-oa1-x30.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1704760159989100003 Content-Type: text/plain; charset="utf-8" From: Kaiwen Xue This adds the definitions for ISA extension smcntrpmf. Signed-off-by: Kaiwen Xue Reviewed-by: Daniel Henrique Barboza Signed-off-by: Atish Patra Acked-by: Alistair Francis --- target/riscv/cpu.h | 6 ++++++ target/riscv/cpu_bits.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index d74b361be641..34617c4c4bab 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -319,6 +319,12 @@ struct CPUArchState { =20 target_ulong mcountinhibit; =20 + /* PMU cycle & instret privilege mode filtering */ + target_ulong mcyclecfg; + target_ulong mcyclecfgh; + target_ulong minstretcfg; + target_ulong minstretcfgh; + /* PMU counter state */ PMUCTRState pmu_ctrs[RV_MAX_MHPMCOUNTERS]; =20 diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h index ebd7917d490a..0ee91e502e8f 100644 --- a/target/riscv/cpu_bits.h +++ b/target/riscv/cpu_bits.h @@ -401,6 +401,10 @@ /* Machine counter-inhibit register */ #define CSR_MCOUNTINHIBIT 0x320 =20 +/* Machine counter configuration registers */ +#define CSR_MCYCLECFG 0x321 +#define CSR_MINSTRETCFG 0x322 + #define CSR_MHPMEVENT3 0x323 #define CSR_MHPMEVENT4 0x324 #define CSR_MHPMEVENT5 0x325 @@ -431,6 +435,9 @@ #define CSR_MHPMEVENT30 0x33e #define CSR_MHPMEVENT31 0x33f =20 +#define CSR_MCYCLECFGH 0x721 +#define CSR_MINSTRETCFGH 0x722 + #define CSR_MHPMEVENT3H 0x723 #define CSR_MHPMEVENT4H 0x724 #define CSR_MHPMEVENT5H 0x725 @@ -885,6 +892,28 @@ typedef enum RISCVException { /* PMU related bits */ #define MIE_LCOFIE (1 << IRQ_PMU_OVF) =20 +#define MCYCLECFG_BIT_MINH BIT_ULL(62) +#define MCYCLECFGH_BIT_MINH BIT(30) +#define MCYCLECFG_BIT_SINH BIT_ULL(61) +#define MCYCLECFGH_BIT_SINH BIT(29) +#define MCYCLECFG_BIT_UINH BIT_ULL(60) +#define MCYCLECFGH_BIT_UINH BIT(28) +#define MCYCLECFG_BIT_VSINH BIT_ULL(59) +#define MCYCLECFGH_BIT_VSINH BIT(27) +#define MCYCLECFG_BIT_VUINH BIT_ULL(58) +#define MCYCLECFGH_BIT_VUINH BIT(26) + +#define MINSTRETCFG_BIT_MINH BIT_ULL(62) +#define MINSTRETCFGH_BIT_MINH BIT(30) +#define MINSTRETCFG_BIT_SINH BIT_ULL(61) +#define MINSTRETCFGH_BIT_SINH BIT(29) +#define MINSTRETCFG_BIT_UINH BIT_ULL(60) +#define MINSTRETCFGH_BIT_UINH BIT(28) +#define MINSTRETCFG_BIT_VSINH BIT_ULL(59) +#define MINSTRETCFGH_BIT_VSINH BIT(27) +#define MINSTRETCFG_BIT_VUINH BIT_ULL(58) +#define MINSTRETCFGH_BIT_VUINH BIT(26) + #define MHPMEVENT_BIT_OF BIT_ULL(63) #define MHPMEVENTH_BIT_OF BIT(31) #define MHPMEVENT_BIT_MINH BIT_ULL(62) --=20 2.34.1