mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] riscv: Add Beijing LeapRise Technology vendor ID and vendor extension framework
@ 2026-11-20  6:51 lv.yating
  2026-11-20  7:02 ` [PATCH v2 1/2] riscv: Add LeapRise Technology to the vendor list lv.yating
  2026-11-20  7:04 ` [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension framework support lv.yating
  0 siblings, 2 replies; 4+ messages in thread
From: lv.yating @ 2026-11-20  6:51 UTC (permalink / raw)
  To: pjw, palmer, aou, alex, corbet, skhan, rdunlap
  Cc: linux-riscv, linux-kernel, liu.qingtao2, he.yilin, ye.zhihao1,
	zhang.cheng35, hu.shengming, lv.yating, linux-doc

From: Lv Yating <lv.yating@zte.com.cn>

Hi,

Beijing LeapRise Technology has been assigned a JEDEC manufacturer
identity, encoded as 0x966 in the mvendorid CSR per the JEP106
scheme (bank 0x12, final byte 0x66).

This series lays the kernel groundwork for LeapRise RISC-V cores:

Patch 1 adds the vendor ID constant (LEAPRISE_VENDOR_ID) to the
RISC-V vendor list.

Patch 2 adds the vendor extension framework support: hwprobe key
recognition (RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0) and an empty
extension probe list hooked into the common probing path. The key
reports an empty bitmask for now, allowing userspace to distinguish
it from unknown keys (reported as -1), so LeapRise userspace
libraries can be prepared ahead of the first hardware shipping
vendor extensions. The key is documented in
Documentation/arch/riscv/hwprobe.rst.

Follow-up patches will register extensions as their specifications
are finalized.

---
Changelog:

v2:
- Bumped RISCV_HWPROBE_MAX_KEY to 17 so the new key is valid for
  userspace and in the vDSO data.
- Registered LeapRise in the vendor extension framework: added the entry
  to riscv_isa_vendor_ext_list[], the LEAPRISE_VENDOR_ID switch case,
  riscv_isa_vendor_ext_list_leaprise in leaprise.c, and
  RISCV_ISA_VENDOR_EXT_MAX_LEAPRISE.
- Fixed the build failure in vendor_extensions.c and the wrong
  MIPS_VENDOR_ID case label.
- Fixed the Kconfig.vendor syntax error.
- Unified SPDX on GPL-2.0-only and cleaned up the new files.

v1:
-https://lore.kernel.org/all/202611160811.6AG8B8QM046993@mse-db.zte.com.cn/
-https://lore.kernel.org/all/202611160824.6AG8OXL4051238@mse-db.zte.com.cn/

best regards,
Lv Yating

Lv Yating (2):
  riscv: Add LeapRise Technology to the vendor list
  riscv: hwprobe: Add LeapRise vendor extension framework support

 Documentation/arch/riscv/hwprobe.rst          |  4 ++++
 arch/riscv/Kconfig.vendor                     | 14 +++++++++++++
 arch/riscv/include/asm/hwprobe.h              |  3 ++-
 .../include/asm/vendor_extensions/leaprise.h  | 17 ++++++++++++++++
 .../asm/vendor_extensions/leaprise_hwprobe.h  | 20 +++++++++++++++++++
 arch/riscv/include/asm/vendorid_list.h        |  1 +
 arch/riscv/include/uapi/asm/hwprobe.h         |  1 +
 arch/riscv/include/uapi/asm/vendor/leaprise.h |  3 +++
 arch/riscv/kernel/sys_hwprobe.c               |  4 ++++
 arch/riscv/kernel/vendor_extensions.c         | 10 ++++++++++
 arch/riscv/kernel/vendor_extensions/Makefile  |  2 ++
 .../riscv/kernel/vendor_extensions/leaprise.c | 12 +++++++++++
 .../vendor_extensions/leaprise_hwprobe.c      | 19 ++++++++++++++++++
 13 files changed, 109 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/include/asm/vendor_extensions/leaprise.h
 create mode 100644 arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
 create mode 100644 arch/riscv/include/uapi/asm/vendor/leaprise.h
 create mode 100644 arch/riscv/kernel/vendor_extensions/leaprise.c
 create mode 100644 arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c

-- 
2.27.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] riscv: Add LeapRise Technology to the vendor list
  2026-11-20  6:51 [PATCH v2 0/2] riscv: Add Beijing LeapRise Technology vendor ID and vendor extension framework lv.yating
@ 2026-11-20  7:02 ` lv.yating
  2026-11-20  7:04 ` [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension framework support lv.yating
  1 sibling, 0 replies; 4+ messages in thread
From: lv.yating @ 2026-11-20  7:02 UTC (permalink / raw)
  To: lv.yating
  Cc: pjw, palmer, aou, alex, corbet, skhan, rdunlap, linux-riscv,
	linux-kernel, liu.qingtao2, he.yilin, ye.zhihao1, zhang.cheng35,
	hu.shengming, linux-doc

From: Lv Yating <lv.yating@zte.com.cn>

Beijing LeapRise Technology Co., Ltd. has been assigned a JEDEC
manufacturer identity: bank 0x12 with final byte 0x66. Per the
JEP106 encoding used for mvendorid, with the parity bit dropped:

    mvendorid = (bank << 7) | (byte & 0x7f) = 0x966

Add LEAPRISE_VENDOR_ID to the vendor ID list as groundwork for
follow-up patches.

Signed-off-by: Lv Yating <lv.yating@zte.com.cn>
---
 arch/riscv/include/asm/vendorid_list.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/include/asm/vendorid_list.h b/arch/riscv/include/asm/vendorid_list.h
index 7f5030ee1fcf..2d0a8a2e4a67 100644
--- a/arch/riscv/include/asm/vendorid_list.h
+++ b/arch/riscv/include/asm/vendorid_list.h
@@ -6,6 +6,7 @@
 #define ASM_VENDOR_LIST_H

 #define ANDES_VENDOR_ID		0x31e
+#define LEAPRISE_VENDOR_ID	0x966
 #define MICROCHIP_VENDOR_ID	0x029
 #define MIPS_VENDOR_ID		0x127
 #define SIFIVE_VENDOR_ID	0x489
-- 
2.27.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension  framework support
  2026-11-20  6:51 [PATCH v2 0/2] riscv: Add Beijing LeapRise Technology vendor ID and vendor extension framework lv.yating
  2026-11-20  7:02 ` [PATCH v2 1/2] riscv: Add LeapRise Technology to the vendor list lv.yating
@ 2026-11-20  7:04 ` lv.yating
  2026-11-20 13:43   ` [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension? " Conor Dooley
  1 sibling, 1 reply; 4+ messages in thread
From: lv.yating @ 2026-11-20  7:04 UTC (permalink / raw)
  To: lv.yating
  Cc: pjw, palmer, aou, alex, corbet, skhan, rdunlap, linux-riscv,
	linux-kernel, liu.qingtao2, he.yilin, ye.zhihao1, zhang.cheng35,
	hu.shengming, linux-doc

From: Lv Yating <lv.yating@zte.com.cn>

Add RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0 (key 17) and the
supporting vendor extension framework entries for Beijing LeapRise
Technology Co., Ltd.

The key is recognized by riscv_hwprobe() and reports an empty
bitmask for now: no LeapRise vendor extensions are defined yet.
Recognizing the key allows userspace to distinguish a kernel that
supports LeapRise vendor extension probing (empty bitmask) from an
older kernel that does not know the key at all (key set to -1), so
LeapRise userspace libraries can be prepared ahead of the first
hardware shipping vendor extensions.

Follow-up patches will register extensions as they are defined.

Signed-off-by: Lv Yating <lv.yating@zte.com.cn>
---
 Documentation/arch/riscv/hwprobe.rst          |  4 ++++
 arch/riscv/Kconfig.vendor                     | 14 +++++++++++++
 arch/riscv/include/asm/hwprobe.h              |  3 ++-
 .../include/asm/vendor_extensions/leaprise.h  | 17 ++++++++++++++++
 .../asm/vendor_extensions/leaprise_hwprobe.h  | 20 +++++++++++++++++++
 arch/riscv/include/uapi/asm/hwprobe.h         |  1 +
 arch/riscv/include/uapi/asm/vendor/leaprise.h |  3 +++
 arch/riscv/kernel/sys_hwprobe.c               |  4 ++++
 arch/riscv/kernel/vendor_extensions.c         | 10 ++++++++++
 arch/riscv/kernel/vendor_extensions/Makefile  |  2 ++
 .../riscv/kernel/vendor_extensions/leaprise.c | 12 +++++++++++
 .../vendor_extensions/leaprise_hwprobe.c      | 19 ++++++++++++++++++
 12 files changed, 108 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/include/asm/vendor_extensions/leaprise.h
 create mode 100644 arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
 create mode 100644 arch/riscv/include/uapi/asm/vendor/leaprise.h
 create mode 100644 arch/riscv/kernel/vendor_extensions/leaprise.c
 create mode 100644 arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c

diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst
index 8454a6ae6fd1..336a2c5b05d9 100644
--- a/Documentation/arch/riscv/hwprobe.rst
+++ b/Documentation/arch/riscv/hwprobe.rst
@@ -431,3 +431,7 @@ The following keys are defined:
   * :c:macro:`RISCV_HWPROBE_EXT_ZIC64B`: The Zic64b extension is supported,
     as defined in the RISC-V Profiles specification starting from commit
     b1d80660 ("Updated to ratified state.")
+
+* :c:macro:`RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0`: A bitmask containing the
+  leaprise vendor extensions that are compatible with the
+  :c:macro:`RISCV_HWPROBE_BASE_BEHAVIOR_IMA`: base system behavior.
diff --git a/arch/riscv/Kconfig.vendor b/arch/riscv/Kconfig.vendor
index 3c1f92e406c3..03af8bc0f903 100644
--- a/arch/riscv/Kconfig.vendor
+++ b/arch/riscv/Kconfig.vendor
@@ -16,6 +16,20 @@ config RISCV_ISA_VENDOR_EXT_ANDES
 	  If you don't know what to do here, say Y.
 endmenu

+menu "LeapRise"
+config RISCV_ISA_VENDOR_EXT_LEAPRISE
+	bool "LeapRise vendor extension support"
+	select RISCV_ISA_VENDOR_EXT
+	default y
+	help
+	  Say N here to disable detection of and support for all LeapRise vendor
+	  extensions. Without this option enabled, LeapRise vendor extensions
+	  will not be detected at boot and their presence not reported to
+	  userspace.
+
+	  If you don't know what to do here, say Y.
+endmenu
+
 menu "MIPS"
 config RISCV_ISA_VENDOR_EXT_MIPS
 	bool "MIPS vendor extension support"
diff --git a/arch/riscv/include/asm/hwprobe.h b/arch/riscv/include/asm/hwprobe.h
index 9b04377c0f98..e37e5a8afbb4 100644
--- a/arch/riscv/include/asm/hwprobe.h
+++ b/arch/riscv/include/asm/hwprobe.h
@@ -8,7 +8,7 @@

 #include <uapi/asm/hwprobe.h>

-#define RISCV_HWPROBE_MAX_KEY		16
+#define RISCV_HWPROBE_MAX_KEY		17

 static inline bool riscv_hwprobe_key_is_valid(__s64 key)
 {
@@ -25,6 +25,7 @@ static inline bool hwprobe_key_is_bitmask(__s64 key)
 	case RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0:
 	case RISCV_HWPROBE_KEY_VENDOR_EXT_MIPS_0:
 	case RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0:
+	case RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0:
 		return true;
 	}

diff --git a/arch/riscv/include/asm/vendor_extensions/leaprise.h b/arch/riscv/include/asm/vendor_extensions/leaprise.h
new file mode 100644
index 000000000000..0d4ab8f03983
--- /dev/null
+++ b/arch/riscv/include/asm/vendor_extensions/leaprise.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_H
+#define _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_H
+
+#include <asm/vendor_extensions.h>
+#include <linux/types.h>
+
+/*
+ * Extension keys should be strictly less than max.
+ * It is safe to increment this when necessary.
+ */
+#define RISCV_ISA_VENDOR_EXT_MAX_LEAPRISE			32
+
+extern struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_leaprise;
+
+#endif
diff --git a/arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h b/arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
new file mode 100644
index 000000000000..980402df0095
--- /dev/null
+++ b/arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_HWPROBE_H
+#define _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_HWPROBE_H
+
+#include <linux/cpumask.h>
+
+#include <uapi/asm/hwprobe.h>
+
+#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE
+void hwprobe_isa_vendor_ext_leaprise_0(struct riscv_hwprobe *pair, const struct cpumask *cpus);
+#else
+static inline void hwprobe_isa_vendor_ext_leaprise_0(struct riscv_hwprobe *pair,
+						   const struct cpumask *cpus)
+{
+	pair->value = 0;
+}
+#endif
+
+#endif
diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h
index 9a121ee3b436..6907ca4648ef 100644
--- a/arch/riscv/include/uapi/asm/hwprobe.h
+++ b/arch/riscv/include/uapi/asm/hwprobe.h
@@ -124,6 +124,7 @@ struct riscv_hwprobe {
 #define		RISCV_HWPROBE_EXT_ZA64RS	_BITULL(5)
 #define		RISCV_HWPROBE_EXT_B		_BITULL(6)
 #define		RISCV_HWPROBE_EXT_ZIC64B	_BITULL(7)
+#define RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0	17

 /* Increase RISCV_HWPROBE_MAX_KEY when adding items. */

diff --git a/arch/riscv/include/uapi/asm/vendor/leaprise.h b/arch/riscv/include/uapi/asm/vendor/leaprise.h
new file mode 100644
index 000000000000..9ee13f1ca559
--- /dev/null
+++ b/arch/riscv/include/uapi/asm/vendor/leaprise.h
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+
+/* LeapRise vendor extensions: none defined yet */
diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c
index cd7cf272e6e1..e60facabdd86 100644
--- a/arch/riscv/kernel/sys_hwprobe.c
+++ b/arch/riscv/kernel/sys_hwprobe.c
@@ -15,6 +15,7 @@
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/vector.h>
+#include <asm/vendor_extensions/leaprise_hwprobe.h>
 #include <asm/vendor_extensions/mips_hwprobe.h>
 #include <asm/vendor_extensions/sifive_hwprobe.h>
 #include <asm/vendor_extensions/thead_hwprobe.h>
@@ -364,6 +365,9 @@ static void hwprobe_one_pair(struct riscv_hwprobe *pair,
 	case RISCV_HWPROBE_KEY_VENDOR_EXT_MIPS_0:
 		hwprobe_isa_vendor_ext_mips_0(pair, cpus);
 		break;
+	case RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0:
+		hwprobe_isa_vendor_ext_leaprise_0(pair, cpus);
+		break;

 	/*
 	 * For forward compatibility, unknown keys don't fail the whole
diff --git a/arch/riscv/kernel/vendor_extensions.c b/arch/riscv/kernel/vendor_extensions.c
index bb4a75923685..e7372194096e 100644
--- a/arch/riscv/kernel/vendor_extensions.c
+++ b/arch/riscv/kernel/vendor_extensions.c
@@ -6,6 +6,7 @@
 #include <asm/vendorid_list.h>
 #include <asm/vendor_extensions.h>
 #include <asm/vendor_extensions/andes.h>
+#include <asm/vendor_extensions/leaprise.h>
 #include <asm/vendor_extensions/mips.h>
 #include <asm/vendor_extensions/sifive.h>
 #include <asm/vendor_extensions/thead.h>
@@ -17,6 +18,9 @@ struct riscv_isa_vendor_ext_data_list *riscv_isa_vendor_ext_list[] = {
 #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES
 	&riscv_isa_vendor_ext_list_andes,
 #endif
+#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE
+	&riscv_isa_vendor_ext_list_leaprise,
+#endif
 #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS
 	&riscv_isa_vendor_ext_list_mips,
 #endif
@@ -53,6 +57,12 @@ bool __riscv_isa_vendor_extension_available(int cpu, unsigned long vendor, unsig
 		cpu_bmap = riscv_isa_vendor_ext_list_andes.per_hart_isa_bitmap;
 		break;
 	#endif
+	#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE
+	case LEAPRISE_VENDOR_ID:
+		bmap = &riscv_isa_vendor_ext_list_leaprise.all_harts_isa_bitmap;
+		cpu_bmap = riscv_isa_vendor_ext_list_leaprise.per_hart_isa_bitmap;
+		break;
+	#endif
 	#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS
 	case MIPS_VENDOR_ID:
 		bmap = &riscv_isa_vendor_ext_list_mips.all_harts_isa_bitmap;
diff --git a/arch/riscv/kernel/vendor_extensions/Makefile b/arch/riscv/kernel/vendor_extensions/Makefile
index bf116c82b6bd..1f76fd4050c7 100644
--- a/arch/riscv/kernel/vendor_extensions/Makefile
+++ b/arch/riscv/kernel/vendor_extensions/Makefile
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only

 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES)	+= andes.o
+obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE)	+= leaprise.o
+obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE)	+= leaprise_hwprobe.o
 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_MIPS)  	+= mips.o
 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_MIPS)  	+= mips_hwprobe.o
 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE)	+= sifive.o
diff --git a/arch/riscv/kernel/vendor_extensions/leaprise.c b/arch/riscv/kernel/vendor_extensions/leaprise.c
new file mode 100644
index 000000000000..bdc2eed288ba
--- /dev/null
+++ b/arch/riscv/kernel/vendor_extensions/leaprise.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <asm/cpufeature.h>
+#include <asm/vendor_extensions.h>
+#include <asm/vendor_extensions/leaprise.h>
+
+/* LeapRise vendor extensions: none defined yet */
+
+struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_leaprise = {
+	.ext_data_count = 0,
+	.ext_data = NULL,
+};
diff --git a/arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c b/arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c
new file mode 100644
index 000000000000..260a2b38e4d6
--- /dev/null
+++ b/arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <asm/vendor_extensions.h>
+#include <asm/vendor_extensions/leaprise.h>
+#include <asm/vendor_extensions/leaprise_hwprobe.h>
+#include <asm/vendor_extensions/vendor_hwprobe.h>
+
+#include <linux/cpumask.h>
+#include <linux/types.h>
+
+#include <uapi/asm/hwprobe.h>
+#include <uapi/asm/vendor/leaprise.h>
+
+void hwprobe_isa_vendor_ext_leaprise_0(struct riscv_hwprobe *pair,
+				   const struct cpumask *cpus)
+{
+	/* No LeapRise vendor extensions are defined yet. */
+	pair->value = 0;
+}
-- 
2.27.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension? framework support
  2026-11-20  7:04 ` [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension framework support lv.yating
@ 2026-11-20 13:43   ` Conor Dooley
  0 siblings, 0 replies; 4+ messages in thread
From: Conor Dooley @ 2026-11-20 13:43 UTC (permalink / raw)
  To: lv.yating
  Cc: pjw, palmer, aou, alex, corbet, skhan, rdunlap, linux-riscv,
	linux-kernel, liu.qingtao2, he.yilin, ye.zhihao1, zhang.cheng35,
	hu.shengming, linux-doc

[-- Attachment #1: Type: text/plain, Size: 12415 bytes --]

On Fri, Nov 20, 2026 at 03:04:37PM +0800, lv.yating@zte.com.cn wrote:
> From: Lv Yating <lv.yating@zte.com.cn>
> 
> Add RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0 (key 17) and the
> supporting vendor extension framework entries for Beijing LeapRise
> Technology Co., Ltd.
> 
> The key is recognized by riscv_hwprobe() and reports an empty
> bitmask for now: no LeapRise vendor extensions are defined yet.
> Recognizing the key allows userspace to distinguish a kernel that
> supports LeapRise vendor extension probing (empty bitmask) from an
> older kernel that does not know the key at all (key set to -1), so
> LeapRise userspace libraries can be prepared ahead of the first
> hardware shipping vendor extensions.

I don't buy this argument really. You kernel will require out of tree
patches to report the extensions for your userspace to do anything with
them, so why can this not wait until then?
Empty bitmask versus an error is a much of a muchness, both mean no
support.

I fear this is being done to reserve a key without actually upstreaming
anything to do with these extensions, which I think sets a bad
precedent. Upstreaming a user (which really should be trivial, unless
all your extensions need kernel support) would assuage that fear.

> 
> Follow-up patches will register extensions as they are defined.
> 
> Signed-off-by: Lv Yating <lv.yating@zte.com.cn>
> ---
>  Documentation/arch/riscv/hwprobe.rst          |  4 ++++
>  arch/riscv/Kconfig.vendor                     | 14 +++++++++++++
>  arch/riscv/include/asm/hwprobe.h              |  3 ++-
>  .../include/asm/vendor_extensions/leaprise.h  | 17 ++++++++++++++++
>  .../asm/vendor_extensions/leaprise_hwprobe.h  | 20 +++++++++++++++++++
>  arch/riscv/include/uapi/asm/hwprobe.h         |  1 +
>  arch/riscv/include/uapi/asm/vendor/leaprise.h |  3 +++
>  arch/riscv/kernel/sys_hwprobe.c               |  4 ++++
>  arch/riscv/kernel/vendor_extensions.c         | 10 ++++++++++
>  arch/riscv/kernel/vendor_extensions/Makefile  |  2 ++
>  .../riscv/kernel/vendor_extensions/leaprise.c | 12 +++++++++++
>  .../vendor_extensions/leaprise_hwprobe.c      | 19 ++++++++++++++++++
>  12 files changed, 108 insertions(+), 1 deletion(-)
>  create mode 100644 arch/riscv/include/asm/vendor_extensions/leaprise.h
>  create mode 100644 arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
>  create mode 100644 arch/riscv/include/uapi/asm/vendor/leaprise.h
>  create mode 100644 arch/riscv/kernel/vendor_extensions/leaprise.c
>  create mode 100644 arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c
> 
> diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst
> index 8454a6ae6fd1..336a2c5b05d9 100644
> --- a/Documentation/arch/riscv/hwprobe.rst
> +++ b/Documentation/arch/riscv/hwprobe.rst
> @@ -431,3 +431,7 @@ The following keys are defined:
>    * :c:macro:`RISCV_HWPROBE_EXT_ZIC64B`: The Zic64b extension is supported,
>      as defined in the RISC-V Profiles specification starting from commit
>      b1d80660 ("Updated to ratified state.")
> +
> +* :c:macro:`RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0`: A bitmask containing the
> +  leaprise vendor extensions that are compatible with the
> +  :c:macro:`RISCV_HWPROBE_BASE_BEHAVIOR_IMA`: base system behavior.
> diff --git a/arch/riscv/Kconfig.vendor b/arch/riscv/Kconfig.vendor
> index 3c1f92e406c3..03af8bc0f903 100644
> --- a/arch/riscv/Kconfig.vendor
> +++ b/arch/riscv/Kconfig.vendor
> @@ -16,6 +16,20 @@ config RISCV_ISA_VENDOR_EXT_ANDES
>  	  If you don't know what to do here, say Y.
>  endmenu
> 
> +menu "LeapRise"
> +config RISCV_ISA_VENDOR_EXT_LEAPRISE
> +	bool "LeapRise vendor extension support"
> +	select RISCV_ISA_VENDOR_EXT
> +	default y
> +	help
> +	  Say N here to disable detection of and support for all LeapRise vendor
> +	  extensions. Without this option enabled, LeapRise vendor extensions
> +	  will not be detected at boot and their presence not reported to
> +	  userspace.
> +
> +	  If you don't know what to do here, say Y.

This, for example, makes no sense when there are no extensions
detectable in the first place? A bunch of this is dead code without
anything actually using it right now.

Cheers,
Conor.

> +endmenu
> +
>  menu "MIPS"
>  config RISCV_ISA_VENDOR_EXT_MIPS
>  	bool "MIPS vendor extension support"
> diff --git a/arch/riscv/include/asm/hwprobe.h b/arch/riscv/include/asm/hwprobe.h
> index 9b04377c0f98..e37e5a8afbb4 100644
> --- a/arch/riscv/include/asm/hwprobe.h
> +++ b/arch/riscv/include/asm/hwprobe.h
> @@ -8,7 +8,7 @@
> 
>  #include <uapi/asm/hwprobe.h>
> 
> -#define RISCV_HWPROBE_MAX_KEY		16
> +#define RISCV_HWPROBE_MAX_KEY		17
> 
>  static inline bool riscv_hwprobe_key_is_valid(__s64 key)
>  {
> @@ -25,6 +25,7 @@ static inline bool hwprobe_key_is_bitmask(__s64 key)
>  	case RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0:
>  	case RISCV_HWPROBE_KEY_VENDOR_EXT_MIPS_0:
>  	case RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0:
> +	case RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0:
>  		return true;
>  	}
> 
> diff --git a/arch/riscv/include/asm/vendor_extensions/leaprise.h b/arch/riscv/include/asm/vendor_extensions/leaprise.h
> new file mode 100644
> index 000000000000..0d4ab8f03983
> --- /dev/null
> +++ b/arch/riscv/include/asm/vendor_extensions/leaprise.h
> @@ -0,0 +1,17 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +
> +#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_H
> +#define _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_H
> +
> +#include <asm/vendor_extensions.h>
> +#include <linux/types.h>
> +
> +/*
> + * Extension keys should be strictly less than max.
> + * It is safe to increment this when necessary.
> + */
> +#define RISCV_ISA_VENDOR_EXT_MAX_LEAPRISE			32
> +
> +extern struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_leaprise;
> +
> +#endif
> diff --git a/arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h b/arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
> new file mode 100644
> index 000000000000..980402df0095
> --- /dev/null
> +++ b/arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +
> +#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_HWPROBE_H
> +#define _ASM_RISCV_VENDOR_EXTENSIONS_LEAPRISE_HWPROBE_H
> +
> +#include <linux/cpumask.h>
> +
> +#include <uapi/asm/hwprobe.h>
> +
> +#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE
> +void hwprobe_isa_vendor_ext_leaprise_0(struct riscv_hwprobe *pair, const struct cpumask *cpus);
> +#else
> +static inline void hwprobe_isa_vendor_ext_leaprise_0(struct riscv_hwprobe *pair,
> +						   const struct cpumask *cpus)
> +{
> +	pair->value = 0;
> +}
> +#endif
> +
> +#endif
> diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h
> index 9a121ee3b436..6907ca4648ef 100644
> --- a/arch/riscv/include/uapi/asm/hwprobe.h
> +++ b/arch/riscv/include/uapi/asm/hwprobe.h
> @@ -124,6 +124,7 @@ struct riscv_hwprobe {
>  #define		RISCV_HWPROBE_EXT_ZA64RS	_BITULL(5)
>  #define		RISCV_HWPROBE_EXT_B		_BITULL(6)
>  #define		RISCV_HWPROBE_EXT_ZIC64B	_BITULL(7)
> +#define RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0	17
> 
>  /* Increase RISCV_HWPROBE_MAX_KEY when adding items. */
> 
> diff --git a/arch/riscv/include/uapi/asm/vendor/leaprise.h b/arch/riscv/include/uapi/asm/vendor/leaprise.h
> new file mode 100644
> index 000000000000..9ee13f1ca559
> --- /dev/null
> +++ b/arch/riscv/include/uapi/asm/vendor/leaprise.h
> @@ -0,0 +1,3 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +
> +/* LeapRise vendor extensions: none defined yet */
> diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c
> index cd7cf272e6e1..e60facabdd86 100644
> --- a/arch/riscv/kernel/sys_hwprobe.c
> +++ b/arch/riscv/kernel/sys_hwprobe.c
> @@ -15,6 +15,7 @@
>  #include <asm/uaccess.h>
>  #include <asm/unistd.h>
>  #include <asm/vector.h>
> +#include <asm/vendor_extensions/leaprise_hwprobe.h>
>  #include <asm/vendor_extensions/mips_hwprobe.h>
>  #include <asm/vendor_extensions/sifive_hwprobe.h>
>  #include <asm/vendor_extensions/thead_hwprobe.h>
> @@ -364,6 +365,9 @@ static void hwprobe_one_pair(struct riscv_hwprobe *pair,
>  	case RISCV_HWPROBE_KEY_VENDOR_EXT_MIPS_0:
>  		hwprobe_isa_vendor_ext_mips_0(pair, cpus);
>  		break;
> +	case RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0:
> +		hwprobe_isa_vendor_ext_leaprise_0(pair, cpus);
> +		break;
> 
>  	/*
>  	 * For forward compatibility, unknown keys don't fail the whole
> diff --git a/arch/riscv/kernel/vendor_extensions.c b/arch/riscv/kernel/vendor_extensions.c
> index bb4a75923685..e7372194096e 100644
> --- a/arch/riscv/kernel/vendor_extensions.c
> +++ b/arch/riscv/kernel/vendor_extensions.c
> @@ -6,6 +6,7 @@
>  #include <asm/vendorid_list.h>
>  #include <asm/vendor_extensions.h>
>  #include <asm/vendor_extensions/andes.h>
> +#include <asm/vendor_extensions/leaprise.h>
>  #include <asm/vendor_extensions/mips.h>
>  #include <asm/vendor_extensions/sifive.h>
>  #include <asm/vendor_extensions/thead.h>
> @@ -17,6 +18,9 @@ struct riscv_isa_vendor_ext_data_list *riscv_isa_vendor_ext_list[] = {
>  #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES
>  	&riscv_isa_vendor_ext_list_andes,
>  #endif
> +#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE
> +	&riscv_isa_vendor_ext_list_leaprise,
> +#endif
>  #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS
>  	&riscv_isa_vendor_ext_list_mips,
>  #endif
> @@ -53,6 +57,12 @@ bool __riscv_isa_vendor_extension_available(int cpu, unsigned long vendor, unsig
>  		cpu_bmap = riscv_isa_vendor_ext_list_andes.per_hart_isa_bitmap;
>  		break;
>  	#endif
> +	#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE
> +	case LEAPRISE_VENDOR_ID:
> +		bmap = &riscv_isa_vendor_ext_list_leaprise.all_harts_isa_bitmap;
> +		cpu_bmap = riscv_isa_vendor_ext_list_leaprise.per_hart_isa_bitmap;
> +		break;
> +	#endif
>  	#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS
>  	case MIPS_VENDOR_ID:
>  		bmap = &riscv_isa_vendor_ext_list_mips.all_harts_isa_bitmap;
> diff --git a/arch/riscv/kernel/vendor_extensions/Makefile b/arch/riscv/kernel/vendor_extensions/Makefile
> index bf116c82b6bd..1f76fd4050c7 100644
> --- a/arch/riscv/kernel/vendor_extensions/Makefile
> +++ b/arch/riscv/kernel/vendor_extensions/Makefile
> @@ -1,6 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> 
>  obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES)	+= andes.o
> +obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE)	+= leaprise.o
> +obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_LEAPRISE)	+= leaprise_hwprobe.o
>  obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_MIPS)  	+= mips.o
>  obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_MIPS)  	+= mips_hwprobe.o
>  obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE)	+= sifive.o
> diff --git a/arch/riscv/kernel/vendor_extensions/leaprise.c b/arch/riscv/kernel/vendor_extensions/leaprise.c
> new file mode 100644
> index 000000000000..bdc2eed288ba
> --- /dev/null
> +++ b/arch/riscv/kernel/vendor_extensions/leaprise.c
> @@ -0,0 +1,12 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <asm/cpufeature.h>
> +#include <asm/vendor_extensions.h>
> +#include <asm/vendor_extensions/leaprise.h>
> +
> +/* LeapRise vendor extensions: none defined yet */
> +
> +struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_leaprise = {
> +	.ext_data_count = 0,
> +	.ext_data = NULL,
> +};
> diff --git a/arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c b/arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c
> new file mode 100644
> index 000000000000..260a2b38e4d6
> --- /dev/null
> +++ b/arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c
> @@ -0,0 +1,19 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <asm/vendor_extensions.h>
> +#include <asm/vendor_extensions/leaprise.h>
> +#include <asm/vendor_extensions/leaprise_hwprobe.h>
> +#include <asm/vendor_extensions/vendor_hwprobe.h>
> +
> +#include <linux/cpumask.h>
> +#include <linux/types.h>
> +
> +#include <uapi/asm/hwprobe.h>
> +#include <uapi/asm/vendor/leaprise.h>
> +
> +void hwprobe_isa_vendor_ext_leaprise_0(struct riscv_hwprobe *pair,
> +				   const struct cpumask *cpus)
> +{
> +	/* No LeapRise vendor extensions are defined yet. */
> +	pair->value = 0;
> +}
> -- 
> 2.27.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20 13:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  6:51 [PATCH v2 0/2] riscv: Add Beijing LeapRise Technology vendor ID and vendor extension framework lv.yating
2026-11-20  7:02 ` [PATCH v2 1/2] riscv: Add LeapRise Technology to the vendor list lv.yating
2026-11-20  7:04 ` [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension framework support lv.yating
2026-11-20 13:43   ` [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension? " Conor Dooley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®