diff options
| author | Jiang Liu <jiang.liu@linux.intel.com> | 2014-10-27 04:12:05 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2014-12-16 08:08:17 -0500 |
| commit | 11d686e956d6db58e4cb96b30008d0a43ddd0ce3 (patch) | |
| tree | eb4b5eedda341ca77fe1bb599879f9ece487637f | |
| parent | 8643e28da27d6d50f772409b8dc80bdab52239fb (diff) | |
x86, irq: Move IRQ initialization routines from io_apic.c into vector.c
Move IRQ initialization routines from io_apic.c into vector.c,
preparing for enabling hierarchy irqdomain.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Link: http://lkml.kernel.org/r/1414397531-28254-15-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | arch/x86/include/asm/io_apic.h | 2 | ||||
| -rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 22 | ||||
| -rw-r--r-- | arch/x86/kernel/apic/vector.c | 28 |
3 files changed, 31 insertions, 21 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index b7f1499d177f..bf006cce9418 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
| @@ -145,6 +145,7 @@ extern unsigned long io_apic_irqs; | |||
| 145 | 145 | ||
| 146 | struct irq_cfg; | 146 | struct irq_cfg; |
| 147 | extern void ioapic_insert_resources(void); | 147 | extern void ioapic_insert_resources(void); |
| 148 | extern int arch_early_ioapic_init(void); | ||
| 148 | 149 | ||
| 149 | extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *, | 150 | extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *, |
| 150 | unsigned int, int, | 151 | unsigned int, int, |
| @@ -248,6 +249,7 @@ extern void print_IO_APICs(void); | |||
| 248 | #define io_apic_assign_pci_irqs 0 | 249 | #define io_apic_assign_pci_irqs 0 |
| 249 | #define setup_ioapic_ids_from_mpc x86_init_noop | 250 | #define setup_ioapic_ids_from_mpc x86_init_noop |
| 250 | static inline void ioapic_insert_resources(void) { } | 251 | static inline void ioapic_insert_resources(void) { } |
| 252 | static inline int arch_early_ioapic_init(void) { return 0; } | ||
| 251 | static inline void print_IO_APICs(void) {} | 253 | static inline void print_IO_APICs(void) {} |
| 252 | #define gsi_top (NR_IRQS_LEGACY) | 254 | #define gsi_top (NR_IRQS_LEGACY) |
| 253 | static inline int mp_find_ioapic(u32 gsi) { return 0; } | 255 | static inline int mp_find_ioapic(u32 gsi) { return 0; } |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 8dcdb7b1e848..2619cbe88d9f 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
| @@ -245,7 +245,7 @@ static void free_ioapic_saved_registers(int idx) | |||
| 245 | ioapics[idx].saved_registers = NULL; | 245 | ioapics[idx].saved_registers = NULL; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | int __init arch_early_irq_init(void) | 248 | int __init arch_early_ioapic_init(void) |
| 249 | { | 249 | { |
| 250 | struct irq_cfg *cfg; | 250 | struct irq_cfg *cfg; |
| 251 | int i, node = cpu_to_node(0); | 251 | int i, node = cpu_to_node(0); |
| @@ -2487,26 +2487,6 @@ unsigned int arch_dynirq_lower_bound(unsigned int from) | |||
| 2487 | return ioapic_initialized ? ioapic_dynirq_base : gsi_top; | 2487 | return ioapic_initialized ? ioapic_dynirq_base : gsi_top; |
| 2488 | } | 2488 | } |
| 2489 | 2489 | ||
| 2490 | int __init arch_probe_nr_irqs(void) | ||
| 2491 | { | ||
| 2492 | int nr; | ||
| 2493 | |||
| 2494 | if (nr_irqs > (NR_VECTORS * nr_cpu_ids)) | ||
| 2495 | nr_irqs = NR_VECTORS * nr_cpu_ids; | ||
| 2496 | |||
| 2497 | nr = (gsi_top + nr_legacy_irqs()) + 8 * nr_cpu_ids; | ||
| 2498 | #if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ) | ||
| 2499 | /* | ||
| 2500 | * for MSI and HT dyn irq | ||
| 2501 | */ | ||
| 2502 | nr += gsi_top * 16; | ||
| 2503 | #endif | ||
| 2504 | if (nr < nr_irqs) | ||
| 2505 | nr_irqs = nr; | ||
| 2506 | |||
| 2507 | return 0; | ||
| 2508 | } | ||
| 2509 | |||
| 2510 | #ifdef CONFIG_X86_32 | 2490 | #ifdef CONFIG_X86_32 |
| 2511 | static int io_apic_get_unique_id(int ioapic, int apic_id) | 2491 | static int io_apic_get_unique_id(int ioapic, int apic_id) |
| 2512 | { | 2492 | { |
diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 938108fbc39b..19fcb57f86d5 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c | |||
| @@ -235,6 +235,34 @@ void clear_irq_vector(int irq, struct irq_cfg *cfg) | |||
| 235 | raw_spin_unlock_irqrestore(&vector_lock, flags); | 235 | raw_spin_unlock_irqrestore(&vector_lock, flags); |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | int __init arch_probe_nr_irqs(void) | ||
| 239 | { | ||
| 240 | int nr; | ||
| 241 | |||
| 242 | if (nr_irqs > (NR_VECTORS * nr_cpu_ids)) | ||
| 243 | nr_irqs = NR_VECTORS * nr_cpu_ids; | ||
| 244 | |||
| 245 | nr = (gsi_top + nr_legacy_irqs()) + 8 * nr_cpu_ids; | ||
| 246 | #if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ) | ||
| 247 | /* | ||
| 248 | * for MSI and HT dyn irq | ||
| 249 | */ | ||
| 250 | if (gsi_top <= NR_IRQS_LEGACY) | ||
| 251 | nr += 8 * nr_cpu_ids; | ||
| 252 | else | ||
| 253 | nr += gsi_top * 16; | ||
| 254 | #endif | ||
| 255 | if (nr < nr_irqs) | ||
| 256 | nr_irqs = nr; | ||
| 257 | |||
| 258 | return nr_legacy_irqs(); | ||
| 259 | } | ||
| 260 | |||
| 261 | int __init arch_early_irq_init(void) | ||
| 262 | { | ||
| 263 | return arch_early_ioapic_init(); | ||
| 264 | } | ||
| 265 | |||
| 238 | static void __setup_vector_irq(int cpu) | 266 | static void __setup_vector_irq(int cpu) |
| 239 | { | 267 | { |
| 240 | /* Initialize vector_irq on a new cpu */ | 268 | /* Initialize vector_irq on a new cpu */ |
