Merge patch series "riscv: Add vendor extensions support for SiFive"
Cyan Yang <cyan.yang@sifive.com> says: This patch set adds four vendor-specific ISA extensions from SiFive: "xsfvqmaccdod", "xsfvqmaccqoq", "xsfvfnrclipxfqf", and "xsfvfwmaccqqq". Additionally, a new hwprobe key, RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0, has been added to query which SiFive vendor extensions are supported on the current platform. Signed-off-by: Cyan Yang <cyan.yang@sifive.com> Link: https://lore.kernel.org/r/20250418053239.4351-1-cyan.yang@sifive.com * b4-shazam-merge: riscv: hwprobe: Add SiFive xsfvfwmaccqqq vendor extension riscv: hwprobe: Document SiFive xsfvfwmaccqqq vendor extension riscv: Add SiFive xsfvfwmaccqqq vendor extension dt-bindings: riscv: Add xsfvfwmaccqqq ISA extension description riscv: hwprobe: Add SiFive xsfvfnrclipxfqf vendor extension riscv: hwprobe: Document SiFive xsfvfnrclipxfqf vendor extension riscv: Add SiFive xsfvfnrclipxfqf vendor extension dt-bindings: riscv: Add xsfvfnrclipxfqf ISA extension description riscv: hwprobe: Add SiFive vendor extension support and probe for xsfqmaccdod and xsfqmaccqoq riscv: hwprobe: Document SiFive xsfvqmaccdod and xsfvqmaccqoq vendor extensions riscv: Add SiFive xsfvqmaccdod and xsfvqmaccqoq vendor extensions dt-bindings: riscv: Add xsfvqmaccdod and xsfvqmaccqoq ISA extension description Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
@@ -335,3 +335,25 @@ The following keys are defined:
|
||||
|
||||
* :c:macro:`RISCV_HWPROBE_KEY_ZICBOM_BLOCK_SIZE`: An unsigned int which
|
||||
represents the size of the Zicbom block in bytes.
|
||||
|
||||
* :c:macro:`RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0`: A bitmask containing the
|
||||
sifive vendor extensions that are compatible with the
|
||||
:c:macro:`RISCV_HWPROBE_BASE_BEHAVIOR_IMA`: base system behavior.
|
||||
|
||||
* SIFIVE
|
||||
|
||||
* :c:macro:`RISCV_HWPROBE_VENDOR_EXT_XSFVQMACCDOD`: The Xsfqmaccdod vendor
|
||||
extension is supported in version 1.1 of SiFive Int8 Matrix Multiplication
|
||||
Extensions Specification.
|
||||
|
||||
* :c:macro:`RISCV_HWPROBE_VENDOR_EXT_XSFVQMACCQOQ`: The Xsfqmaccqoq vendor
|
||||
extension is supported in version 1.1 of SiFive Int8 Matrix Multiplication
|
||||
Instruction Extensions Specification.
|
||||
|
||||
* :c:macro:`RISCV_HWPROBE_VENDOR_EXT_XSFVFNRCLIPXFQF`: The Xsfvfnrclipxfqf
|
||||
vendor extension is supported in version 1.0 of SiFive FP32-to-int8 Ranged
|
||||
Clip Instructions Extensions Specification.
|
||||
|
||||
* :c:macro:`RISCV_HWPROBE_VENDOR_EXT_XSFVFWMACCQQQ`: The Xsfvfwmaccqqq
|
||||
vendor extension is supported in version 1.0 of Matrix Multiply Accumulate
|
||||
Instruction Extensions Specification.
|
||||
@@ -662,6 +662,31 @@ properties:
|
||||
Registers in the AX45MP datasheet.
|
||||
https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf
|
||||
|
||||
# SiFive
|
||||
- const: xsfvqmaccdod
|
||||
description:
|
||||
SiFive Int8 Matrix Multiplication Extensions Specification.
|
||||
See more details in
|
||||
https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification
|
||||
|
||||
- const: xsfvqmaccqoq
|
||||
description:
|
||||
SiFive Int8 Matrix Multiplication Extensions Specification.
|
||||
See more details in
|
||||
https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification
|
||||
|
||||
- const: xsfvfnrclipxfqf
|
||||
description:
|
||||
SiFive FP32-to-int8 Ranged Clip Instructions Extensions Specification.
|
||||
See more details in
|
||||
https://www.sifive.com/document-file/fp32-to-int8-ranged-clip-instructions
|
||||
|
||||
- const: xsfvfwmaccqqq
|
||||
description:
|
||||
SiFive Matrix Multiply Accumulate Instruction Extensions Specification.
|
||||
See more details in
|
||||
https://www.sifive.com/document-file/matrix-multiply-accumulate-instruction
|
||||
|
||||
# T-HEAD
|
||||
- const: xtheadvector
|
||||
description:
|
||||
|
||||
@@ -16,6 +16,19 @@ config RISCV_ISA_VENDOR_EXT_ANDES
|
||||
If you don't know what to do here, say Y.
|
||||
endmenu
|
||||
|
||||
menu "SiFive"
|
||||
config RISCV_ISA_VENDOR_EXT_SIFIVE
|
||||
bool "SiFive vendor extension support"
|
||||
select RISCV_ISA_VENDOR_EXT
|
||||
default y
|
||||
help
|
||||
Say N here if you want to disable all SiFive vendor extension
|
||||
support. This will cause any SiFive vendor extensions that are
|
||||
requested by hardware probing to be ignored.
|
||||
|
||||
If you don't know what to do here, say Y.
|
||||
endmenu
|
||||
|
||||
menu "T-Head"
|
||||
config RISCV_ISA_VENDOR_EXT_THEAD
|
||||
bool "T-Head vendor extension support"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <uapi/asm/hwprobe.h>
|
||||
|
||||
#define RISCV_HWPROBE_MAX_KEY 12
|
||||
#define RISCV_HWPROBE_MAX_KEY 13
|
||||
|
||||
static inline bool riscv_hwprobe_key_is_valid(__s64 key)
|
||||
{
|
||||
@@ -22,6 +22,7 @@ static inline bool hwprobe_key_is_bitmask(__s64 key)
|
||||
case RISCV_HWPROBE_KEY_IMA_EXT_0:
|
||||
case RISCV_HWPROBE_KEY_CPUPERF_0:
|
||||
case RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0:
|
||||
case RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_SIFIVE_H
|
||||
#define _ASM_RISCV_VENDOR_EXTENSIONS_SIFIVE_H
|
||||
|
||||
#include <asm/vendor_extensions.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define RISCV_ISA_VENDOR_EXT_XSFVQMACCDOD 0
|
||||
#define RISCV_ISA_VENDOR_EXT_XSFVQMACCQOQ 1
|
||||
#define RISCV_ISA_VENDOR_EXT_XSFVFNRCLIPXFQF 2
|
||||
#define RISCV_ISA_VENDOR_EXT_XSFVFWMACCQQQ 3
|
||||
|
||||
extern struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_sifive;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_SIFIVE_HWPROBE_H
|
||||
#define _ASM_RISCV_VENDOR_EXTENSIONS_SIFIVE_HWPROBE_H
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
#include <uapi/asm/hwprobe.h>
|
||||
|
||||
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE
|
||||
void hwprobe_isa_vendor_ext_sifive_0(struct riscv_hwprobe *pair, const struct cpumask *cpus);
|
||||
#else
|
||||
static inline void hwprobe_isa_vendor_ext_sifive_0(struct riscv_hwprobe *pair,
|
||||
const struct cpumask *cpus)
|
||||
{
|
||||
pair->value = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -104,6 +104,7 @@ struct riscv_hwprobe {
|
||||
#define RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED 4
|
||||
#define RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0 11
|
||||
#define RISCV_HWPROBE_KEY_ZICBOM_BLOCK_SIZE 12
|
||||
#define RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0 13
|
||||
/* Increase RISCV_HWPROBE_MAX_KEY when adding items. */
|
||||
|
||||
/* Flags */
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
|
||||
#define RISCV_HWPROBE_VENDOR_EXT_XSFVQMACCDOD (1 << 0)
|
||||
#define RISCV_HWPROBE_VENDOR_EXT_XSFVQMACCQOQ (1 << 1)
|
||||
#define RISCV_HWPROBE_VENDOR_EXT_XSFVFNRCLIPXFQF (1 << 2)
|
||||
#define RISCV_HWPROBE_VENDOR_EXT_XSFVFWMACCQQQ (1 << 3)
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/vector.h>
|
||||
#include <asm/vendor_extensions/sifive_hwprobe.h>
|
||||
#include <asm/vendor_extensions/thead_hwprobe.h>
|
||||
#include <vdso/vsyscall.h>
|
||||
|
||||
@@ -300,6 +301,10 @@ static void hwprobe_one_pair(struct riscv_hwprobe *pair,
|
||||
pair->value = riscv_timebase;
|
||||
break;
|
||||
|
||||
case RISCV_HWPROBE_KEY_VENDOR_EXT_SIFIVE_0:
|
||||
hwprobe_isa_vendor_ext_sifive_0(pair, cpus);
|
||||
break;
|
||||
|
||||
case RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0:
|
||||
hwprobe_isa_vendor_ext_thead_0(pair, cpus);
|
||||
break;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <asm/vendorid_list.h>
|
||||
#include <asm/vendor_extensions.h>
|
||||
#include <asm/vendor_extensions/andes.h>
|
||||
#include <asm/vendor_extensions/sifive.h>
|
||||
#include <asm/vendor_extensions/thead.h>
|
||||
|
||||
#include <linux/array_size.h>
|
||||
@@ -15,6 +16,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_SIFIVE
|
||||
&riscv_isa_vendor_ext_list_sifive,
|
||||
#endif
|
||||
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_THEAD
|
||||
&riscv_isa_vendor_ext_list_thead,
|
||||
#endif
|
||||
@@ -45,6 +49,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_SIFIVE
|
||||
case SIFIVE_VENDOR_ID:
|
||||
bmap = &riscv_isa_vendor_ext_list_sifive.all_harts_isa_bitmap;
|
||||
cpu_bmap = riscv_isa_vendor_ext_list_sifive.per_hart_isa_bitmap;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_THEAD
|
||||
case THEAD_VENDOR_ID:
|
||||
bmap = &riscv_isa_vendor_ext_list_thead.all_harts_isa_bitmap;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES) += andes.o
|
||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE) += sifive.o
|
||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE) += sifive_hwprobe.o
|
||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_THEAD) += thead.o
|
||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_THEAD) += thead_hwprobe.o
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <asm/cpufeature.h>
|
||||
#include <asm/vendor_extensions.h>
|
||||
#include <asm/vendor_extensions/sifive.h>
|
||||
|
||||
#include <linux/array_size.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* All SiFive vendor extensions supported in Linux */
|
||||
const struct riscv_isa_ext_data riscv_isa_vendor_ext_sifive[] = {
|
||||
__RISCV_ISA_EXT_DATA(xsfvfnrclipxfqf, RISCV_ISA_VENDOR_EXT_XSFVFNRCLIPXFQF),
|
||||
__RISCV_ISA_EXT_DATA(xsfvfwmaccqqq, RISCV_ISA_VENDOR_EXT_XSFVFWMACCQQQ),
|
||||
__RISCV_ISA_EXT_DATA(xsfvqmaccdod, RISCV_ISA_VENDOR_EXT_XSFVQMACCDOD),
|
||||
__RISCV_ISA_EXT_DATA(xsfvqmaccqoq, RISCV_ISA_VENDOR_EXT_XSFVQMACCQOQ),
|
||||
};
|
||||
|
||||
struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_sifive = {
|
||||
.ext_data_count = ARRAY_SIZE(riscv_isa_vendor_ext_sifive),
|
||||
.ext_data = riscv_isa_vendor_ext_sifive,
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <asm/vendor_extensions/sifive.h>
|
||||
#include <asm/vendor_extensions/sifive_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/sifive.h>
|
||||
|
||||
void hwprobe_isa_vendor_ext_sifive_0(struct riscv_hwprobe *pair, const struct cpumask *cpus)
|
||||
{
|
||||
VENDOR_EXTENSION_SUPPORTED(pair, cpus,
|
||||
riscv_isa_vendor_ext_list_sifive.per_hart_isa_bitmap, {
|
||||
VENDOR_EXT_KEY(XSFVQMACCDOD);
|
||||
VENDOR_EXT_KEY(XSFVQMACCQOQ);
|
||||
VENDOR_EXT_KEY(XSFVFNRCLIPXFQF);
|
||||
VENDOR_EXT_KEY(XSFVFWMACCQQQ);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user