mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	smp, generic: introduce arch_disable_smp_support() instead of disable_ioapic_setup()
Impact: cleanup disable_ioapic_setup() in init/main.c is ugly as the function is x86-specific. The #ifdef inline prototype there is ugly too. Replace it with a generic arch_disable_smp_support() function - which has a weak alias for non-x86 architectures and for non-ioapic x86 builds. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
		
							parent
							
								
									d8106d2e24
								
							
						
					
					
						commit
						65a4e574d2
					
				
					 6 changed files with 24 additions and 20 deletions
				
			
		| 
						 | 
					@ -143,15 +143,6 @@ extern int noioapicreroute;
 | 
				
			||||||
/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
 | 
					/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
 | 
				
			||||||
extern int timer_through_8259;
 | 
					extern int timer_through_8259;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void disable_ioapic_setup(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
#ifdef CONFIG_PCI
 | 
					 | 
				
			||||||
	noioapicquirk = 1;
 | 
					 | 
				
			||||||
	noioapicreroute = -1;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	skip_ioapic_setup = 1;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * If we use the IO-APIC for IRQ routing, disable automatic
 | 
					 * If we use the IO-APIC for IRQ routing, disable automatic
 | 
				
			||||||
 * assignment of PCI IRQ's.
 | 
					 * assignment of PCI IRQ's.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1138,9 +1138,7 @@ void __cpuinit setup_local_APIC(void)
 | 
				
			||||||
	int i, j;
 | 
						int i, j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (disable_apic) {
 | 
						if (disable_apic) {
 | 
				
			||||||
#ifdef CONFIG_X86_IO_APIC
 | 
							arch_disable_smp_support();
 | 
				
			||||||
		disable_ioapic_setup();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,10 +98,19 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int skip_ioapic_setup;
 | 
					int skip_ioapic_setup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void arch_disable_smp_support(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#ifdef CONFIG_PCI
 | 
				
			||||||
 | 
						noioapicquirk = 1;
 | 
				
			||||||
 | 
						noioapicreroute = -1;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						skip_ioapic_setup = 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __init parse_noapic(char *str)
 | 
					static int __init parse_noapic(char *str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* disable IO-APIC */
 | 
						/* disable IO-APIC */
 | 
				
			||||||
	disable_ioapic_setup();
 | 
						arch_disable_smp_support();
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
early_param("noapic", parse_noapic);
 | 
					early_param("noapic", parse_noapic);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1071,7 +1071,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
 | 
				
			||||||
		printk(KERN_ERR "... forcing use of dummy APIC emulation."
 | 
							printk(KERN_ERR "... forcing use of dummy APIC emulation."
 | 
				
			||||||
				"(tell your hw vendor)\n");
 | 
									"(tell your hw vendor)\n");
 | 
				
			||||||
		smpboot_clear_io_apic();
 | 
							smpboot_clear_io_apic();
 | 
				
			||||||
		disable_ioapic_setup();
 | 
							arch_disable_smp_support();
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +66,12 @@ extern int __cpu_up(unsigned int cpunum);
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
extern void smp_cpus_done(unsigned int max_cpus);
 | 
					extern void smp_cpus_done(unsigned int max_cpus);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Callback to arch code if there's nosmp or maxcpus=0 on the
 | 
				
			||||||
 | 
					 * boot command line:
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					extern void arch_disable_smp_support(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Call a function on all other processors
 | 
					 * Call a function on all other processors
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								init/main.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								init/main.c
									
									
									
									
									
								
							| 
						 | 
					@ -136,14 +136,14 @@ unsigned int __initdata setup_max_cpus = NR_CPUS;
 | 
				
			||||||
 * greater than 0, limits the maximum number of CPUs activated in
 | 
					 * greater than 0, limits the maximum number of CPUs activated in
 | 
				
			||||||
 * SMP mode to <NUM>.
 | 
					 * SMP mode to <NUM>.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#ifndef CONFIG_X86_IO_APIC
 | 
					
 | 
				
			||||||
static inline void disable_ioapic_setup(void) {};
 | 
					void __weak arch_disable_smp_support(void) { }
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __init nosmp(char *str)
 | 
					static int __init nosmp(char *str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	setup_max_cpus = 0;
 | 
						setup_max_cpus = 0;
 | 
				
			||||||
	disable_ioapic_setup();
 | 
						arch_disable_smp_support();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -153,14 +153,14 @@ static int __init maxcpus(char *str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	get_option(&str, &setup_max_cpus);
 | 
						get_option(&str, &setup_max_cpus);
 | 
				
			||||||
	if (setup_max_cpus == 0)
 | 
						if (setup_max_cpus == 0)
 | 
				
			||||||
		disable_ioapic_setup();
 | 
							arch_disable_smp_support();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
early_param("maxcpus", maxcpus);
 | 
					early_param("maxcpus", maxcpus);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define setup_max_cpus NR_CPUS
 | 
					const unsigned int setup_max_cpus = NR_CPUS;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue