diff options
Diffstat (limited to 'arch/x86/kernel/apic/io_apic.c')
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 42 |
1 files changed, 41 insertions, 1 deletions
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; | |||
85 | static DEFINE_RAW_SPINLOCK(ioapic_lock); | 85 | static DEFINE_RAW_SPINLOCK(ioapic_lock); |
86 | static DEFINE_RAW_SPINLOCK(vector_lock); | 86 | static DEFINE_RAW_SPINLOCK(vector_lock); |
87 | static DEFINE_MUTEX(ioapic_mutex); | 87 | static DEFINE_MUTEX(ioapic_mutex); |
88 | static unsigned int ioapic_dynirq_base; | ||
88 | 89 | ||
89 | static struct ioapic { | 90 | static 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 | ||
2924 | static 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 | |||
2923 | void __init setup_IO_APIC(void) | 2950 | void __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 | ||
3815 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | 3849 | void __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 | ||