Lines Matching +full:- +full:alt

1 // SPDX-License-Identifier: GPL-2.0-only
20 #define __ALT_PTR(a,f) ((void *)&(a)->f + (a)->f)
44 static bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc) in branch_insn_requires_update() argument
46 unsigned long replptr = (unsigned long)ALT_REPL_PTR(alt); in branch_insn_requires_update()
47 return !(pc >= replptr && pc <= (replptr + alt->alt_len)); in branch_insn_requires_update()
50 #define align_down(x, a) ((unsigned long)(x) & ~(((unsigned long)(a)) - 1))
52 static u32 get_alt_insn(struct alt_instr *alt, __le32 *insnptr, __le32 *altinsnptr) in get_alt_insn() argument
69 if (branch_insn_requires_update(alt, target)) { in get_alt_insn()
70 offset = target - (unsigned long)insnptr; in get_alt_insn()
78 * If we're replacing an adrp instruction, which uses PC-relative in get_alt_insn()
84 new_offset = target - align_down(insnptr, SZ_4K); in get_alt_insn()
97 static void patch_alternative(struct alt_instr *alt, in patch_alternative() argument
103 replptr = ALT_REPL_PTR(alt); in patch_alternative()
107 insn = get_alt_insn(alt, origptr + i, replptr + i); in patch_alternative()
113 * We provide our own, private D-cache cleaning function so that we don't
124 cur = start & ~(d_size - 1); in clean_dcache_range_nopatch()
128 * Cortex-A53 errata 826319, 827319, 824069 and 819472 in clean_dcache_range_nopatch()
138 struct alt_instr *alt; in __apply_alternatives() local
143 for (alt = region->begin; alt < region->end; alt++) { in __apply_alternatives()
146 if (!test_bit(alt->cpufeature, feature_mask)) in __apply_alternatives()
150 if (alt->cpufeature < ARM64_CB_PATCH && in __apply_alternatives()
151 !cpus_have_cap(alt->cpufeature)) in __apply_alternatives()
154 if (alt->cpufeature == ARM64_CB_PATCH) in __apply_alternatives()
155 BUG_ON(alt->alt_len != 0); in __apply_alternatives()
157 BUG_ON(alt->alt_len != alt->orig_len); in __apply_alternatives()
161 origptr = ALT_ORIG_PTR(alt); in __apply_alternatives()
163 nr_inst = alt->orig_len / AARCH64_INSN_SIZE; in __apply_alternatives()
165 if (alt->cpufeature < ARM64_CB_PATCH) in __apply_alternatives()
168 alt_cb = ALT_REPL_PTR(alt); in __apply_alternatives()
170 alt_cb(alt, origptr, updptr, nr_inst); in __apply_alternatives()
244 /* If called on non-boot cpu things could go wrong */ in apply_boot_alternatives()