powerpc: Separate the irq radix tree insertion and lookup
authorSebastien Dugue <sebastien.dugue@bull.net>
Thu, 4 Sep 2008 12:37:07 +0000 (22:37 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 15 Sep 2008 18:08:44 +0000 (11:08 -0700)
commit967e012ef306e99cfddcd7423f37414e6b568361
treeb265dc79fcc5d46d8397a01bd310cabfa3a2e28e
parentaaf4a9b0f78786e6915077cbbb1d6f4fb6a8ee0b
powerpc: Separate the irq radix tree insertion and lookup

irq_radix_revmap() currently serves 2 purposes, irq mapping lookup
and insertion which happen in interrupt and process context respectively.

Separate the function into its 2 components, one for lookup only and one
for insertion only.

Fix the only user of the revmap tree (XICS) to use the new functions.

Also, move the insertion into the radix tree of those irqs that were
requested before it was initialized at said tree initialization.

Mutual exclusion between the tree initialization and readers/writers is
handled via a state variable (revmap_trees_allocated) set to 1 when the tree
has been initialized and set to 2 after the already requested irqs have been
inserted in the tree by the init path. This state is checked before any reader
or writer access just like we used to check for tree.gfp_mask != 0 before.

Finally, now that we're not any longer inserting nodes into the radix-tree
in interrupt context, turn the GFP_ATOMIC allocations into GFP_KERNEL ones.

Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/include/asm/irq.h
arch/powerpc/kernel/irq.c
arch/powerpc/platforms/pseries/xics.c