riscv: Add Beijing LeapRise Technology vendor ID and vendor extension framework
Subsystems (2)
v2 cover riscv: Add Beijing LeapRise Technology vendor ID and vendor extension framework
From: Lv Yating <[email protected]>
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/[email protected]/ -https://lore.kernel.org/all/[email protected]/
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
Signature · 1 line
2.27.0
PATCH v2 1/2 riscv: Add LeapRise Technology to the vendor list
From: Lv Yating <[email protected]>
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.
--- arch/riscv/include/asm/vendorid_list.h | 1 + 1 file changed, 1 insertion(+)
arch/riscv/include/asm/vendorid_list.h +1 -0
@@ -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
Signature · 1 line
2.27.0
PATCH v2 2/2 riscv: hwprobe: Add LeapRise vendor extension framework support
In reply to [email protected]From: Lv Yating <[email protected]>
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.
--- 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
Documentation/arch/riscv/hwprobe.rst +4 -0
@@ -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.
arch/riscv/Kconfig.vendor +14 -0
@@ -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"
arch/riscv/include/asm/hwprobe.h +2 -1
@@ -8,7 +8,7 @@#include <uapi/asm/hwprobe.h> -#define RISCV_HWPROBE_MAX_KEY 16 +#define RISCV_HWPROBE_MAX_KEY 17static 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; }
arch/riscv/include/asm/vendor_extensions/leaprise.h new file +17 -0
@@ -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
arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h new file +20 -0
@@ -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
arch/riscv/include/uapi/asm/hwprobe.h +1 -0
@@ -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. */
arch/riscv/include/uapi/asm/vendor/leaprise.h new file +3 -0
@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +/* LeapRise vendor extensions: none defined yet */
arch/riscv/kernel/sys_hwprobe.c +4 -0
@@ -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
arch/riscv/kernel/vendor_extensions.c +10 -0
@@ -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;
arch/riscv/kernel/vendor_extensions/Makefile +2 -0
@@ -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
arch/riscv/kernel/vendor_extensions/leaprise.c new file +12 -0
@@ -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 , +};
arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c new file +19 -0
@@ -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 ; +}
Signature · 1 line
2.27.0
Re: [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension? framework support
Quoted 6 lines · On Fri, Nov 20, 2026 at 03:04:37PM +0800, [email protected] wrote:
From: Lv Yating <[email protected]>
Add
RISCV_HWPROBE_KEY_VENDOR_EXT_LEAPRISE_0(key 17) and the supporting vendor extension framework entries for Beijing LeapRise Technology Co., Ltd.
Quoted 7 lines
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.
Quoted 46 lines
Follow-up patches will register extensions as they are defined.
Signed-off-by Lv Yating <[email protected]>--- 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.cDocumentation/arch/riscv/hwprobe.rst +4
-0@@ -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.arch/riscv/Kconfig.vendor +2
-0@@ -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
arch/riscv/Kconfig.vendor config RISCV_ISA_VENDOR_EXT_ANDES · line 30
Quoted 10 lines
arch/riscv/Kconfig.vendor +10
-0+ 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.
Quoted 212 lines
arch/riscv/Kconfig.vendor +2
-0+endmenu + menu "MIPS" config RISCV_ISA_VENDOR_EXT_MIPS bool "MIPS vendor extension support"arch/riscv/include/asm/hwprobe.h +2
-1@@ -8,7 +8,7 @@#include <uapi/asm/hwprobe.h> -#define RISCV_HWPROBE_MAX_KEY 16 +#define RISCV_HWPROBE_MAX_KEY 17static 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; }arch/riscv/include/asm/vendor_extensions/leaprise.h new file +17
-0@@ -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 arch/riscv/include/asm/vendor_extensions/leaprise_hwprobe.h new file +20
-0@@ -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 arch/riscv/include/uapi/asm/hwprobe.h +1
-0@@ -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. */ arch/riscv/include/uapi/asm/vendor/leaprise.h new file +3
-0@@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +/* LeapRise vendor extensions: none defined yet */ arch/riscv/kernel/sys_hwprobe.c +4
-0@@ -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 arch/riscv/kernel/vendor_extensions.c +10
-0@@ -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;arch/riscv/kernel/vendor_extensions/Makefile +2
-0@@ -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.oarch/riscv/kernel/vendor_extensions/leaprise.c new file +12
-0@@ -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 , +};arch/riscv/kernel/vendor_extensions/leaprise_hwprobe.c new file +19
-0@@ -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 ; +}Signature · 1 line
2.27.0
Re: [PATCH v2 2/2] riscv: hwprobe: Add LeapRise vendor extension? framework support
Thanks for the clear explanation. I'll drop patch 2 due to lack of real use case for the extension framework.
May I ask whether patch 1 (LEAPRISE_VENDOR_ID) can still be considered on its own?
Best regards,
Lv Yating