@@ -268,7 +268,7 @@ struct microcode_ctrl {
268
268
};
269
269
270
270
static DEFINE_PER_CPU (struct microcode_ctrl , ucode_ctrl ) ;
271
- static atomic_t late_cpus_in , late_cpus_out ;
271
+ static atomic_t late_cpus_in ;
272
272
273
273
static bool wait_for_cpus (atomic_t * cnt )
274
274
{
@@ -304,7 +304,7 @@ static bool wait_for_ctrl(void)
304
304
return false;
305
305
}
306
306
307
- static __maybe_unused void load_secondary (unsigned int cpu )
307
+ static void load_secondary (unsigned int cpu )
308
308
{
309
309
unsigned int ctrl_cpu = this_cpu_read (ucode_ctrl .ctrl_cpu );
310
310
enum ucode_state ret ;
@@ -339,7 +339,7 @@ static __maybe_unused void load_secondary(unsigned int cpu)
339
339
this_cpu_write (ucode_ctrl .ctrl , SCTRL_DONE );
340
340
}
341
341
342
- static __maybe_unused void load_primary (unsigned int cpu )
342
+ static void load_primary (unsigned int cpu )
343
343
{
344
344
struct cpumask * secondaries = topology_sibling_cpumask (cpu );
345
345
enum sibling_ctrl ctrl ;
@@ -376,46 +376,14 @@ static __maybe_unused void load_primary(unsigned int cpu)
376
376
377
377
static int load_cpus_stopped (void * unused )
378
378
{
379
- int cpu = smp_processor_id ();
380
- enum ucode_state ret ;
381
-
382
- /*
383
- * Wait for all CPUs to arrive. A load will not be attempted unless all
384
- * CPUs show up.
385
- * */
386
- if (!wait_for_cpus (& late_cpus_in )) {
387
- this_cpu_write (ucode_ctrl .result , UCODE_TIMEOUT );
388
- return 0 ;
389
- }
390
-
391
- /*
392
- * On an SMT system, it suffices to load the microcode on one sibling of
393
- * the core because the microcode engine is shared between the threads.
394
- * Synchronization still needs to take place so that no concurrent
395
- * loading attempts happen on multiple threads of an SMT core. See
396
- * below.
397
- */
398
- if (cpumask_first (topology_sibling_cpumask (cpu )) != cpu )
399
- goto wait_for_siblings ;
379
+ unsigned int cpu = smp_processor_id ();
400
380
401
- ret = microcode_ops -> apply_microcode (cpu );
402
- this_cpu_write (ucode_ctrl .result , ret );
403
-
404
- wait_for_siblings :
405
- if (!wait_for_cpus (& late_cpus_out ))
406
- panic ("Timeout during microcode update!\n" );
407
-
408
- /*
409
- * At least one thread has completed update on each core.
410
- * For others, simply call the update to make sure the
411
- * per-cpu cpuinfo can be updated with right microcode
412
- * revision.
413
- */
414
- if (cpumask_first (topology_sibling_cpumask (cpu )) == cpu )
415
- return 0 ;
381
+ if (this_cpu_read (ucode_ctrl .ctrl_cpu ) == cpu )
382
+ load_primary (cpu );
383
+ else
384
+ load_secondary (cpu );
416
385
417
- ret = microcode_ops -> apply_microcode (cpu );
418
- this_cpu_write (ucode_ctrl .result , ret );
386
+ /* No point to wait here. The CPUs will all wait in stop_machine(). */
419
387
return 0 ;
420
388
}
421
389
@@ -429,7 +397,6 @@ static int load_late_stop_cpus(void)
429
397
pr_err ("You should switch to early loading, if possible.\n" );
430
398
431
399
atomic_set (& late_cpus_in , num_online_cpus ());
432
- atomic_set (& late_cpus_out , num_online_cpus ());
433
400
434
401
/*
435
402
* Take a snapshot before the microcode update in order to compare and
0 commit comments