mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: linux-kernel@vger.kernel.org
Cc: Milton Miller <miltonm@bga.com>,
	Grant Likely <grant.likely@secretlab.ca>
Subject: [PATCH 09/12] irqdomain: Reserve IRQs for legacy domain
Date: Fri, 15 Jun 2012 23:01:34 -0600	[thread overview]
Message-ID: <1339822897-15840-10-git-send-email-grant.likely@secretlab.ca> (raw)
In-Reply-To: <1339822897-15840-1-git-send-email-grant.likely@secretlab.ca>

It is really important to make sure irqs used by the legacy domain are
still reserved in the irq_desc subsystem so they don't get allocated
for some other purpose.  Without SPARSE_IRQ, this generally isn't a
problem because it is assumed that all irqs have static assignments
(which isn't actually true, and is part of the reason why SPARSE_IRQ
should really be turned on these days).  However, when SPARSE_IRQs is
turned on, the irq range passed to irq_domain_add_legacy() is not
guaranteed to be reserved.

This patch fixes the problem by unconditionally reserving any irqs
passed into irq_domain_add_legacy().  The irqs may have already been
reserved, so the return code on irq_reserve_irqs() may report a
failure, but it should still be safe.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 kernel/irq/irqdomain.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index d6d0de0..c0a00de 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -151,6 +151,13 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
 	if (!domain)
 		return NULL;
 
+	/*
+	 * Do our best to reserve the irq descs; but this overlaps with the nr_irqs setting
+	 * from the platform code
+	 */
+	if (irq_reserve_irqs(first_irq, size))
+		pr_info("IRQs %i..%i already reserved, overlapping with nr_irqs?\n",
+			first_irq, first_irq + size - 1);
 	WARN_ON(irq_domain_associate_many(domain, first_irq, first_hwirq, size));
 
 	return domain;
-- 
1.7.9.5


  parent reply	other threads:[~2012-06-16  5:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16  5:01 [PATCH 00/12] irqdomain cleanup and refactoring Grant Likely
2012-06-16  5:01 ` [PATCH 01/12] irqdomain: Split disassociating code into separate function Grant Likely
2012-06-16  5:57   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 02/12] irqdomain: Always update revmap when setting up a virq Grant Likely
2012-06-16  5:57   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 03/12] irqdomain: Support for static IRQ mapping and association Grant Likely
2012-06-16  5:58   ` Benjamin Herrenschmidt
2012-06-17 22:16     ` Grant Likely
2012-06-16  5:01 ` [PATCH 04/12] irqdomain: Eliminate dedicated radix lookup functions Grant Likely
2012-06-16  5:56   ` Benjamin Herrenschmidt
2012-06-16  6:12     ` Grant Likely
2012-06-17 21:58       ` Grant Likely
2012-06-16  5:01 ` [PATCH 05/12] irqdomain: Fix irq_create_direct_mapping() to test irq_domain type Grant Likely
2012-06-16  5:01 ` [PATCH 06/12] irqdomain: eliminate slow-path revmap lookups Grant Likely
2012-06-16  5:01 ` [PATCH 07/12] irqdomain: Make ops->map hook optional Grant Likely
2012-06-16  5:59   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 08/12] irqdomain: Replace LEGACY mapping with LINEAR Grant Likely
2012-06-16  6:01   ` Benjamin Herrenschmidt
2012-06-16  6:16     ` Grant Likely
2012-06-18 12:23       ` Mark Brown
2012-06-16  5:01 ` Grant Likely [this message]
2012-06-16  5:01 ` [PATCH 10/12] irqdomain: Add debugging message Grant Likely
2012-06-16  6:02   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 11/12] irqdomain: reorganize revmap data Grant Likely
2012-06-16  6:06   ` Benjamin Herrenschmidt
2012-06-16  6:19     ` Grant Likely
2012-06-16  6:20       ` Grant Likely
2012-06-16  5:01 ` [PATCH 12/12] irqdomain: merge linear and tree reverse mappings Grant Likely
2012-06-18 12:28 ` [PATCH 00/12] irqdomain cleanup and refactoring Mark Brown

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=1339822897-15840-10-git-send-email-grant.likely@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miltonm@bga.com \
    /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

all inboxes | Powered by JetHome®