|
@@ -32,6 +32,8 @@
|
|
|
#define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset)
|
|
|
#define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset)
|
|
|
|
|
|
+int alternatives_applied;
|
|
|
+
|
|
|
struct alt_region {
|
|
|
struct alt_instr *begin;
|
|
|
struct alt_instr *end;
|
|
@@ -143,7 +145,6 @@ static void __apply_alternatives(void *alt_region, bool use_linear_alias)
|
|
|
*/
|
|
|
static int __apply_alternatives_multi_stop(void *unused)
|
|
|
{
|
|
|
- static int patched = 0;
|
|
|
struct alt_region region = {
|
|
|
.begin = (struct alt_instr *)__alt_instructions,
|
|
|
.end = (struct alt_instr *)__alt_instructions_end,
|
|
@@ -151,14 +152,14 @@ static int __apply_alternatives_multi_stop(void *unused)
|
|
|
|
|
|
/* We always have a CPU 0 at this point (__init) */
|
|
|
if (smp_processor_id()) {
|
|
|
- while (!READ_ONCE(patched))
|
|
|
+ while (!READ_ONCE(alternatives_applied))
|
|
|
cpu_relax();
|
|
|
isb();
|
|
|
} else {
|
|
|
- BUG_ON(patched);
|
|
|
+ BUG_ON(alternatives_applied);
|
|
|
__apply_alternatives(®ion, true);
|
|
|
/* Barriers provided by the cache flushing */
|
|
|
- WRITE_ONCE(patched, 1);
|
|
|
+ WRITE_ONCE(alternatives_applied, 1);
|
|
|
}
|
|
|
|
|
|
return 0;
|