]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
authorSam Mendoza-Jonas <sam@mendozajonas.com>
Mon, 11 Jul 2016 03:38:57 +0000 (13:38 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 27 Jul 2016 02:38:18 +0000 (12:38 +1000)
Commit 2def86a7200c ("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>
drivers/tty/hvc/hvc_console.h
drivers/tty/hvc/hvc_irq.c
drivers/tty/hvc/hvc_opal.c

index 91310198082736e0a5bffb75192b71aa1649764a..798c48d0d32c1c14ddb8645ef8851ccb5b91508a 100644 (file)
@@ -60,6 +60,7 @@ struct hvc_struct {
        struct winsize ws;
        struct work_struct tty_resize;
        struct list_head next;
+       unsigned long flags;
 };
 
 /* implemented by a low level driver */
index c9adb0559f61c2b743125b35713df17e3720e624..bc7a96874637baf9961ea6f998edd1be4b533ebb 100644 (file)
@@ -14,6 +14,11 @@ 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;
 }
 
@@ -28,8 +33,8 @@ int notifier_add_irq(struct hvc_struct *hp, int irq)
                hp->irq_requested = 0;
                return 0;
        }
-       rc = request_irq(irq, hvc_handle_interrupt, 0,
-                          "hvc_console", hp);
+       rc = request_irq(irq, hvc_handle_interrupt, hp->flags,
+                       "hvc_console", hp);
        if (!rc)
                hp->irq_requested = 1;
        return rc;
index 47b54c6aefd2688bfee7c48a506f01f9a5546ec1..b7cd0ae7d927a49d132f5f6699a17cdd86beef6a 100644 (file)
@@ -224,6 +224,9 @@ static int hvc_opal_probe(struct platform_device *dev)
        hp = hvc_alloc(termno, irq, ops, MAX_VIO_PUT_CHARS);
        if (IS_ERR(hp))
                return PTR_ERR(hp);
+
+       /* hvc consoles on powernv may need to share a single irq */
+       hp->flags = IRQF_SHARED;
        dev_set_drvdata(&dev->dev, hp);
 
        return 0;