genirq/irqdomain: Add map counter
authorThomas Gleixner <tglx@linutronix.de>
Mon, 19 Jun 2017 23:37:16 +0000 (01:37 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 22 Jun 2017 16:21:12 +0000 (18:21 +0200)
Add a map counter instead of counting radix tree entries for
diagnosis. That also gives correct information for linear domains.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/20170619235444.459397746@linutronix.de
include/linux/irqdomain.h
kernel/irq/irqdomain.c

index 9cf32a2fbe692d700d25bd13e4ca5d727258d456..17ccd54d936d374e7ed3459e513bc7dd4c2dafbc 100644 (file)
@@ -130,6 +130,7 @@ struct irq_domain_chip_generic;
  * @host_data: private data pointer for use by owner.  Not touched by irq_domain
  *             core code.
  * @flags: host per irq_domain flags
+ * @mapcount: The number of mapped interrupts
  *
  * Optional elements
  * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
@@ -152,6 +153,7 @@ struct irq_domain {
        const struct irq_domain_ops *ops;
        void *host_data;
        unsigned int flags;
+       unsigned int mapcount;
 
        /* Optional data */
        struct fwnode_handle *fwnode;
index e1b925bea205816f06075ec0ed9d8b51a612ffa5..8d5805c655b6b8a8015d63e0b1341bd44a50d2c5 100644 (file)
@@ -423,6 +423,7 @@ void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq)
 
        irq_data->domain = NULL;
        irq_data->hwirq = 0;
+       domain->mapcount--;
 
        /* Clear reverse map for this hwirq */
        if (hwirq < domain->revmap_size) {
@@ -474,6 +475,7 @@ int irq_domain_associate(struct irq_domain *domain, unsigned int virq,
                        domain->name = irq_data->chip->name;
        }
 
+       domain->mapcount++;
        if (hwirq < domain->revmap_size) {
                domain->linear_revmap[hwirq] = virq;
        } else {
@@ -1081,6 +1083,7 @@ static void irq_domain_insert_irq(int virq)
                struct irq_domain *domain = data->domain;
                irq_hw_number_t hwirq = data->hwirq;
 
+               domain->mapcount++;
                if (hwirq < domain->revmap_size) {
                        domain->linear_revmap[hwirq] = virq;
                } else {
@@ -1110,6 +1113,7 @@ static void irq_domain_remove_irq(int virq)
                struct irq_domain *domain = data->domain;
                irq_hw_number_t hwirq = data->hwirq;
 
+               domain->mapcount--;
                if (hwirq < domain->revmap_size) {
                        domain->linear_revmap[hwirq] = 0;
                } else {