Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Use mips_gic_present() in place of gic_present

In preparation for removing the gic_present global variable, switch to
using the mips_gic_present() function instead. For the most part this is
a straightforward substitution. In cases which previously wrapped the
GIC case in an #ifdef CONFIG_MIPS_GIC that #ifdef has been removed,
since mips_gic_present() will return a compile-time constant false
allowing the affected code to be optimised out anyway.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/17044/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Paul Burton and committed by
Ralf Baechle
72eb2995 85eec73c

+17 -23
+4 -3
arch/mips/generic/irq.c
··· 16 16 #include <linux/types.h> 17 17 18 18 #include <asm/irq.h> 19 + #include <asm/mips-cps.h> 19 20 #include <asm/time.h> 20 21 21 22 int get_c0_fdc_int(void) ··· 25 24 26 25 if (cpu_has_veic) 27 26 panic("Unimplemented!"); 28 - else if (gic_present) 27 + else if (mips_gic_present()) 29 28 mips_cpu_fdc_irq = gic_get_c0_fdc_int(); 30 29 else if (cp0_fdc_irq >= 0) 31 30 mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq; ··· 41 40 42 41 if (cpu_has_veic) 43 42 panic("Unimplemented!"); 44 - else if (gic_present) 43 + else if (mips_gic_present()) 45 44 mips_cpu_perf_irq = gic_get_c0_perfcount_int(); 46 45 else if (cp0_perfcount_irq >= 0) 47 46 mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; ··· 57 56 58 57 if (cpu_has_veic) 59 58 panic("Unimplemented!"); 60 - else if (gic_present) 59 + else if (mips_gic_present()) 61 60 mips_cpu_timer_irq = gic_get_c0_compare_int(); 62 61 else 63 62 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
+2 -4
arch/mips/kernel/smp-mt.c
··· 21 21 #include <linux/sched.h> 22 22 #include <linux/cpumask.h> 23 23 #include <linux/interrupt.h> 24 - #include <linux/irqchip/mips-gic.h> 25 24 #include <linux/compiler.h> 26 25 #include <linux/sched/task_stack.h> 27 26 #include <linux/smp.h> ··· 35 36 #include <asm/mipsregs.h> 36 37 #include <asm/mipsmtregs.h> 37 38 #include <asm/mips_mt.h> 39 + #include <asm/mips-cps.h> 38 40 39 41 static void __init smvp_copy_vpe_config(void) 40 42 { ··· 118 118 119 119 static void vsmp_init_secondary(void) 120 120 { 121 - #ifdef CONFIG_MIPS_GIC 122 121 /* This is Malta specific: IPI,performance and timer interrupts */ 123 - if (gic_present) 122 + if (mips_gic_present()) 124 123 change_c0_status(ST0_IM, STATUSF_IP2 | STATUSF_IP3 | 125 124 STATUSF_IP4 | STATUSF_IP5 | 126 125 STATUSF_IP6 | STATUSF_IP7); 127 126 else 128 - #endif 129 127 change_c0_status(ST0_IM, STATUSF_IP0 | STATUSF_IP1 | 130 128 STATUSF_IP6 | STATUSF_IP7); 131 129 }
-4
arch/mips/lantiq/irq.c
··· 61 61 /* we have a cascade of 8 irqs */ 62 62 #define MIPS_CPU_IRQ_CASCADE 8 63 63 64 - #ifdef CONFIG_MIPS_MT_SMP 65 - int gic_present; 66 - #endif 67 - 68 64 static int exin_avail; 69 65 static u32 ltq_eiu_irq[MAX_EIU]; 70 66 static void __iomem *ltq_icu_membase[MAX_IM];
+2 -2
arch/mips/mti-malta/malta-int.c
··· 19 19 #include <linux/smp.h> 20 20 #include <linux/interrupt.h> 21 21 #include <linux/io.h> 22 - #include <linux/irqchip/mips-gic.h> 23 22 #include <linux/of_irq.h> 24 23 #include <linux/kernel_stat.h> 25 24 #include <linux/kernel.h> ··· 30 31 #include <asm/irq_regs.h> 31 32 #include <asm/mips-boards/malta.h> 32 33 #include <asm/mips-boards/maltaint.h> 34 + #include <asm/mips-cps.h> 33 35 #include <asm/gt64120.h> 34 36 #include <asm/mips-boards/generic.h> 35 37 #include <asm/mips-boards/msc01_pci.h> ··· 214 214 msc_nr_irqs); 215 215 } 216 216 217 - if (gic_present) { 217 + if (mips_gic_present()) { 218 218 corehi_irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_COREHI; 219 219 } else if (cpu_has_veic) { 220 220 set_vi_handler(MSC01E_INT_COREHI, corehi_irqdispatch);
+9 -10
arch/mips/mti-malta/malta-time.c
··· 40 40 #include <asm/time.h> 41 41 #include <asm/mc146818-time.h> 42 42 #include <asm/msc01_ic.h> 43 + #include <asm/mips-cps.h> 43 44 44 45 #include <asm/mips-boards/generic.h> 45 46 #include <asm/mips-boards/maltaint.h> ··· 86 85 87 86 local_irq_save(flags); 88 87 89 - if (gic_present) 88 + if (mips_gic_present()) 90 89 clear_gic_config(GIC_CONFIG_COUNTSTOP); 91 90 92 91 /* ··· 96 95 while (CMOS_READ(RTC_REG_A) & RTC_UIP); 97 96 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP)); 98 97 start = read_c0_count(); 99 - if (gic_present) 98 + if (mips_gic_present()) 100 99 gicstart = read_gic_counter(); 101 100 102 101 /* Wait for falling edge before reading RTC. */ ··· 106 105 /* Read counters again exactly on rising edge of update flag. */ 107 106 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP)); 108 107 count = read_c0_count(); 109 - if (gic_present) 108 + if (mips_gic_present()) 110 109 giccount = read_gic_counter(); 111 110 112 111 /* Wait for falling edge before reading RTC again. */ ··· 129 128 count /= secs; 130 129 mips_hpt_frequency = count; 131 130 132 - if (gic_present) { 131 + if (mips_gic_present()) { 133 132 giccount = div_u64(giccount - gicstart, secs); 134 133 gic_frequency = giccount; 135 134 } ··· 155 154 156 155 if (cpu_has_veic) 157 156 return -1; 158 - else if (gic_present) 157 + else if (mips_gic_present()) 159 158 return gic_get_c0_fdc_int(); 160 159 else if (cp0_fdc_irq >= 0) 161 160 return MIPS_CPU_IRQ_BASE + cp0_fdc_irq; ··· 168 167 if (cpu_has_veic) { 169 168 set_vi_handler(MSC01E_INT_PERFCTR, mips_perf_dispatch); 170 169 mips_cpu_perf_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR; 171 - } else if (gic_present) { 170 + } else if (mips_gic_present()) { 172 171 mips_cpu_perf_irq = gic_get_c0_perfcount_int(); 173 172 } else if (cp0_perfcount_irq >= 0) { 174 173 mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; ··· 185 184 if (cpu_has_veic) { 186 185 set_vi_handler(MSC01E_INT_CPUCTR, mips_timer_dispatch); 187 186 mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR; 188 - } else if (gic_present) { 187 + } else if (mips_gic_present()) { 189 188 mips_cpu_timer_irq = gic_get_c0_compare_int(); 190 189 } else { 191 190 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; ··· 259 258 setup_pit_timer(); 260 259 #endif 261 260 262 - #ifdef CONFIG_MIPS_GIC 263 - if (gic_present) { 261 + if (mips_gic_present()) { 264 262 freq = freqround(gic_frequency, 5000); 265 263 printk("GIC frequency %d.%02d MHz\n", freq/1000000, 266 264 (freq%1000000)*100/1000000); ··· 268 268 timer_probe(); 269 269 #endif 270 270 } 271 - #endif 272 271 }