Commit 2d534926 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6

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
parents ac694dbd f5a1ad05
...@@ -93,6 +93,7 @@ Linux IRQ number into the hardware. ...@@ -93,6 +93,7 @@ Linux IRQ number into the hardware.
Most drivers cannot use this mapping. Most drivers cannot use this mapping.
==== Legacy ==== ==== Legacy ====
irq_domain_add_simple()
irq_domain_add_legacy() irq_domain_add_legacy()
irq_domain_add_legacy_isa() irq_domain_add_legacy_isa()
...@@ -115,3 +116,7 @@ The legacy map should only be used if fixed IRQ mappings must be ...@@ -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 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 mapping Linux IRQs 0-15 so that existing ISA drivers get the correct IRQ
numbers. 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.
...@@ -111,7 +111,7 @@ static unsigned int icp_hv_get_irq(void) ...@@ -111,7 +111,7 @@ static unsigned int icp_hv_get_irq(void)
if (vec == XICS_IRQ_SPURIOUS) if (vec == XICS_IRQ_SPURIOUS)
return NO_IRQ; return NO_IRQ;
irq = irq_radix_revmap_lookup(xics_host, vec); irq = irq_find_mapping(xics_host, vec);
if (likely(irq != NO_IRQ)) { if (likely(irq != NO_IRQ)) {
xics_push_cppr(vec); xics_push_cppr(vec);
return irq; return irq;
......
...@@ -119,7 +119,7 @@ static unsigned int icp_native_get_irq(void) ...@@ -119,7 +119,7 @@ static unsigned int icp_native_get_irq(void)
if (vec == XICS_IRQ_SPURIOUS) if (vec == XICS_IRQ_SPURIOUS)
return NO_IRQ; return NO_IRQ;
irq = irq_radix_revmap_lookup(xics_host, vec); irq = irq_find_mapping(xics_host, vec);
if (likely(irq != NO_IRQ)) { if (likely(irq != NO_IRQ)) {
xics_push_cppr(vec); xics_push_cppr(vec);
return irq; return irq;
......
...@@ -329,9 +329,6 @@ static int xics_host_map(struct irq_domain *h, unsigned int virq, ...@@ -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); 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 */ /* They aren't all level sensitive but we just don't really know */
irq_set_status_flags(virq, IRQ_LEVEL); irq_set_status_flags(virq, IRQ_LEVEL);
......
...@@ -112,6 +112,11 @@ struct irq_domain { ...@@ -112,6 +112,11 @@ struct irq_domain {
}; };
#ifdef CONFIG_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, struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
unsigned int size, unsigned int size,
unsigned int first_irq, unsigned int first_irq,
...@@ -144,16 +149,31 @@ static inline struct irq_domain *irq_domain_add_legacy_isa( ...@@ -144,16 +149,31 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
extern void irq_domain_remove(struct irq_domain *host); 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, extern unsigned int irq_create_mapping(struct irq_domain *host,
irq_hw_number_t hwirq); irq_hw_number_t hwirq);
extern void irq_dispose_mapping(unsigned int virq); extern void irq_dispose_mapping(unsigned int virq);
extern unsigned int irq_find_mapping(struct irq_domain *host, extern unsigned int irq_find_mapping(struct irq_domain *host,
irq_hw_number_t hwirq); irq_hw_number_t hwirq);
extern unsigned int irq_create_direct_mapping(struct irq_domain *host); extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, extern int irq_create_strict_mappings(struct irq_domain *domain,
irq_hw_number_t hwirq); unsigned int irq_base,
extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, irq_hw_number_t hwirq_base, int count);
irq_hw_number_t hwirq);
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, extern unsigned int irq_linear_revmap(struct irq_domain *host,
irq_hw_number_t hwirq); irq_hw_number_t hwirq);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/topology.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/errno.h> #include <asm/errno.h>
...@@ -158,11 +159,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size) ...@@ -158,11 +159,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
#define OF_BAD_ADDR ((u64)-1) #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) static inline const char* of_node_full_name(struct device_node *np)
{ {
return np ? np->full_name : "<no-node>"; return np ? np->full_name : "<no-node>";
...@@ -427,6 +423,15 @@ static inline int of_machine_is_compatible(const char *compat) ...@@ -427,6 +423,15 @@ static inline int of_machine_is_compatible(const char *compat)
while (0) while (0)
#endif /* CONFIG_OF */ #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 * of_property_read_bool - Findfrom a property
* @np: device node from which the property value is to be read. * @np: device node from which the property value is to be read.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment