From patchwork Thu Mar 14 14:25:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13592496 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 5088EC54E67 for ; Thu, 14 Mar 2024 14:26:44 +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=QinZ1jisIq7cKa9zQH90+cGdoqSGKTxl+Fru2phlHzo=; b=VA/VpyB/eVvU88 FaqpC4Hr3FrNDAc8L04/ZHWtdP5ts86h7Mg8fjs5YaJZ9XZt75sCXNWFLhHSflU9KKRiz/kGLmDWF wHkI4Bc0/tF75SrKk1yw9mpiWBs9fTu+xkd2cMuAm2vKdi8iw+qhgVolSYat00gb6NENsdhlBriv1 SMvXN7+fFtg5U9CQ5Z2f9Zn5eeHQOf7vvfnXxGLmpjdh0prpj470f+jnlSmntc9MQgcxC8Ko4wz9X 1iTRIVxcm38ejcY5YHE/WEGAvi2mqioXbnF5JvdwOjZaqsL5C2HD5twyzo153837jwopc240VJJJG 6WqX1JeRZNyeLSQa/mYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkm2Z-0000000Ed9M-2wq4; Thu, 14 Mar 2024 14:26:39 +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 1rkm2W-0000000Ed5h-1MDg for linux-riscv@lists.infradead.org; Thu, 14 Mar 2024 14:26:38 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6e6ac741ff7so1132716b3a.0 for ; Thu, 14 Mar 2024 07:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1710426394; x=1711031194; 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=1t6ULOFAaWOfVhtAE5dYdqGmEHfwVNxBeqPWXOtKDqU=; b=XKbgN1xR6SuLAfgtEUivGzjI/93z+HdcRNBNaTng8MG297Jv7XQSizoMP8WAmgt6TJ 4TU+4hOvQHN0qJ+eAkBLIVyFsahbquFiN1jFvFaT5uIC2/QVZkfcR9VIdD+KwfkZoYTr ZC8nZarFvO1hYgjFCI9RIeE7Nd4I/dOy/EeWMn3asxPSGwJBZhoiprVr72vf/2psgFKK UIKHlFrFSGmL2u1Z/w0ufX3yOWHoTfWypFO37w7wV0COsjwTSDf5YXh9i2D8mQvdcTVD tASOWzhmGbark9uwktL6XOaE0JIob73oYslfQSadotCxE/FIdBhP9ss/7mgFXtqVTJOH ae4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710426394; x=1711031194; 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=1t6ULOFAaWOfVhtAE5dYdqGmEHfwVNxBeqPWXOtKDqU=; b=Xsne2egfTQX59AIr7ULQt+dRZELZV55UGy1cB9VTl///ud8OiPtHLrDZf/JQTCgrGL SE0mikTXOPZM7hVLtgiMTh4ZQx9vgAnNQh8iX8UNXaC0eGxKC3jhPP7RJ2/3x2XUtv/E PRAEnOvEQNdRQdr3NaSvPv5qLwEJb7Bmk3q3DTvOCre64DBH/HicO4MIM9ZSGxGF1ToP MmRYbu0Zww134CZNHNkxnHYV1qQyeklHtEjzPEHIEWj/nrPUR5YJlBZ+yEWxmbP1b83k dkHRGoXBj9u1GvFmcYjTbX/kOSF58ad08OCpCMRZzzzMUpBMKpT1BkFN/VE5Yb72WSmc VryA== X-Gm-Message-State: AOJu0YxamD0QFpojQAQ65SS3eEbMjpQMMQ2VbiP1/nYbm9/r96hUNRRt DCNrNkwinQfNC5hew6eK44oBgqUbJbtRPlvfKalPpWIJkomOBsCpeq1WHM07c7qOP+L0FivPwdu LH/HKgzYD2d+CwDOzR3m6bv/4JdCnChx66CGXSUEXJTDgfUlTcIhSp+sI+chsJe40yQiu1gfD0i 3XI/HtM1U/5G/lAl6Srfv1gmBHKXArnzCMbwTa0v5ErhtvH83kN3dI X-Google-Smtp-Source: AGHT+IG80ljIyKK1zGSybNl1gNOV0i6UWFuSbMUxXNM7m/B0dqRlnvIqlBubLWrZYGebXhTWOcEqxA== X-Received: by 2002:a05:6a00:189d:b0:6e3:caa7:3038 with SMTP id x29-20020a056a00189d00b006e3caa73038mr2430783pfh.0.1710426393619; Thu, 14 Mar 2024 07:26:33 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id y9-20020a62f249000000b006e6854d45afsm1556435pfl.97.2024.03.14.07.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 07:26:33 -0700 (PDT) From: Andy Chiu To: linux-riscv@lists.infradead.org, palmer@dabbelt.com Cc: greentime.hu@sifive.com, conor.dooley@microchip.com, guoren@linux.alibaba.com, bjorn@kernel.org, Andy Chiu , Jonathan Corbet , Paul Walmsley , Albert Ou , Evan Green , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Heiko Stuebner , Andrew Jones , Costa Shulyupin Subject: [v2, 6/7] riscv: hwprobe: add zve Vector subextensions into hwprobe interface Date: Thu, 14 Mar 2024 22:25:41 +0800 Message-Id: <20240314142542.19957-7-andy.chiu@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240314142542.19957-1-andy.chiu@sifive.com> References: <20240314142542.19957-1-andy.chiu@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240314_072636_404487_2DDC2EF5 X-CRM114-Status: GOOD ( 10.66 ) 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 The following Vector subextensions for "embedded" platforms are added into RISCV_HWPROBE_KEY_IMA_EXT_0: - ZVE32X - ZVE32F - ZVE64X - ZVE64F - ZVE64D Extensions end with X mean the platform don't have a Vector FPU. Extensions end with F/D mean whether single (F) or double (D) precision Vector operation is supported. The number 32 or 64 follows from ZVE tells the maximum element length. Signed-off-by: Andy Chiu Reviewed-by: Clément Léger --- Changelog v2: - zve* extensions in hwprobe depends on whether kernel supports v, so include them after has_vector(). Fix a typo. (Clément) --- Documentation/arch/riscv/hwprobe.rst | 15 +++++++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 5 +++++ arch/riscv/kernel/sys_hwprobe.c | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index b2bcc9eed9aa..d0b02e012e5d 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -188,6 +188,21 @@ The following keys are defined: manual starting from commit 95cf1f9 ("Add changes requested by Ved during signoff") + * :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. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVE32F`: The Vector sub-extension Zve32f is + supported, as defined by version 1.0 of the RISC-V Vector extension manual. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVE64X`: The Vector sub-extension Zve64x is + supported, as defined by version 1.0 of the RISC-V Vector extension manual. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVE64F`: The Vector sub-extension Zve64f is + supported, as defined by version 1.0 of the RISC-V Vector extension manual. + + * :c:macro:`RISCV_HWPROBE_EXT_ZVE64D`: The Vector sub-extension Zve64d is + supported, as defined by version 1.0 of the RISC-V Vector extension manual. + * :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..b9a0876e969f 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -59,6 +59,11 @@ 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_ZVE32X (1ULL << 36) +#define RISCV_HWPROBE_EXT_ZVE32F (1ULL << 37) +#define RISCV_HWPROBE_EXT_ZVE64X (1ULL << 38) +#define RISCV_HWPROBE_EXT_ZVE64F (1ULL << 39) +#define RISCV_HWPROBE_EXT_ZVE64D (1ULL << 40) #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..db7495001f27 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -113,6 +113,11 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZICOND); if (has_vector()) { + EXT_KEY(ZVE32X); + EXT_KEY(ZVE32F); + EXT_KEY(ZVE64X); + EXT_KEY(ZVE64F); + EXT_KEY(ZVE64D); EXT_KEY(ZVBB); EXT_KEY(ZVBC); EXT_KEY(ZVKB);