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

Merge tag 'riscv-for-linus-6.11-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull more RISC-V updates from Palmer Dabbelt:

- Support for NUMA (via SRAT and SLIT), console output (via SPCR), and
cache info (via PPTT) on ACPI-based systems.

- The trap entry/exit code no longer breaks the return address stack
predictor on many systems, which results in an improvement to trap
latency.

- Support for HAVE_ARCH_STACKLEAK.

- The sv39 linear map has been extended to support 128GiB mappings.

- The frequency of the mtime CSR is now visible via hwprobe.

* tag 'riscv-for-linus-6.11-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (21 commits)
RISC-V: Provide the frequency of time CSR via hwprobe
riscv: Extend sv39 linear mapping max size to 128G
riscv: enable HAVE_ARCH_STACKLEAK
riscv: signal: Remove unlikely() from WARN_ON() condition
riscv: Improve exception and system call latency
RISC-V: Select ACPI PPTT drivers
riscv: cacheinfo: initialize cacheinfo's level and type from ACPI PPTT
riscv: cacheinfo: remove the useless input parameter (node) of ci_leaf_init()
RISC-V: ACPI: Enable SPCR table for console output on RISC-V
riscv: boot: remove duplicated targets line
trace: riscv: Remove deprecated kprobe on ftrace support
riscv: cpufeature: Extract common elements from extension checking
riscv: Introduce vendor variants of extension helpers
riscv: Add vendor extensions to /proc/cpuinfo
riscv: Extend cpufeature.c to detect vendor extensions
RISC-V: run savedefconfig for defconfig
RISC-V: hwprobe: sort EXT_KEY()s in hwprobe_isa_ext0() alphabetically
ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init
ACPI: NUMA: change the ACPI_NUMA to a hidden option
ACPI: NUMA: Add handler for SRAT RINTC affinity structure
...

+750 -245
+2
Documentation/arch/riscv/hwprobe.rst
··· 264 264 265 265 * :c:macro:`RISCV_HWPROBE_KEY_HIGHEST_VIRT_ADDRESS`: An unsigned long which 266 266 represent the highest userspace virtual address usable. 267 + 268 + * :c:macro:`RISCV_HWPROBE_KEY_TIME_CSR_FREQ`: Frequency (in Hz) of `time CSR`.
+6 -5
Documentation/arch/riscv/vm-layout.rst
··· 47 47 | Kernel-space virtual memory, shared between all processes: 48 48 ____________________________________________________________|___________________________________________________________ 49 49 | | | | 50 - ffffffc6fea00000 | -228 GB | ffffffc6feffffff | 6 MB | fixmap 51 - ffffffc6ff000000 | -228 GB | ffffffc6ffffffff | 16 MB | PCI io 52 - ffffffc700000000 | -228 GB | ffffffc7ffffffff | 4 GB | vmemmap 53 - ffffffc800000000 | -224 GB | ffffffd7ffffffff | 64 GB | vmalloc/ioremap space 54 - ffffffd800000000 | -160 GB | fffffff6ffffffff | 124 GB | direct mapping of all physical memory 50 + ffffffc4fea00000 | -236 GB | ffffffc4feffffff | 6 MB | fixmap 51 + ffffffc4ff000000 | -236 GB | ffffffc4ffffffff | 16 MB | PCI io 52 + ffffffc500000000 | -236 GB | ffffffc5ffffffff | 4 GB | vmemmap 53 + ffffffc600000000 | -232 GB | ffffffd5ffffffff | 64 GB | vmalloc/ioremap space 54 + ffffffd600000000 | -168 GB | fffffff5ffffffff | 128 GB | direct mapping of all physical memory 55 + | | | | 55 56 fffffff700000000 | -36 GB | fffffffeffffffff | 32 GB | kasan 56 57 __________________|____________|__________________|_________|____________________________________________________________ 57 58 |
-1
arch/arm64/Kconfig
··· 1471 1471 config NUMA 1472 1472 bool "NUMA Memory Allocation and Scheduler Support" 1473 1473 select GENERIC_ARCH_NUMA 1474 - select ACPI_NUMA if ACPI 1475 1474 select OF_NUMA 1476 1475 select HAVE_SETUP_PER_CPU_AREA 1477 1476 select NEED_PER_CPU_EMBED_FIRST_CHUNK
-1
arch/loongarch/Kconfig
··· 476 476 config NUMA 477 477 bool "NUMA Support" 478 478 select SMP 479 - select ACPI_NUMA if ACPI 480 479 help 481 480 Say Y to compile the kernel with NUMA (Non-Uniform Memory Access) 482 481 support. This option improves performance on systems with more
+5 -1
arch/riscv/Kconfig
··· 13 13 config RISCV 14 14 def_bool y 15 15 select ACPI_GENERIC_GSI if ACPI 16 + select ACPI_PPTT if ACPI 16 17 select ACPI_REDUCED_HARDWARE_ONLY if ACPI 18 + select ACPI_SPCR_TABLE if ACPI 17 19 select ARCH_DMA_DEFAULT_COHERENT 18 20 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION 19 21 select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM_VMEMMAP ··· 125 123 select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT 126 124 select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET 127 125 select HAVE_ARCH_SECCOMP_FILTER 126 + select HAVE_ARCH_STACKLEAK 128 127 select HAVE_ARCH_THREAD_STRUCT_WHITELIST 129 128 select HAVE_ARCH_TRACEHOOK 130 129 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU ··· 157 154 select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT 158 155 select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT 159 156 select HAVE_KPROBES if !XIP_KERNEL 160 - select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL 161 157 select HAVE_KRETPROBES if !XIP_KERNEL 162 158 # https://github.com/ClangBuiltLinux/linux/issues/1881 163 159 select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD ··· 821 819 support efficient unaligned memory accesses. 822 820 823 821 endchoice 822 + 823 + source "arch/riscv/Kconfig.vendor" 824 824 825 825 endmenu # "Platform type" 826 826
+19
arch/riscv/Kconfig.vendor
··· 1 + menu "Vendor extensions" 2 + 3 + config RISCV_ISA_VENDOR_EXT 4 + bool 5 + 6 + menu "Andes" 7 + config RISCV_ISA_VENDOR_EXT_ANDES 8 + bool "Andes vendor extension support" 9 + select RISCV_ISA_VENDOR_EXT 10 + default y 11 + help 12 + Say N here if you want to disable all Andes vendor extension 13 + support. This will cause any Andes vendor extensions that are 14 + requested by hardware probing to be ignored. 15 + 16 + If you don't know what to do here, say Y. 17 + endmenu 18 + 19 + endmenu
-1
arch/riscv/boot/Makefile
··· 18 18 OBJCOPYFLAGS_loader.bin :=-O binary 19 19 OBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S 20 20 21 - targets := Image Image.* loader loader.o loader.lds loader.bin 22 21 targets := Image Image.* loader loader.o loader.lds loader.bin xipImage 23 22 24 23 ifeq ($(CONFIG_XIP_KERNEL),y)
+8 -18
arch/riscv/configs/defconfig
··· 7 7 CONFIG_IKCONFIG_PROC=y 8 8 CONFIG_CGROUPS=y 9 9 CONFIG_MEMCG=y 10 + CONFIG_BLK_CGROUP=y 10 11 CONFIG_CGROUP_SCHED=y 11 12 CONFIG_CFS_BANDWIDTH=y 12 13 CONFIG_RT_GROUP_SCHED=y ··· 36 35 CONFIG_ARCH_VIRT=y 37 36 CONFIG_ARCH_CANAAN=y 38 37 CONFIG_SMP=y 39 - CONFIG_HOTPLUG_CPU=y 40 - CONFIG_PM=y 41 - CONFIG_CPU_IDLE=y 42 38 CONFIG_CPU_FREQ=y 43 39 CONFIG_CPU_FREQ_STAT=y 44 40 CONFIG_CPU_FREQ_GOV_POWERSAVE=m ··· 50 52 CONFIG_JUMP_LABEL=y 51 53 CONFIG_MODULES=y 52 54 CONFIG_MODULE_UNLOAD=y 53 - CONFIG_SPARSEMEM_MANUAL=y 54 55 CONFIG_BLK_DEV_THROTTLING=y 56 + CONFIG_SPARSEMEM_MANUAL=y 55 57 CONFIG_NET=y 56 58 CONFIG_PACKET=y 57 - CONFIG_UNIX=y 58 59 CONFIG_XFRM_USER=m 59 - CONFIG_INET=y 60 60 CONFIG_IP_MULTICAST=y 61 61 CONFIG_IP_ADVANCED_ROUTER=y 62 62 CONFIG_IP_PNP=y ··· 98 102 CONFIG_NET_CLS_CGROUP=m 99 103 CONFIG_NETLINK_DIAG=y 100 104 CONFIG_CGROUP_NET_PRIO=y 105 + CONFIG_CAN=m 101 106 CONFIG_NET_9P=y 102 107 CONFIG_NET_9P_VIRTIO=y 103 - CONFIG_CAN=m 104 108 CONFIG_PCI=y 105 109 CONFIG_PCIEPORTBUS=y 106 110 CONFIG_PCI_HOST_GENERIC=y ··· 149 153 CONFIG_SERIAL_8250_CONSOLE=y 150 154 CONFIG_SERIAL_8250_DW=y 151 155 CONFIG_SERIAL_OF_PLATFORM=y 152 - CONFIG_SERIAL_SH_SCI=y 153 156 CONFIG_SERIAL_EARLYCON_RISCV_SBI=y 157 + CONFIG_SERIAL_SH_SCI=y 154 158 CONFIG_VIRTIO_CONSOLE=y 155 159 CONFIG_HW_RANDOM=y 156 160 CONFIG_HW_RANDOM_VIRTIO=y ··· 175 179 CONFIG_RZG2L_THERMAL=y 176 180 CONFIG_WATCHDOG=y 177 181 CONFIG_SUNXI_WATCHDOG=y 178 - CONFIG_RENESAS_RZG2LWDT=y 179 182 CONFIG_MFD_AXP20X_I2C=y 180 183 CONFIG_REGULATOR=y 181 184 CONFIG_REGULATOR_FIXED_VOLTAGE=y ··· 188 193 CONFIG_DRM_SUN4I=m 189 194 CONFIG_DRM_VIRTIO_GPU=m 190 195 CONFIG_FB=y 191 - CONFIG_FRAMEBUFFER_CONSOLE=y 192 196 CONFIG_SOUND=y 193 197 CONFIG_SND=y 194 198 CONFIG_SND_SOC=y 195 - CONFIG_SND_SOC_RZ=m 196 199 CONFIG_SND_DESIGNWARE_I2S=m 197 200 CONFIG_SND_SOC_STARFIVE=m 198 201 CONFIG_SND_SOC_JH7110_PWMDAC=m ··· 232 239 CONFIG_MMC=y 233 240 CONFIG_MMC_SDHCI=y 234 241 CONFIG_MMC_SDHCI_PLTFM=y 235 - CONFIG_MMC_SDHCI_CADENCE=y 236 242 CONFIG_MMC_SDHCI_OF_DWCMSHC=y 243 + CONFIG_MMC_SDHCI_CADENCE=y 237 244 CONFIG_MMC_SPI=y 245 + CONFIG_MMC_SDHI=y 238 246 CONFIG_MMC_DW=y 239 247 CONFIG_MMC_DW_STARFIVE=y 240 - CONFIG_MMC_SDHI=y 241 248 CONFIG_MMC_SUNXI=y 242 249 CONFIG_RTC_CLASS=y 243 250 CONFIG_RTC_DRV_SUN6I=y 244 251 CONFIG_DMADEVICES=y 245 252 CONFIG_DMA_SUN6I=m 246 253 CONFIG_DW_AXI_DMAC=y 247 - CONFIG_RZ_DMAC=y 248 254 CONFIG_VIRTIO_PCI=y 249 255 CONFIG_VIRTIO_BALLOON=y 250 256 CONFIG_VIRTIO_INPUT=y 251 257 CONFIG_VIRTIO_MMIO=y 252 - CONFIG_RENESAS_OSTM=y 253 258 CONFIG_CLK_SOPHGO_CV1800=y 254 259 CONFIG_SUN8I_DE2_CCU=m 260 + CONFIG_RENESAS_OSTM=y 255 261 CONFIG_SUN50I_IOMMU=y 256 262 CONFIG_RPMSG_CHAR=y 257 263 CONFIG_RPMSG_CTRL=y 258 264 CONFIG_RPMSG_VIRTIO=y 259 - CONFIG_ARCH_R9A07G043=y 265 + CONFIG_PM_DEVFREQ=y 260 266 CONFIG_IIO=y 261 - CONFIG_RZG2L_ADC=m 262 - CONFIG_RESET_RZG2L_USBPHY_CTRL=y 263 267 CONFIG_PHY_SUN4I_USB=m 264 268 CONFIG_PHY_RCAR_GEN3_USB2=y 265 269 CONFIG_PHY_STARFIVE_JH7110_DPHY_RX=m
+3
arch/riscv/errata/andes/errata.c
··· 17 17 #include <asm/processor.h> 18 18 #include <asm/sbi.h> 19 19 #include <asm/vendorid_list.h> 20 + #include <asm/vendor_extensions.h> 20 21 21 22 #define ANDES_AX45MP_MARCHID 0x8000000000008a45UL 22 23 #define ANDES_AX45MP_MIMPID 0x500UL ··· 66 65 unsigned long archid, unsigned long impid, 67 66 unsigned int stage) 68 67 { 68 + BUILD_BUG_ON(ERRATA_ANDES_NUMBER >= RISCV_VENDOR_EXT_ALTERNATIVES_BASE); 69 + 69 70 if (stage == RISCV_ALTERNATIVES_BOOT) 70 71 errata_probe_iocp(stage, archid, impid); 71 72
+3
arch/riscv/errata/sifive/errata.c
··· 12 12 #include <asm/alternative.h> 13 13 #include <asm/vendorid_list.h> 14 14 #include <asm/errata_list.h> 15 + #include <asm/vendor_extensions.h> 15 16 16 17 struct errata_info_t { 17 18 char name[32]; ··· 96 95 u32 cpu_req_errata; 97 96 u32 cpu_apply_errata = 0; 98 97 u32 tmp; 98 + 99 + BUILD_BUG_ON(ERRATA_SIFIVE_NUMBER >= RISCV_VENDOR_EXT_ALTERNATIVES_BASE); 99 100 100 101 if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) 101 102 return;
+3
arch/riscv/errata/thead/errata.c
··· 18 18 #include <asm/io.h> 19 19 #include <asm/patch.h> 20 20 #include <asm/vendorid_list.h> 21 + #include <asm/vendor_extensions.h> 21 22 22 23 #define CSR_TH_SXSTATUS 0x5c0 23 24 #define SXSTATUS_MAEE _AC(0x200000, UL) ··· 166 165 u32 cpu_req_errata = thead_errata_probe(stage, archid, impid); 167 166 u32 tmp; 168 167 void *oldptr, *altptr; 168 + 169 + BUILD_BUG_ON(ERRATA_THEAD_NUMBER >= RISCV_VENDOR_EXT_ALTERNATIVES_BASE); 169 170 170 171 for (alt = begin; alt < end; alt++) { 171 172 if (alt->vendor_id != THEAD_VENDOR_ID)
+13 -2
arch/riscv/include/asm/acpi.h
··· 61 61 62 62 void acpi_init_rintc_map(void); 63 63 struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); 64 - u32 get_acpi_id_for_cpu(int cpu); 64 + static inline u32 get_acpi_id_for_cpu(int cpu) 65 + { 66 + return acpi_cpu_get_madt_rintc(cpu)->uid; 67 + } 68 + 65 69 int acpi_get_riscv_isa(struct acpi_table_header *table, 66 70 unsigned int cpu, const char **isa); 67 71 68 - static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } 69 72 void acpi_get_cbo_block_size(struct acpi_table_header *table, u32 *cbom_size, 70 73 u32 *cboz_size, u32 *cbop_size); 71 74 #else ··· 89 86 u32 *cbop_size) { } 90 87 91 88 #endif /* CONFIG_ACPI */ 89 + 90 + #ifdef CONFIG_ACPI_NUMA 91 + int acpi_numa_get_nid(unsigned int cpu); 92 + void acpi_map_cpus_to_nodes(void); 93 + #else 94 + static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } 95 + static inline void acpi_map_cpus_to_nodes(void) { } 96 + #endif /* CONFIG_ACPI_NUMA */ 92 97 93 98 #endif /*_ASM_ACPI_H*/
+69 -34
arch/riscv/include/asm/cpufeature.h
··· 33 33 34 34 void riscv_user_isa_enable(void); 35 35 36 + #define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ 37 + .name = #_name, \ 38 + .property = #_name, \ 39 + .id = _id, \ 40 + .subset_ext_ids = _subset_exts, \ 41 + .subset_ext_size = _subset_exts_size, \ 42 + .validate = _validate \ 43 + } 44 + 45 + #define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) 46 + 47 + #define __RISCV_ISA_EXT_DATA_VALIDATE(_name, _id, _validate) \ 48 + _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, _validate) 49 + 50 + /* Used to declare pure "lasso" extension (Zk for instance) */ 51 + #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ 52 + _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ 53 + ARRAY_SIZE(_bundled_exts), NULL) 54 + 55 + /* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */ 56 + #define __RISCV_ISA_EXT_SUPERSET(_name, _id, _sub_exts) \ 57 + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), NULL) 58 + #define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ 59 + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) 60 + 36 61 #if defined(CONFIG_RISCV_MISALIGNED) 37 62 bool check_unaligned_access_emulated_all_cpus(void); 38 63 void unaligned_emulation_finish(void); ··· 104 79 105 80 unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap); 106 81 82 + #define STANDARD_EXT 0 83 + 107 84 bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned int bit); 108 85 #define riscv_isa_extension_available(isa_bitmap, ext) \ 109 86 __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext) 110 87 111 - static __always_inline bool 112 - riscv_has_extension_likely(const unsigned long ext) 88 + static __always_inline bool __riscv_has_extension_likely(const unsigned long vendor, 89 + const unsigned long ext) 113 90 { 114 - compiletime_assert(ext < RISCV_ISA_EXT_MAX, 115 - "ext must be < RISCV_ISA_EXT_MAX"); 116 - 117 - if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { 118 - asm goto( 119 - ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1) 120 - : 121 - : [ext] "i" (ext) 122 - : 123 - : l_no); 124 - } else { 125 - if (!__riscv_isa_extension_available(NULL, ext)) 126 - goto l_no; 127 - } 91 + asm goto(ALTERNATIVE("j %l[l_no]", "nop", %[vendor], %[ext], 1) 92 + : 93 + : [vendor] "i" (vendor), [ext] "i" (ext) 94 + : 95 + : l_no); 128 96 129 97 return true; 130 98 l_no: 131 99 return false; 132 100 } 133 101 134 - static __always_inline bool 135 - riscv_has_extension_unlikely(const unsigned long ext) 102 + static __always_inline bool __riscv_has_extension_unlikely(const unsigned long vendor, 103 + const unsigned long ext) 136 104 { 137 - compiletime_assert(ext < RISCV_ISA_EXT_MAX, 138 - "ext must be < RISCV_ISA_EXT_MAX"); 139 - 140 - if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { 141 - asm goto( 142 - ALTERNATIVE("nop", "j %l[l_yes]", 0, %[ext], 1) 143 - : 144 - : [ext] "i" (ext) 145 - : 146 - : l_yes); 147 - } else { 148 - if (__riscv_isa_extension_available(NULL, ext)) 149 - goto l_yes; 150 - } 105 + asm goto(ALTERNATIVE("nop", "j %l[l_yes]", %[vendor], %[ext], 1) 106 + : 107 + : [vendor] "i" (vendor), [ext] "i" (ext) 108 + : 109 + : l_yes); 151 110 152 111 return false; 153 112 l_yes: 154 113 return true; 155 114 } 156 115 116 + static __always_inline bool riscv_has_extension_unlikely(const unsigned long ext) 117 + { 118 + compiletime_assert(ext < RISCV_ISA_EXT_MAX, "ext must be < RISCV_ISA_EXT_MAX"); 119 + 120 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) 121 + return __riscv_has_extension_unlikely(STANDARD_EXT, ext); 122 + 123 + return __riscv_isa_extension_available(NULL, ext); 124 + } 125 + 126 + static __always_inline bool riscv_has_extension_likely(const unsigned long ext) 127 + { 128 + compiletime_assert(ext < RISCV_ISA_EXT_MAX, "ext must be < RISCV_ISA_EXT_MAX"); 129 + 130 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) 131 + return __riscv_has_extension_likely(STANDARD_EXT, ext); 132 + 133 + return __riscv_isa_extension_available(NULL, ext); 134 + } 135 + 157 136 static __always_inline bool riscv_cpu_has_extension_likely(int cpu, const unsigned long ext) 158 137 { 159 - if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && riscv_has_extension_likely(ext)) 138 + compiletime_assert(ext < RISCV_ISA_EXT_MAX, "ext must be < RISCV_ISA_EXT_MAX"); 139 + 140 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && 141 + __riscv_has_extension_likely(STANDARD_EXT, ext)) 160 142 return true; 161 143 162 144 return __riscv_isa_extension_available(hart_isa[cpu].isa, ext); ··· 171 139 172 140 static __always_inline bool riscv_cpu_has_extension_unlikely(int cpu, const unsigned long ext) 173 141 { 174 - if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && riscv_has_extension_unlikely(ext)) 142 + compiletime_assert(ext < RISCV_ISA_EXT_MAX, "ext must be < RISCV_ISA_EXT_MAX"); 143 + 144 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && 145 + __riscv_has_extension_unlikely(STANDARD_EXT, ext)) 175 146 return true; 176 147 177 148 return __riscv_isa_extension_available(hart_isa[cpu].isa, ext);
+12 -13
arch/riscv/include/asm/hwcap.h
··· 80 80 #define RISCV_ISA_EXT_ZFA 71 81 81 #define RISCV_ISA_EXT_ZTSO 72 82 82 #define RISCV_ISA_EXT_ZACAS 73 83 - #define RISCV_ISA_EXT_XANDESPMU 74 84 - #define RISCV_ISA_EXT_ZVE32X 75 85 - #define RISCV_ISA_EXT_ZVE32F 76 86 - #define RISCV_ISA_EXT_ZVE64X 77 87 - #define RISCV_ISA_EXT_ZVE64F 78 88 - #define RISCV_ISA_EXT_ZVE64D 79 89 - #define RISCV_ISA_EXT_ZIMOP 80 90 - #define RISCV_ISA_EXT_ZCA 81 91 - #define RISCV_ISA_EXT_ZCB 82 92 - #define RISCV_ISA_EXT_ZCD 83 93 - #define RISCV_ISA_EXT_ZCF 84 94 - #define RISCV_ISA_EXT_ZCMOP 85 95 - #define RISCV_ISA_EXT_ZAWRS 86 83 + #define RISCV_ISA_EXT_ZVE32X 74 84 + #define RISCV_ISA_EXT_ZVE32F 75 85 + #define RISCV_ISA_EXT_ZVE64X 76 86 + #define RISCV_ISA_EXT_ZVE64F 77 87 + #define RISCV_ISA_EXT_ZVE64D 78 88 + #define RISCV_ISA_EXT_ZIMOP 79 89 + #define RISCV_ISA_EXT_ZCA 80 90 + #define RISCV_ISA_EXT_ZCB 81 91 + #define RISCV_ISA_EXT_ZCD 82 92 + #define RISCV_ISA_EXT_ZCF 83 93 + #define RISCV_ISA_EXT_ZCMOP 84 94 + #define RISCV_ISA_EXT_ZAWRS 85 96 95 97 96 #define RISCV_ISA_EXT_XLINUXENVCFG 127 98 97
+1 -1
arch/riscv/include/asm/hwprobe.h
··· 8 8 9 9 #include <uapi/asm/hwprobe.h> 10 10 11 - #define RISCV_HWPROBE_MAX_KEY 7 11 + #define RISCV_HWPROBE_MAX_KEY 8 12 12 13 13 static inline bool riscv_hwprobe_key_is_valid(__s64 key) 14 14 {
+1 -1
arch/riscv/include/asm/page.h
··· 37 37 * define the PAGE_OFFSET value for SV48 and SV39. 38 38 */ 39 39 #define PAGE_OFFSET_L4 _AC(0xffffaf8000000000, UL) 40 - #define PAGE_OFFSET_L3 _AC(0xffffffd800000000, UL) 40 + #define PAGE_OFFSET_L3 _AC(0xffffffd600000000, UL) 41 41 #else 42 42 #define PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) 43 43 #endif /* CONFIG_64BIT */
+1
arch/riscv/include/asm/thread_info.h
··· 10 10 11 11 #include <asm/page.h> 12 12 #include <linux/const.h> 13 + #include <linux/sizes.h> 13 14 14 15 /* thread information allocation */ 15 16 #define THREAD_SIZE_ORDER CONFIG_THREAD_SIZE_ORDER
+104
arch/riscv/include/asm/vendor_extensions.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright 2024 Rivos, Inc 4 + */ 5 + 6 + #ifndef _ASM_VENDOR_EXTENSIONS_H 7 + #define _ASM_VENDOR_EXTENSIONS_H 8 + 9 + #include <asm/cpufeature.h> 10 + 11 + #include <linux/array_size.h> 12 + #include <linux/types.h> 13 + 14 + /* 15 + * The extension keys of each vendor must be strictly less than this value. 16 + */ 17 + #define RISCV_ISA_VENDOR_EXT_MAX 32 18 + 19 + struct riscv_isavendorinfo { 20 + DECLARE_BITMAP(isa, RISCV_ISA_VENDOR_EXT_MAX); 21 + }; 22 + 23 + struct riscv_isa_vendor_ext_data_list { 24 + bool is_initialized; 25 + const size_t ext_data_count; 26 + const struct riscv_isa_ext_data *ext_data; 27 + struct riscv_isavendorinfo per_hart_isa_bitmap[NR_CPUS]; 28 + struct riscv_isavendorinfo all_harts_isa_bitmap; 29 + }; 30 + 31 + extern struct riscv_isa_vendor_ext_data_list *riscv_isa_vendor_ext_list[]; 32 + 33 + extern const size_t riscv_isa_vendor_ext_list_size; 34 + 35 + /* 36 + * The alternatives need some way of distinguishing between vendor extensions 37 + * and errata. Incrementing all of the vendor extension keys so they are at 38 + * least 0x8000 accomplishes that. 39 + */ 40 + #define RISCV_VENDOR_EXT_ALTERNATIVES_BASE 0x8000 41 + 42 + #define VENDOR_EXT_ALL_CPUS -1 43 + 44 + bool __riscv_isa_vendor_extension_available(int cpu, unsigned long vendor, unsigned int bit); 45 + #define riscv_cpu_isa_vendor_extension_available(cpu, vendor, ext) \ 46 + __riscv_isa_vendor_extension_available(cpu, vendor, RISCV_ISA_VENDOR_EXT_##ext) 47 + #define riscv_isa_vendor_extension_available(vendor, ext) \ 48 + __riscv_isa_vendor_extension_available(VENDOR_EXT_ALL_CPUS, vendor, \ 49 + RISCV_ISA_VENDOR_EXT_##ext) 50 + 51 + static __always_inline bool riscv_has_vendor_extension_likely(const unsigned long vendor, 52 + const unsigned long ext) 53 + { 54 + if (!IS_ENABLED(CONFIG_RISCV_ISA_VENDOR_EXT)) 55 + return false; 56 + 57 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) 58 + return __riscv_has_extension_likely(vendor, 59 + ext + RISCV_VENDOR_EXT_ALTERNATIVES_BASE); 60 + 61 + return __riscv_isa_vendor_extension_available(VENDOR_EXT_ALL_CPUS, vendor, ext); 62 + } 63 + 64 + static __always_inline bool riscv_has_vendor_extension_unlikely(const unsigned long vendor, 65 + const unsigned long ext) 66 + { 67 + if (!IS_ENABLED(CONFIG_RISCV_ISA_VENDOR_EXT)) 68 + return false; 69 + 70 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) 71 + return __riscv_has_extension_unlikely(vendor, 72 + ext + RISCV_VENDOR_EXT_ALTERNATIVES_BASE); 73 + 74 + return __riscv_isa_vendor_extension_available(VENDOR_EXT_ALL_CPUS, vendor, ext); 75 + } 76 + 77 + static __always_inline bool riscv_cpu_has_vendor_extension_likely(const unsigned long vendor, 78 + int cpu, const unsigned long ext) 79 + { 80 + if (!IS_ENABLED(CONFIG_RISCV_ISA_VENDOR_EXT)) 81 + return false; 82 + 83 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && 84 + __riscv_has_extension_likely(vendor, ext + RISCV_VENDOR_EXT_ALTERNATIVES_BASE)) 85 + return true; 86 + 87 + return __riscv_isa_vendor_extension_available(cpu, vendor, ext); 88 + } 89 + 90 + static __always_inline bool riscv_cpu_has_vendor_extension_unlikely(const unsigned long vendor, 91 + int cpu, 92 + const unsigned long ext) 93 + { 94 + if (!IS_ENABLED(CONFIG_RISCV_ISA_VENDOR_EXT)) 95 + return false; 96 + 97 + if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && 98 + __riscv_has_extension_unlikely(vendor, ext + RISCV_VENDOR_EXT_ALTERNATIVES_BASE)) 99 + return true; 100 + 101 + return __riscv_isa_vendor_extension_available(cpu, vendor, ext); 102 + } 103 + 104 + #endif /* _ASM_VENDOR_EXTENSIONS_H */
+19
arch/riscv/include/asm/vendor_extensions/andes.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_RISCV_VENDOR_EXTENSIONS_ANDES_H 3 + #define _ASM_RISCV_VENDOR_EXTENSIONS_ANDES_H 4 + 5 + #include <asm/vendor_extensions.h> 6 + 7 + #include <linux/types.h> 8 + 9 + #define RISCV_ISA_VENDOR_EXT_XANDESPMU 0 10 + 11 + /* 12 + * Extension keys should be strictly less than max. 13 + * It is safe to increment this when necessary. 14 + */ 15 + #define RISCV_ISA_VENDOR_EXT_MAX_ANDES 32 16 + 17 + extern struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_andes; 18 + 19 + #endif
+1
arch/riscv/include/uapi/asm/hwprobe.h
··· 81 81 #define RISCV_HWPROBE_MISALIGNED_MASK (7 << 0) 82 82 #define RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE 6 83 83 #define RISCV_HWPROBE_KEY_HIGHEST_VIRT_ADDRESS 7 84 + #define RISCV_HWPROBE_KEY_TIME_CSR_FREQ 8 84 85 /* Increase RISCV_HWPROBE_MAX_KEY when adding items. */ 85 86 86 87 /* Flags */
+3
arch/riscv/kernel/Makefile
··· 58 58 obj-y += stacktrace.o 59 59 obj-y += cacheinfo.o 60 60 obj-y += patch.o 61 + obj-y += vendor_extensions.o 62 + obj-y += vendor_extensions/ 61 63 obj-y += probes/ 62 64 obj-y += tests/ 63 65 obj-$(CONFIG_MMU) += vdso.o vdso/ ··· 112 110 113 111 obj-$(CONFIG_64BIT) += pi/ 114 112 obj-$(CONFIG_ACPI) += acpi.o 113 + obj-$(CONFIG_ACPI_NUMA) += acpi_numa.o
+11 -6
arch/riscv/kernel/acpi.c
··· 17 17 #include <linux/efi.h> 18 18 #include <linux/io.h> 19 19 #include <linux/memblock.h> 20 + #include <linux/of_fdt.h> 20 21 #include <linux/pci.h> 22 + #include <linux/serial_core.h> 21 23 22 24 int acpi_noirq = 1; /* skip ACPI IRQ initialization */ 23 25 int acpi_disabled = 1; ··· 133 131 if (param_acpi_off || 134 132 (!param_acpi_on && !param_acpi_force && 135 133 efi.acpi20 == EFI_INVALID_TABLE_ADDR)) 136 - return; 134 + goto done; 137 135 138 136 /* 139 137 * ACPI is disabled at this point. Enable it in order to parse ··· 152 150 pr_err("Failed to init ACPI tables\n"); 153 151 if (!param_acpi_force) 154 152 disable_acpi(); 153 + } 154 + 155 + done: 156 + if (acpi_disabled) { 157 + if (earlycon_acpi_spcr_enable) 158 + early_init_dt_scan_chosen_stdout(); 159 + } else { 160 + acpi_parse_spcr(earlycon_acpi_spcr_enable, true); 155 161 } 156 162 } 157 163 ··· 199 189 struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) 200 190 { 201 191 return &cpu_madt_rintc[cpu]; 202 - } 203 - 204 - u32 get_acpi_id_for_cpu(int cpu) 205 - { 206 - return acpi_cpu_get_madt_rintc(cpu)->uid; 207 192 } 208 193 209 194 /*
+131
arch/riscv/kernel/acpi_numa.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * ACPI 6.6 based NUMA setup for RISCV 4 + * Lots of code was borrowed from arch/arm64/kernel/acpi_numa.c 5 + * 6 + * Copyright 2004 Andi Kleen, SuSE Labs. 7 + * Copyright (C) 2013-2016, Linaro Ltd. 8 + * Author: Hanjun Guo <hanjun.guo@linaro.org> 9 + * Copyright (C) 2024 Intel Corporation. 10 + * 11 + * Reads the ACPI SRAT table to figure out what memory belongs to which CPUs. 12 + * 13 + * Called from acpi_numa_init while reading the SRAT and SLIT tables. 14 + * Assumes all memory regions belonging to a single proximity domain 15 + * are in one chunk. Holes between them will be included in the node. 16 + */ 17 + 18 + #define pr_fmt(fmt) "ACPI: NUMA: " fmt 19 + 20 + #include <linux/acpi.h> 21 + #include <linux/bitmap.h> 22 + #include <linux/kernel.h> 23 + #include <linux/mm.h> 24 + #include <linux/memblock.h> 25 + #include <linux/mmzone.h> 26 + #include <linux/module.h> 27 + #include <linux/topology.h> 28 + 29 + #include <asm/numa.h> 30 + 31 + static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE }; 32 + 33 + int __init acpi_numa_get_nid(unsigned int cpu) 34 + { 35 + return acpi_early_node_map[cpu]; 36 + } 37 + 38 + static inline int get_cpu_for_acpi_id(u32 uid) 39 + { 40 + int cpu; 41 + 42 + for (cpu = 0; cpu < nr_cpu_ids; cpu++) 43 + if (uid == get_acpi_id_for_cpu(cpu)) 44 + return cpu; 45 + 46 + return -EINVAL; 47 + } 48 + 49 + static int __init acpi_parse_rintc_pxm(union acpi_subtable_headers *header, 50 + const unsigned long end) 51 + { 52 + struct acpi_srat_rintc_affinity *pa; 53 + int cpu, pxm, node; 54 + 55 + if (srat_disabled()) 56 + return -EINVAL; 57 + 58 + pa = (struct acpi_srat_rintc_affinity *)header; 59 + if (!pa) 60 + return -EINVAL; 61 + 62 + if (!(pa->flags & ACPI_SRAT_RINTC_ENABLED)) 63 + return 0; 64 + 65 + pxm = pa->proximity_domain; 66 + node = pxm_to_node(pxm); 67 + 68 + /* 69 + * If we can't map the UID to a logical cpu this 70 + * means that the UID is not part of possible cpus 71 + * so we do not need a NUMA mapping for it, skip 72 + * the SRAT entry and keep parsing. 73 + */ 74 + cpu = get_cpu_for_acpi_id(pa->acpi_processor_uid); 75 + if (cpu < 0) 76 + return 0; 77 + 78 + acpi_early_node_map[cpu] = node; 79 + pr_info("SRAT: PXM %d -> HARTID 0x%lx -> Node %d\n", pxm, 80 + cpuid_to_hartid_map(cpu), node); 81 + 82 + return 0; 83 + } 84 + 85 + void __init acpi_map_cpus_to_nodes(void) 86 + { 87 + int i; 88 + 89 + /* 90 + * In ACPI, SMP and CPU NUMA information is provided in separate 91 + * static tables, namely the MADT and the SRAT. 92 + * 93 + * Thus, it is simpler to first create the cpu logical map through 94 + * an MADT walk and then map the logical cpus to their node ids 95 + * as separate steps. 96 + */ 97 + acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), 98 + ACPI_SRAT_TYPE_RINTC_AFFINITY, acpi_parse_rintc_pxm, 0); 99 + 100 + for (i = 0; i < nr_cpu_ids; i++) 101 + early_map_cpu_to_node(i, acpi_numa_get_nid(i)); 102 + } 103 + 104 + /* Callback for Proximity Domain -> logical node ID mapping */ 105 + void __init acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) 106 + { 107 + int pxm, node; 108 + 109 + if (srat_disabled()) 110 + return; 111 + 112 + if (pa->header.length < sizeof(struct acpi_srat_rintc_affinity)) { 113 + pr_err("SRAT: Invalid SRAT header length: %d\n", pa->header.length); 114 + bad_srat(); 115 + return; 116 + } 117 + 118 + if (!(pa->flags & ACPI_SRAT_RINTC_ENABLED)) 119 + return; 120 + 121 + pxm = pa->proximity_domain; 122 + node = acpi_map_pxm_to_node(pxm); 123 + 124 + if (node == NUMA_NO_NODE) { 125 + pr_err("SRAT: Too many proximity domains %d\n", pxm); 126 + bad_srat(); 127 + return; 128 + } 129 + 130 + node_set(node, numa_nodes_parsed); 131 + }
+28 -7
arch/riscv/kernel/cacheinfo.c
··· 3 3 * Copyright (C) 2017 SiFive 4 4 */ 5 5 6 + #include <linux/acpi.h> 6 7 #include <linux/cpu.h> 7 8 #include <linux/of.h> 8 9 #include <asm/cacheinfo.h> ··· 65 64 } 66 65 67 66 static void ci_leaf_init(struct cacheinfo *this_leaf, 68 - struct device_node *node, 69 67 enum cache_type type, unsigned int level) 70 68 { 71 69 this_leaf->level = level; ··· 79 79 struct device_node *prev = NULL; 80 80 int levels = 1, level = 1; 81 81 82 + if (!acpi_disabled) { 83 + int ret, fw_levels, split_levels; 84 + 85 + ret = acpi_get_cache_info(cpu, &fw_levels, &split_levels); 86 + if (ret) 87 + return ret; 88 + 89 + BUG_ON((split_levels > fw_levels) || 90 + (split_levels + fw_levels > this_cpu_ci->num_leaves)); 91 + 92 + for (; level <= this_cpu_ci->num_levels; level++) { 93 + if (level <= split_levels) { 94 + ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level); 95 + ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level); 96 + } else { 97 + ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level); 98 + } 99 + } 100 + return 0; 101 + } 102 + 82 103 if (of_property_read_bool(np, "cache-size")) 83 - ci_leaf_init(this_leaf++, np, CACHE_TYPE_UNIFIED, level); 104 + ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level); 84 105 if (of_property_read_bool(np, "i-cache-size")) 85 - ci_leaf_init(this_leaf++, np, CACHE_TYPE_INST, level); 106 + ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level); 86 107 if (of_property_read_bool(np, "d-cache-size")) 87 - ci_leaf_init(this_leaf++, np, CACHE_TYPE_DATA, level); 108 + ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level); 88 109 89 110 prev = np; 90 111 while ((np = of_find_next_cache_node(np))) { ··· 118 97 if (level <= levels) 119 98 break; 120 99 if (of_property_read_bool(np, "cache-size")) 121 - ci_leaf_init(this_leaf++, np, CACHE_TYPE_UNIFIED, level); 100 + ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level); 122 101 if (of_property_read_bool(np, "i-cache-size")) 123 - ci_leaf_init(this_leaf++, np, CACHE_TYPE_INST, level); 102 + ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level); 124 103 if (of_property_read_bool(np, "d-cache-size")) 125 - ci_leaf_init(this_leaf++, np, CACHE_TYPE_DATA, level); 104 + ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level); 126 105 levels = level; 127 106 } 128 107 of_node_put(np);
+32 -3
arch/riscv/kernel/cpu.c
··· 16 16 #include <asm/sbi.h> 17 17 #include <asm/smp.h> 18 18 #include <asm/pgtable.h> 19 + #include <asm/vendor_extensions.h> 19 20 20 21 bool arch_match_cpu_phys_id(int cpu, u64 phys_id) 21 22 { ··· 236 235 237 236 #ifdef CONFIG_PROC_FS 238 237 239 - static void print_isa(struct seq_file *f, const unsigned long *isa_bitmap) 238 + #define ALL_CPUS -1 239 + 240 + static void print_vendor_isa(struct seq_file *f, int cpu) 241 + { 242 + struct riscv_isavendorinfo *vendor_bitmap; 243 + struct riscv_isa_vendor_ext_data_list *ext_list; 244 + const struct riscv_isa_ext_data *ext_data; 245 + 246 + for (int i = 0; i < riscv_isa_vendor_ext_list_size; i++) { 247 + ext_list = riscv_isa_vendor_ext_list[i]; 248 + ext_data = riscv_isa_vendor_ext_list[i]->ext_data; 249 + 250 + if (cpu == ALL_CPUS) 251 + vendor_bitmap = &ext_list->all_harts_isa_bitmap; 252 + else 253 + vendor_bitmap = &ext_list->per_hart_isa_bitmap[cpu]; 254 + 255 + for (int j = 0; j < ext_list->ext_data_count; j++) { 256 + if (!__riscv_isa_extension_available(vendor_bitmap->isa, ext_data[j].id)) 257 + continue; 258 + 259 + seq_printf(f, "_%s", ext_data[j].name); 260 + } 261 + } 262 + } 263 + 264 + static void print_isa(struct seq_file *f, const unsigned long *isa_bitmap, int cpu) 240 265 { 241 266 242 267 if (IS_ENABLED(CONFIG_32BIT)) ··· 280 253 281 254 seq_printf(f, "%s", riscv_isa_ext[i].name); 282 255 } 256 + 257 + print_vendor_isa(f, cpu); 283 258 284 259 seq_puts(f, "\n"); 285 260 } ··· 345 316 * line. 346 317 */ 347 318 seq_puts(m, "isa\t\t: "); 348 - print_isa(m, NULL); 319 + print_isa(m, NULL, ALL_CPUS); 349 320 print_mmu(m); 350 321 351 322 if (acpi_disabled) { ··· 367 338 * additional extensions not present across all harts. 368 339 */ 369 340 seq_puts(m, "hart isa\t: "); 370 - print_isa(m, hart_isa[cpu_id].isa); 341 + print_isa(m, hart_isa[cpu_id].isa, cpu_id); 371 342 seq_puts(m, "\n"); 372 343 373 344 return 0;
+103 -40
arch/riscv/kernel/cpufeature.c
··· 24 24 #include <asm/processor.h> 25 25 #include <asm/sbi.h> 26 26 #include <asm/vector.h> 27 + #include <asm/vendor_extensions.h> 27 28 28 29 #define NUM_ALPHA_EXTS ('z' - 'a' + 1) 29 30 ··· 100 99 } 101 100 return 0; 102 101 } 103 - 104 - #define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ 105 - .name = #_name, \ 106 - .property = #_name, \ 107 - .id = _id, \ 108 - .subset_ext_ids = _subset_exts, \ 109 - .subset_ext_size = _subset_exts_size, \ 110 - .validate = _validate \ 111 - } 112 - 113 - #define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) 114 - 115 - #define __RISCV_ISA_EXT_DATA_VALIDATE(_name, _id, _validate) \ 116 - _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, _validate) 117 - 118 - /* Used to declare pure "lasso" extension (Zk for instance) */ 119 - #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ 120 - _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ 121 - ARRAY_SIZE(_bundled_exts), NULL) 122 - 123 - /* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */ 124 - #define __RISCV_ISA_EXT_SUPERSET(_name, _id, _sub_exts) \ 125 - _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), NULL) 126 - #define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ 127 - _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) 128 102 129 103 static int riscv_ext_zca_depends(const struct riscv_isa_ext_data *data, 130 104 const unsigned long *isa_bitmap) ··· 381 405 __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), 382 406 __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), 383 407 __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), 384 - __RISCV_ISA_EXT_DATA(xandespmu, RISCV_ISA_EXT_XANDESPMU), 385 408 }; 386 409 387 410 const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); ··· 487 512 bool ext_err = false; 488 513 489 514 switch (*ext) { 515 + case 'x': 516 + case 'X': 517 + if (acpi_disabled) 518 + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); 519 + /* 520 + * To skip an extension, we find its end. 521 + * As multi-letter extensions must be split from other multi-letter 522 + * extensions with an "_", the end of a multi-letter extension will 523 + * either be the null character or the "_" at the start of the next 524 + * multi-letter extension. 525 + */ 526 + for (; *isa && *isa != '_'; ++isa) 527 + ; 528 + ext_err = true; 529 + break; 490 530 case 's': 491 531 /* 492 532 * Workaround for invalid single-letter 's' & 'u' (QEMU). ··· 517 527 } 518 528 fallthrough; 519 529 case 'S': 520 - case 'x': 521 - case 'X': 522 530 case 'z': 523 531 case 'Z': 524 532 /* ··· 716 728 acpi_put_table((struct acpi_table_header *)rhct); 717 729 } 718 730 731 + static void __init riscv_fill_cpu_vendor_ext(struct device_node *cpu_node, int cpu) 732 + { 733 + if (!IS_ENABLED(CONFIG_RISCV_ISA_VENDOR_EXT)) 734 + return; 735 + 736 + for (int i = 0; i < riscv_isa_vendor_ext_list_size; i++) { 737 + struct riscv_isa_vendor_ext_data_list *ext_list = riscv_isa_vendor_ext_list[i]; 738 + 739 + for (int j = 0; j < ext_list->ext_data_count; j++) { 740 + const struct riscv_isa_ext_data ext = ext_list->ext_data[j]; 741 + struct riscv_isavendorinfo *isavendorinfo = &ext_list->per_hart_isa_bitmap[cpu]; 742 + 743 + if (of_property_match_string(cpu_node, "riscv,isa-extensions", 744 + ext.property) < 0) 745 + continue; 746 + 747 + /* 748 + * Assume that subset extensions are all members of the 749 + * same vendor. 750 + */ 751 + if (ext.subset_ext_size) 752 + for (int k = 0; k < ext.subset_ext_size; k++) 753 + set_bit(ext.subset_ext_ids[k], isavendorinfo->isa); 754 + 755 + set_bit(ext.id, isavendorinfo->isa); 756 + } 757 + } 758 + } 759 + 760 + /* 761 + * Populate all_harts_isa_bitmap for each vendor with all of the extensions that 762 + * are shared across CPUs for that vendor. 763 + */ 764 + static void __init riscv_fill_vendor_ext_list(int cpu) 765 + { 766 + if (!IS_ENABLED(CONFIG_RISCV_ISA_VENDOR_EXT)) 767 + return; 768 + 769 + for (int i = 0; i < riscv_isa_vendor_ext_list_size; i++) { 770 + struct riscv_isa_vendor_ext_data_list *ext_list = riscv_isa_vendor_ext_list[i]; 771 + 772 + if (!ext_list->is_initialized) { 773 + bitmap_copy(ext_list->all_harts_isa_bitmap.isa, 774 + ext_list->per_hart_isa_bitmap[cpu].isa, 775 + RISCV_ISA_VENDOR_EXT_MAX); 776 + ext_list->is_initialized = true; 777 + } else { 778 + bitmap_and(ext_list->all_harts_isa_bitmap.isa, 779 + ext_list->all_harts_isa_bitmap.isa, 780 + ext_list->per_hart_isa_bitmap[cpu].isa, 781 + RISCV_ISA_VENDOR_EXT_MAX); 782 + } 783 + } 784 + } 785 + 719 786 static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) 720 787 { 721 788 unsigned int cpu; ··· 803 760 } 804 761 805 762 riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); 763 + riscv_fill_cpu_vendor_ext(cpu_node, cpu); 806 764 807 765 of_node_put(cpu_node); 808 766 ··· 820 776 bitmap_copy(riscv_isa, isainfo->isa, RISCV_ISA_EXT_MAX); 821 777 else 822 778 bitmap_and(riscv_isa, riscv_isa, isainfo->isa, RISCV_ISA_EXT_MAX); 779 + 780 + riscv_fill_vendor_ext_list(cpu); 823 781 } 824 782 825 783 if (bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX)) ··· 964 918 { 965 919 struct alt_entry *alt; 966 920 void *oldptr, *altptr; 967 - u16 id, value; 921 + u16 id, value, vendor; 968 922 969 923 if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) 970 924 return; 971 925 972 926 for (alt = begin; alt < end; alt++) { 973 - if (alt->vendor_id != 0) 974 - continue; 975 - 976 927 id = PATCH_ID_CPUFEATURE_ID(alt->patch_id); 928 + vendor = PATCH_ID_CPUFEATURE_ID(alt->vendor_id); 977 929 978 - if (id >= RISCV_ISA_EXT_MAX) { 930 + /* 931 + * Any alternative with a patch_id that is less than 932 + * RISCV_ISA_EXT_MAX is interpreted as a standard extension. 933 + * 934 + * Any alternative with patch_id that is greater than or equal 935 + * to RISCV_VENDOR_EXT_ALTERNATIVES_BASE is interpreted as a 936 + * vendor extension. 937 + */ 938 + if (id < RISCV_ISA_EXT_MAX) { 939 + /* 940 + * This patch should be treated as errata so skip 941 + * processing here. 942 + */ 943 + if (alt->vendor_id != 0) 944 + continue; 945 + 946 + if (!__riscv_isa_extension_available(NULL, id)) 947 + continue; 948 + 949 + value = PATCH_ID_CPUFEATURE_VALUE(alt->patch_id); 950 + if (!riscv_cpufeature_patch_check(id, value)) 951 + continue; 952 + } else if (id >= RISCV_VENDOR_EXT_ALTERNATIVES_BASE) { 953 + if (!__riscv_isa_vendor_extension_available(VENDOR_EXT_ALL_CPUS, vendor, 954 + id - RISCV_VENDOR_EXT_ALTERNATIVES_BASE)) 955 + continue; 956 + } else { 979 957 WARN(1, "This extension id:%d is not in ISA extension list", id); 980 958 continue; 981 959 } 982 - 983 - if (!__riscv_isa_extension_available(NULL, id)) 984 - continue; 985 - 986 - value = PATCH_ID_CPUFEATURE_VALUE(alt->patch_id); 987 - if (!riscv_cpufeature_patch_check(id, value)) 988 - continue; 989 960 990 961 oldptr = ALT_OLD_PTR(alt); 991 962 altptr = ALT_ALT_PTR(alt);
+14 -7
arch/riscv/kernel/entry.S
··· 88 88 call riscv_v_context_nesting_start 89 89 #endif 90 90 move a0, sp /* pt_regs */ 91 - la ra, ret_from_exception 92 91 93 92 /* 94 93 * MSB of cause differentiates between ··· 96 97 bge s4, zero, 1f 97 98 98 99 /* Handle interrupts */ 99 - tail do_irq 100 + call do_irq 101 + j ret_from_exception 100 102 1: 101 103 /* Handle other exceptions */ 102 104 slli t0, s4, RISCV_LGPTR ··· 105 105 la t2, excp_vect_table_end 106 106 add t0, t1, t0 107 107 /* Check if exception code lies within bounds */ 108 - bgeu t0, t2, 1f 109 - REG_L t0, 0(t0) 110 - jr t0 111 - 1: 112 - tail do_trap_unknown 108 + bgeu t0, t2, 3f 109 + REG_L t1, 0(t0) 110 + 2: jalr t1 111 + j ret_from_exception 112 + 3: 113 + 114 + la t1, do_trap_unknown 115 + j 2b 113 116 SYM_CODE_END(handle_exception) 114 117 ASM_NOKPROBE(handle_exception) 115 118 ··· 132 129 andi s0, s0, SR_SPP 133 130 #endif 134 131 bnez s0, 1f 132 + 133 + #ifdef CONFIG_GCC_PLUGIN_STACKLEAK 134 + call stackleak_erase_on_task_stack 135 + #endif 135 136 136 137 /* Save unwound kernel stack pointer in thread_info */ 137 138 addi s0, sp, PT_SIZE_ON_STACK
-1
arch/riscv/kernel/probes/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-$(CONFIG_KPROBES) += kprobes.o decode-insn.o simulate-insn.o 3 3 obj-$(CONFIG_RETHOOK) += rethook.o rethook_trampoline.o 4 - obj-$(CONFIG_KPROBES_ON_FTRACE) += ftrace.o 5 4 obj-$(CONFIG_UPROBES) += uprobes.o decode-insn.o simulate-insn.o 6 5 CFLAGS_REMOVE_simulate-insn.o = $(CC_FLAGS_FTRACE) 7 6 CFLAGS_REMOVE_rethook.o = $(CC_FLAGS_FTRACE)
-65
arch/riscv/kernel/probes/ftrace.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - #include <linux/kprobes.h> 4 - 5 - /* Ftrace callback handler for kprobes -- called under preepmt disabled */ 6 - void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, 7 - struct ftrace_ops *ops, struct ftrace_regs *fregs) 8 - { 9 - struct kprobe *p; 10 - struct pt_regs *regs; 11 - struct kprobe_ctlblk *kcb; 12 - int bit; 13 - 14 - if (unlikely(kprobe_ftrace_disabled)) 15 - return; 16 - 17 - bit = ftrace_test_recursion_trylock(ip, parent_ip); 18 - if (bit < 0) 19 - return; 20 - 21 - p = get_kprobe((kprobe_opcode_t *)ip); 22 - if (unlikely(!p) || kprobe_disabled(p)) 23 - goto out; 24 - 25 - regs = ftrace_get_regs(fregs); 26 - kcb = get_kprobe_ctlblk(); 27 - if (kprobe_running()) { 28 - kprobes_inc_nmissed_count(p); 29 - } else { 30 - unsigned long orig_ip = instruction_pointer(regs); 31 - 32 - instruction_pointer_set(regs, ip); 33 - 34 - __this_cpu_write(current_kprobe, p); 35 - kcb->kprobe_status = KPROBE_HIT_ACTIVE; 36 - if (!p->pre_handler || !p->pre_handler(p, regs)) { 37 - /* 38 - * Emulate singlestep (and also recover regs->pc) 39 - * as if there is a nop 40 - */ 41 - instruction_pointer_set(regs, 42 - (unsigned long)p->addr + MCOUNT_INSN_SIZE); 43 - if (unlikely(p->post_handler)) { 44 - kcb->kprobe_status = KPROBE_HIT_SSDONE; 45 - p->post_handler(p, regs, 0); 46 - } 47 - instruction_pointer_set(regs, orig_ip); 48 - } 49 - 50 - /* 51 - * If pre_handler returns !0, it changes regs->pc. We have to 52 - * skip emulating post_handler. 53 - */ 54 - __this_cpu_write(current_kprobe, NULL); 55 - } 56 - out: 57 - ftrace_test_recursion_unlock(bit); 58 - } 59 - NOKPROBE_SYMBOL(kprobe_ftrace_handler); 60 - 61 - int arch_prepare_kprobe_ftrace(struct kprobe *p) 62 - { 63 - p->ainsn.api.insn = NULL; 64 - return 0; 65 - }
+3 -1
arch/riscv/kernel/setup.c
··· 281 281 setup_smp(); 282 282 #endif 283 283 284 - if (!acpi_disabled) 284 + if (!acpi_disabled) { 285 285 acpi_init_rintc_map(); 286 + acpi_map_cpus_to_nodes(); 287 + } 286 288 287 289 riscv_init_cbo_blocksizes(); 288 290 riscv_fill_hwcap();
+1 -1
arch/riscv/kernel/signal.c
··· 84 84 datap = state + 1; 85 85 86 86 /* datap is designed to be 16 byte aligned for better performance */ 87 - WARN_ON(unlikely(!IS_ALIGNED((unsigned long)datap, 16))); 87 + WARN_ON(!IS_ALIGNED((unsigned long)datap, 16)); 88 88 89 89 get_cpu_vector_context(); 90 90 riscv_v_vstate_save(&current->thread.vstate, regs);
-2
arch/riscv/kernel/smpboot.c
··· 96 96 if (hart == cpuid_to_hartid_map(0)) { 97 97 BUG_ON(found_boot_cpu); 98 98 found_boot_cpu = true; 99 - early_map_cpu_to_node(0, acpi_numa_get_nid(cpu_count)); 100 99 return 0; 101 100 } 102 101 ··· 105 106 } 106 107 107 108 cpuid_to_hartid_map(cpu_count) = hart; 108 - early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count)); 109 109 cpu_count++; 110 110 111 111 return 0;
+2 -2
arch/riscv/kernel/stacktrace.c
··· 16 16 17 17 #ifdef CONFIG_FRAME_POINTER 18 18 19 - extern asmlinkage void ret_from_exception(void); 19 + extern asmlinkage void handle_exception(void); 20 20 21 21 static inline int fp_is_valid(unsigned long fp, unsigned long sp) 22 22 { ··· 71 71 fp = frame->fp; 72 72 pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra, 73 73 &frame->ra); 74 - if (pc == (unsigned long)ret_from_exception) { 74 + if (pc == (unsigned long)handle_exception) { 75 75 if (unlikely(!__kernel_text_address(pc) || !fn(arg, pc))) 76 76 break; 77 77
+26 -22
arch/riscv/kernel/sys_hwprobe.c
··· 9 9 #include <asm/cpufeature.h> 10 10 #include <asm/hwprobe.h> 11 11 #include <asm/processor.h> 12 + #include <asm/delay.h> 12 13 #include <asm/sbi.h> 13 14 #include <asm/switch_to.h> 14 15 #include <asm/uaccess.h> ··· 94 93 * regardless of the kernel's configuration, as no other checks, besides 95 94 * presence in the hart_isa bitmap, are made. 96 95 */ 96 + EXT_KEY(ZACAS); 97 + EXT_KEY(ZAWRS); 97 98 EXT_KEY(ZBA); 98 99 EXT_KEY(ZBB); 99 - EXT_KEY(ZBS); 100 - EXT_KEY(ZICBOZ); 101 100 EXT_KEY(ZBC); 102 - 103 101 EXT_KEY(ZBKB); 104 102 EXT_KEY(ZBKC); 105 103 EXT_KEY(ZBKX); 104 + EXT_KEY(ZBS); 105 + EXT_KEY(ZCA); 106 + EXT_KEY(ZCB); 107 + EXT_KEY(ZCMOP); 108 + EXT_KEY(ZICBOZ); 109 + EXT_KEY(ZICOND); 110 + EXT_KEY(ZIHINTNTL); 111 + EXT_KEY(ZIHINTPAUSE); 112 + EXT_KEY(ZIMOP); 106 113 EXT_KEY(ZKND); 107 114 EXT_KEY(ZKNE); 108 115 EXT_KEY(ZKNH); 109 116 EXT_KEY(ZKSED); 110 117 EXT_KEY(ZKSH); 111 118 EXT_KEY(ZKT); 112 - EXT_KEY(ZIHINTNTL); 113 119 EXT_KEY(ZTSO); 114 - EXT_KEY(ZACAS); 115 - EXT_KEY(ZICOND); 116 - EXT_KEY(ZIHINTPAUSE); 117 - EXT_KEY(ZIMOP); 118 - EXT_KEY(ZCA); 119 - EXT_KEY(ZCB); 120 - EXT_KEY(ZCMOP); 121 - EXT_KEY(ZAWRS); 122 120 123 121 /* 124 122 * All the following extensions must depend on the kernel 125 123 * support of V. 126 124 */ 127 125 if (has_vector()) { 128 - EXT_KEY(ZVE32X); 129 - EXT_KEY(ZVE32F); 130 - EXT_KEY(ZVE64X); 131 - EXT_KEY(ZVE64F); 132 - EXT_KEY(ZVE64D); 133 126 EXT_KEY(ZVBB); 134 127 EXT_KEY(ZVBC); 128 + EXT_KEY(ZVE32F); 129 + EXT_KEY(ZVE32X); 130 + EXT_KEY(ZVE64D); 131 + EXT_KEY(ZVE64F); 132 + EXT_KEY(ZVE64X); 133 + EXT_KEY(ZVFH); 134 + EXT_KEY(ZVFHMIN); 135 135 EXT_KEY(ZVKB); 136 136 EXT_KEY(ZVKG); 137 137 EXT_KEY(ZVKNED); ··· 141 139 EXT_KEY(ZVKSED); 142 140 EXT_KEY(ZVKSH); 143 141 EXT_KEY(ZVKT); 144 - EXT_KEY(ZVFH); 145 - EXT_KEY(ZVFHMIN); 146 142 } 147 143 148 144 if (has_fpu()) { 149 - EXT_KEY(ZFH); 150 - EXT_KEY(ZFHMIN); 151 - EXT_KEY(ZFA); 152 145 EXT_KEY(ZCD); 153 146 EXT_KEY(ZCF); 147 + EXT_KEY(ZFA); 148 + EXT_KEY(ZFH); 149 + EXT_KEY(ZFHMIN); 154 150 } 155 151 #undef EXT_KEY 156 152 } ··· 235 235 break; 236 236 case RISCV_HWPROBE_KEY_HIGHEST_VIRT_ADDRESS: 237 237 pair->value = user_max_virt_addr(); 238 + break; 239 + 240 + case RISCV_HWPROBE_KEY_TIME_CSR_FREQ: 241 + pair->value = riscv_timebase; 238 242 break; 239 243 240 244 /*
+56
arch/riscv/kernel/vendor_extensions.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright 2024 Rivos, Inc 4 + */ 5 + 6 + #include <asm/vendorid_list.h> 7 + #include <asm/vendor_extensions.h> 8 + #include <asm/vendor_extensions/andes.h> 9 + 10 + #include <linux/array_size.h> 11 + #include <linux/types.h> 12 + 13 + struct riscv_isa_vendor_ext_data_list *riscv_isa_vendor_ext_list[] = { 14 + #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES 15 + &riscv_isa_vendor_ext_list_andes, 16 + #endif 17 + }; 18 + 19 + const size_t riscv_isa_vendor_ext_list_size = ARRAY_SIZE(riscv_isa_vendor_ext_list); 20 + 21 + /** 22 + * __riscv_isa_vendor_extension_available() - Check whether given vendor 23 + * extension is available or not. 24 + * 25 + * @cpu: check if extension is available on this cpu 26 + * @vendor: vendor that the extension is a member of 27 + * @bit: bit position of the desired extension 28 + * Return: true or false 29 + * 30 + * NOTE: When cpu is -1, will check if extension is available on all cpus 31 + */ 32 + bool __riscv_isa_vendor_extension_available(int cpu, unsigned long vendor, unsigned int bit) 33 + { 34 + struct riscv_isavendorinfo *bmap; 35 + struct riscv_isavendorinfo *cpu_bmap; 36 + 37 + switch (vendor) { 38 + #ifdef CONFIG_RISCV_ISA_VENDOR_EXT_ANDES 39 + case ANDES_VENDOR_ID: 40 + bmap = &riscv_isa_vendor_ext_list_andes.all_harts_isa_bitmap; 41 + cpu_bmap = &riscv_isa_vendor_ext_list_andes.per_hart_isa_bitmap[cpu]; 42 + break; 43 + #endif 44 + default: 45 + return false; 46 + } 47 + 48 + if (cpu != -1) 49 + bmap = &cpu_bmap[cpu]; 50 + 51 + if (bit >= RISCV_ISA_VENDOR_EXT_MAX) 52 + return false; 53 + 54 + return test_bit(bit, bmap->isa) ? true : false; 55 + } 56 + EXPORT_SYMBOL_GPL(__riscv_isa_vendor_extension_available);
+3
arch/riscv/kernel/vendor_extensions/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + obj-$(CONFIG_RISCV_ISA_VENDOR_EXT_ANDES) += andes.o
+18
arch/riscv/kernel/vendor_extensions/andes.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + 3 + #include <asm/cpufeature.h> 4 + #include <asm/vendor_extensions.h> 5 + #include <asm/vendor_extensions/andes.h> 6 + 7 + #include <linux/array_size.h> 8 + #include <linux/types.h> 9 + 10 + /* All Andes vendor extensions supported in Linux */ 11 + const struct riscv_isa_ext_data riscv_isa_vendor_ext_andes[] = { 12 + __RISCV_ISA_EXT_DATA(xandespmu, RISCV_ISA_VENDOR_EXT_XANDESPMU), 13 + }; 14 + 15 + struct riscv_isa_vendor_ext_data_list riscv_isa_vendor_ext_list_andes = { 16 + .ext_data_count = ARRAY_SIZE(riscv_isa_vendor_ext_andes), 17 + .ext_data = riscv_isa_vendor_ext_andes, 18 + };
+1 -4
drivers/acpi/numa/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 config ACPI_NUMA 3 - bool "NUMA support" 4 - depends on NUMA 5 - depends on (X86 || ARM64 || LOONGARCH) 6 - default y if ARM64 3 + def_bool NUMA && !X86 7 4 8 5 config ACPI_HMAT 9 6 bool "ACPI Heterogeneous Memory Attribute Table Support"
+31 -1
drivers/acpi/numa/srat.c
··· 167 167 } 168 168 } 169 169 break; 170 + 171 + case ACPI_SRAT_TYPE_RINTC_AFFINITY: 172 + { 173 + struct acpi_srat_rintc_affinity *p = 174 + (struct acpi_srat_rintc_affinity *)header; 175 + pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n", 176 + p->acpi_processor_uid, 177 + p->proximity_domain, 178 + (p->flags & ACPI_SRAT_RINTC_ENABLED) ? 179 + "enabled" : "disabled"); 180 + } 181 + break; 182 + 170 183 default: 171 184 pr_warn("Found unsupported SRAT entry (type = 0x%x)\n", 172 185 header->type); ··· 463 450 } 464 451 #endif /* defined(CONFIG_X86) || defined (CONFIG_ARM64) */ 465 452 453 + static int __init 454 + acpi_parse_rintc_affinity(union acpi_subtable_headers *header, 455 + const unsigned long end) 456 + { 457 + struct acpi_srat_rintc_affinity *rintc_affinity; 458 + 459 + rintc_affinity = (struct acpi_srat_rintc_affinity *)header; 460 + acpi_table_print_srat_entry(&header->common); 461 + 462 + /* let architecture-dependent part to do it */ 463 + acpi_numa_rintc_affinity_init(rintc_affinity); 464 + 465 + return 0; 466 + } 467 + 466 468 static int __init acpi_parse_srat(struct acpi_table_header *table) 467 469 { 468 470 struct acpi_table_srat *srat = (struct acpi_table_srat *)table; ··· 513 485 514 486 /* SRAT: System Resource Affinity Table */ 515 487 if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { 516 - struct acpi_subtable_proc srat_proc[4]; 488 + struct acpi_subtable_proc srat_proc[5]; 517 489 518 490 memset(srat_proc, 0, sizeof(srat_proc)); 519 491 srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY; ··· 524 496 srat_proc[2].handler = acpi_parse_gicc_affinity; 525 497 srat_proc[3].id = ACPI_SRAT_TYPE_GENERIC_AFFINITY; 526 498 srat_proc[3].handler = acpi_parse_gi_affinity; 499 + srat_proc[4].id = ACPI_SRAT_TYPE_RINTC_AFFINITY; 500 + srat_proc[4].handler = acpi_parse_rintc_affinity; 527 501 528 502 acpi_table_parse_entries_array(ACPI_SIG_SRAT, 529 503 sizeof(struct acpi_table_srat),
+1 -1
drivers/base/arch_numa.c
··· 445 445 446 446 ret = acpi_numa_init(); 447 447 if (ret) { 448 - pr_info("Failed to initialise from firmware\n"); 448 + pr_debug("Failed to initialise from firmware\n"); 449 449 return ret; 450 450 } 451 451
+2 -1
drivers/firmware/efi/libstub/Makefile
··· 28 28 -DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \ 29 29 -DEFI_HAVE_STRCMP -fno-builtin -fpic \ 30 30 $(call cc-option,-mno-single-pic-base) 31 - cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax 31 + cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax \ 32 + $(DISABLE_STACKLEAK_PLUGIN) 32 33 cflags-$(CONFIG_LOONGARCH) += -fpie 33 34 34 35 cflags-$(CONFIG_EFI_PARAMS_FROM_FDT) += -I$(srctree)/scripts/dtc/libfdt
+8 -3
drivers/perf/riscv_pmu_sbi.c
··· 25 25 #include <asm/errata_list.h> 26 26 #include <asm/sbi.h> 27 27 #include <asm/cpufeature.h> 28 + #include <asm/vendor_extensions.h> 29 + #include <asm/vendor_extensions/andes.h> 28 30 29 31 #define ALT_SBI_PMU_OVERFLOW(__ovl) \ 30 32 asm volatile(ALTERNATIVE_2( \ ··· 35 33 THEAD_VENDOR_ID, ERRATA_THEAD_PMU, \ 36 34 CONFIG_ERRATA_THEAD_PMU, \ 37 35 "csrr %0, " __stringify(ANDES_CSR_SCOUNTEROF), \ 38 - 0, RISCV_ISA_EXT_XANDESPMU, \ 36 + ANDES_VENDOR_ID, \ 37 + RISCV_ISA_VENDOR_EXT_XANDESPMU + RISCV_VENDOR_EXT_ALTERNATIVES_BASE, \ 39 38 CONFIG_ANDES_CUSTOM_PMU) \ 40 39 : "=r" (__ovl) : \ 41 40 : "memory") ··· 45 42 asm volatile(ALTERNATIVE( \ 46 43 "csrc " __stringify(CSR_IP) ", %0\n\t", \ 47 44 "csrc " __stringify(ANDES_CSR_SLIP) ", %0\n\t", \ 48 - 0, RISCV_ISA_EXT_XANDESPMU, \ 45 + ANDES_VENDOR_ID, \ 46 + RISCV_ISA_VENDOR_EXT_XANDESPMU + RISCV_VENDOR_EXT_ALTERNATIVES_BASE, \ 49 47 CONFIG_ANDES_CUSTOM_PMU) \ 50 48 : : "r"(__irq_mask) \ 51 49 : "memory") ··· 1099 1095 riscv_cached_mimpid(0) == 0) { 1100 1096 riscv_pmu_irq_num = THEAD_C9XX_RV_IRQ_PMU; 1101 1097 riscv_pmu_use_irq = true; 1102 - } else if (riscv_isa_extension_available(NULL, XANDESPMU) && 1098 + } else if (riscv_has_vendor_extension_unlikely(ANDES_VENDOR_ID, 1099 + RISCV_ISA_VENDOR_EXT_XANDESPMU) && 1103 1100 IS_ENABLED(CONFIG_ANDES_CUSTOM_PMU)) { 1104 1101 riscv_pmu_irq_num = ANDES_SLI_CAUSE_BASE + ANDES_RV_IRQ_PMOVI; 1105 1102 riscv_pmu_use_irq = true;
+6
include/linux/acpi.h
··· 259 259 acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { } 260 260 #endif 261 261 262 + #ifdef CONFIG_RISCV 263 + void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa); 264 + #else 265 + static inline void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) { } 266 + #endif 267 + 262 268 #ifndef PHYS_CPUID_INVALID 263 269 typedef u32 phys_cpuid_t; 264 270 #define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)