Commit 71998d1b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-irq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 irq fixes from Ingo Molnar:
 "Two changes: a cpu-hotplug/irq race fix, plus a HyperV related fix"

* 'x86-irq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/irq: Fix fixup_irqs() error handling
  x86, irq, pic: Probe for legacy PIC and set legacy_pic appropriately
parents b2e09f63 fb24da80
...@@ -2297,7 +2297,7 @@ int __ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, ...@@ -2297,7 +2297,7 @@ int __ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
int err; int err;
if (!config_enabled(CONFIG_SMP)) if (!config_enabled(CONFIG_SMP))
return -1; return -EPERM;
if (!cpumask_intersects(mask, cpu_online_mask)) if (!cpumask_intersects(mask, cpu_online_mask))
return -EINVAL; return -EINVAL;
...@@ -2328,7 +2328,7 @@ int native_ioapic_set_affinity(struct irq_data *data, ...@@ -2328,7 +2328,7 @@ int native_ioapic_set_affinity(struct irq_data *data,
int ret; int ret;
if (!config_enabled(CONFIG_SMP)) if (!config_enabled(CONFIG_SMP))
return -1; return -EPERM;
raw_spin_lock_irqsave(&ioapic_lock, flags); raw_spin_lock_irqsave(&ioapic_lock, flags);
ret = __ioapic_set_affinity(data, mask, &dest); ret = __ioapic_set_affinity(data, mask, &dest);
...@@ -3001,9 +3001,11 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force) ...@@ -3001,9 +3001,11 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
struct irq_cfg *cfg = data->chip_data; struct irq_cfg *cfg = data->chip_data;
struct msi_msg msg; struct msi_msg msg;
unsigned int dest; unsigned int dest;
int ret;
if (__ioapic_set_affinity(data, mask, &dest)) ret = __ioapic_set_affinity(data, mask, &dest);
return -1; if (ret)
return ret;
__get_cached_msi_msg(data->msi_desc, &msg); __get_cached_msi_msg(data->msi_desc, &msg);
...@@ -3100,9 +3102,11 @@ dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask, ...@@ -3100,9 +3102,11 @@ dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
struct irq_cfg *cfg = data->chip_data; struct irq_cfg *cfg = data->chip_data;
unsigned int dest, irq = data->irq; unsigned int dest, irq = data->irq;
struct msi_msg msg; struct msi_msg msg;
int ret;
if (__ioapic_set_affinity(data, mask, &dest)) ret = __ioapic_set_affinity(data, mask, &dest);
return -1; if (ret)
return ret;
dmar_msi_read(irq, &msg); dmar_msi_read(irq, &msg);
...@@ -3149,9 +3153,11 @@ static int hpet_msi_set_affinity(struct irq_data *data, ...@@ -3149,9 +3153,11 @@ static int hpet_msi_set_affinity(struct irq_data *data,
struct irq_cfg *cfg = data->chip_data; struct irq_cfg *cfg = data->chip_data;
struct msi_msg msg; struct msi_msg msg;
unsigned int dest; unsigned int dest;
int ret;
if (__ioapic_set_affinity(data, mask, &dest)) ret = __ioapic_set_affinity(data, mask, &dest);
return -1; if (ret)
return ret;
hpet_msi_read(data->handler_data, &msg); hpet_msi_read(data->handler_data, &msg);
...@@ -3218,9 +3224,11 @@ ht_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force) ...@@ -3218,9 +3224,11 @@ ht_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
{ {
struct irq_cfg *cfg = data->chip_data; struct irq_cfg *cfg = data->chip_data;
unsigned int dest; unsigned int dest;
int ret;
if (__ioapic_set_affinity(data, mask, &dest)) ret = __ioapic_set_affinity(data, mask, &dest);
return -1; if (ret)
return ret;
target_ht_irq(data->irq, dest, cfg->vector); target_ht_irq(data->irq, dest, cfg->vector);
return IRQ_SET_MASK_OK_NOCOPY; return IRQ_SET_MASK_OK_NOCOPY;
......
...@@ -132,15 +132,6 @@ static void __init ms_hyperv_init_platform(void) ...@@ -132,15 +132,6 @@ static void __init ms_hyperv_init_platform(void)
lapic_timer_frequency = hv_lapic_frequency; lapic_timer_frequency = hv_lapic_frequency;
printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n", printk(KERN_INFO "HyperV: LAPIC Timer Frequency: %#x\n",
lapic_timer_frequency); lapic_timer_frequency);
/*
* On Hyper-V, when we are booting off an EFI firmware stack,
* we do not have many legacy devices including PIC, PIT etc.
*/
if (efi_enabled(EFI_BOOT)) {
printk(KERN_INFO "HyperV: Using null_legacy_pic\n");
legacy_pic = &null_legacy_pic;
}
} }
#endif #endif
......
...@@ -299,13 +299,31 @@ static void unmask_8259A(void) ...@@ -299,13 +299,31 @@ static void unmask_8259A(void)
static void init_8259A(int auto_eoi) static void init_8259A(int auto_eoi)
{ {
unsigned long flags; unsigned long flags;
unsigned char probe_val = ~(1 << PIC_CASCADE_IR);
unsigned char new_val;
i8259A_auto_eoi = auto_eoi; i8259A_auto_eoi = auto_eoi;
raw_spin_lock_irqsave(&i8259A_lock, flags); raw_spin_lock_irqsave(&i8259A_lock, flags);
outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ /*
* Check to see if we have a PIC.
* Mask all except the cascade and read
* back the value we just wrote. If we don't
* have a PIC, we will read 0xff as opposed to the
* value we wrote.
*/
outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
outb(probe_val, PIC_MASTER_IMR);
new_val = inb(PIC_MASTER_IMR);
if (new_val != probe_val) {
printk(KERN_INFO "Using NULL legacy PIC\n");
legacy_pic = &null_legacy_pic;
raw_spin_unlock_irqrestore(&i8259A_lock, flags);
return;
}
outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
/* /*
* outb_pic - this has to work on a wide range of PC hardware. * outb_pic - this has to work on a wide range of PC hardware.
......
...@@ -365,6 +365,7 @@ void fixup_irqs(void) ...@@ -365,6 +365,7 @@ void fixup_irqs(void)
struct irq_desc *desc; struct irq_desc *desc;
struct irq_data *data; struct irq_data *data;
struct irq_chip *chip; struct irq_chip *chip;
int ret;
for_each_irq_desc(irq, desc) { for_each_irq_desc(irq, desc) {
int break_affinity = 0; int break_affinity = 0;
...@@ -403,10 +404,14 @@ void fixup_irqs(void) ...@@ -403,10 +404,14 @@ void fixup_irqs(void)
if (!irqd_can_move_in_process_context(data) && chip->irq_mask) if (!irqd_can_move_in_process_context(data) && chip->irq_mask)
chip->irq_mask(data); chip->irq_mask(data);
if (chip->irq_set_affinity) if (chip->irq_set_affinity) {
chip->irq_set_affinity(data, affinity, true); ret = chip->irq_set_affinity(data, affinity, true);
else if (!(warned++)) if (ret == -ENOSPC)
set_affinity = 0; pr_crit("IRQ %d set affinity failed because there are no available vectors. The device assigned to this IRQ is unstable.\n", irq);
} else {
if (!(warned++))
set_affinity = 0;
}
/* /*
* We unmask if the irq was not marked masked by the * We unmask if the irq was not marked masked by the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment