From patchwork Mon Feb 19 15:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13562858 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 A5BE3C48BC3 for ; Mon, 19 Feb 2024 15:49:26 +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=97NPFkVhwj144iubfBjJf3+tCnK3oF/wfmFR5X24CXI=; b=uAy17I/FlBTznc ZYPco1Y1A0Sn0RgKFcxajMTRMD96jYzJDtcM10t+aFXUmKUT29wP0apr2qmCHBtKVez2lWS3ecEPG vYdahNRw4ZardzWT/GRgi/VBxU1EozBVEdKZQr1XeexxAR03TtIEKOpbth3zTdwxLNEn18Dn2TWG/ 6zoKdvFJ9OTF+j+E+FN1Xm5SlkFGcnQ0nn8xRgG658SuntE4V9xDGTWmBojkrwXcYpoq96/cS6ZW3 QcifdgXCDOtznQKRUgLfC8+vdp6PsP9HR++1QbWad22SbmDzIVbyFrYo2y1SPgNF6j+EkBj+i3fGM McFvsGmNjBqubh8H7wZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc5tS-0000000BCRP-0ZFc; Mon, 19 Feb 2024 15:49:22 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rc5tP-0000000BCQc-39Xx for linux-riscv@lists.infradead.org; Mon, 19 Feb 2024 15:49:21 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e45c698090so146738b3a.0 for ; Mon, 19 Feb 2024 07:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1708357758; x=1708962558; 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=CDVX+aQQf3UCj4psWuuhlbCqwqS7vSYaBRqyqThSZrc=; b=WrXllruvp5xgDQ70Xdoa0otRHnnsidG344tHrOJUZGkPRIld5tfXcqjxxDKhiFDTDe WsbqqE2rcNFjcoDIeHMPNcmXMzR3v4aFjJc4wQE5c0vrQXJaTictsqTbrnpkCMw5Z4VX iZHRWikz2gt3icu3+2g4ChVA4bB+WqMRy6cJRfS/pFvrcQy5WaQGdj2wKSHdDU46h6gI qU/jnbJuIBKqXlqjW7fgtcOb9z7uh9VdB2ST3Q1qko9IwApfCe6WTrBmv/oXb0t7q1Ik KfzrjITIDntpI0VidNBHZJrpMMq65UMX6k+iCsSXlBGw8Hqu9GS9pnFXzbZ1vrEAQ09Z dhNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708357758; x=1708962558; 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=CDVX+aQQf3UCj4psWuuhlbCqwqS7vSYaBRqyqThSZrc=; b=mNCuDmnl0YSzktXcawDx2qoc/2kshefGVqq8uTU9gdmPSS/xbDQwfRdzZ66MwJ6xlP hfDSg5KAE8fc17n+Zy0YjVpEzpKOSGHeNe3A+GlSffv8YxV0pk3EPGWxiYWDuDWp6Xdq LwoAbE6Yu1grn+5kjG4FZWtuOzYOGKAp/RD7pj/1PJFrJiyqa6D8GGe4CSMXwPXtRLZR EutMYZV53hVUveH4O1QF3XeC625awM5bWRXpJDogEY+H9MaSIo77sU41u5n1WzhDhVQQ aTL5ofjYw08oJFUoxT4HON1opp29ZXaTKAqdq5FZY3a4SIfnlK7dMd7N7bp52HAier4U K17g== X-Forwarded-Encrypted: i=1; AJvYcCVB8QsVqSc9uQQn/F1orgcBHZo416/dyGdHdezOHaP4GTKf6tZTP7ztBvhcaGFVMIvAk+oWNF1v8kSJ9aQjBsYn/rGroEr5R82FqkbpdT0X X-Gm-Message-State: AOJu0YyyeAZUgv5il8XEF+IvqohfHFiUaRYhP/MhYCiQx/gDYDfkFG3t O/tgR8OMYXJSRa2/BczTeYoEI+owKfdy0GdwBQmlU/pKAZye4h8lqDCSi4MWb2w= X-Google-Smtp-Source: AGHT+IEcyZCHhd6HIFFkqbFH2GwEOuyTsp9nTeseU6jdpsxfQQbNhEYUiWvejav6rxmgpRl71P7gWA== X-Received: by 2002:a05:6a21:789d:b0:1a0:a6bb:d0d0 with SMTP id bf29-20020a056a21789d00b001a0a6bbd0d0mr3708851pzc.1.1708357758289; Mon, 19 Feb 2024 07:49:18 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:8501:8c81:d5c:f8d2]) by smtp.gmail.com with ESMTPSA id lo10-20020a056a003d0a00b006e0f4a183c8sm4990773pfb.104.2024.02.19.07.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 07:49:17 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= 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?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Robbin Ehn Subject: [PATCH] riscv: hwprobe: export Zihintpause ISA extension Date: Mon, 19 Feb 2024 16:49:04 +0100 Message-ID: <20240219154905.528301-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240219_074920_054614_BC597D7C X-CRM114-Status: GOOD ( 10.10 ) 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 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 --- 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..0012c8433613 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 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);