aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/io_apic.h3
-rw-r--r--arch/x86/kernel/acpi/boot.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c42
-rw-r--r--arch/x86/kernel/devicetree.c2
-rw-r--r--arch/x86/kernel/mpparse.c2
-rw-r--r--arch/x86/platform/sfi/sfi.c2
6 files changed, 47 insertions, 6 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 64c6e344399b..3e4bea3a52b1 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -190,7 +190,8 @@ extern int mp_find_ioapic(u32 gsi);
190extern int mp_find_ioapic_pin(int ioapic, u32 gsi); 190extern int mp_find_ioapic_pin(int ioapic, u32 gsi);
191extern u32 mp_pin_to_gsi(int ioapic, int pin); 191extern u32 mp_pin_to_gsi(int ioapic, int pin);
192extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags); 192extern int mp_map_gsi_to_irq(u32 gsi, unsigned int flags);
193extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); 193extern void __init mp_register_ioapic(int id, u32 address, u32 gsi_base,
194 struct ioapic_domain_cfg *cfg);
194extern void __init pre_init_apic_IRQ0(void); 195extern void __init pre_init_apic_IRQ0(void);
195 196
196extern void mp_save_irq(struct mpc_intsrc *m); 197extern void mp_save_irq(struct mpc_intsrc *m);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index d6635baf9e3d..f86b4bae4640 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -462,7 +462,7 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
462 acpi_table_print_madt_entry(header); 462 acpi_table_print_madt_entry(header);
463 463
464 mp_register_ioapic(ioapic->id, 464 mp_register_ioapic(ioapic->id,
465 ioapic->address, ioapic->global_irq_base); 465 ioapic->address, ioapic->global_irq_base, NULL);
466 466
467 return 0; 467 return 0;
468} 468}
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 51ce80004a78..563f4504f54d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -85,6 +85,7 @@ int sis_apic_bug = -1;
85static DEFINE_RAW_SPINLOCK(ioapic_lock); 85static DEFINE_RAW_SPINLOCK(ioapic_lock);
86static DEFINE_RAW_SPINLOCK(vector_lock); 86static DEFINE_RAW_SPINLOCK(vector_lock);
87static DEFINE_MUTEX(ioapic_mutex); 87static DEFINE_MUTEX(ioapic_mutex);
88static unsigned int ioapic_dynirq_base;
88 89
89static struct ioapic { 90static struct ioapic {
90 /* 91 /*
@@ -2920,8 +2921,35 @@ out:
2920 */ 2921 */
2921#define PIC_IRQS (1UL << PIC_CASCADE_IR) 2922#define PIC_IRQS (1UL << PIC_CASCADE_IR)
2922 2923
2924static int mp_irqdomain_create(int ioapic)
2925{
2926 int hwirqs = mp_ioapic_pin_count(ioapic);
2927 struct ioapic *ip = &ioapics[ioapic];
2928 struct ioapic_domain_cfg *cfg = &ip->irqdomain_cfg;
2929 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic);
2930
2931 if (cfg->type == IOAPIC_DOMAIN_INVALID)
2932 return 0;
2933
2934 ip->irqdomain = irq_domain_add_linear(cfg->dev, hwirqs, cfg->ops,
2935 (void *)(long)ioapic);
2936 if(!ip->irqdomain)
2937 return -ENOMEM;
2938
2939 if (cfg->type == IOAPIC_DOMAIN_LEGACY ||
2940 cfg->type == IOAPIC_DOMAIN_STRICT)
2941 ioapic_dynirq_base = max(ioapic_dynirq_base,
2942 gsi_cfg->gsi_end + 1);
2943
2944 if (gsi_cfg->gsi_base == 0)
2945 irq_set_default_host(ip->irqdomain);
2946
2947 return 0;
2948}
2949
2923void __init setup_IO_APIC(void) 2950void __init setup_IO_APIC(void)
2924{ 2951{
2952 int ioapic;
2925 2953
2926 /* 2954 /*
2927 * calling enable_IO_APIC() is moved to setup_local_APIC for BP 2955 * calling enable_IO_APIC() is moved to setup_local_APIC for BP
@@ -2929,6 +2957,9 @@ void __init setup_IO_APIC(void)
2929 io_apic_irqs = nr_legacy_irqs() ? ~PIC_IRQS : ~0UL; 2957 io_apic_irqs = nr_legacy_irqs() ? ~PIC_IRQS : ~0UL;
2930 2958
2931 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); 2959 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
2960 for_each_ioapic(ioapic)
2961 BUG_ON(mp_irqdomain_create(ioapic));
2962
2932 /* 2963 /*
2933 * Set up IO-APIC IRQ routing. 2964 * Set up IO-APIC IRQ routing.
2934 */ 2965 */
@@ -3437,6 +3468,9 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
3437{ 3468{
3438 unsigned int min = gsi_top + nr_legacy_irqs(); 3469 unsigned int min = gsi_top + nr_legacy_irqs();
3439 3470
3471 if (ioapic_dynirq_base)
3472 return ioapic_dynirq_base;
3473
3440 return from < min ? min : from; 3474 return from < min ? min : from;
3441} 3475}
3442 3476
@@ -3812,7 +3846,8 @@ static __init int bad_ioapic_register(int idx)
3812 return 0; 3846 return 0;
3813} 3847}
3814 3848
3815void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) 3849void __init mp_register_ioapic(int id, u32 address, u32 gsi_base,
3850 struct ioapic_domain_cfg *cfg)
3816{ 3851{
3817 int idx = 0; 3852 int idx = 0;
3818 int entries; 3853 int entries;
@@ -3826,6 +3861,11 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
3826 ioapics[idx].mp_config.type = MP_IOAPIC; 3861 ioapics[idx].mp_config.type = MP_IOAPIC;
3827 ioapics[idx].mp_config.flags = MPC_APIC_USABLE; 3862 ioapics[idx].mp_config.flags = MPC_APIC_USABLE;
3828 ioapics[idx].mp_config.apicaddr = address; 3863 ioapics[idx].mp_config.apicaddr = address;
3864 ioapics[idx].irqdomain = NULL;
3865 if (cfg)
3866 ioapics[idx].irqdomain_cfg = *cfg;
3867 else
3868 ioapics[idx].irqdomain_cfg.type = IOAPIC_DOMAIN_INVALID;
3829 3869
3830 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 3870 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
3831 3871
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index b4680058db8b..d2c53feacd77 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -177,7 +177,7 @@ static void __init dtb_add_ioapic(struct device_node *dn)
177 dn->full_name); 177 dn->full_name);
178 return; 178 return;
179 } 179 }
180 mp_register_ioapic(++ioapic_id, r.start, gsi_top); 180 mp_register_ioapic(++ioapic_id, r.start, gsi_top, NULL);
181} 181}
182 182
183static void __init dtb_ioapic_setup(void) 183static void __init dtb_ioapic_setup(void)
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index b10e1132f316..ea8595e4cbd5 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -115,7 +115,7 @@ static void __init MP_bus_info(struct mpc_bus *m)
115static void __init MP_ioapic_info(struct mpc_ioapic *m) 115static void __init MP_ioapic_info(struct mpc_ioapic *m)
116{ 116{
117 if (m->flags & MPC_APIC_USABLE) 117 if (m->flags & MPC_APIC_USABLE)
118 mp_register_ioapic(m->apicid, m->apicaddr, gsi_top); 118 mp_register_ioapic(m->apicid, m->apicaddr, gsi_top, NULL);
119} 119}
120 120
121static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq) 121static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq)
diff --git a/arch/x86/platform/sfi/sfi.c b/arch/x86/platform/sfi/sfi.c
index bcd1a703e3e6..8f2f789c6f04 100644
--- a/arch/x86/platform/sfi/sfi.c
+++ b/arch/x86/platform/sfi/sfi.c
@@ -82,7 +82,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table)
82 pentry = (struct sfi_apic_table_entry *)sb->pentry; 82 pentry = (struct sfi_apic_table_entry *)sb->pentry;
83 83
84 for (i = 0; i < num; i++) { 84 for (i = 0; i < num; i++) {
85 mp_register_ioapic(i, pentry->phys_addr, gsi_top); 85 mp_register_ioapic(i, pentry->phys_addr, gsi_top, NULL);
86 pentry++; 86 pentry++;
87 } 87 }
88 88