x86/irq and x86/apic changes for v2.6.34
Subsystems (5)
H. Peter Anvin
reviewerHi Linus,
The APIC- and IRQ-related changes from the x86 tree for v2.6.34 are available in the git repository at:
ssh://master.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-apic-for-linus
Brandon Phiilps (1):
x86: Avoid race condition in pci_enable_msix()
Brandon Philips (1):
x86, irq: Keep chip_data in create_irq_nr and destroy_irq
Eric W. Biederman (2):
xen: Remove unnecessary arch specific xen irq functions.
x86: Fix out of order of gsi
H. Peter Anvin (4):
x86, apic: Reclaim IDT vectors 0x20-0x2f
x86, apic: Don't waste a vector to improve vector spread Merge branch 'x86/urgent' into x86/irq
Merge branch 'x86/irq' into x86/apic
Ingo Molnar (1):
x86: apic: Fix mismerge, add arch_probe_nr_irqs() again
Jiri Slaby (1):
x86, ia32_aout: do not kill argument mapping
Justin P. Mattock (1):
x86: Add iMac9,1 to pci_reboot_dmi_table
Suresh Siddha (5):
x86, vmi: Fix vmi_get_timer_vector() to use IRQ0_VECTOR
x86, irq: Use 0x20 for the IRQ_MOVE_CLEANUP_VECTOR instead of 0x1f x86, irq: Don't block IRQ0_VECTOR..IRQ15_VECTOR's on all cpu's
x86, irq: Update the vector domain for legacy irqs handled by io-apic x86, irq: Move __setup_vector_irq() before the first irq enable in cpu online path
Thomas Gleixner (3):
x86: Convert ioapic_lock and vector_lock to raw_spinlock
x86: Convert nmi_lock to raw_spinlock
x86: Convert i8259_lock to raw_spinlock
Yinghai Lu (8):
x86: Increase NR_IRQS and nr_irqs
x86: Fix SCI on IOAPIC != 0
irq: Remove unnecessary bootmem code
init: Move radix_tree_init() early
sparseirq: Change irq_desc_ptrs to static
sparseirq: Use radix_tree instead of ptrs array x86, irq: Remove arch_probe_nr_irqs
smp: Use nr_cpus= to set nr_cpu_ids early
Documentation/kernel-parameters.txt | 6 + arch/ia64/include/asm/xen/events.h | 4 - arch/ia64/kernel/acpi.c | 4 +- arch/x86/ia32/ia32_aout.c | 1 - arch/x86/include/asm/i8259.h | 2 +- arch/x86/include/asm/io_apic.h | 1 + arch/x86/include/asm/irq.h | 1 + arch/x86/include/asm/irq_vectors.h | 48 +++---- arch/x86/include/asm/system.h | 4 +- arch/x86/kernel/acpi/boot.c | 14 +- arch/x86/kernel/apic/apic.c | 17 --- arch/x86/kernel/apic/io_apic.c | 258 ++++++++++++++++++++--------------- arch/x86/kernel/apic/nmi.c | 6 +- arch/x86/kernel/apic/probe_32.c | 29 ++++- arch/x86/kernel/apic/probe_64.c | 2 +- arch/x86/kernel/i8259.c | 30 ++-- arch/x86/kernel/irqinit.c | 35 +++--- arch/x86/kernel/mpparse.c | 7 - arch/x86/kernel/reboot.c | 8 + arch/x86/kernel/smpboot.c | 15 ++- arch/x86/kernel/time.c | 4 +- arch/x86/kernel/visws_quirks.c | 6 +- arch/x86/kernel/vmiclock_32.c | 6 +- arch/x86/mm/gup.c | 2 +- drivers/acpi/numa.c | 4 +- drivers/char/agp/amd64-agp.c | 5 +- drivers/xen/events.c | 8 +- include/linux/irq.h | 2 + init/main.c | 16 ++- kernel/irq/chip.c | 52 ++++++-- kernel/irq/handle.c | 58 ++++---- kernel/irq/internals.h | 6 +- kernel/irq/numa_migrate.c | 4 +- 33 files changed, 380 insertions(+), 285 deletions(-)
Documentation/kernel-parameters.txt +6 -0
@@ -1794,6 +1794,12 @@ and is between 256 and 4096 characters. It is defined in the file purges which is reported from either PAL_VM_SUMMARY or SAL PALO. + nr_cpus= [SMP] Maximum number of processors that an SMP kernel + could support. nr_cpus=n : n >= 1 limits the kernel to + supporting 'n' processors. Later in runtime you can not + use hotplug cpu feature to put more cpu back to online. + just like you compile the kernel NR_CPUS=n + nr_uarts= [SERIAL] maximum number of UARTs to be registered. numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA.
arch/ia64/include/asm/xen/events.h +0 -4
@@ -36,10 +36,6 @@ static inline int xen_irqs_disabled(struct pt_regs *regs) return !(ia64_psr(regs)->i); } -static inline void handle_irq (int irq,struct pt_regs *regs) -{ -__do_IRQ (irq); -}#define irq_ctx_init (cpu) do { } while (0)#endif /* _ASM_IA64_XEN_EVENTS_H */
arch/ia64/kernel/acpi.c +2 -2
@@ -852,8 +852,8 @@ __init void prefill_possible_map(void) possible = available_cpus + additional_cpus; -if (possible >NR_CPUS ) - possible =NR_CPUS ; +if (possible > nr_cpu_ids) + possible = nr_cpu_ids;printk (KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n" , possible,max ((possible - available_cpus),0 ));
arch/x86/ia32/ia32_aout.c +0 -1
@@ -327,7 +327,6 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) current->mm->free_area_cache =TASK_UNMAPPED_BASE ; current->mm->cached_hole_size =0 ; - current->mm->mmap =NULL ;install_exec_creds (bprm); current->flags &= ~PF_FORKNOEXEC ;
arch/x86/include/asm/i8259.h +1 -1
@@ -24,7 +24,7 @@ extern unsigned int cached_irq_mask;#define SLAVE_ICW4_DEFAULT 0x01#define PIC_ICW4_AEOI 2 -extern spinlock_t i8259A_lock; +extern raw_spinlock_t i8259A_lock;extern void init_8259A (int auto_eoi);extern void enable_8259A_irq (unsigned int irq);
arch/x86/include/asm/io_apic.h +1 -0
@@ -160,6 +160,7 @@ extern int io_apic_get_redir_entries(int ioapic);struct io_apic_irq_attr ;extern int io_apic_set_pci_routing (struct device *dev,int irq,struct io_apic_irq_attr *irq_attr); +void setup_IO_APIC_irq_extra (u32 gsi);extern int (*ioapic_renumber_irq)(int ioapic,int irq);extern void ioapic_init_mappings (void );extern void ioapic_insert_resources (void );
arch/x86/include/asm/irq.h +1 -0
@@ -48,5 +48,6 @@ extern DECLARE_BITMAP(used_vectors, NR_VECTORS);extern int vector_used_by_percpu_irq (unsigned int vector);extern void init_ISA_irqs (void ); +extern int nr_legacy_irqs;#endif /* _ASM_X86_IRQ_H */
arch/x86/include/asm/irq_vectors.h +23 -25
85 lines not on this page · raw message
arch/x86/kernel/acpi/boot.c +8 -1
@@ -447,6 +447,12 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)int acpi_gsi_to_irq (u32 gsi,unsigned int *irq) { *irq = gsi; + +#ifdef CONFIG_X86_IO_APIC +if (acpi_irq_model ==ACPI_IRQ_MODEL_IOAPIC ) +setup_IO_APIC_irq_extra (gsi); +#endif +return 0 ; }
@@ -474,7 +480,8 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) plat_gsi = mp_register_gsi(dev, gsi, trigger, polarity); }#endif -acpi_gsi_to_irq (plat_gsi, &irq); + irq = plat_gsi; +return irq; }
arch/x86/kernel/apic/io_apic.c +146 -112
579 lines not on this page · raw message
arch/x86/kernel/apic/nmi.c +3 -3
@@ -416,13 +416,13 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)/* We can be called before check_nmi_watchdog, hence NULL check. */ if (cpumask_test_cpu (cpu,to_cpumask (backtrace_mask))) { -static DEFINE_SPINLOCK (lock);/* Serialise the printks */ +static DEFINE_RAW_SPINLOCK (lock);/* Serialise the printks */ -spin_lock (&lock); +raw_spin_lock (&lock);printk (KERN_WARNING "NMI backtrace for cpu %d\n" , cpu);show_regs (regs);dump_stack (); -spin_unlock (&lock); +raw_spin_unlock (&lock);cpumask_clear_cpu (cpu,to_cpumask (backtrace_mask)); rc =1 ;
arch/x86/kernel/i8259.c +15 -15
@@ -32,7 +32,7 @@*/ static int i8259A_auto_eoi; -DEFINE_SPINLOCK (i8259A_lock); +DEFINE_RAW_SPINLOCK (i8259A_lock);static void mask_and_ack_8259A (unsigned int );struct irq_chip i8259A_chip = {
@@ -68,13 +68,13 @@ void disable_8259A_irq(unsigned int irq)unsigned int mask =1 << irq;unsigned long flags; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags); cached_irq_mask |= mask;if (irq &8 )outb (cached_slave_mask,PIC_SLAVE_IMR );else outb (cached_master_mask,PIC_MASTER_IMR ); -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags); }void enable_8259A_irq (unsigned int irq)
@@ -82,13 +82,13 @@ void enable_8259A_irq(unsigned int irq)unsigned int mask = ~(1 << irq);unsigned long flags; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags); cached_irq_mask &= mask;if (irq &8 )outb (cached_slave_mask,PIC_SLAVE_IMR );else outb (cached_master_mask,PIC_MASTER_IMR ); -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags); }int i8259A_irq_pending (unsigned int irq)
@@ -97,12 +97,12 @@ int i8259A_irq_pending(unsigned int irq)unsigned long flags;int ret; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags);if (irq <8 ) ret =inb (PIC_MASTER_CMD ) & mask;else ret =inb (PIC_SLAVE_CMD ) & (mask >>8 ); -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags);return ret; }
@@ -150,7 +150,7 @@ static void mask_and_ack_8259A(unsigned int irq)unsigned int irqmask =1 << irq;unsigned long flags; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags);/* * Lightweight spurious IRQ detection. We do not want * to overdo spurious IRQ handling - it's usually a sign
@@ -183,7 +183,7 @@ handle_real_irq:outb (cached_master_mask,PIC_MASTER_IMR );outb (0x60 +irq,PIC_MASTER_CMD );/* 'Specific EOI to master */ } -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags);return ; spurious_8259A_irq:
@@ -285,24 +285,24 @@ void mask_8259A(void) {unsigned long flags; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags);outb (0xff ,PIC_MASTER_IMR );/* mask all of 8259A-1 */ outb (0xff ,PIC_SLAVE_IMR );/* mask all of 8259A-2 */ -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags); }void unmask_8259A (void ) {unsigned long flags; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags);outb (cached_master_mask,PIC_MASTER_IMR );/* restore master IRQ mask */ outb (cached_slave_mask,PIC_SLAVE_IMR );/* restore slave IRQ mask */ -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags); }void init_8259A (int auto_eoi)
@@ -311,7 +311,7 @@ void init_8259A(int auto_eoi) i8259A_auto_eoi = auto_eoi; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags);outb (0xff ,PIC_MASTER_IMR );/* mask all of 8259A-1 */ outb (0xff ,PIC_SLAVE_IMR );/* mask all of 8259A-2 */
@@ -356,5 +356,5 @@ void init_8259A(int auto_eoi)outb (cached_master_mask,PIC_MASTER_IMR );/* restore master IRQ mask */ outb (cached_slave_mask,PIC_SLAVE_IMR );/* restore slave IRQ mask */ -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags); }
arch/x86/kernel/irqinit.c +17 -18
@@ -84,24 +84,7 @@ static struct irqaction irq2 = { }; DEFINE_PER_CPU(vector_irq_t, vector_irq) = { - [0 ... IRQ0_VECTOR - 1] = -1, - [IRQ0_VECTOR] = 0, - [IRQ1_VECTOR] = 1, - [IRQ2_VECTOR] = 2, - [IRQ3_VECTOR] = 3, - [IRQ4_VECTOR] = 4, - [IRQ5_VECTOR] = 5, - [IRQ6_VECTOR] = 6, - [IRQ7_VECTOR] = 7, - [IRQ8_VECTOR] = 8, - [IRQ9_VECTOR] = 9, - [IRQ10_VECTOR] = 10, - [IRQ11_VECTOR] = 11, - [IRQ12_VECTOR] = 12, - [IRQ13_VECTOR] = 13, - [IRQ14_VECTOR] = 14, - [IRQ15_VECTOR] = 15, - [IRQ15_VECTOR + 1 ... NR_VECTORS - 1] = -1 + [0 ... NR_VECTORS - 1] = -1, };int vector_used_by_percpu_irq (unsigned int vector)
@@ -116,6 +99,9 @@ int vector_used_by_percpu_irq(unsigned int vector)return 0 ; } +/* Number of legacy interrupts */ +int nr_legacy_irqs__read_mostly =NR_IRQS_LEGACY ; +void __init init_ISA_irqs (void ) {int i;
@@ -142,6 +128,19 @@ void __init init_ISA_irqs(void)void __init init_IRQ (void ) { +int i; + +/* +* On cpu 0, Assign IRQ0_VECTOR..IRQ15_VECTOR's to IRQ 0..15. +* If these IRQ's are handled by legacy interrupt-controllers like PIC, +* then this configuration will likely be static after the boot. If +* these IRQ's are handled by more mordern controllers like IO-APIC, +* then this vector space can be freed and re-used dynamically as the +* irq's migrate etc. +*/ +for (i =0 ; i < nr_legacy_irqs; i++) +per_cpu (vector_irq,0 )[IRQ0_VECTOR + i] = i; + x86_init.irqs.intr_init (); }
arch/x86/kernel/reboot.c +8 -0
@@ -461,6 +461,14 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Macmini3,1"), }, }, + { /* Handle problems with rebooting on the iMac9,1. */ + .callback = set_pci_reboot, + .ident = "Apple iMac9,1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"), + }, + }, { } };
arch/x86/kernel/smpboot.c +9 -4
@@ -241,6 +241,11 @@ static void __cpuinit smp_callin(void)map_cpu_to_logical_apicid ();notify_cpu_starting (cpuid); + +/* +* Need to setup vector mappings before we enable interrupts. +*/ +__setup_vector_irq (smp_processor_id ());/* * Get our bogomips. *
@@ -315,7 +320,6 @@ notrace static void __cpuinit start_secondary(void *unused)*/ ipi_call_lock ();lock_vector_lock (); -__setup_vector_irq (smp_processor_id ());set_cpu_online (smp_processor_id (), true);unlock_vector_lock ();ipi_call_unlock ();
@@ -1212,11 +1216,12 @@ __init void prefill_possible_map(void) total_cpus =max_t (int, possible, num_processors + disabled_cpus); -if (possible >CONFIG_NR_CPUS ) { +/* nr_cpu_ids could be reduced via nr_cpus= */ +if (possible > nr_cpu_ids) {printk (KERN_WARNING "%d Processors exceeds NR_CPUS limit of %d\n" , - possible,CONFIG_NR_CPUS ); - possible =CONFIG_NR_CPUS ; + possible, nr_cpu_ids); + possible = nr_cpu_ids; } printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
arch/x86/kernel/time.c +2 -2
@@ -70,11 +70,11 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)* manually to deassert NMI lines for the watchdog if run * on an 82489DX-based system. */ -spin_lock (&i8259A_lock); +raw_spin_lock (&i8259A_lock);outb (0x0c ,PIC_MASTER_OCW3 );/* Ack the IRQ; AEOI will end it automatically. */ inb (PIC_MASTER_POLL ); -spin_unlock (&i8259A_lock); +raw_spin_unlock (&i8259A_lock); } global_clock_event->event_handler (global_clock_event);
arch/x86/kernel/visws_quirks.c +3 -3
@@ -559,7 +559,7 @@ static irqreturn_t piix4_master_intr(int irq, void *dev_id)struct irq_desc *desc;unsigned long flags; -spin_lock_irqsave (&i8259A_lock, flags); +raw_spin_lock_irqsave (&i8259A_lock, flags);/* Find out what's interrupting in the PIIX4 master 8259 */ outb (0x0c ,0x20 );/* OCW3 Poll command */
@@ -596,7 +596,7 @@ static irqreturn_t piix4_master_intr(int irq, void *dev_id)outb (0x60 + realirq,0x20 ); } -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags); desc =irq_to_desc (realirq);
@@ -614,7 +614,7 @@ static irqreturn_t piix4_master_intr(int irq, void *dev_id)return IRQ_HANDLED ; out_unlock: -spin_unlock_irqrestore (&i8259A_lock, flags); +raw_spin_unlock_irqrestore (&i8259A_lock, flags);return IRQ_NONE ; }
arch/x86/kernel/vmiclock_32.c +1 -5
@@ -79,11 +79,7 @@ unsigned long vmi_tsc_khz(void)static inline unsigned int vmi_get_timer_vector (void ) { -#ifdef CONFIG_X86_IO_APIC -return FIRST_DEVICE_VECTOR ; -#else -return FIRST_EXTERNAL_VECTOR ; -#endif +return IRQ0_VECTOR ; }/** vmi clockchip */
drivers/acpi/numa.c +2 -2
@@ -279,9 +279,9 @@ int __init acpi_numa_init(void)/* SRAT: Static Resource Affinity Table */ if (!acpi_table_parse (ACPI_SIG_SRAT , acpi_parse_srat)) {acpi_table_parse_srat (ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY , - acpi_parse_x2apic_affinity,NR_CPUS ); + acpi_parse_x2apic_affinity, nr_cpu_ids);acpi_table_parse_srat (ACPI_SRAT_TYPE_CPU_AFFINITY , - acpi_parse_processor_affinity,NR_CPUS ); + acpi_parse_processor_affinity, nr_cpu_ids); ret =acpi_table_parse_srat (ACPI_SRAT_TYPE_MEMORY_AFFINITY , acpi_parse_memory_affinity,NR_NODE_MEMBLKS );
drivers/xen/events.c +6 -2
@@ -649,9 +649,13 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)int bit_idx =__ffs (pending_bits);int port = (word_idx *BITS_PER_LONG ) + bit_idx;int irq = evtchn_to_irq[port]; +struct irq_desc *desc; -if (irq !=-1 ) -handle_irq (irq, regs); +if (irq !=-1 ) { + desc =irq_to_desc (irq); +if (desc) +generic_handle_irq_desc (irq, desc); + } } }
include/linux/irq.h +2 -0
@@ -400,7 +400,9 @@ static inline int irq_has_action(unsigned int irq)/* Dynamic irq helper functions */ extern void dynamic_irq_init (unsigned int irq); +void dynamic_irq_init_keep_chip_data (unsigned int irq);extern void dynamic_irq_cleanup (unsigned int irq); +void dynamic_irq_cleanup_keep_chip_data (unsigned int irq);/* Set/get chip/data for an IRQ: */ extern int set_irq_chip (unsigned int irq,struct irq_chip *chip);
init/main.c +15 -1
@@ -149,6 +149,20 @@ static int __init nosmp(char *str)early_param ("nosmp" , nosmp); +/* this is hard limit */ +static int __init nrcpus (char *str) +{ +int nr_cpus; + +get_option (&str, &nr_cpus); +if (nr_cpus >0 && nr_cpus < nr_cpu_ids) + nr_cpu_ids = nr_cpus; + +return 0 ; +} + +early_param ("nr_cpus" , nrcpus); +static int __init maxcpus (char *str) {get_option (&str, &setup_max_cpus);
@@ -586,6 +600,7 @@ asmlinkage void __init start_kernel(void)local_irq_disable (); }rcu_init (); +radix_tree_init ();/* init some links before init_ISA_irqs() */ early_irq_init ();init_IRQ ();
@@ -659,7 +674,6 @@ asmlinkage void __init start_kernel(void)proc_caches_init ();buffer_init ();key_init (); -radix_tree_init ();security_init ();vfs_caches_init (totalram_pages);signals_init ();
kernel/irq/chip.c +43 -9
84 lines not on this page · raw message
kernel/irq/handle.c +28 -30
114 lines not on this page · raw message
kernel/irq/internals.h +1 -5
@@ -21,11 +21,7 @@ extern void clear_kstat_irqs(struct irq_desc *desc);extern raw_spinlock_t sparse_irq_lock;#ifdef CONFIG_SPARSE_IRQ -/* irq_desc_ptrs allocated at boot time */ -extern struct irq_desc **irq_desc_ptrs; -#else -/* irq_desc_ptrs is a fixed size array */ -extern struct irq_desc *irq_desc_ptrs[NR_IRQS ]; +void replace_irq_desc (unsigned int irq,struct irq_desc *desc);#endif #ifdef CONFIG_PROC_FS
kernel/irq/numa_migrate.c +2 -2
@@ -70,7 +70,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,raw_spin_lock_irqsave (&sparse_irq_lock, flags);/* We have to check it to avoid races with another CPU */ - desc = irq_desc_ptrs[irq]; + desc =irq_to_desc (irq);if (desc && old_desc != desc) goto out_unlock;
@@ -90,7 +90,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, goto out_unlock; } - irq_desc_ptrs[irq] = desc; +replace_irq_desc (irq, desc);raw_spin_unlock_irqrestore (&sparse_irq_lock, flags);/* free the old one */