From patchwork Sat Aug 17 07:56:29 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: 13767039 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 336AEC52D7F for ; Sat, 17 Aug 2024 07:57:21 +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: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:In-Reply-To:References: List-Owner; bh=4cHPJK68vmuCE+UEZz4ZPU0TuprVjQHmfCNhoHlEIxk=; b=CbG+Mzp2wHkklx EL6hBg9yfhNnQwJxO57814PWE8O4iwgLJGwFuQP7eGIBKUDvRWvC8imHW5pEEZFVcYg/j9jE5OKJl /if3pnSVVIapKwsQ4/fDgTxZyBaPx9DrVxFt+4mQuL/qRPUc47fFzhbwZ04my//PapasmZx9sfFo/ pbTLi/v1KmL02fb/air/8dkTdP/fjs4UjLLde+QwRGjZbcBov97oO2htp0WaXx7sIMRbeoX17BC4H Gks9av7XvA7wqe2GT21NNg0N9LM97MVNrCbcLbl8fJs86bd+Lx3IOYKHd6eudjpe1L3LR2s6E6orT jef0ycv6q0jIiGaiVqjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfEJH-0000000Esgz-31Gi; Sat, 17 Aug 2024 07:57:15 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfEJF-0000000Esg8-2bdm for linux-riscv@lists.infradead.org; Sat, 17 Aug 2024 07:57:15 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a83869373b6so250798666b.2 for ; Sat, 17 Aug 2024 00:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723881431; x=1724486231; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n5jB9WqD9hn9VQJpZtHAV2ARCrG+g8V2GVK+szYij7E=; b=jPfGcN2qy7ilwRYDO1uQ7eZW5YdPcCoS8GmVvyIPJA9EgIeJgLxmAeX65fHHFC8Apa M1QMD7PYNdDp6egn7xQdQFNWtzPQNFrG5KvP2VRSJs2KQs/ux2E2kW1wCH2vKahGGvuU RzNiUQOeax8pZCk3kbBrfWuqbqblbTTV908yvrKN4b5nzrLPicDamqh5tA8g64HbRF/G N5I2LVEWqkYK7HzhKTtHboIFfwC9ehGNaaP6jtEJmtwBc9hf1ZTec2XzOgVo8BjXOoDx TvC8ZIJQsMCOo8ObsMTPDiTtSlgRUEr4vKwG+eAKHWEZc7uiwwkeyJHxIPCF2DPOVwU6 AGMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723881431; x=1724486231; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n5jB9WqD9hn9VQJpZtHAV2ARCrG+g8V2GVK+szYij7E=; b=VXkb3J5a6qZPDzcuLCbHUQv1fCtuWlcyUc9tvfpvBYD2qVtkdY3aQRTWalUz5vWqjZ uLYLbtwJFKU/4GqESlSiqHKJlPJ+iCwqIE2DWO4WaWgWCSKtBB5lkBHqosGkN63goCpq 6UnE4wJ317+wL7IUER5h3VKm7yeZ7wI+GroCmOuIPkyEhaoEpb6V8LG93jTutwbQolay cdGVNlKQKVPuZXp0RTJ/d2/kQv3YZzKyF5EnWrGcGGiJRhoLEbHptupBDlAZgUXBKmdo SXtof/IW1qFV+FdRn5V+3sBfw/aDFF2oRbu8pPkYt5vg+944LjZDPzaEOddZPLvR88Cv 8nMA== X-Forwarded-Encrypted: i=1; AJvYcCUX4P2NOfrFBIaKODq2t4l0SE/sKoUEVYwXgTsqTDGld7QTufag5id+6gZx/3WX5SpdZ7YEdlOnHeA8Bg==@lists.infradead.org X-Gm-Message-State: AOJu0YwbnZZBriQORR6c4zeQOkp7X8Z623gRytR+rdz8Ze6l/3C3tr/4 4djhh2Z31kNt8DXIPJOo1C6VKFlMQNVzAhSeXFv1uEd5V09w744OMhpjY25E X-Google-Smtp-Source: AGHT+IGxg9zUYsOiUSm9ol0uO2f1rXCDCYJQtLTwAm0CSAhLAQ7RavbVKMfZvk659KR/93hyGd3LQQ== X-Received: by 2002:a17:907:e223:b0:a7d:a080:bb1 with SMTP id a640c23a62f3a-a83929f1240mr344339366b.43.1723881430522; Sat, 17 Aug 2024 00:57:10 -0700 (PDT) Received: from localhost.localdomain ([37.72.3.43]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8383946967sm369430866b.172.2024.08.17.00.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2024 00:57:09 -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, =?utf-8?q?Mi?= =?utf-8?q?quel_Sabat=C3=A9_Sol=C3=A0?= Subject: [PATCH] riscv: hwprobe: export Zicntr and Zihpm extensions Date: Sat, 17 Aug 2024 09:56:29 +0200 Message-ID: <20240817075629.262318-1-mikisabate@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240817_005713_686676_7CE77FC6 X-CRM114-Status: UNSURE ( 9.60 ) 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à Acked-by: Jesse Taube --- 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(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 3db60a0911df..5bb69c985cce 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -188,10 +188,16 @@ The following keys are defined: manual starting from commit 95cf1f9 ("Add changes requested by Ved during signoff") + * :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_ZIHINTPAUSE`: The Zihintpause extension is 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..30aede1c90ff 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -118,6 +118,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZKSH); EXT_KEY(ZKT); EXT_KEY(ZTSO); + EXT_KEY(ZICNTR); + EXT_KEY(ZIHPM); /* * All the following extensions must depend on the kernel