alternative.c (1745cfafebdfb017f6871c80f9894910a76373a4) | alternative.c (a35707c3d850dda0ceefb75b1b3bd191921d5765) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * alternative runtime patching 4 * inspired by the ARM64 and x86 version 5 * 6 * Copyright (C) 2021 Sifive. 7 */ 8 --- 29 unchanged lines hidden (view full) --- 38#endif 39 40 switch (cpu_mfr_info->vendor_id) { 41#ifdef CONFIG_ERRATA_SIFIVE 42 case SIFIVE_VENDOR_ID: 43 cpu_mfr_info->vendor_patch_func = sifive_errata_patch_func; 44 break; 45#endif | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * alternative runtime patching 4 * inspired by the ARM64 and x86 version 5 * 6 * Copyright (C) 2021 Sifive. 7 */ 8 --- 29 unchanged lines hidden (view full) --- 38#endif 39 40 switch (cpu_mfr_info->vendor_id) { 41#ifdef CONFIG_ERRATA_SIFIVE 42 case SIFIVE_VENDOR_ID: 43 cpu_mfr_info->vendor_patch_func = sifive_errata_patch_func; 44 break; 45#endif |
46#ifdef CONFIG_ERRATA_THEAD 47 case THEAD_VENDOR_ID: 48 cpu_mfr_info->vendor_patch_func = thead_errata_patch_func; 49 break; 50#endif |
|
46 default: 47 cpu_mfr_info->vendor_patch_func = NULL; 48 } 49} 50 51/* 52 * This is called very early in the boot process (directly after we run 53 * a feature detect on the boot CPU). No need to worry about other CPUs --- 23 unchanged lines hidden (view full) --- 77 /* If called on non-boot cpu things could go wrong */ 78 WARN_ON(smp_processor_id() != 0); 79 80 _apply_alternatives((struct alt_entry *)__alt_start, 81 (struct alt_entry *)__alt_end, 82 RISCV_ALTERNATIVES_BOOT); 83} 84 | 51 default: 52 cpu_mfr_info->vendor_patch_func = NULL; 53 } 54} 55 56/* 57 * This is called very early in the boot process (directly after we run 58 * a feature detect on the boot CPU). No need to worry about other CPUs --- 23 unchanged lines hidden (view full) --- 82 /* If called on non-boot cpu things could go wrong */ 83 WARN_ON(smp_processor_id() != 0); 84 85 _apply_alternatives((struct alt_entry *)__alt_start, 86 (struct alt_entry *)__alt_end, 87 RISCV_ALTERNATIVES_BOOT); 88} 89 |
90/* 91 * apply_early_boot_alternatives() is called from setup_vm() with MMU-off. 92 * 93 * Following requirements should be honoured for it to work correctly: 94 * 1) It should use PC-relative addressing for accessing kernel symbols. 95 * To achieve this we always use GCC cmodel=medany. 96 * 2) The compiler instrumentation for FTRACE will not work for setup_vm() 97 * so disable compiler instrumentation when FTRACE is enabled. 98 * 99 * Currently, the above requirements are honoured by using custom CFLAGS 100 * for alternative.o in kernel/Makefile. 101 */ 102void __init apply_early_boot_alternatives(void) 103{ 104#ifdef CONFIG_RISCV_ALTERNATIVE_EARLY 105 _apply_alternatives((struct alt_entry *)__alt_start, 106 (struct alt_entry *)__alt_end, 107 RISCV_ALTERNATIVES_EARLY_BOOT); 108#endif 109} 110 |
|
85#ifdef CONFIG_MODULES 86void apply_module_alternatives(void *start, size_t length) 87{ 88 _apply_alternatives((struct alt_entry *)start, 89 (struct alt_entry *)(start + length), 90 RISCV_ALTERNATIVES_MODULE); 91} 92#endif | 111#ifdef CONFIG_MODULES 112void apply_module_alternatives(void *start, size_t length) 113{ 114 _apply_alternatives((struct alt_entry *)start, 115 (struct alt_entry *)(start + length), 116 RISCV_ALTERNATIVES_MODULE); 117} 118#endif |