Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2226643rdb; Wed, 21 Feb 2024 00:31:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUWjqRRT2BCBBUfLhR3arjhmdxrtWHBwilYBuBvxEb3rPi1djNcjn9uC1tELcGpX37g4wlavGP1cp18TonjfxJIk8HtV2owFQ94U8a3Dw== X-Google-Smtp-Source: AGHT+IHzWX17+hxjPVZsBZ7rYRzjWRQK5De6wCqHkPyJuE6l7lxsvnKuhshuWOPhm1iLM7vfdMkg X-Received: by 2002:a17:906:81c5:b0:a3e:9592:1424 with SMTP id e5-20020a17090681c500b00a3e95921424mr5645617ejx.40.1708504283544; Wed, 21 Feb 2024 00:31:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708504283; cv=pass; d=google.com; s=arc-20160816; b=WrbhxcMnjq2SkfKCQRCReI8tyd51PMf/CuiD0rRT5osEkWaRpPoRa+2uIz7HZJeheW r2nLq1Kdn4k0bTmctgQTr1yOmpUcaDk2zf5B04TggCexVmBdn3+6gNcQAaCW9+nm7EUc F1CTQwZEgCU5WtqkYUhcm/8IbsYgz2emv1Imm+O+3eoDhMLaKHgpVyPdmcOE9LZUEw3M lgC0G74l9LPPjISSsnZY7vEbrsmFn2wI62OmZPIQt++J6b1F7YmHGl8l2c6hrIohIuY2 hQteXJ7adihAWW6JI2trh+st5kcqWv2jkcYtNzdJ0vQ2x7QoouMI84+jyNY1ukNgD1c7 DBJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=3DfmgtPB5KtCEWqqxteO1F8ctpQ9OvQULDo2fgyZ5GM=; fh=8jVuHczUFS/Z6O0qFcrFpuho2wAtx3PA//StP8+EFFA=; b=BqsL9TCZZBPh70pOch7VFZNK4A10kvuh+uEGKQw7/WItRsxUZj+PvDomp8FY2gyZNq f6F7gma+W1n3BiCij4W76ihm+xFbOoY8Lc18j4nBxOhl0/j6ZkLlpponoSj41VLMPGk2 Vnx1xM3kKEDpqvDD7/oGlCgEn9JS0FtZQDeei8PMd9DPsu2jl34QNrSlC0f4Oa9EmsiM 2M163T4yk841PGuABaca3ZPLmiJTCvdmMlVUr/vJNtzRlm/ylaKJQ7RBo6ADjC3/sotm PljqEP7ngBkjzAR2lvZ/ZF0XDj5aPNqnXo3DR6yJuAZns73D2ZDSxzX5ftzRv0XU6Tsg 82UA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=UhuKLhBG; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-74307-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74307-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qw19-20020a1709066a1300b00a3e58ceebcfsi3565062ejc.164.2024.02.21.00.31.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 00:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74307-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=UhuKLhBG; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-74307-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74307-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4DF3D1F253D6 for ; Wed, 21 Feb 2024 08:31:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B30443C484; Wed, 21 Feb 2024 08:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="UhuKLhBG" Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3E073C487 for ; Wed, 21 Feb 2024 08:31:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708504275; cv=none; b=sQdBwdu6VYbkKKFlWJkYnqlF98H8ys0wp2++0g087qOn38FdpCCCBpLfGquQlP2TnrBS2a22n360xI7Xr1zAi/Z1EaD+HjulkEtf1/OOH4X6CgXz3WXVcf9vofdj5b8UriKqor18XTTPx9Izyqnemw7U+2m0Xy3o6DPLjYolJi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708504275; c=relaxed/simple; bh=vqbvLAUaPJ4WgRR+teh0/Ah4uMsjuy4TXqtUh9j5+sE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=N+ak/Toa3sDfcq12tziXjMWn6s8L+vfwkah5yuzN2n2GY9wUSAr4204KSiMt7W1O6ueBf05FgsBAfhIK1Fxin8Z0QVeQfdZumy8CCSeimO6LrA3OoAKyyCD7EViSdekQ8S6/h0gW4tZ2ke42Fhic7inK7UEzOToS9ic9MZ9ynoY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=UhuKLhBG; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-33ad9ec3ec2so1002614f8f.1 for ; Wed, 21 Feb 2024 00:31:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1708504272; x=1709109072; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3DfmgtPB5KtCEWqqxteO1F8ctpQ9OvQULDo2fgyZ5GM=; b=UhuKLhBGQ/Rjv05yaNvR/EWKJMdH1Nkxmlfib/Ra8xN1twy6AVAleTXbmpfS53Au9u YMP9aK7I+Bgd4APrC+wdSgkpDtyEJbbe7+C9byJO+BLLa07VnCTfWgcYhFOmpjtYIemC fJfeMB6JY5xhSO5IW47UTmBB5huqKeBA3aLhMZZp+JcJrLNfid0DJNvJBJmPVICo2xsK T2i7pKBFAm5fPIoEDYChqST6pih7iho+L1U+HHtmjT25vbGGMKNPikws+oQgpX2CbIO2 foHLlvJrk+FpTLW8yTRZtZTZvdSxqAO8QDWRgXFF194IbydtBLqKFj9+HoUPKY8Z+4ZZ LsKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708504272; x=1709109072; 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=3DfmgtPB5KtCEWqqxteO1F8ctpQ9OvQULDo2fgyZ5GM=; b=exGJDjGfUka4cHHVkk6Ac3lObQ8WtkKnE6maebbCMUtE4GPxBBsaKCelEsJrZMoGGj 4hKi50EF8sgmoN0tcj+yULtStkbplk1LAV+ED7nf48YIZi+u4VPTacbV8akZ7ifSiFC4 JnFlSIUOw2BPENFj8lTF4LiuUY1C74T2J/pxQBaJ2s3krQ58FZMU829mMTLDvKEhtOIt PcRkHzAUWaL1RY+wI6jhdKDx4RFmMjgiPfUbWEmd5vBB+s0e7R67Z7iKvJyb+l4iwqyr rDgctLpRLscqz7oo30+kuRSXor4l0CXjSCcG4vNHbp6aJD7QO1MkFOV/iZeCQEzs78ar ZJ0w== X-Forwarded-Encrypted: i=1; AJvYcCVlG5mHBJJMJAj7g/OzQBH0dCdagvgIoqdS4sNwfNgBOpNIuWafxszIY1j6lmAuBSOmzwpX+5waZClxlAtvv9hE9uZ0PdORdsZMEafh X-Gm-Message-State: AOJu0YwzJ/N8pT/Yq6RNXkhD1W9xCdnql+XMghqSabxj8cZuF0DYtTc7 HVEZiA8chfk8X5J4Iyl9Tj1zkbUe622oNzAGTNRp53bsaowY+m3ZXFzYUbmqVgM= X-Received: by 2002:a05:600c:1ca8:b0:412:52a2:bd4e with SMTP id k40-20020a05600c1ca800b0041252a2bd4emr9522943wms.3.1708504272039; Wed, 21 Feb 2024 00:31:12 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:e1be:e214:b8ab:dbb2]) by smtp.gmail.com with ESMTPSA id q4-20020adfab04000000b0033cf637eea2sm16210705wrc.29.2024.02.21.00.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 00:31:11 -0800 (PST) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Robbin Ehn , Atish Patra Subject: [PATCH v2] riscv: hwprobe: export Zihintpause ISA extension Date: Wed, 21 Feb 2024 09:31:06 +0100 Message-ID: <20240221083108.1235311-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Export the Zihintpause ISA extension through hwprobe which allows using "pause" instructions. Some userspace applications (OpenJDK for instance) uses this to handle some locking back-off. Signed-off-by: Clément Léger Reviewed-by: Atish Patra --- v2: - Fix typo "commit commit" - Add Atish Reviewed-by: - Link to v1: https://lore.kernel.org/lkml/20240219154905.528301-1-cleger@rivosinc.com/ --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index b2bcc9eed9aa..204cd4433af5 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -188,6 +188,10 @@ The following keys are defined: manual starting from commit 95cf1f9 ("Add changes requested by Ved during signoff") + * :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_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 9f2a8e3ff204..31c570cbd1c5 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -59,6 +59,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) +#define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) #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 a7c56b41efd2..1008d25880e1 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -111,6 +111,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZTSO); EXT_KEY(ZACAS); EXT_KEY(ZICOND); + EXT_KEY(ZIHINTPAUSE); if (has_vector()) { EXT_KEY(ZVBB); -- 2.43.0