linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: irqdomain breaks ap4 boot
Date: Thu, 09 Aug 2012 04:28:45 +0000	[thread overview]
Message-ID: <20120809042844.GF1614@linux-sh.org> (raw)
In-Reply-To: <878vdxd3mq.wl%kuninori.morimoto.gx@renesas.com>

On Fri, Aug 03, 2012 at 02:00:40PM +0900, Paul Mundt wrote:
> On Thu, Aug 02, 2012 at 02:50:26AM -0700, kuninori.morimoto.gx@renesas.com wrote:
> > 
> > Hi Paul
> > 
> > I noticed that sh irqdomain commit breaks mackerel boot.
> > below is "git bisect" result and kernel log
> > 
> > ------- log -----------------------------
> > ...
> > NR_IRQS:16 nr_irqs:16 16
> > intc: Registered controller 'sh7372-intca' with 108 IRQs
> > intc: Registered controller 'sh7372-intca-irq-lo' with 16 IRQs
> > intc: can't get irq_desc for 0
> > intc: can't get irq_desc for 1
> > intc: can't get irq_desc for 2
> > intc: can't get irq_desc for 3
> > intc: can't get irq_desc for 4
> > intc: can't get irq_desc for 5
> > intc: can't get irq_desc for 6
> > intc: can't get irq_desc for 7
> > intc: can't get irq_desc for 8
> > intc: can't get irq_desc for 9
> > intc: can't get irq_desc for 10
> > intc: can't get irq_desc for 11
> > intc: can't get irq_desc for 12
> > intc: can't get irq_desc for 13
> > intc: can't get irq_desc for 14
> > intc: can't get irq_desc for 15
> > intc: Registered controller 'sh7372-intca-irq-hi' with 16 IRQs
> 
> Great, it's ARM's silly NR_IRQS_LEGACY getting in the way, and we don't
> seem to have any ability to simply not pre-allocate IRQs given that ARM's
> machine_desc lamely doesn't allow 0 as a valid nr_irqs initializer even
> on sparseirq configurations.
> 
> It's not entirely obvious why you are tripping up on this though, as we
> should already gracefully handle the -EEXIST case.
> 
> I'll have a bit of a think over how to fix it properly.

Ok, it's fixed now. We were previously handling the -EEXIST case but were
getting tripped up by moving the irq_desc allocation in to the irq domain
code and not handling the failure case for pre-allocated vectors with
sparseirq.

I'll send this off for -rc2:

---

commit 1026023705b0baa2b37df2a0d1da0022fc7b985e
Author: Paul Mundt <lethal@linux-sh.org>
Date:   Thu Aug 9 12:59:40 2012 +0900

    sh: intc: Handle domain association for sparseirq pre-allocated vectors.
    
    Presently it's assumed that the irqdomain code handles the irq_desc
    allocation for us, but this isn't necessarily the case when we've
    pre-allocated IRQs via sparseirq. Previously we had a -EEXIST check in
    the code that attempted to trap these cases and simply update them
    in-place, but this behaviour was inadvertently lost in the transition to
    irqdomains.
    
    This simply restores the previous behaviour, first attempting to let the
    irqdomain core fetch the allocation for us, and falling back to an
    in-place domain association in the extant IRQ case. Fixes up regressions
    on platforms that pre-allocate legacy IRQs (specifically ARM-based
    SH-Mobile platforms, as SH stopped pre-allocating vectors some time ago).
    
    Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>

diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 2374468..32c26d7 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -324,8 +324,16 @@ int __init register_intc_controller(struct intc_desc *desc)
 
 		res = irq_create_identity_mapping(d->domain, irq);
 		if (unlikely(res)) {
-			pr_err("can't get irq_desc for %d\n", irq);
-			continue;
+			if (res = -EEXIST) {
+				res = irq_domain_associate(d->domain, irq, irq);
+				if (unlikely(res)) {
+					pr_err("domain association failure\n");
+					continue;
+				}
+			} else {
+				pr_err("can't identity map IRQ %d\n", irq);
+				continue;
+			}
 		}
 
 		intc_irq_xlate_set(irq, vect->enum_id, d);
@@ -345,8 +353,19 @@ int __init register_intc_controller(struct intc_desc *desc)
 			 */
 			res = irq_create_identity_mapping(d->domain, irq2);
 			if (unlikely(res)) {
-				pr_err("can't get irq_desc for %d\n", irq2);
-				continue;
+				if (res = -EEXIST) {
+					res = irq_domain_associate(d->domain,
+								   irq, irq);
+					if (unlikely(res)) {
+						pr_err("domain association "
+						       "failure\n");
+						continue;
+					}
+				} else {
+					pr_err("can't identity map IRQ %d\n",
+					       irq);
+					continue;
+				}
 			}
 
 			vect2->enum_id = 0;

  parent reply	other threads:[~2012-08-09  4:28 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02  9:50 irqdomain breaks ap4 boot kuninori.morimoto.gx
2012-08-03  5:00 ` Paul Mundt
2012-08-09  4:28 ` Paul Mundt [this message]
2012-08-09  4:53 ` Kuninori Morimoto
2012-08-10  6:10 ` Kuninori Morimoto
2012-08-10 12:38 ` Paul Mundt
2012-08-17  5:54   ` kzm9g boot fail (was Re: irqdomain breaks ap4 boot) Tetsuyuki Kobayashi
2012-08-20  1:14     ` Kuninori Morimoto
2012-08-20  3:13     ` Paul Mundt
2012-08-20  4:19     ` Kuninori Morimoto
2012-08-20  4:19     ` Tetsuyuki Kobayashi
2012-08-20  4:38     ` Paul Mundt
2012-08-20  4:45     ` Kuninori Morimoto
2012-08-20  5:24     ` Paul Mundt
2012-08-20  5:33     ` Tetsuyuki Kobayashi
2012-08-20  6:13     ` Kuninori Morimoto
2012-08-20  6:24     ` Kuninori Morimoto
2012-08-20  6:30     ` Paul Mundt
2012-08-20  6:32     ` Tetsuyuki Kobayashi
2012-08-22  6:49       ` [PATCH] mmc: sh-mmcif: avoid Oops on spurious interrupts Guennadi Liakhovetski
2012-08-22 12:16         ` Tetsuyuki Kobayashi
2012-08-23  7:11           ` Guennadi Liakhovetski
2012-09-04  7:40             ` Tetsuyuki Kobayashi
2012-08-31  3:05         ` Tetsuyuki Kobayashi
2012-09-18  6:13           ` Tetsuyuki Kobayashi
2012-09-18  6:42             ` Guennadi Liakhovetski
2012-09-18  8:02               ` Tetsuyuki Kobayashi
2012-09-18  8:44                 ` Tetsuyuki Kobayashi
2012-09-18  8:56                   ` Guennadi Liakhovetski
2012-09-19  2:50         ` Tetsuyuki Kobayashi
2012-09-26  1:47           ` Tetsuyuki Kobayashi
2012-09-26 10:04             ` Chris Ball
2012-09-19  6:24         ` Chris Ball
2012-09-21  2:35           ` Tetsuyuki Kobayashi
2012-08-20  7:18     ` kzm9g boot fail (was Re: irqdomain breaks ap4 boot) Magnus Damm
2012-08-20  7:40     ` Paul Mundt
2012-08-20  7:41     ` Kuninori Morimoto
2012-08-20  7:54     ` Paul Mundt
2012-08-20  8:12     ` Kuninori Morimoto
2012-08-20  8:35     ` Kuninori Morimoto
2012-08-21  2:31     ` Kuninori Morimoto
2012-08-21  4:22     ` Tetsuyuki Kobayashi
2012-08-31  6:55 ` irqdomain breaks ap4 boot Tetsuyuki Kobayashi
2012-08-31  7:17 ` Simon Horman
2012-08-31 10:36 ` Paul Mundt
2012-09-18  2:15 ` Tetsuyuki Kobayashi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120809042844.GF1614@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).