From patchwork Thu Feb 13 00:38:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13972635 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 D1AEDC021A4 for ; Thu, 13 Feb 2025 00:39:13 +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=rXBcpK5ZbqiNCTtaQ23Ofo9zegFGgYhgbuksf1szqcI=; b=OInmT/1MeqLSG3 SE7wh88dMOF2HfU9LqG/AJsza4YslA9tst+4SPrFE08LXVmJ/Ihma0souvqQZiKjp7yCarhAPKqaE Q7kQ0qnXu6jbvdAq44j7m9SPJWpD/pla3EjBseiTzg1Vtq2uTdW0uRQPsZeKnhjjiIbwABIfaOQUk Pq/tIeKvcDzoH7gaMDGPq1nsA/OhzkwjBeYIxtCmv4MbKedG+E1Hq51tTukaKJTKAWtqB2KMVbLe9 EgnJY3fJW7UikLsucLYb2+7HWlRRAOIHCKM0uhT2cg71lUmHKiDvft6ElY2YYAYQlfAmeo6jZpjRY MMWsXicOZx5Uqvd2qG+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tiNFz-00000009IdN-1lpk; Thu, 13 Feb 2025 00:39:07 +0000 Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tiNFw-00000009Ibc-48qj for linux-riscv@lists.infradead.org; Thu, 13 Feb 2025 00:39:06 +0000 Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-47191bcb2afso1951081cf.2 for ; Wed, 12 Feb 2025 16:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739407144; x=1740011944; 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=U/dVS4QIgcS+IuNnmD54Uf/v25I+PAzsTeOUn9AzZIw=; b=SIr2qRhg6Zkgv3UECnEloEuweZZ7qCZedKI1TB9+lZE0OBYDIFDAX+RY/EqzYyFWIG Hgg+g3sfTSaNL4yKmGZLYOqYVV+st5rZMr+woZZXbnYX/NE0qY//Dl/CBl7despTg248 i0Pn5Wr2p5cM2awipwGVTCGktWqdv9ibPOP7RL/2ExmOrqIM8t9Ne/BlIeXdZmdzBySX 9BwxbIAZ8MatK6zKovUsVAkxt63z9SCStXqsIaSd/lEYXx8CAB6VwYymPqI64DJO0Xn7 QGNI/XWEV09h+ebG2NBA1mvE+Ip8Yg4hW5pHzLj/6RBhSBmPkBF8qfNXfzulQNT+lHSv X84A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739407144; x=1740011944; 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=U/dVS4QIgcS+IuNnmD54Uf/v25I+PAzsTeOUn9AzZIw=; b=Qd+vnDJMoJ7JnSk9bXKpa56vSZEnCg3v0Tk/KZFaKvX+/1EeG3sAymBgovo3mEVKC4 SnS+tXwgRhQJb3i1jFOG7GQz1GXD2gB0o7vsRwf0+vbb8a/am/fpIe7bdNyWzszx+HNl J+RsryOa7e1Gu05BmQnb9R4KQSHto3XhtCMoVR1Mj/CIChCDkwgxlSgL3uZOsQa2fFoi XN8y8RAJMTa4iVxGFd+BC6EXqsKzxD5xyhnwl7RWmxbp0+p3nbrFBSO5z+rJTqUukXMv vvkdscbIMFCfGhjb3xgTo0wpZCNSId2NHTZyH2HoLXs3jLOZerBTTyYKshi1GaDRXnjW VGWg== X-Forwarded-Encrypted: i=1; AJvYcCWE0qpWL/TrOaysT+enOzJBIEI91gnN5BmYzX0J5vC6kx49O9cH7/iP6SDm7XcRmo6sAGhQG1t/rNWWQw==@lists.infradead.org X-Gm-Message-State: AOJu0YxgcgpqErcBFf2MNnmzS6U1F/uKS7W829tD0OC6xey1IaqY8oKL 2do2NaeuVVePNPX5BRyDiySIrV0moZVfGWaJcnSM1LDY17hspwgs X-Gm-Gg: ASbGncuOxe0VcnHO9/LjK4fMVoyNnrurnJ5Xk9/0fPd/gmI2OOoWxeUg8izTPrb8lH2 7IsvUcZt1xOdVroPWjJijYWLRKmTmVI6K30G292foT2lnj+/IzJkoO7DmgW5uM5d4CivQimNP+N gmwq9ywXyURja9jHsvctTDW6DIDbpsHltFPk9Ehx4ioPUD5S6cOz+nBmpgHO/AAphDjFVt1gAfb QHGBDIQfnHdqYof2RJIUqRpIl6WuoXTsyFWe7Ub+14nldt/CvTnMSHkjBn3izeGFCY= X-Google-Smtp-Source: AGHT+IHspWsE6z8rbANPu1J4EJHGR6YUyo3bjSrXk+tx6Wy/U/d08EMp+rHEHGe9CzvstZnDSmahbQ== X-Received: by 2002:a05:622a:1a1c:b0:466:9d0e:1920 with SMTP id d75a77b69052e-471afe5fa85mr71820871cf.24.1739407143682; Wed, 12 Feb 2025 16:39:03 -0800 (PST) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with UTF8SMTPSA id d75a77b69052e-471c29e9261sm1302281cf.5.2025.02.12.16.39.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 16:39:02 -0800 (PST) From: Inochi Amaoto To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Charlie Jenkins , Evan Green , Andrew Jones , Inochi Amaoto , Jesse Taube , Andy Chiu , Alexandre Ghiti , Yong-Xuan Wang , Yu Chien Peter Lin , Samuel Holland Cc: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yixun Lan , Longbin Li , Conor Dooley Subject: [PATCH v4 1/3] dt-bindings: riscv: add bfloat16 ISA extension description Date: Thu, 13 Feb 2025 08:38:45 +0800 Message-ID: <20250213003849.147358-2-inochiama@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213003849.147358-1-inochiama@gmail.com> References: <20250213003849.147358-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250212_163905_024586_3AE643F7 X-CRM114-Status: UNSURE ( 8.97 ) 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 Add description for the BFloat16 precision Floating-Point ISA extension, (Zfbfmin, Zvfbfmin, Zvfbfwma). which was ratified in commit 4dc23d62 ("Added Chapter title to BF16") of the riscv-isa-manual. Signed-off-by: Inochi Amaoto Acked-by: Conor Dooley --- .../devicetree/bindings/riscv/extensions.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index a63b994e0763..f26997c3d34d 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -329,6 +329,12 @@ properties: instructions, as ratified in commit 056b6ff ("Zfa is ratified") of riscv-isa-manual. + - const: zfbfmin + description: + The standard Zfbfmin extension which provides minimal support for + 16-bit half-precision brain floating-point instructions, as ratified + in commit 4dc23d62 ("Added Chapter title to BF16") of riscv-isa-manual. + - const: zfh description: The standard Zfh extension for 16-bit half-precision binary @@ -525,6 +531,18 @@ properties: in commit 6f702a2 ("Vector extensions are now ratified") of riscv-v-spec. + - const: zvfbfmin + description: + The standard Zvfbfmin extension for minimal support for vectored + 16-bit half-precision brain floating-point instructions, as ratified + in commit 4dc23d62 ("Added Chapter title to BF16") of riscv-isa-manual. + + - const: zvfbfwma + description: + The standard Zvfbfwma extension for vectored half-precision brain + floating-point widening multiply-accumulate instructions, as ratified + in commit 4dc23d62 ("Added Chapter title to BF16") of riscv-isa-manual. + - const: zvfh description: The standard Zvfh extension for vectored half-precision @@ -673,6 +691,33 @@ properties: then: contains: const: zca + # Zfbfmin depends on F + - if: + contains: + const: zfbfmin + then: + contains: + const: f + # Zvfbfmin depends on V or Zve32f + - if: + contains: + const: zvfbfmin + then: + oneOf: + - contains: + const: v + - contains: + const: zve32f + # Zvfbfwma depends on Zfbfmin and Zvfbfmin + - if: + contains: + const: zvfbfwma + then: + allOf: + - contains: + const: zfbfmin + - contains: + const: zvfbfmin allOf: # Zcf extension does not exist on rv64 From patchwork Thu Feb 13 00:38:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13972636 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 9FC68C021A0 for ; Thu, 13 Feb 2025 00:39:16 +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=Hz8rH1w7w5wYwL3lkKWdsg3a1j6P8Du1bjqPZrgWEDU=; b=DLQRbbX3JxzpeU Kwz5wk8yjyijQjPur02eAcK1nm4BiNxzThAxJcoBrq83jHK5sZWU4mAEfyYNBzqhAR4zr9EJKPdte aGXXHAiBjW8XSSvkKq1V9o8Ym5c932PmPzmPQsaW5zBbMNKasjr5d3+h7vaOSvWgD635T/MMP8lEY lUk53TfkemtX3GVdrA2d5XTdw9jCi5Cfeif3PT9tcWs5FURX/t45cpa20n/dbfCH/ipesyQ5Gh6yy mi5EmodPdZrZnRsFj2GKPsmBO3QzyF77buIO+Ym0MADx794P4Bvboi/NckHz2B6Xc5qIA9tgZBGPr j4t/T7rOLDW0tp6PTzmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tiNG3-00000009Ifo-01zw; Thu, 13 Feb 2025 00:39:11 +0000 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tiNG0-00000009Idj-2mw4 for linux-riscv@lists.infradead.org; Thu, 13 Feb 2025 00:39:09 +0000 Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-471963ae31bso3048411cf.3 for ; Wed, 12 Feb 2025 16:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739407147; x=1740011947; 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=dUrtJevhcm0CKbwqKbK4CuYq0Bi82l+4WvPMumL72xI=; b=fz2Sh45m0uW79x1NVs5jtIeztfzAQbJ9o/8mDvlaZyX+Z1RSmN2vri/FdaKeiPjqap Ul8TvRrW+GX3S/wqnl2lo/H8Kf+My7IeDbb9DAN62zEYhHp0R/OJGYLnH4EMkjV9E9Y9 U6ZwcPmgizobzGPfrrAoXCpzHlD42WCk2+08rpA6Hdr2LI8/x0xJ+qBJUR7S5WfgnFge 10Vk9DyywnIZoa+LN3LktOWxGJ1lMd0GTC7ewFaeoZXAwuUx0J4CXIQhpS8w4v+BTk0J pNgyxLWIn3nO2ZDH83nthwdBHD49murKzb8DbOnUEAfj2G+Jm/HwiUfVXVe1JzBT014c UibQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739407147; x=1740011947; 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=dUrtJevhcm0CKbwqKbK4CuYq0Bi82l+4WvPMumL72xI=; b=B9xt6J1fQFgVbK5MhdLABkOpkrw6mLWmWazfUGst64KXmQdf3eb1lY8gQ8XFeo/AXg W8QNG3bjFxefpVgfn1q0AV3D+jXgRA0LKgy2wOzQGI5Y4+uN3qBa5NKKeXyH5GI8atEV w7nU6GVZBRvaP4VVWN5nDpasrV4/07IqS73CrfBGdUPKjMNytdhCKJ0YUux+/BQhwh1w MyFHzZ1BB1m0bwRhlpjsHD/7sb6fhztYEYj87LN/uLcN1Fs+ypHSrKdpQZbeFQqhjUG+ LYXua5Sked2mRA2ojmBTTrLWIroLmDKC3WgIMZ2lH5AP6YzNTuTENx7SQ5Fb7kB0+Rbo HWRg== X-Forwarded-Encrypted: i=1; AJvYcCVBBn0IaCEpZLjmGCLhcL98XMW5Rq/bIu/ENhBPCeo8G7CXQFUWvoT6LesEj3nL+we07nSsY45T69EzuQ==@lists.infradead.org X-Gm-Message-State: AOJu0YzhmNMvNCtbLVd+5NabUsyENAyJMOPFUeoKukWlA0LgiPBokYnn RDECddZf70WWE/Hw5uWIeNs+Vu4XRalQYYgxGbw23CEYiNNb3VI+ X-Gm-Gg: ASbGnctPL6kzzp8cOdTcmkFAud8G2AUJdeGVensVtG1oc4NqpBZgcZnL67vadark1KG evtA0Ky5hfulxSgYGkQ7WQwgrdXxJUszHldVM7DS3sEtKY9tn+/Adr1i4fN6kwyXAn8+bFxHvOj e+GpN+l+o4Gy+I3eQJZ5pmGj8aGbs52k0+pm6quT3fDdXc2oHirhVUnYRZFPZiZIMl9QdOxHXKe Z6TnUuAdnEIEjUKIMbw4yQ4GnQiISuIa7WhVwr9N3Xdi39n/A4I1dvmOJMLuX9K8kw= X-Google-Smtp-Source: AGHT+IH4Lace1X98ZnWBEvY1cymlk72VSYPPy3ZXrC1eukrH19AoRSIo1KXtdbZz9LKA1vAlD6ac/A== X-Received: by 2002:ac8:5a15:0:b0:471:a602:e75 with SMTP id d75a77b69052e-471bed7567dmr20929571cf.25.1739407147286; Wed, 12 Feb 2025 16:39:07 -0800 (PST) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with UTF8SMTPSA id d75a77b69052e-471c2b06002sm1152481cf.77.2025.02.12.16.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 16:39:07 -0800 (PST) From: Inochi Amaoto To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Charlie Jenkins , Evan Green , Inochi Amaoto , Andrew Jones , Jesse Taube , Andy Chiu , Alexandre Ghiti , Yong-Xuan Wang , Yu Chien Peter Lin , Samuel Holland Cc: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yixun Lan , Longbin Li Subject: [PATCH v4 2/3] riscv: add ISA extension parsing for bfloat16 ISA extension Date: Thu, 13 Feb 2025 08:38:46 +0800 Message-ID: <20250213003849.147358-3-inochiama@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213003849.147358-1-inochiama@gmail.com> References: <20250213003849.147358-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250212_163908_704299_E02C338A X-CRM114-Status: GOOD ( 11.48 ) 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 Add parsing for Zfbmin, Zvfbfmin, Zvfbfwma ISA extension which were ratified in 4dc23d62 ("Added Chapter title to BF16") of the riscv-isa-manual. Signed-off-by: Inochi Amaoto Reviewed-by: Clément Léger --- arch/riscv/include/asm/hwcap.h | 3 +++ arch/riscv/kernel/cpufeature.c | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 869da082252a..14cc29f2a723 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -100,6 +100,9 @@ #define RISCV_ISA_EXT_ZICCRSE 91 #define RISCV_ISA_EXT_SVADE 92 #define RISCV_ISA_EXT_SVADU 93 +#define RISCV_ISA_EXT_ZFBFMIN 94 +#define RISCV_ISA_EXT_ZVFBFMIN 95 +#define RISCV_ISA_EXT_ZVFBFWMA 96 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index c6ba750536c3..37fb6b07281e 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -80,6 +80,15 @@ bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned i } EXPORT_SYMBOL_GPL(__riscv_isa_extension_available); +static int riscv_ext_f_depends(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f)) + return 0; + + return -EPROBE_DEFER; +} + static int riscv_ext_zicbom_validate(const struct riscv_isa_ext_data *data, const unsigned long *isa_bitmap) { @@ -140,6 +149,28 @@ static int riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data, return -EPROBE_DEFER; } +static int riscv_vector_f_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (!IS_ENABLED(CONFIG_RISCV_ISA_V)) + return -EINVAL; + + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZVE32F)) + return 0; + + return -EPROBE_DEFER; +} + +static int riscv_ext_zvfbfwma_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZFBFMIN) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZVFBFMIN)) + return 0; + + return -EPROBE_DEFER; +} + static int riscv_ext_svadu_validate(const struct riscv_isa_ext_data *data, const unsigned long *isa_bitmap) { @@ -345,6 +376,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zacas, RISCV_ISA_EXT_ZACAS), __RISCV_ISA_EXT_DATA(zawrs, RISCV_ISA_EXT_ZAWRS), __RISCV_ISA_EXT_DATA(zfa, RISCV_ISA_EXT_ZFA), + __RISCV_ISA_EXT_DATA_VALIDATE(zfbfmin, RISCV_ISA_EXT_ZFBFMIN, riscv_ext_f_depends), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN), __RISCV_ISA_EXT_DATA(zca, RISCV_ISA_EXT_ZCA), @@ -377,6 +409,9 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_SUPERSET(zve64d, RISCV_ISA_EXT_ZVE64D, riscv_zve64d_exts), __RISCV_ISA_EXT_SUPERSET(zve64f, RISCV_ISA_EXT_ZVE64F, riscv_zve64f_exts), __RISCV_ISA_EXT_SUPERSET(zve64x, RISCV_ISA_EXT_ZVE64X, riscv_zve64x_exts), + __RISCV_ISA_EXT_DATA_VALIDATE(zvfbfmin, RISCV_ISA_EXT_ZVFBFMIN, riscv_vector_f_validate), + __RISCV_ISA_EXT_DATA_VALIDATE(zvfbfwma, RISCV_ISA_EXT_ZVFBFWMA, + riscv_ext_zvfbfwma_validate), __RISCV_ISA_EXT_DATA(zvfh, RISCV_ISA_EXT_ZVFH), __RISCV_ISA_EXT_DATA(zvfhmin, RISCV_ISA_EXT_ZVFHMIN), __RISCV_ISA_EXT_DATA(zvkb, RISCV_ISA_EXT_ZVKB), From patchwork Thu Feb 13 00:38:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Inochi Amaoto X-Patchwork-Id: 13972637 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 CF335C021A5 for ; Thu, 13 Feb 2025 00:39:18 +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=E9A14zWLNAgDejW0tr67hMiP71qHL81IK0E1IhPkZvA=; b=PEBrSikd7aItL0 etRnSjZ+GmVTKs5VcaBUs459nKMWdboxRdn00Vm9QzQicRGcDe8cXbbKcQubcBkqmVgSwp4/AsBqh ixm30futfIomModUH1p9CWr4SUkEAS3B26Ho6hjg6uvVS6ZaFu31OIyYvr9hvGOXz6ySs40ckjgIN BxP/AJLHy2YzPtv3Uu/95Typf7VOHKQa3968CIZlSQnFW2BElER3AKJe3FLmgdYBkah3Pv7bIFQ/1 TR1VEkOLxzPh5CHnq9asfp/ZtvkRhDDR6VhLXEslP+3x80JmaiDrK54ueN+TEi/uVKeDhF5EItWvx GgCyef3sCFRzIpiucGkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tiNG6-00000009Ii1-2XQK; Thu, 13 Feb 2025 00:39:14 +0000 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tiNG4-00000009IgG-1Qri for linux-riscv@lists.infradead.org; Thu, 13 Feb 2025 00:39:13 +0000 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-471bc8eaf3fso2325351cf.2 for ; Wed, 12 Feb 2025 16:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739407151; x=1740011951; 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=1VKAEXIbPsMighQ8qKly+RRtipWoEJVN3H+Ie+l08Lw=; b=Wyb0E/1Y5NEhKerHfByRVwTyyeOUZxOIGY0EmGckWaxV1bLj/mk8oo+jFdQ3cLon4v AIOmq7x2gzVyitUFZM79Q8xv8B7IYW3/JVZ4rnWQ4OrdkqdhopW2nOSESKURjzBpr0Z/ U2rOLOnGjZq5H6CLvE+cbRskK+klh7JbEKKoVRiv3o7njK4FNGZhaUEFnY/WKCHLQYNf /6EYahgzvQ5d2zUJK6+D3rAO9P+8vPudwAvRTf0hdQFX41W1Vg3+xxfBqcU5guTgPctL XZsom3qupEGG1DgxyKcNAt7J6J3Oy4BVRIiHWh5IXLt6gvM6DSmCTMHOLQElE1PXOGuv kmmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739407151; x=1740011951; 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=1VKAEXIbPsMighQ8qKly+RRtipWoEJVN3H+Ie+l08Lw=; b=MSs6NQdgN6kf8ogwZtqKbVDmAA52IG3+u8U870SZlJSswGL4MGvfMtDs0eAuu6JCq9 KOkNDTqPecPvx8NDyMvxnO1NyAmh1OWrIja1dMeGU+/ph7yv8kdX1Txtygpl4CKvZceY DjwDozPn2y1N4p1zgASYEMzLMofV8nuIBO8oyG0ZMQiudJaLpjCVybG+8+iu0vdA/LIT yoL4ME/Is4GpiejLHZzb1ppDJcTXkQ0D82DgbexR/3TnP491GNzT5wkJhHUOThClCThs 92I2Xhs/UrGzjpihwg1xVWsTwYmSf4eoWIOVl2ji6Z+VSaifnUNyCBzsPP+yTD1wLXfl QTWQ== X-Forwarded-Encrypted: i=1; AJvYcCXhgahX6NtYIc7heLla6roicWLCyxhKti2ZOYoa8enrZ3tk7BuB4MzxaCoT+YFTUrZ83uZhIi6tvTTc3A==@lists.infradead.org X-Gm-Message-State: AOJu0YzF8AwyS+iBowF0w+XfLBc+vp159fQc8K4TJXqTzQLz1qPrpGLH SUQJ34rE0bq49IP1b/G3YYftYef9p8POm6lUfFefwf40NekN8a/8 X-Gm-Gg: ASbGncu2r+CbAoWvNv3kWJVzoMSSbTMXaUvn2Kfu9zy82+YKghzfoIVjaTdKRy1KMYw FgsxXN4xxwpLT+JR1n6koATMpQApwNu+mmPMlp6a6nNoFad63CmGJvzuPH4t1mUs5Ov0jFB1Ktp ZvoZXT25kG0CFmhNIwpHfGONiuXZX9wZnad/NjVhnZU3Ci9dFE6OSE8oNG58crSq8GV4a3iwxNs uWNu+reltQ8E+9Uec/vHZ5Xjy9os16FYxc3hb46HXWhr+ihFfPA/5xNX691ISd5pGg= X-Google-Smtp-Source: AGHT+IHBc4LTnAwtHYivgaNgVKDo5w4ZaLaXgX6Xpv7NQpTgZYGhBYw2IsMuK7NVT7OfDxlvlEfZdw== X-Received: by 2002:ac8:7dd0:0:b0:471:9174:53ba with SMTP id d75a77b69052e-471afde1e0fmr56132161cf.9.1739407151127; Wed, 12 Feb 2025 16:39:11 -0800 (PST) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with UTF8SMTPSA id d75a77b69052e-471c2b04b18sm1163941cf.72.2025.02.12.16.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 16:39:10 -0800 (PST) From: Inochi Amaoto To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Charlie Jenkins , Evan Green , Andrew Jones , Inochi Amaoto , Jesse Taube , Andy Chiu , Alexandre Ghiti , Yong-Xuan Wang , Yu Chien Peter Lin , Samuel Holland Cc: linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yixun Lan , Longbin Li Subject: [PATCH v4 3/3] riscv: hwprobe: export bfloat16 ISA extension Date: Thu, 13 Feb 2025 08:38:47 +0800 Message-ID: <20250213003849.147358-4-inochiama@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213003849.147358-1-inochiama@gmail.com> References: <20250213003849.147358-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250212_163912_376838_378500DA 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 Export Zfbmin, Zvfbfmin, Zvfbfwma ISA extension through hwprobe. Signed-off-by: Inochi Amaoto Reviewed-by: Clément Léger --- Documentation/arch/riscv/hwprobe.rst | 12 ++++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 3 +++ arch/riscv/kernel/sys_hwprobe.c | 3 +++ 3 files changed, 18 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index f273ea15a8e8..feefe5ea24ea 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -242,6 +242,18 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_SUPM`: The Supm extension is supported as defined in version 1.0 of the RISC-V Pointer Masking extensions. + * :c:macro:`RISCV_HWPROBE_EXT_ZFBFMIN`: The Zfbfmin extension is supported as + defined in the RISC-V ISA manual starting from commit 4dc23d6229de + ("Added Chapter title to BF16"). + + * :c:macro:`RISCV_HWPROBE_EXT_ZVFBFMIN`: The Zvfbfmin extension is supported as + defined in the RISC-V ISA manual starting from commit 4dc23d6229de + ("Added Chapter title to BF16"). + + * :c:macro:`RISCV_HWPROBE_EXT_ZVFBFWMA`: The Zvfbfwma extension is supported as + defined in the RISC-V ISA manual starting from commit 4dc23d6229de + ("Added Chapter title to BF16"). + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated. Returns similar values to :c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF`, but the key was mistakenly classified as a bitmask rather than a value. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index c3c1cc951cb9..e4e286c63629 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -73,6 +73,9 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 47) #define RISCV_HWPROBE_EXT_ZAWRS (1ULL << 48) #define RISCV_HWPROBE_EXT_SUPM (1ULL << 49) +#define RISCV_HWPROBE_EXT_ZFBFMIN (1ULL << 50) +#define RISCV_HWPROBE_EXT_ZVFBFMIN (1ULL << 51) +#define RISCV_HWPROBE_EXT_ZVFBFWMA (1ULL << 52) #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 bcd3b816306c..f76163958e27 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -132,6 +132,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZVE64D); EXT_KEY(ZVE64F); EXT_KEY(ZVE64X); + EXT_KEY(ZVFBFMIN); + EXT_KEY(ZVFBFWMA); EXT_KEY(ZVFH); EXT_KEY(ZVFHMIN); EXT_KEY(ZVKB); @@ -148,6 +150,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZCD); EXT_KEY(ZCF); EXT_KEY(ZFA); + EXT_KEY(ZFBFMIN); EXT_KEY(ZFH); EXT_KEY(ZFHMIN); }