linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
@ 2016-07-11  3:38 Samuel Mendoza-Jonas
  2016-07-11  3:38 ` [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available Samuel Mendoza-Jonas
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Samuel Mendoza-Jonas @ 2016-07-11  3:38 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Greg Kroah-Hartman, Jiri Slaby, Michael Ellerman,
	Alistair Popple, Samuel Mendoza-Jonas, # 4 . 1 . x-

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:

[   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
00000000 (hvc_console)
[   51.180010] 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>
Cc: <stable@vger.kernel.org> # 4.1.x-
---
 drivers/tty/hvc/hvc_console.h | 1 +
 drivers/tty/hvc/hvc_irq.c     | 7 +++++--
 drivers/tty/hvc/hvc_opal.c    | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.h b/drivers/tty/hvc/hvc_console.h
index 9131019..798c48d 100644
--- a/drivers/tty/hvc/hvc_console.h
+++ b/drivers/tty/hvc/hvc_console.h
@@ -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 */
diff --git a/drivers/tty/hvc/hvc_irq.c b/drivers/tty/hvc/hvc_irq.c
index c9adb05..57d9df7 100644
--- a/drivers/tty/hvc/hvc_irq.c
+++ b/drivers/tty/hvc/hvc_irq.c
@@ -14,6 +14,9 @@ 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 +31,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;
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index 47b54c6..b7cd0ae 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -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;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available
  2016-07-11  3:38 [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Samuel Mendoza-Jonas
@ 2016-07-11  3:38 ` Samuel Mendoza-Jonas
  2016-07-11  6:28   ` Michael Ellerman
  2016-07-27 14:32   ` [V2,2/2] " Michael Ellerman
  2016-07-11  6:29 ` [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Michael Ellerman
  2016-07-27 14:32 ` [V2,1/2] " Michael Ellerman
  2 siblings, 2 replies; 9+ messages in thread
From: Samuel Mendoza-Jonas @ 2016-07-11  3:38 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Greg Kroah-Hartman, Jiri Slaby, Michael Ellerman,
	Alistair Popple, Samuel Mendoza-Jonas, # 4 . 1 . x-

Update the hvc driver to use the OPAL irqchip if made available by the
running firmware. If it is not present, the driver falls back to the
existing OPAL event number.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Cc: <stable@vger.kernel.org> # 4.1.x-
---
v2: Always try irq_of_parse_and_map before falling back

 drivers/tty/hvc/hvc_opal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index b7cd0ae..5107993 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -214,7 +214,13 @@ static int hvc_opal_probe(struct platform_device *dev)
 		dev->dev.of_node->full_name,
 		boot ? " (boot console)" : "");
 
-	irq = opal_event_request(ilog2(OPAL_EVENT_CONSOLE_INPUT));
+	irq = irq_of_parse_and_map(dev->dev.of_node, 0);
+	if (!irq) {
+		pr_info("hvc%d: No interrupts property, using OPAL event\n",
+				termno);
+		irq = opal_event_request(ilog2(OPAL_EVENT_CONSOLE_INPUT));
+	}
+
 	if (!irq) {
 		pr_err("hvc_opal: Unable to map interrupt for device %s\n",
 			dev->dev.of_node->full_name);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available
  2016-07-11  3:38 ` [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available Samuel Mendoza-Jonas
@ 2016-07-11  6:28   ` Michael Ellerman
  2016-07-27 14:32   ` [V2,2/2] " Michael Ellerman
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2016-07-11  6:28 UTC (permalink / raw)
  To: Samuel Mendoza-Jonas, linuxppc-dev
  Cc: Greg Kroah-Hartman, Jiri Slaby, Alistair Popple,
	Samuel Mendoza-Jonas, # 4 . 1 . x-

Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:

> Update the hvc driver to use the OPAL irqchip if made available by the
> running firmware. If it is not present, the driver falls back to the
> existing OPAL event number.
>
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> Cc: <stable@vger.kernel.org> # 4.1.x-
> ---
> v2: Always try irq_of_parse_and_map before falling back

LGTM.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

> diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
> index b7cd0ae..5107993 100644
> --- a/drivers/tty/hvc/hvc_opal.c
> +++ b/drivers/tty/hvc/hvc_opal.c
> @@ -214,7 +214,13 @@ static int hvc_opal_probe(struct platform_device *dev)
>  		dev->dev.of_node->full_name,
>  		boot ? " (boot console)" : "");
>  
> -	irq = opal_event_request(ilog2(OPAL_EVENT_CONSOLE_INPUT));
> +	irq = irq_of_parse_and_map(dev->dev.of_node, 0);
> +	if (!irq) {
> +		pr_info("hvc%d: No interrupts property, using OPAL event\n",
> +				termno);
> +		irq = opal_event_request(ilog2(OPAL_EVENT_CONSOLE_INPUT));
> +	}
> +
>  	if (!irq) {
>  		pr_err("hvc_opal: Unable to map interrupt for device %s\n",
>  			dev->dev.of_node->full_name);
> -- 
> 2.9.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
  2016-07-11  3:38 [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Samuel Mendoza-Jonas
  2016-07-11  3:38 ` [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available Samuel Mendoza-Jonas
@ 2016-07-11  6:29 ` Michael Ellerman
  2016-07-26  4:11   ` Michael Ellerman
  2016-07-27 14:32 ` [V2,1/2] " Michael Ellerman
  2 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2016-07-11  6:29 UTC (permalink / raw)
  To: Samuel Mendoza-Jonas, linuxppc-dev
  Cc: Greg Kroah-Hartman, Jiri Slaby, Alistair Popple,
	Samuel Mendoza-Jonas, # 4 . 1 . x-

Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:

> 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:
>
> [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> 00000000 (hvc_console)
> [   51.180010] 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>
> Cc: <stable@vger.kernel.org> # 4.1.x-
> ---
>  drivers/tty/hvc/hvc_console.h | 1 +
>  drivers/tty/hvc/hvc_irq.c     | 7 +++++--
>  drivers/tty/hvc/hvc_opal.c    | 3 +++
>  3 files changed, 9 insertions(+), 2 deletions(-)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

Greg are you happy to take these two?

cheers

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
  2016-07-11  6:29 ` [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Michael Ellerman
@ 2016-07-26  4:11   ` Michael Ellerman
  2016-07-26  4:28     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2016-07-26  4:11 UTC (permalink / raw)
  To: gregkh; +Cc: Alistair Popple, Jiri Slaby, Samuel Mendoza-Jonas, linuxppc-dev

Quoting Michael Ellerman (2016-07-11 16:29:20)
> Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:
> =

> > 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:
> >
> > [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> > 00000000 (hvc_console)
> > [   51.180010] 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>
> > Cc: <stable@vger.kernel.org> # 4.1.x-
> > ---
> >  drivers/tty/hvc/hvc_console.h | 1 +
> >  drivers/tty/hvc/hvc_irq.c     | 7 +++++--
> >  drivers/tty/hvc/hvc_opal.c    | 3 +++
> >  3 files changed, 9 insertions(+), 2 deletions(-)
> =

> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> =

> Greg are you happy to take these two?

Hi Greg,

I don't see this series anywhere, do you mind if I take them via the
powerpc tree for 4.8 ? Or do you want to pick them up.

cheers

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
  2016-07-26  4:11   ` Michael Ellerman
@ 2016-07-26  4:28     ` Greg KH
  2016-07-26  9:49       ` Michael Ellerman
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2016-07-26  4:28 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Alistair Popple, Jiri Slaby, Samuel Mendoza-Jonas, linuxppc-dev

On Tue, Jul 26, 2016 at 02:11:11PM +1000, Michael Ellerman wrote:
> Quoting Michael Ellerman (2016-07-11 16:29:20)
> > Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:
> > 
> > > 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:
> > >
> > > [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> > > 00000000 (hvc_console)
> > > [   51.180010] 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>
> > > Cc: <stable@vger.kernel.org> # 4.1.x-
> > > ---
> > >  drivers/tty/hvc/hvc_console.h | 1 +
> > >  drivers/tty/hvc/hvc_irq.c     | 7 +++++--
> > >  drivers/tty/hvc/hvc_opal.c    | 3 +++
> > >  3 files changed, 9 insertions(+), 2 deletions(-)
> > 
> > Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> > 
> > Greg are you happy to take these two?
> 
> Hi Greg,
> 
> I don't see this series anywhere, do you mind if I take them via the
> powerpc tree for 4.8 ? Or do you want to pick them up.

You can take them, I'm not touching patches now until 4.8-rc1 is out,
sorry.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
  2016-07-26  4:28     ` Greg KH
@ 2016-07-26  9:49       ` Michael Ellerman
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2016-07-26  9:49 UTC (permalink / raw)
  To: Greg KH; +Cc: Alistair Popple, Jiri Slaby, Samuel Mendoza-Jonas, linuxppc-dev

Greg KH <gregkh@linuxfoundation.org> writes:

> On Tue, Jul 26, 2016 at 02:11:11PM +1000, Michael Ellerman wrote:
>> Quoting Michael Ellerman (2016-07-11 16:29:20)
>> > Greg are you happy to take these two?
>> 
>> I don't see this series anywhere, do you mind if I take them via the
>> powerpc tree for 4.8 ? Or do you want to pick them up.
>
> You can take them, I'm not touching patches now until 4.8-rc1 is out,
> sorry.

No worries, I'll grab them.

cheers

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [V2,1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles
  2016-07-11  3:38 [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Samuel Mendoza-Jonas
  2016-07-11  3:38 ` [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available Samuel Mendoza-Jonas
  2016-07-11  6:29 ` [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Michael Ellerman
@ 2016-07-27 14:32 ` Michael Ellerman
  2 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2016-07-27 14:32 UTC (permalink / raw)
  To: Sam Mendoza-Jonas, linuxppc-dev
  Cc: Greg Kroah-Hartman, Jiri Slaby, # 4 . 1 . x-,
	Alistair Popple, Samuel Mendoza-Jonas

On Mon, 2016-11-07 at 03:38:57 UTC, Sam Mendoza-Jonas wrote:
> 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:
> 
> [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> 00000000 (hvc_console)
> [   51.180010] 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>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/bbc3dfe8805de86874b1a1b142

cheers

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [V2,2/2] tty/hvc: Use opal irqchip interface if available
  2016-07-11  3:38 ` [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available Samuel Mendoza-Jonas
  2016-07-11  6:28   ` Michael Ellerman
@ 2016-07-27 14:32   ` Michael Ellerman
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2016-07-27 14:32 UTC (permalink / raw)
  To: Sam Mendoza-Jonas, linuxppc-dev
  Cc: Greg Kroah-Hartman, Jiri Slaby, # 4 . 1 . x-,
	Alistair Popple, Samuel Mendoza-Jonas

On Mon, 2016-11-07 at 03:38:58 UTC, Sam Mendoza-Jonas wrote:
> Update the hvc driver to use the OPAL irqchip if made available by the
> running firmware. If it is not present, the driver falls back to the
> existing OPAL event number.
> 
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/00dab8187e182da41122f66c20

cheers

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-27 14:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11  3:38 [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Samuel Mendoza-Jonas
2016-07-11  3:38 ` [PATCH V2 2/2] tty/hvc: Use opal irqchip interface if available Samuel Mendoza-Jonas
2016-07-11  6:28   ` Michael Ellerman
2016-07-27 14:32   ` [V2,2/2] " Michael Ellerman
2016-07-11  6:29 ` [PATCH V2 1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles Michael Ellerman
2016-07-26  4:11   ` Michael Ellerman
2016-07-26  4:28     ` Greg KH
2016-07-26  9:49       ` Michael Ellerman
2016-07-27 14:32 ` [V2,1/2] " Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).