@@ -25,6 +25,22 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
25
25
struct alt_instr * entry ;
26
26
int index = 0 , applied = 0 ;
27
27
int num_cpus = num_online_cpus ();
28
+ u32 cond_check ;
29
+
30
+ cond_check = ALT_COND_ALWAYS |
31
+ ((num_cpus == 1 ) ? ALT_COND_NO_SMP : 0 ) |
32
+ ((cache_info .dc_size == 0 ) ? ALT_COND_NO_DCACHE : 0 ) |
33
+ ((cache_info .ic_size == 0 ) ? ALT_COND_NO_ICACHE : 0 ) |
34
+ (running_on_qemu ? ALT_COND_RUN_ON_QEMU : 0 ) |
35
+ ((split_tlb == 0 ) ? ALT_COND_NO_SPLIT_TLB : 0 ) |
36
+ /*
37
+ * If the PDC_MODEL capabilities has Non-coherent IO-PDIR bit
38
+ * set (bit #61, big endian), we have to flush and sync every
39
+ * time IO-PDIR is changed in Ike/Astro.
40
+ */
41
+ (((boot_cpu_data .cpu_type > pcxw_ ) &&
42
+ ((boot_cpu_data .pdc .capabilities & PDC_MODEL_IOPDIR_FDC ) == 0 ))
43
+ ? ALT_COND_NO_IOC_FDC : 0 );
28
44
29
45
for (entry = start ; entry < end ; entry ++ , index ++ ) {
30
46
@@ -38,29 +54,14 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
38
54
39
55
WARN_ON (!cond );
40
56
41
- if (cond != ALT_COND_ALWAYS && no_alternatives )
57
+ if (( cond & ALT_COND_ALWAYS ) == 0 && no_alternatives )
42
58
continue ;
43
59
44
60
pr_debug ("Check %d: Cond 0x%x, Replace %02d instructions @ 0x%px with 0x%08x\n" ,
45
61
index , cond , len , from , replacement );
46
62
47
- if ((cond & ALT_COND_NO_SMP ) && (num_cpus != 1 ))
48
- continue ;
49
- if ((cond & ALT_COND_NO_DCACHE ) && (cache_info .dc_size != 0 ))
50
- continue ;
51
- if ((cond & ALT_COND_NO_ICACHE ) && (cache_info .ic_size != 0 ))
52
- continue ;
53
- if ((cond & ALT_COND_RUN_ON_QEMU ) && !running_on_qemu )
54
- continue ;
55
-
56
- /*
57
- * If the PDC_MODEL capabilities has Non-coherent IO-PDIR bit
58
- * set (bit #61, big endian), we have to flush and sync every
59
- * time IO-PDIR is changed in Ike/Astro.
60
- */
61
- if ((cond & ALT_COND_NO_IOC_FDC ) &&
62
- ((boot_cpu_data .cpu_type <= pcxw_ ) ||
63
- (boot_cpu_data .pdc .capabilities & PDC_MODEL_IOPDIR_FDC )))
63
+ /* Bounce out if none of the conditions are true. */
64
+ if ((cond & cond_check ) == 0 )
64
65
continue ;
65
66
66
67
/* Want to replace pdtlb by a pdtlb,l instruction? */
0 commit comments