提交 11d686e9 编写于 作者: J Jiang Liu 提交者: Thomas Gleixner

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: NJiang 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.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 8643e28d
...@@ -145,6 +145,7 @@ extern unsigned long io_apic_irqs; ...@@ -145,6 +145,7 @@ extern unsigned long io_apic_irqs;
struct irq_cfg; struct irq_cfg;
extern void ioapic_insert_resources(void); extern void ioapic_insert_resources(void);
extern int arch_early_ioapic_init(void);
extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *, extern int native_setup_ioapic_entry(int, struct IO_APIC_route_entry *,
unsigned int, int, unsigned int, int,
...@@ -248,6 +249,7 @@ extern void print_IO_APICs(void); ...@@ -248,6 +249,7 @@ extern void print_IO_APICs(void);
#define io_apic_assign_pci_irqs 0 #define io_apic_assign_pci_irqs 0
#define setup_ioapic_ids_from_mpc x86_init_noop #define setup_ioapic_ids_from_mpc x86_init_noop
static inline void ioapic_insert_resources(void) { } static inline void ioapic_insert_resources(void) { }
static inline int arch_early_ioapic_init(void) { return 0; }
static inline void print_IO_APICs(void) {} static inline void print_IO_APICs(void) {}
#define gsi_top (NR_IRQS_LEGACY) #define gsi_top (NR_IRQS_LEGACY)
static inline int mp_find_ioapic(u32 gsi) { return 0; } static inline int mp_find_ioapic(u32 gsi) { return 0; }
......
...@@ -245,7 +245,7 @@ static void free_ioapic_saved_registers(int idx) ...@@ -245,7 +245,7 @@ static void free_ioapic_saved_registers(int idx)
ioapics[idx].saved_registers = NULL; ioapics[idx].saved_registers = NULL;
} }
int __init arch_early_irq_init(void) int __init arch_early_ioapic_init(void)
{ {
struct irq_cfg *cfg; struct irq_cfg *cfg;
int i, node = cpu_to_node(0); int i, node = cpu_to_node(0);
...@@ -2487,26 +2487,6 @@ unsigned int arch_dynirq_lower_bound(unsigned int from) ...@@ -2487,26 +2487,6 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
return ioapic_initialized ? ioapic_dynirq_base : gsi_top; return ioapic_initialized ? ioapic_dynirq_base : gsi_top;
} }
int __init arch_probe_nr_irqs(void)
{
int nr;
if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
nr_irqs = NR_VECTORS * nr_cpu_ids;
nr = (gsi_top + nr_legacy_irqs()) + 8 * nr_cpu_ids;
#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
/*
* for MSI and HT dyn irq
*/
nr += gsi_top * 16;
#endif
if (nr < nr_irqs)
nr_irqs = nr;
return 0;
}
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
static int io_apic_get_unique_id(int ioapic, int apic_id) static int io_apic_get_unique_id(int ioapic, int apic_id)
{ {
......
...@@ -235,6 +235,34 @@ void clear_irq_vector(int irq, struct irq_cfg *cfg) ...@@ -235,6 +235,34 @@ void clear_irq_vector(int irq, struct irq_cfg *cfg)
raw_spin_unlock_irqrestore(&vector_lock, flags); raw_spin_unlock_irqrestore(&vector_lock, flags);
} }
int __init arch_probe_nr_irqs(void)
{
int nr;
if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
nr_irqs = NR_VECTORS * nr_cpu_ids;
nr = (gsi_top + nr_legacy_irqs()) + 8 * nr_cpu_ids;
#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
/*
* for MSI and HT dyn irq
*/
if (gsi_top <= NR_IRQS_LEGACY)
nr += 8 * nr_cpu_ids;
else
nr += gsi_top * 16;
#endif
if (nr < nr_irqs)
nr_irqs = nr;
return nr_legacy_irqs();
}
int __init arch_early_irq_init(void)
{
return arch_early_ioapic_init();
}
static void __setup_vector_irq(int cpu) static void __setup_vector_irq(int cpu)
{ {
/* Initialize vector_irq on a new cpu */ /* Initialize vector_irq on a new cpu */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册