From patchwork Tue Aug 20 04:47:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Miquel_Sabat=C3=A9_Sol=C3=A0?= X-Patchwork-Id: 13769317 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 B8E41C531DC for ; Tue, 20 Aug 2024 04:48:49 +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=Im3G7eynl15DfTvZik/hKd+PiIcI4/x/gZ+PhGfOBhE=; b=l53EcihsOnsbgG xbow0XdncHeylcmkXzIKcewQl+gXm+qvz9W3/logYVYWfQGi6IpOnfvsaykLb/ou4JxpCNLpFeI/1 pMjCk19fzl4sulX+VBT8OjKDTEatmfibzNsKczzSq5Qf/YeFwcEo20xEdHC4D1CnQXewD9g5OACvI vZ1GMztDFXgpjUjD90T5J4ZRNCdSXZRmzN7WOt3vDtzCU5d9MgA0pBEzcCYMF+CdAmdpzGXMt+H/p v0Uh02QHB1/0P4nUHsO2OPut9be+jWvfUBTEkvbGy3CLEuanzqIO6zpkmI40Gy8vrPsE9P+CPFDpU DIvvSsM8aExOox5mENkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgGnS-00000003nui-2OcH; Tue, 20 Aug 2024 04:48:42 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgGnP-00000003nu6-3ZGY for linux-riscv@lists.infradead.org; Tue, 20 Aug 2024 04:48:41 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4281c164408so39637915e9.1 for ; Mon, 19 Aug 2024 21:48:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724129318; x=1724734118; darn=lists.infradead.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=Fye/jS5o+GEq4JZRP+A1JuHLRGwmKc6iHbcdO7MuGDM=; b=IhELzjJqtYmkRpi3Kc4i+4EbRqG1egKOeVB8wrh2FwPcYlLaxxvB84MUUTlBcSSqF7 1nr6UE8w8ZquvsHjEERNiKn0QLrKaBNuOpB7AabOmCQTROEuC/8FsF4NozkmHGQGJ32q QjJJNru3bRQwxsq+6TQfzJVQjdScD5rp0i3KwnwN9/Cz3KLuoxtN+4/hWBJCyd60AOqZ 3kcra9Z8ixkqD+IrSzAcrOTKauaALXuk91dlZgPgKhhJdgkl21AtszkvtPBiw0J/csFu 7j9gOVyCV6ae/GFxiGda6yxhmKpspQg42y3JA1hRDe+ICACYwm4WujXnsDdtAB5elJGO w+tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724129318; x=1724734118; 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=Fye/jS5o+GEq4JZRP+A1JuHLRGwmKc6iHbcdO7MuGDM=; b=SZwT/7+nxtHgNGLlVFKS3g5q5vhIQkwW/Vrmygo4PSEDDupb3c6uzw3Ot9NEJ0q9bH V+x2mQyOWiNwz7ubU50ORvw6NhNQAtxuXkU/tF9o3xD36b7ImojQhLUiO/T2RDQLzOnx 8sW7WSPicRyltcuckhPZxEoky6D9lLgg18Q7pOhGcqDCKICepjWEF1htcG0e/ayMJuvO d9pRAMPdW05LagLka6ORtcieM53Vr5AH/FcjDRCtAdaZPpYWK+fJeTd/qfuh0647cJP7 tUcyiwhgswZ2GynPW/WbbAftcflFfuVexZLUV2q7ts9El2Cv0sBfZfSkPzob0sS7A/71 qmCw== X-Forwarded-Encrypted: i=1; AJvYcCXoUWRaoosnRTaF0nzMfPuiKE8ia2aifBoAiQRuOo/2QTPKyvSjvLZouaQwtK8No54turdxj+uzoXnfmQ==@lists.infradead.org X-Gm-Message-State: AOJu0YyXxYTRGjy/ajsbYDIlyICuvLExALxDj4/fcBk6PDc9rh98FhPr c15mTfmahlyUiSywygdudz6BHH5i8lQ7Fr54kIqE1FMdUWZjmm6CDGm4fD8C X-Google-Smtp-Source: AGHT+IGepWIntETFS0+Xa90Hiu+rMqViuMxhxVMaVXC8MjFst8jt6k0gXZCZcKMX7zUqHRGOXDvJgw== X-Received: by 2002:a05:600c:458b:b0:428:1663:2c2e with SMTP id 5b1f17b1804b1-429ed7a6b76mr80365795e9.17.1724129317734; Mon, 19 Aug 2024 21:48:37 -0700 (PDT) Received: from localhost.localdomain ([2a01:57a0:1620:4000::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded299a9sm180852875e9.18.2024.08.19.21.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 21:48:37 -0700 (PDT) From: =?utf-8?q?Miquel_Sabat=C3=A9_Sol=C3=A0?= To: paul.walmsley@sifive.com Cc: palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, jesse@rivosinc.com, conor@kernel.org, =?utf-8?q?Miquel_Sabat=C3=A9_Sol?= =?utf-8?q?=C3=A0?= Subject: [PATCH v2] riscv: hwprobe: export Zicntr and Zihpm extensions Date: Tue, 20 Aug 2024 06:47:49 +0200 Message-ID: <20240820044749.557349-1-mikisabate@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240817075629.262318-1-mikisabate@gmail.com> References: <20240817075629.262318-1-mikisabate@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_214839_910476_D5B45171 X-CRM114-Status: UNSURE ( 9.40 ) 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 Export Zicntr and Zihpm ISA extensions through the hwprobe syscall. Signed-off-by: Miquel Sabaté Solà Reviewed-by: Conor Dooley --- Documentation/arch/riscv/hwprobe.rst | 6 ++++++ arch/riscv/include/uapi/asm/hwprobe.h | 2 ++ arch/riscv/kernel/sys_hwprobe.c | 2 ++ 3 files changed, 10 insertions(+) base-commit: dc1c8034e31b14a2e5e212104ec508aec44ce1b9 diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 3db60a0911df..cfd2929d0562 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -183,6 +183,9 @@ The following keys are defined: defined in the Atomic Compare-and-Swap (CAS) instructions manual starting from commit 5059e0ca641c ("update to ratified"). + * :c:macro:`RISCV_HWPROBE_EXT_ZICNTR`: The Zicntr extension version 2.0 + is supported as defined in the RISC-V ISA manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZICOND`: The Zicond extension is supported as defined in the RISC-V Integer Conditional (Zicond) operations extension manual starting from commit 95cf1f9 ("Add changes requested by Ved @@ -192,6 +195,9 @@ The following keys are defined: supported as defined in the RISC-V ISA manual starting from commit d8ab5c78c207 ("Zihintpause is ratified"). + * :c:macro:`RISCV_HWPROBE_EXT_ZIHPM`: The Zihpm extension version 2.0 + is supported as defined in the RISC-V ISA manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZVE32X`: The Vector sub-extension Zve32x is supported, as defined by version 1.0 of the RISC-V Vector extension manual. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index b706c8e47b02..098a815b3fd4 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -72,6 +72,8 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZCF (1ULL << 46) #define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 47) #define RISCV_HWPROBE_EXT_ZAWRS (1ULL << 48) +#define RISCV_HWPROBE_EXT_ZICNTR (1ULL << 49) +#define RISCV_HWPROBE_EXT_ZIHPM (1ULL << 50) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 8d1b5c35d2a7..910b41b6a7ab 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -107,9 +107,11 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZCB); EXT_KEY(ZCMOP); EXT_KEY(ZICBOZ); + EXT_KEY(ZICNTR); EXT_KEY(ZICOND); EXT_KEY(ZIHINTNTL); EXT_KEY(ZIHINTPAUSE); + EXT_KEY(ZIHPM); EXT_KEY(ZIMOP); EXT_KEY(ZKND); EXT_KEY(ZKNE);