mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 05:11:48 +00:00
bbc3dfe880
Commit 2def86a720
("hvc: Convert to using interrupts instead of opal
events") enabled the use of interrupts in the hvc_driver for OPAL
platforms. However on machines with more than one hvc console, any
console after the first will fail to register an interrupt handler in
notifier_add_irq() since all consoles share the same IRQ number but do
not set the IRQF_SHARED flag:
genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs. 00000000 (hvc_console)
hvc_open: request_irq failed with rc -16.
This error propagates up to hvc_open() and the console is closed, but
OPAL will still generate interrupts that are not handled, leading to
rcu_sched stall warnings.
Set IRQF_SHARED when calling request_irq(), allowing additional consoles
to start properly. This is only set for consoles handled by
hvc_opal_probe(), leaving other types unaffected.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
55 lines
1013 B
C
55 lines
1013 B
C
/*
|
|
* Copyright IBM Corp. 2001,2008
|
|
*
|
|
* This file contains the IRQ specific code for hvc_console
|
|
*
|
|
*/
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include "hvc_console.h"
|
|
|
|
static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
|
|
{
|
|
/* if hvc_poll request a repoll, then kick the hvcd thread */
|
|
if (hvc_poll(dev_instance))
|
|
hvc_kick();
|
|
|
|
/*
|
|
* We're safe to always return IRQ_HANDLED as the hvcd thread will
|
|
* iterate through each hvc_struct.
|
|
*/
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
/*
|
|
* For IRQ based systems these callbacks can be used
|
|
*/
|
|
int notifier_add_irq(struct hvc_struct *hp, int irq)
|
|
{
|
|
int rc;
|
|
|
|
if (!irq) {
|
|
hp->irq_requested = 0;
|
|
return 0;
|
|
}
|
|
rc = request_irq(irq, hvc_handle_interrupt, hp->flags,
|
|
"hvc_console", hp);
|
|
if (!rc)
|
|
hp->irq_requested = 1;
|
|
return rc;
|
|
}
|
|
|
|
void notifier_del_irq(struct hvc_struct *hp, int irq)
|
|
{
|
|
if (!hp->irq_requested)
|
|
return;
|
|
free_irq(irq, hp);
|
|
hp->irq_requested = 0;
|
|
}
|
|
|
|
void notifier_hangup_irq(struct hvc_struct *hp, int irq)
|
|
{
|
|
notifier_del_irq(hp, irq);
|
|
}
|