diff mbox

[RFC,06/14] irq_domain/powerpc: Eliminate virq_is_host()

Message ID 1326313337-24603-7-git-send-email-grant.likely@secretlab.ca (mailing list archive)
State Superseded
Headers show

Commit Message

Grant Likely Jan. 11, 2012, 8:22 p.m. UTC
There is only one user, and it is trivial to open-code.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/irq.h         |    1 -
 arch/powerpc/kernel/irq.c              |    7 -------
 arch/powerpc/sysdev/xics/xics-common.c |   12 ++++++------
 3 files changed, 6 insertions(+), 14 deletions(-)

Comments

Grant Likely Jan. 18, 2012, 12:38 a.m. UTC | #1
On Thu, Jan 12, 2012 at 3:17 AM, Milton Miller <miltonm@bga.com> wrote:
> On Wed Jan 11 2012 about 15:24:34 EST, Grant Likely wrote:
>> There is only one user, and it is trivial to open-code.
>
> I added virq_is_host because I had planned to change how we find the
> host (domain) from a virq.
>
> Instead of storing a pointer in irq_desc (a pointer for every irq),
> I planned to use a NR_IRQ(+extra) bitmap per domain.  This should be
> a win storage-wise when the number of irq controllers is less than the
> number of bits in a long.
>
> This would also convert scanning for a reverse map from walking every
> irqdesc to walking find_next_bit over the irqs assigned to the host.
>
> Thus my rule was "code outside kernel/irq must not touch domain";
> both the contents and how it was associated were abstracted.
>
> Other planned changes included splitting the reverse lookup into
> domain dependent pieces, creating the ida for sparse map at domain
> creation time (init irq is after radix_tree_init as its used by the
> current irq code) so we never fall back to linear search.  Linear
> populated the reverse map as the irq was assigned, and changed to
> a seperate subtype if it mapped an irq above the map size.
>
> I thought some of the domains would be split into seperate files
> selected by Kconfig, at least the sparse tree.
>
> There was also a nomap varient to handle iseries (and one of the cell
> varients) where the interrupt number to use for an event is controlled
> by the guest, that led to the discussion with tlgx about how to
> disallow the extra irqs above the limit set by the arch callback.
>
> Actually making virq-is-domain a domain callback could eliminate the
> need for the bitmap on legacy (range limited) domains.
>
>
> I have my work in progress patches from 2.6.39 if you would like to
> see them.  I was trying to clean up powerpc before pushing it over,
> and didn't get all the concepts written.  So I just sent Ben what
> was ready at the time and haven't had time to get back to it.

Go ahead and send me your patches.  I'll see what I can add into my series.

> Overall, I think most of the other concepts are ok, although I would
> have chosen to remove NO_IRQ before moving the code, and probably
> the rename from host to domain.

Haha.  Yeah, I debated reordering those a bit, but it would have
created a bunch of rebase work for little benefit.  Unless someone
really complains loudly, I'm going to leave it in the order as is.

>  I haven't studied the patches in
> detail since your tree is based on linux-next and my drive doesn't
> have space for that.  It took me a while to realize the code removed
> from the header file in 4/14 (powerpc use commmon host) was actually
> moved to irq-domain in 1/14 (a comment to that effect would be nice).

Okay, I'll add a comment to that effect.  If I rebase to Linus' tree
after 3.3-rc1 is released, can you help me test?

g.
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index abdd7ef..f80f262 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -58,7 +58,6 @@  extern atomic_t ppc_n_lost_interrupts;
 struct irq_data;
 extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
 extern irq_hw_number_t virq_to_hw(unsigned int virq);
-extern bool virq_is_host(unsigned int virq, struct irq_domain *host);
 
 /**
  * irq_alloc_host - Allocate a new irq_domain data structure
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 23fd9ce..a15cf0a 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -510,13 +510,6 @@  irq_hw_number_t virq_to_hw(unsigned int virq)
 }
 EXPORT_SYMBOL_GPL(virq_to_hw);
 
-bool virq_is_host(unsigned int virq, struct irq_domain *host)
-{
-	struct irq_data *irq_data = irq_get_irq_data(virq);
-	return irq_data ? irq_data->domain == host : false;
-}
-EXPORT_SYMBOL_GPL(virq_is_host);
-
 static int default_irq_host_match(struct irq_domain *h, struct device_node *np)
 {
 	return h->of_node != NULL && h->of_node == np;
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index c4b3ce1..fb2e303 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -212,16 +212,16 @@  void xics_migrate_irqs_away(void)
 		/* We can't set affinity on ISA interrupts */
 		if (virq < NUM_ISA_INTERRUPTS)
 			continue;
-		if (!virq_is_host(virq, xics_host))
-			continue;
-		irq = (unsigned int)virq_to_hw(virq);
-		/* We need to get IPIs still. */
-		if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
-			continue;
 		desc = irq_to_desc(virq);
 		/* We only need to migrate enabled IRQS */
 		if (!desc || !desc->action)
 			continue;
+		if (desc->irq_data.domain != xics_host)
+			continue;
+		irq = desc->irq_data.hwirq;
+		/* We need to get IPIs still. */
+		if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
+			continue;
 		chip = irq_desc_get_chip(desc);
 		if (!chip || !chip->irq_set_affinity)
 			continue;