linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irqchip/mips-gic: Fix IRQs in gic_dev_domain
@ 2016-05-23 11:05 Harvey Hunt
  2016-06-14  9:46 ` [tip:irq/urgent] " tip-bot for Harvey Hunt
       [not found] ` <CA+mqd+7mh3v-1mk4xpxBjxtt4_JjycisWj6VnV7AaOH=i=y3Qw@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Harvey Hunt @ 2016-05-23 11:05 UTC (permalink / raw)
  To: tglx, jason, marc.zyngier
  Cc: Harvey Hunt, linux-mips, linux-kernel, Qais Yousef

When allocating a new device IRQ, gic_dev_domain_alloc() correctly calls
irq_domain_set_hwirq_and_chip(), but gic_irq_domain_alloc() does not. This
means that gic_irq_domain believes all IRQs from the dev domain have an
hwirq of 0 and creates incorrect mappings in the linear_revmap. As
gic_irq_domain is a parent of the gic_dev_domain, this leads to an
inability to boot on devices with a GIC. Excerpt of the error:

[    2.297649] irq 0: nobody cared (try booting with the "irqpoll" option)
...
[    2.436963] handlers:
[    2.439492] Disabling IRQ #0

Fix this by calling irq_domain_set_hwirq_and_chip() for both the dev and
irq domain.

Now that we are modifying the parent domain, be sure to clear it up in
case of an allocation error.

Fixes: c98c1822ee13 ("irqchip/mips-gic: Add device hierarchy domain")
Fixes: 2af70a962070 ("irqchip/mips-gic: Add a IPI hierarchy domain")
Signed-off-by: Harvey Hunt <harvey.hunt@imgtec.com>
Tested-by: Govindraj Raja <Govindraj.Raja@imgtec.com> # On Pistachio SoC
Reviewed-by: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: <linux-mips@linux-mips.org>
Cc: <linux-kernel@vger.kernel.org>
Cc: Qais Yousef <qsyousef@gmail.com>
---
 drivers/irqchip/irq-mips-gic.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 4dffccf..40fb120 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -734,6 +734,12 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq,
 		/* verify that it doesn't conflict with an IPI irq */
 		if (test_bit(spec->hwirq, ipi_resrv))
 			return -EBUSY;
+
+		hwirq = GIC_SHARED_TO_HWIRQ(spec->hwirq);
+
+		return irq_domain_set_hwirq_and_chip(d, virq, hwirq,
+						     &gic_level_irq_controller,
+						     NULL);
 	} else {
 		base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs);
 		if (base_hwirq == gic_shared_intrs) {
@@ -855,10 +861,14 @@ static int gic_dev_domain_alloc(struct irq_domain *d, unsigned int virq,
 						    &gic_level_irq_controller,
 						    NULL);
 		if (ret)
-			return ret;
+			goto error;
 	}
 
 	return 0;
+
+error:
+	irq_domain_free_irqs_parent(d, virq, nr_irqs);
+	return ret;
 }
 
 void gic_dev_domain_free(struct irq_domain *d, unsigned int virq,
-- 
2.8.2

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

* [tip:irq/urgent] irqchip/mips-gic: Fix IRQs in gic_dev_domain
  2016-05-23 11:05 [PATCH] irqchip/mips-gic: Fix IRQs in gic_dev_domain Harvey Hunt
@ 2016-06-14  9:46 ` tip-bot for Harvey Hunt
       [not found] ` <CA+mqd+7mh3v-1mk4xpxBjxtt4_JjycisWj6VnV7AaOH=i=y3Qw@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Harvey Hunt @ 2016-06-14  9:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: matt.redfearn, linux-kernel, hpa, tglx, mingo, harvey.hunt, qsyousef

Commit-ID:  4b2312bd0592708c85ed94368c874819e7013309
Gitweb:     http://git.kernel.org/tip/4b2312bd0592708c85ed94368c874819e7013309
Author:     Harvey Hunt <harvey.hunt@imgtec.com>
AuthorDate: Mon, 23 May 2016 12:05:52 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 14 Jun 2016 11:41:57 +0200

irqchip/mips-gic: Fix IRQs in gic_dev_domain

When allocating a new device IRQ, gic_dev_domain_alloc() correctly calls
irq_domain_set_hwirq_and_chip(), but gic_irq_domain_alloc() does not. This
means that gic_irq_domain believes all IRQs from the dev domain have an
hwirq of 0 and creates incorrect mappings in the linear_revmap. As
gic_irq_domain is a parent of the gic_dev_domain, this leads to an
inability to boot on devices with a GIC. Excerpt of the error:

[    2.297649] irq 0: nobody cared (try booting with the "irqpoll" option)
...
[    2.436963] handlers:
[    2.439492] Disabling IRQ #0

Fix this by calling irq_domain_set_hwirq_and_chip() for both the dev and
irq domain.

Now that we are modifying the parent domain, be sure to clear it up in
case of an allocation error.

Fixes: c98c1822ee13 ("irqchip/mips-gic: Add device hierarchy domain")
Fixes: 2af70a962070 ("irqchip/mips-gic: Add a IPI hierarchy domain")
Signed-off-by: Harvey Hunt <harvey.hunt@imgtec.com>
Tested-by: Govindraj Raja <Govindraj.Raja@imgtec.com> # On Pistachio SoC
Reviewed-by: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Qais Yousef <qsyousef@gmail.com>
Cc: jason@lakedaemon.net
Cc: marc.zyngier@arm.com
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1464001552-31174-1-git-send-email-harvey.hunt@imgtec.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 drivers/irqchip/irq-mips-gic.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 3b5e10a..8a4adbeb 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -746,6 +746,12 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq,
 		/* verify that it doesn't conflict with an IPI irq */
 		if (test_bit(spec->hwirq, ipi_resrv))
 			return -EBUSY;
+
+		hwirq = GIC_SHARED_TO_HWIRQ(spec->hwirq);
+
+		return irq_domain_set_hwirq_and_chip(d, virq, hwirq,
+						     &gic_level_irq_controller,
+						     NULL);
 	} else {
 		base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs);
 		if (base_hwirq == gic_shared_intrs) {
@@ -867,10 +873,14 @@ static int gic_dev_domain_alloc(struct irq_domain *d, unsigned int virq,
 						    &gic_level_irq_controller,
 						    NULL);
 		if (ret)
-			return ret;
+			goto error;
 	}
 
 	return 0;
+
+error:
+	irq_domain_free_irqs_parent(d, virq, nr_irqs);
+	return ret;
 }
 
 void gic_dev_domain_free(struct irq_domain *d, unsigned int virq,

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

* Re: [PATCH] irqchip/mips-gic: Fix IRQs in gic_dev_domain
       [not found] ` <CA+mqd+7mh3v-1mk4xpxBjxtt4_JjycisWj6VnV7AaOH=i=y3Qw@mail.gmail.com>
@ 2016-06-23 18:11   ` Jason Cooper
  2016-06-25  8:58     ` Thomas Gleixner
  2016-06-25  9:14     ` Qais Yousef
  0 siblings, 2 replies; 5+ messages in thread
From: Jason Cooper @ 2016-06-23 18:11 UTC (permalink / raw)
  To: Qais Yousef, g
  Cc: Harvey Hunt, linux-mips, Thomas Gleixner, linux-kernel, marc.zyngier

Qais,

On Tue, May 24, 2016 at 11:43:07AM +0100, Qais Yousef wrote:
> Hmm I certainly did test this on real hardware with GIC. Are you using the
> new dev domain? The idea is that GIC is logically divided and shouldn't be
> used directly. Sorry I'm travelling and can't check the code.

Any update on this patch?  Should I stop tracking it?

thx,

Jason.

> On 23 May 2016 12:06, "Harvey Hunt" <harvey.hunt@imgtec.com> wrote:
> 
> > When allocating a new device IRQ, gic_dev_domain_alloc() correctly calls
> > irq_domain_set_hwirq_and_chip(), but gic_irq_domain_alloc() does not. This
> > means that gic_irq_domain believes all IRQs from the dev domain have an
> > hwirq of 0 and creates incorrect mappings in the linear_revmap. As
> > gic_irq_domain is a parent of the gic_dev_domain, this leads to an
> > inability to boot on devices with a GIC. Excerpt of the error:
> >
> > [    2.297649] irq 0: nobody cared (try booting with the "irqpoll" option)
> > ...
> > [    2.436963] handlers:
> > [    2.439492] Disabling IRQ #0
> >
> > Fix this by calling irq_domain_set_hwirq_and_chip() for both the dev and
> > irq domain.
> >
> > Now that we are modifying the parent domain, be sure to clear it up in
> > case of an allocation error.
> >
> > Fixes: c98c1822ee13 ("irqchip/mips-gic: Add device hierarchy domain")
> > Fixes: 2af70a962070 ("irqchip/mips-gic: Add a IPI hierarchy domain")
> > Signed-off-by: Harvey Hunt <harvey.hunt@imgtec.com>
> > Tested-by: Govindraj Raja <Govindraj.Raja@imgtec.com> # On Pistachio SoC
> > Reviewed-by: Matt Redfearn <matt.redfearn@imgtec.com>
> > Cc: <linux-mips@linux-mips.org>
> > Cc: <linux-kernel@vger.kernel.org>
> > Cc: Qais Yousef <qsyousef@gmail.com>
> > ---
> >  drivers/irqchip/irq-mips-gic.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/irqchip/irq-mips-gic.c
> > b/drivers/irqchip/irq-mips-gic.c
> > index 4dffccf..40fb120 100644
> > --- a/drivers/irqchip/irq-mips-gic.c
> > +++ b/drivers/irqchip/irq-mips-gic.c
> > @@ -734,6 +734,12 @@ static int gic_irq_domain_alloc(struct irq_domain *d,
> > unsigned int virq,
> >                 /* verify that it doesn't conflict with an IPI irq */
> >                 if (test_bit(spec->hwirq, ipi_resrv))
> >                         return -EBUSY;
> > +
> > +               hwirq = GIC_SHARED_TO_HWIRQ(spec->hwirq);
> > +
> > +               return irq_domain_set_hwirq_and_chip(d, virq, hwirq,
> > +
> > &gic_level_irq_controller,
> > +                                                    NULL);
> >         } else {
> >                 base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs);
> >                 if (base_hwirq == gic_shared_intrs) {
> > @@ -855,10 +861,14 @@ static int gic_dev_domain_alloc(struct irq_domain
> > *d, unsigned int virq,
> >
> > &gic_level_irq_controller,
> >                                                     NULL);
> >                 if (ret)
> > -                       return ret;
> > +                       goto error;
> >         }
> >
> >         return 0;
> > +
> > +error:
> > +       irq_domain_free_irqs_parent(d, virq, nr_irqs);
> > +       return ret;
> >  }
> >
> >  void gic_dev_domain_free(struct irq_domain *d, unsigned int virq,
> > --
> > 2.8.2
> >
> >

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

* Re: [PATCH] irqchip/mips-gic: Fix IRQs in gic_dev_domain
  2016-06-23 18:11   ` [PATCH] " Jason Cooper
@ 2016-06-25  8:58     ` Thomas Gleixner
  2016-06-25  9:14     ` Qais Yousef
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2016-06-25  8:58 UTC (permalink / raw)
  To: Jason Cooper
  Cc: Qais Yousef, g, Harvey Hunt, linux-mips, linux-kernel, marc.zyngier

On Thu, 23 Jun 2016, Jason Cooper wrote:

> Qais,
> 
> On Tue, May 24, 2016 at 11:43:07AM +0100, Qais Yousef wrote:
> > Hmm I certainly did test this on real hardware with GIC. Are you using the
> > new dev domain? The idea is that GIC is logically divided and shouldn't be
> > used directly. Sorry I'm travelling and can't check the code.
> 
> Any update on this patch?  Should I stop tracking it?

I sent it to Linus as it fixes a real problem for the MIPS people.

Thanks,

	tglx

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

* Re: [PATCH] irqchip/mips-gic: Fix IRQs in gic_dev_domain
  2016-06-23 18:11   ` [PATCH] " Jason Cooper
  2016-06-25  8:58     ` Thomas Gleixner
@ 2016-06-25  9:14     ` Qais Yousef
  1 sibling, 0 replies; 5+ messages in thread
From: Qais Yousef @ 2016-06-25  9:14 UTC (permalink / raw)
  To: Jason Cooper, g
  Cc: Harvey Hunt, linux-mips, Thomas Gleixner, linux-kernel, marc.zyngier

On 23/06/2016 19:11, Jason Cooper wrote:
> Qais,
>
> On Tue, May 24, 2016 at 11:43:07AM +0100, Qais Yousef wrote:
>> Hmm I certainly did test this on real hardware with GIC. Are you using the
>> new dev domain? The idea is that GIC is logically divided and shouldn't be
>> used directly. Sorry I'm travelling and can't check the code.
> Any update on this patch?  Should I stop tracking it?

Apologies I didn't realise I was holding this up. I thought I received 
an email that this was committed so I didn't take a look.

I just had a look and we set the hwirq for the IPI domain in the same 
function. My memory failed me and I thought maybe the problem was due to 
someone trying to access the gic_irq_domain directly. I don't know why 
when I tested this on Malta I didn't see this problem.

Anyways I'm OK with this change if that's what you're asking.

Thanks,
Qais

>
> thx,
>
> Jason.
>
>> On 23 May 2016 12:06, "Harvey Hunt" <harvey.hunt@imgtec.com> wrote:
>>
>>> When allocating a new device IRQ, gic_dev_domain_alloc() correctly calls
>>> irq_domain_set_hwirq_and_chip(), but gic_irq_domain_alloc() does not. This
>>> means that gic_irq_domain believes all IRQs from the dev domain have an
>>> hwirq of 0 and creates incorrect mappings in the linear_revmap. As
>>> gic_irq_domain is a parent of the gic_dev_domain, this leads to an
>>> inability to boot on devices with a GIC. Excerpt of the error:
>>>
>>> [    2.297649] irq 0: nobody cared (try booting with the "irqpoll" option)
>>> ...
>>> [    2.436963] handlers:
>>> [    2.439492] Disabling IRQ #0
>>>
>>> Fix this by calling irq_domain_set_hwirq_and_chip() for both the dev and
>>> irq domain.
>>>
>>> Now that we are modifying the parent domain, be sure to clear it up in
>>> case of an allocation error.
>>>
>>> Fixes: c98c1822ee13 ("irqchip/mips-gic: Add device hierarchy domain")
>>> Fixes: 2af70a962070 ("irqchip/mips-gic: Add a IPI hierarchy domain")
>>> Signed-off-by: Harvey Hunt <harvey.hunt@imgtec.com>
>>> Tested-by: Govindraj Raja <Govindraj.Raja@imgtec.com> # On Pistachio SoC
>>> Reviewed-by: Matt Redfearn <matt.redfearn@imgtec.com>
>>> Cc: <linux-mips@linux-mips.org>
>>> Cc: <linux-kernel@vger.kernel.org>
>>> Cc: Qais Yousef <qsyousef@gmail.com>
>>> ---
>>>   drivers/irqchip/irq-mips-gic.c | 12 +++++++++++-
>>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/irqchip/irq-mips-gic.c
>>> b/drivers/irqchip/irq-mips-gic.c
>>> index 4dffccf..40fb120 100644
>>> --- a/drivers/irqchip/irq-mips-gic.c
>>> +++ b/drivers/irqchip/irq-mips-gic.c
>>> @@ -734,6 +734,12 @@ static int gic_irq_domain_alloc(struct irq_domain *d,
>>> unsigned int virq,
>>>                  /* verify that it doesn't conflict with an IPI irq */
>>>                  if (test_bit(spec->hwirq, ipi_resrv))
>>>                          return -EBUSY;
>>> +
>>> +               hwirq = GIC_SHARED_TO_HWIRQ(spec->hwirq);
>>> +
>>> +               return irq_domain_set_hwirq_and_chip(d, virq, hwirq,
>>> +
>>> &gic_level_irq_controller,
>>> +                                                    NULL);
>>>          } else {
>>>                  base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs);
>>>                  if (base_hwirq == gic_shared_intrs) {
>>> @@ -855,10 +861,14 @@ static int gic_dev_domain_alloc(struct irq_domain
>>> *d, unsigned int virq,
>>>
>>> &gic_level_irq_controller,
>>>                                                      NULL);
>>>                  if (ret)
>>> -                       return ret;
>>> +                       goto error;
>>>          }
>>>
>>>          return 0;
>>> +
>>> +error:
>>> +       irq_domain_free_irqs_parent(d, virq, nr_irqs);
>>> +       return ret;
>>>   }
>>>
>>>   void gic_dev_domain_free(struct irq_domain *d, unsigned int virq,
>>> --
>>> 2.8.2
>>>
>>>

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

end of thread, other threads:[~2016-06-25  9:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23 11:05 [PATCH] irqchip/mips-gic: Fix IRQs in gic_dev_domain Harvey Hunt
2016-06-14  9:46 ` [tip:irq/urgent] " tip-bot for Harvey Hunt
     [not found] ` <CA+mqd+7mh3v-1mk4xpxBjxtt4_JjycisWj6VnV7AaOH=i=y3Qw@mail.gmail.com>
2016-06-23 18:11   ` [PATCH] " Jason Cooper
2016-06-25  8:58     ` Thomas Gleixner
2016-06-25  9:14     ` Qais Yousef

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).