Skip to content

Commit

Permalink
Merge tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6
Browse files Browse the repository at this point in the history
Pull irqdomain changes from Grant Likely:
 "Round of refactoring and enhancements to irq_domain infrastructure.
  This series starts the process of simplifying irqdomain.  The ultimate
  goal is to merge LEGACY, LINEAR and TREE mappings into a single
  system, but had to back off from that after some last minute bugs.
  Instead it mainly reorganizes the code and ensures that the reverse
  map gets populated when the irq is mapped instead of the first time it
  is looked up.

  Merging of the irq_domain types is deferred to v3.7

  In other news, this series adds helpers for creating static mappings
  on a linear or tree mapping."

* tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  irqdomain: Improve diagnostics when a domain mapping fails
  irqdomain: eliminate slow-path revmap lookups
  irqdomain: Fix irq_create_direct_mapping() to test irq_domain type.
  irqdomain: Eliminate dedicated radix lookup functions
  irqdomain: Support for static IRQ mapping and association.
  irqdomain: Always update revmap when setting up a virq
  irqdomain: Split disassociating code into separate function
  irq_domain: correct a minor wrong comment for linear revmap
  irq_domain: Standardise legacy/linear domain selection
  irqdomain: Make ops->map hook optional
  irqdomain: Remove unnecessary test for IRQ_DOMAIN_MAP_LEGACY
  irqdomain: Simple NUMA awareness.
  devicetree: add helper inline for retrieving a node's full name
  • Loading branch information
torvalds committed Aug 1, 2012
2 parents ac694db + f5a1ad0 commit 2d53492
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 169 deletions.
5 changes: 5 additions & 0 deletions Documentation/IRQ-domain.txt
Expand Up @@ -93,6 +93,7 @@ Linux IRQ number into the hardware.
Most drivers cannot use this mapping.

==== Legacy ====
irq_domain_add_simple()
irq_domain_add_legacy()
irq_domain_add_legacy_isa()

Expand All @@ -115,3 +116,7 @@ The legacy map should only be used if fixed IRQ mappings must be
supported. For example, ISA controllers would use the legacy map for
mapping Linux IRQs 0-15 so that existing ISA drivers get the correct IRQ
numbers.

Most users of legacy mappings should use irq_domain_add_simple() which
will use a legacy domain only if an IRQ range is supplied by the
system and will otherwise use a linear domain mapping.
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/xics/icp-hv.c
Expand Up @@ -111,7 +111,7 @@ static unsigned int icp_hv_get_irq(void)
if (vec == XICS_IRQ_SPURIOUS)
return NO_IRQ;

irq = irq_radix_revmap_lookup(xics_host, vec);
irq = irq_find_mapping(xics_host, vec);
if (likely(irq != NO_IRQ)) {
xics_push_cppr(vec);
return irq;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/xics/icp-native.c
Expand Up @@ -119,7 +119,7 @@ static unsigned int icp_native_get_irq(void)
if (vec == XICS_IRQ_SPURIOUS)
return NO_IRQ;

irq = irq_radix_revmap_lookup(xics_host, vec);
irq = irq_find_mapping(xics_host, vec);
if (likely(irq != NO_IRQ)) {
xics_push_cppr(vec);
return irq;
Expand Down
3 changes: 0 additions & 3 deletions arch/powerpc/sysdev/xics/xics-common.c
Expand Up @@ -329,9 +329,6 @@ static int xics_host_map(struct irq_domain *h, unsigned int virq,

pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw);

/* Insert the interrupt mapping into the radix tree for fast lookup */
irq_radix_revmap_insert(xics_host, virq, hw);

/* They aren't all level sensitive but we just don't really know */
irq_set_status_flags(virq, IRQ_LEVEL);

Expand Down
28 changes: 24 additions & 4 deletions include/linux/irqdomain.h
Expand Up @@ -112,6 +112,11 @@ struct irq_domain {
};

#ifdef CONFIG_IRQ_DOMAIN
struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
unsigned int size,
unsigned int first_irq,
const struct irq_domain_ops *ops,
void *host_data);
struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
unsigned int size,
unsigned int first_irq,
Expand Down Expand Up @@ -144,16 +149,31 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(

extern void irq_domain_remove(struct irq_domain *host);

extern int irq_domain_associate_many(struct irq_domain *domain,
unsigned int irq_base,
irq_hw_number_t hwirq_base, int count);
static inline int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
irq_hw_number_t hwirq)
{
return irq_domain_associate_many(domain, irq, hwirq, 1);
}

extern unsigned int irq_create_mapping(struct irq_domain *host,
irq_hw_number_t hwirq);
extern void irq_dispose_mapping(unsigned int virq);
extern unsigned int irq_find_mapping(struct irq_domain *host,
irq_hw_number_t hwirq);
extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq,
irq_hw_number_t hwirq);
extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host,
irq_hw_number_t hwirq);
extern int irq_create_strict_mappings(struct irq_domain *domain,
unsigned int irq_base,
irq_hw_number_t hwirq_base, int count);

static inline int irq_create_identity_mapping(struct irq_domain *host,
irq_hw_number_t hwirq)
{
return irq_create_strict_mappings(host, hwirq, hwirq, 1);
}

extern unsigned int irq_linear_revmap(struct irq_domain *host,
irq_hw_number_t hwirq);

Expand Down
15 changes: 10 additions & 5 deletions include/linux/of.h
Expand Up @@ -21,6 +21,7 @@
#include <linux/kref.h>
#include <linux/mod_devicetable.h>
#include <linux/spinlock.h>
#include <linux/topology.h>

#include <asm/byteorder.h>
#include <asm/errno.h>
Expand Down Expand Up @@ -158,11 +159,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)

#define OF_BAD_ADDR ((u64)-1)

#ifndef of_node_to_nid
static inline int of_node_to_nid(struct device_node *np) { return -1; }
#define of_node_to_nid of_node_to_nid
#endif

static inline const char* of_node_full_name(struct device_node *np)
{
return np ? np->full_name : "<no-node>";
Expand Down Expand Up @@ -427,6 +423,15 @@ static inline int of_machine_is_compatible(const char *compat)
while (0)
#endif /* CONFIG_OF */

#ifndef of_node_to_nid
static inline int of_node_to_nid(struct device_node *np)
{
return numa_node_id();
}

#define of_node_to_nid of_node_to_nid
#endif

/**
* of_property_read_bool - Findfrom a property
* @np: device node from which the property value is to be read.
Expand Down

0 comments on commit 2d53492

Please sign in to comment.