Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Aleksa Paunovic and committed by
Paul Walmsley
a8fed1bc f79671dc

+65
+13
arch/riscv/Kconfig.vendor
··· 16 16 If you don't know what to do here, say Y. 17 17 endmenu 18 18 19 + menu "MIPS" 20 + config RISCV_ISA_VENDOR_EXT_MIPS 21 + bool "MIPS vendor extension support" 22 + select RISCV_ISA_VENDOR_EXT 23 + default y 24 + help 25 + Say N here to disable detection of and support for all MIPS vendor 26 + extensions. Without this option enabled, MIPS vendor extensions will 27 + not be detected at boot and their presence not reported to userspace. 28 + 29 + If you don't know what to do here, say Y. 30 + endmenu 31 + 19 32 menu "SiFive" 20 33 config RISCV_ISA_VENDOR_EXT_SIFIVE 21 34 bool "SiFive vendor extension support"
+18
arch/riscv/include/asm/vendor_extensions/mips.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (C) 2025 MIPS. 4 + */ 5 + 6 + #ifndef _ASM_RISCV_VENDOR_EXTENSIONS_MIPS_H 7 + #define _ASM_RISCV_VENDOR_EXTENSIONS_MIPS_H 8 + 9 + #include <linux/types.h> 10 + 11 + #define RISCV_ISA_VENDOR_EXT_XMIPSEXECTL 0 12 + 13 + #ifndef __ASSEMBLER__ 14 + struct riscv_isa_vendor_ext_data_list; 15 + extern struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_mips; 16 + #endif 17 + 18 + #endif // _ASM_RISCV_VENDOR_EXTENSIONS_MIPS_H
+1
arch/riscv/include/asm/vendorid_list.h
··· 9 9 #define MICROCHIP_VENDOR_ID 0x029 10 10 #define SIFIVE_VENDOR_ID 0x489 11 11 #define THEAD_VENDOR_ID 0x5b7 12 + #define MIPS_VENDOR_ID 0x722 12 13 13 14 #endif
+10
arch/riscv/kernel/vendor_extensions.c
··· 6 6 #include <asm/vendorid_list.h> 7 7 #include <asm/vendor_extensions.h> 8 8 #include <asm/vendor_extensions/andes.h> 9 + #include <asm/vendor_extensions/mips.h> 9 10 #include <asm/vendor_extensions/sifive.h> 10 11 #include <asm/vendor_extensions/thead.h> 11 12 ··· 16 15 struct riscv_isa_vendor_ext_data_list *riscv_isa_vendor_ext_list[] = { 17 16 #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES 18 17 &riscv_isa_vendor_ext_list_andes, 18 + #endif 19 + #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS 20 + &riscv_isa_vendor_ext_list_mips, 19 21 #endif 20 22 #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE 21 23 &riscv_isa_vendor_ext_list_sifive, ··· 51 47 case ANDES_VENDOR_ID: 52 48 bmap = &riscv_isa_vendor_ext_list_andes.all_harts_isa_bitmap; 53 49 cpu_bmap = riscv_isa_vendor_ext_list_andes.per_hart_isa_bitmap; 50 + break; 51 + #endif 52 + #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_MIPS 53 + case MIPS_VENDOR_ID: 54 + bmap = &riscv_isa_vendor_ext_list_mips.all_harts_isa_bitmap; 55 + cpu_bmap = riscv_isa_vendor_ext_list_mips.per_hart_isa_bitmap; 54 56 break; 55 57 #endif 56 58 #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE
+1
arch/riscv/kernel/vendor_extensions/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES) += andes.o 4 + obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_MIPS) += mips.o 4 5 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE) += sifive.o 5 6 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_SIFIVE) += sifive_hwprobe.o 6 7 obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_THEAD) += thead.o
+22
arch/riscv/kernel/vendor_extensions/mips.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (C) 2025 MIPS. 4 + */ 5 + 6 + #include <asm/cpufeature.h> 7 + #include <asm/vendor_extensions.h> 8 + #include <asm/vendor_extensions/mips.h> 9 + 10 + #include <linux/array_size.h> 11 + #include <linux/cpumask.h> 12 + #include <linux/types.h> 13 + 14 + /* All MIPS vendor extensions supported in Linux */ 15 + static const struct riscv_isa_ext_data riscv_isa_vendor_ext_mips[] = { 16 + __RISCV_ISA_EXT_DATA(xmipsexectl, RISCV_ISA_VENDOR_EXT_XMIPSEXECTL), 17 + }; 18 + 19 + struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_mips = { 20 + .ext_data_count = ARRAY_SIZE(riscv_isa_vendor_ext_mips), 21 + .ext_data = riscv_isa_vendor_ext_mips, 22 + };