• Home
  • Raw
  • Download

Lines Matching +full:value +full:- +full:start

1 // SPDX-License-Identifier: GPL-2.0-or-later
19 #include <asm/code-patching.h>
29 unsigned long value; member
40 * the start of the alt_entry, to support the VDSO. This in calc_addr()
70 static int patch_feature_section(unsigned long value, struct fixup_entry *fcur) in patch_feature_section() argument
72 struct ppc_inst *start, *end, *alt_start, *alt_end, *src, *dest, nop; in patch_feature_section() local
74 start = calc_addr(fcur, fcur->start_off); in patch_feature_section()
75 end = calc_addr(fcur, fcur->end_off); in patch_feature_section()
76 alt_start = calc_addr(fcur, fcur->alt_start_off); in patch_feature_section()
77 alt_end = calc_addr(fcur, fcur->alt_end_off); in patch_feature_section()
79 if ((alt_end - alt_start) > (end - start)) in patch_feature_section()
82 if ((value & fcur->mask) == fcur->value) in patch_feature_section()
86 dest = start; in patch_feature_section()
101 void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end) in do_feature_fixups() argument
109 if (patch_feature_section(value, fcur)) { in do_feature_fixups()
111 printk("Unable to patch feature section at %p - %p" \ in do_feature_fixups()
112 " with %p - %p\n", in do_feature_fixups()
113 calc_addr(fcur, fcur->start_off), in do_feature_fixups()
114 calc_addr(fcur, fcur->end_off), in do_feature_fixups()
115 calc_addr(fcur, fcur->alt_start_off), in do_feature_fixups()
116 calc_addr(fcur, fcur->alt_end_off)); in do_feature_fixups()
125 long *start, *end; in do_stf_entry_barrier_fixups() local
128 start = PTRRELOC(&__start___stf_entry_barrier_fixup), in do_stf_entry_barrier_fixups()
148 for (i = 0; start < end; start++, i++) { in do_stf_entry_barrier_fixups()
149 dest = (void *)start + *start; in do_stf_entry_barrier_fixups()
166 printk(KERN_DEBUG "stf-barrier: patched %d entry locations (%s barrier)\n", i, in do_stf_entry_barrier_fixups()
177 long *start, *end; in do_stf_exit_barrier_fixups() local
180 start = PTRRELOC(&__start___stf_exit_barrier_fixup), in do_stf_exit_barrier_fixups()
211 for (i = 0; start < end; start++, i++) { in do_stf_exit_barrier_fixups()
212 dest = (void *)start + *start; in do_stf_exit_barrier_fixups()
223 printk(KERN_DEBUG "stf-barrier: patched %d exit locations (%s barrier)\n", i, in do_stf_exit_barrier_fixups()
244 * The call to the fallback entry flush, and the fallback/sync-ori exit in do_stf_barrier_fixups()
255 long *start, *end; in do_uaccess_flush_fixups() local
258 start = PTRRELOC(&__start___uaccess_flush_fixup); in do_uaccess_flush_fixups()
280 for (i = 0; start < end; start++, i++) { in do_uaccess_flush_fixups()
281 dest = (void *)start + *start; in do_uaccess_flush_fixups()
292 printk(KERN_DEBUG "uaccess-flush: patched %d locations (%s flush)\n", i, in do_uaccess_flush_fixups()
306 long *start, *end; in __do_entry_flush_fixups() local
328 start = PTRRELOC(&__start___entry_flush_fixup); in __do_entry_flush_fixups()
330 for (i = 0; start < end; start++, i++) { in __do_entry_flush_fixups()
331 dest = (void *)start + *start; in __do_entry_flush_fixups()
346 start = PTRRELOC(&__start___scv_entry_flush_fixup); in __do_entry_flush_fixups()
348 for (; start < end; start++, i++) { in __do_entry_flush_fixups()
349 dest = (void *)start + *start; in __do_entry_flush_fixups()
365 printk(KERN_DEBUG "entry-flush: patched %d locations (%s flush)\n", i, in __do_entry_flush_fixups()
391 long *start, *end; in do_rfi_flush_fixups() local
394 start = PTRRELOC(&__start___rfi_flush_fixup), in do_rfi_flush_fixups()
414 for (i = 0; start < end; start++, i++) { in do_rfi_flush_fixups()
415 dest = (void *)start + *start; in do_rfi_flush_fixups()
424 printk(KERN_DEBUG "rfi-flush: patched %d locations (%s flush)\n", i, in do_rfi_flush_fixups()
437 long *start, *end; in do_barrier_nospec_fixups_range() local
440 start = fixup_start; in do_barrier_nospec_fixups_range()
446 pr_info("barrier-nospec: using ORI speculation barrier\n"); in do_barrier_nospec_fixups_range()
450 for (i = 0; start < end; start++, i++) { in do_barrier_nospec_fixups_range()
451 dest = (void *)start + *start; in do_barrier_nospec_fixups_range()
457 printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i); in do_barrier_nospec_fixups_range()
465 void *start, *end; in do_barrier_nospec_fixups() local
467 start = PTRRELOC(&__start___barrier_nospec_fixup), in do_barrier_nospec_fixups()
470 do_barrier_nospec_fixups_range(enable, start, end); in do_barrier_nospec_fixups()
478 long *start, *end; in do_barrier_nospec_fixups_range() local
481 start = fixup_start; in do_barrier_nospec_fixups_range()
488 pr_info("barrier-nospec: using isync; sync as speculation barrier\n"); in do_barrier_nospec_fixups_range()
493 for (i = 0; start < end; start++, i++) { in do_barrier_nospec_fixups_range()
494 dest = (void *)start + *start; in do_barrier_nospec_fixups_range()
501 printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i); in do_barrier_nospec_fixups_range()
506 unsigned int *start, *end; in patch_btb_flush_section() local
508 start = (void *)curr + *curr; in patch_btb_flush_section()
510 for (; start < end; start++) { in patch_btb_flush_section()
511 pr_devel("patching dest %lx\n", (unsigned long)start); in patch_btb_flush_section()
512 patch_instruction((struct ppc_inst *)start, ppc_inst(PPC_INST_NOP)); in patch_btb_flush_section()
518 long *start, *end; in do_btb_flush_fixups() local
520 start = PTRRELOC(&__start__btb_flush_fixup); in do_btb_flush_fixups()
523 for (; start < end; start += 2) in do_btb_flush_fixups()
524 patch_btb_flush_section(start); in do_btb_flush_fixups()
528 void do_lwsync_fixups(unsigned long value, void *fixup_start, void *fixup_end) in do_lwsync_fixups() argument
530 long *start, *end; in do_lwsync_fixups() local
533 if (!(value & CPU_FTR_LWSYNC)) in do_lwsync_fixups()
536 start = fixup_start; in do_lwsync_fixups()
539 for (; start < end; start++) { in do_lwsync_fixups()
540 dest = (void *)start + *start; in do_lwsync_fixups()
555 end = (void *)src + (__end_interrupts - _stext); in do_final_fixups()
576 *PTRRELOC(&saved_cpu_features) = spec->cpu_features; in apply_feature_fixups()
577 *PTRRELOC(&saved_mmu_features) = spec->mmu_features; in apply_feature_fixups()
580 * Apply the CPU-specific and firmware specific fixups to kernel text in apply_feature_fixups()
583 do_feature_fixups(spec->cpu_features, in apply_feature_fixups()
587 do_feature_fixups(spec->mmu_features, in apply_feature_fixups()
591 do_lwsync_fixups(spec->cpu_features, in apply_feature_fixups()
617 WARN(saved_cpu_features != cur_cpu_spec->cpu_features, in check_features()
619 WARN(saved_mmu_features != cur_cpu_spec->mmu_features, in check_features()
633 if (!(x)) printk("feature-fixups: test failed at line %d\n", __LINE__);
640 return (unsigned long)p - (unsigned long)entry; in calc_offset()
649 int size = 4 * (end_ftr_fixup_test1 - ftr_fixup_test1); in test_basic_patching()
651 fixup.value = fixup.mask = 8; in test_basic_patching()
659 /* Check we don't patch if the value matches */ in test_basic_patching()
663 /* Check we do patch if the value doesn't match */ in test_basic_patching()
681 int size = 4 * (end_ftr_fixup_test2 - ftr_fixup_test2); in test_alternative_patching()
683 fixup.value = fixup.mask = 0xF; in test_alternative_patching()
692 /* Check we don't patch if the value matches */ in test_alternative_patching()
696 /* Check we do patch if the value doesn't match */ in test_alternative_patching()
713 int size = 4 * (end_ftr_fixup_test3 - ftr_fixup_test3); in test_alternative_case_too_big()
715 fixup.value = fixup.mask = 0xC; in test_alternative_case_too_big()
740 int size = 4 * (end_ftr_fixup_test4 - ftr_fixup_test4); in test_alternative_case_too_small()
743 /* Check a high-bit flag */ in test_alternative_case_too_small()
744 flag = 1UL << ((sizeof(unsigned long) - 1) * 8); in test_alternative_case_too_small()
745 fixup.value = fixup.mask = flag; in test_alternative_case_too_small()
754 /* Check we don't patch if the value matches */ in test_alternative_case_too_small()
758 /* Check we do patch if the value doesn't match */ in test_alternative_case_too_small()
774 int size = 4 * (end_ftr_fixup_test5 - ftr_fixup_test5); in test_alternative_case_with_branch()
784 int size = 4 * (end_ftr_fixup_test6 - ftr_fixup_test6); in test_alternative_case_with_external_branch()
794 int size = 4 * (end_ftr_fixup_test7 - ftr_fixup_test7); in test_alternative_case_with_branch_to_end()
803 unsigned long size = ftr_fixup_test_FTR_macros_expected - in test_cpu_macros()
816 unsigned long size = ftr_fixup_test_FW_FTR_macros_expected - in test_fw_macros()
831 unsigned long size = end_lwsync_fixup_test - in test_lwsync_macros()
835 if (cur_cpu_spec->cpu_features & CPU_FTR_LWSYNC) { in test_lwsync_macros()
851 int size = sizeof(unsigned int) * (end_ftr_fixup_prefix1 - ftr_fixup_prefix1); in test_prefix_patching()
853 fixup.value = fixup.mask = 8; in test_prefix_patching()
873 int size = sizeof(unsigned int) * (end_ftr_fixup_prefix2 - ftr_fixup_prefix2); in test_prefix_alt_patching()
875 fixup.value = fixup.mask = 8; in test_prefix_alt_patching()
895 int size = sizeof(unsigned int) * (end_ftr_fixup_prefix3 - ftr_fixup_prefix3); in test_prefix_word_alt_patching()
897 fixup.value = fixup.mask = 8; in test_prefix_word_alt_patching()
918 printk(KERN_DEBUG "Running feature fixup self-tests ...\n"); in test_feature_fixups()