mirror of https://github.com/torvalds/linux.git
riscv: Add xmipsexectl as a vendor extension
Add support for MIPS vendor extensions. Add support for the xmipsexectl vendor extension. Signed-off-by: Aleksa Paunovic <aleksa.paunovic@htecgroup.com> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Link: https://lore.kernel.org/r/20250724-p8700-pause-v5-2-a6cbbe1c3412@htecgroup.com [pjw@kernel.org: added the MIPS vendor ID from another patch to fix the build] Signed-off-by: Paul Walmsley <pjw@kernel.org>
This commit is contained in:
parent
f79671dc87
commit
a8fed1bc03
|
|
@ -16,6 +16,19 @@ config RISCV_ISA_VENDOR_EXT_ANDES
|
||||||
If you don't know what to do here, say Y.
|
If you don't know what to do here, say Y.
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
menu "MIPS"
|
||||||
|
config RISCV_ISA_VENDOR_EXT_MIPS
|
||||||
|
bool "MIPS vendor extension support"
|
||||||
|
select RISCV_ISA_VENDOR_EXT
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Say N here to disable detection of and support for all MIPS vendor
|
||||||
|
extensions. Without this option enabled, MIPS 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 "SiFive"
|
menu "SiFive"
|
||||||
config RISCV_ISA_VENDOR_EXT_SIFIVE
|
config RISCV_ISA_VENDOR_EXT_SIFIVE
|
||||||
bool "SiFive vendor extension support"
|
bool "SiFive vendor extension support"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2025 MIPS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASM_RISCV_VENDOR_EXTENSIONS_MIPS_H
|
||||||
|
#define _ASM_RISCV_VENDOR_EXTENSIONS_MIPS_H
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
|
||||||
|
#define RISCV_ISA_VENDOR_EXT_XMIPSEXECTL 0
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLER__
|
||||||
|
struct riscv_isa_vendor_ext_data_list;
|
||||||
|
extern struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_mips;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _ASM_RISCV_VENDOR_EXTENSIONS_MIPS_H
|
||||||
|
|
@ -9,5 +9,6 @@
|
||||||
#define MICROCHIP_VENDOR_ID 0x029
|
#define MICROCHIP_VENDOR_ID 0x029
|
||||||
#define SIFIVE_VENDOR_ID 0x489
|
#define SIFIVE_VENDOR_ID 0x489
|
||||||
#define THEAD_VENDOR_ID 0x5b7
|
#define THEAD_VENDOR_ID 0x5b7
|
||||||
|
#define MIPS_VENDOR_ID 0x722
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <asm/vendorid_list.h>
|
#include <asm/vendorid_list.h>
|
||||||
#include <asm/vendor_extensions.h>
|
#include <asm/vendor_extensions.h>
|
||||||
#include <asm/vendor_extensions/andes.h>
|
#include <asm/vendor_extensions/andes.h>
|
||||||
|
#include <asm/vendor_extensions/mips.h>
|
||||||
#include <asm/vendor_extensions/sifive.h>
|
#include <asm/vendor_extensions/sifive.h>
|
||||||
#include <asm/vendor_extensions/thead.h>
|
#include <asm/vendor_extensions/thead.h>
|
||||||
|
|
||||||
|
|
@ -16,6 +17,9 @@ struct riscv_isa_vendor_ext_data_list *riscv_isa_vendor_ext_list[] = {
|
||||||
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES
|
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES
|
||||||
&riscv_isa_vendor_ext_list_andes,
|
&riscv_isa_vendor_ext_list_andes,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS
|
||||||
|
&riscv_isa_vendor_ext_list_mips,
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE
|
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE
|
||||||
&riscv_isa_vendor_ext_list_sifive,
|
&riscv_isa_vendor_ext_list_sifive,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -49,6 +53,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;
|
cpu_bmap = riscv_isa_vendor_ext_list_andes.per_hart_isa_bitmap;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS
|
||||||
|
case MIPS_VENDOR_ID:
|
||||||
|
bmap = &riscv_isa_vendor_ext_list_mips.all_harts_isa_bitmap;
|
||||||
|
cpu_bmap = riscv_isa_vendor_ext_list_mips.per_hart_isa_bitmap;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE
|
#ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE
|
||||||
case SIFIVE_VENDOR_ID:
|
case SIFIVE_VENDOR_ID:
|
||||||
bmap = &riscv_isa_vendor_ext_list_sifive.all_harts_isa_bitmap;
|
bmap = &riscv_isa_vendor_ext_list_sifive.all_harts_isa_bitmap;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES) += andes.o
|
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES) += andes.o
|
||||||
|
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_MIPS) += mips.o
|
||||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE) += sifive.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_SIFIVE) += sifive_hwprobe.o
|
||||||
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_THEAD) += thead.o
|
obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_THEAD) += thead.o
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2025 MIPS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <asm/cpufeature.h>
|
||||||
|
#include <asm/vendor_extensions.h>
|
||||||
|
#include <asm/vendor_extensions/mips.h>
|
||||||
|
|
||||||
|
#include <linux/array_size.h>
|
||||||
|
#include <linux/cpumask.h>
|
||||||
|
#include <linux/types.h>
|
||||||
|
|
||||||
|
/* All MIPS vendor extensions supported in Linux */
|
||||||
|
static const struct riscv_isa_ext_data riscv_isa_vendor_ext_mips[] = {
|
||||||
|
__RISCV_ISA_EXT_DATA(xmipsexectl, RISCV_ISA_VENDOR_EXT_XMIPSEXECTL),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_mips = {
|
||||||
|
.ext_data_count = ARRAY_SIZE(riscv_isa_vendor_ext_mips),
|
||||||
|
.ext_data = riscv_isa_vendor_ext_mips,
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue