devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Russell King - ARM Linux
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	Gerlando Falauto
	<gerlando.falauto-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [RFC patch 4/8] genirq: generic chip: Cache per irq bit mask
Date: Fri, 03 May 2013 21:50:50 -0000	[thread overview]
Message-ID: <20130503214629.599155322@linutronix.de> (raw)
In-Reply-To: 20130503212258.385818955@linutronix.de

[-- Attachment #1: genirq-generic-chip-cache-mask.patch --]
[-- Type: text/plain, Size: 4882 bytes --]

Cache the per irq bit mask instead of recalculating it over and over.

Signed-off-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
 include/linux/irq.h       |    4 ++++
 kernel/irq/generic-chip.c |   23 ++++++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)

Index: linux-2.6/include/linux/irq.h
===================================================================
--- linux-2.6.orig/include/linux/irq.h
+++ linux-2.6/include/linux/irq.h
@@ -119,6 +119,7 @@ struct irq_domain;
 
 /**
  * struct irq_data - per irq and irq chip data passed down to chip functions
+ * @mask:		precomputed bitmask for accessing the chip registers
  * @irq:		interrupt number
  * @hwirq:		hardware interrupt number, local to the interrupt domain
  * @node:		node index useful for balancing
@@ -138,6 +139,7 @@ struct irq_domain;
  * irq_data.
  */
 struct irq_data {
+	u32			mask;
 	unsigned int		irq;
 	unsigned long		hwirq;
 	unsigned int		node;
@@ -705,11 +707,13 @@ struct irq_chip_generic {
  *				irq chips which need to call irq_set_wake() on
  *				the parent irq. Usually GPIO implementations
  * @IRQ_GC_MASK_CACHE_PER_TYPE:	Mask cache is chip type private
+ * @IRQ_GC_NO_MASK:		Do not calculate irq_data->mask
  */
 enum irq_gc_flags {
 	IRQ_GC_INIT_MASK_CACHE		= 1 << 0,
 	IRQ_GC_INIT_NESTED_LOCK		= 1 << 1,
 	IRQ_GC_MASK_CACHE_PER_TYPE	= 1 << 2,
+	IRQ_GC_NO_MASK			= 1 << 3,
 };
 
 /* Generic chip callback functions */
Index: linux-2.6/kernel/irq/generic-chip.c
===================================================================
--- linux-2.6.orig/kernel/irq/generic-chip.c
+++ linux-2.6/kernel/irq/generic-chip.c
@@ -35,7 +35,7 @@ void irq_gc_mask_disable_reg(struct irq_
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + ct->regs.disable);
@@ -54,7 +54,7 @@ void irq_gc_mask_set_bit(struct irq_data
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	*ct->mask_cache |= mask;
@@ -73,7 +73,7 @@ void irq_gc_mask_clr_bit(struct irq_data
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	*ct->mask_cache &= ~mask;
@@ -92,7 +92,7 @@ void irq_gc_unmask_enable_reg(struct irq
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + ct->regs.enable);
@@ -108,7 +108,7 @@ void irq_gc_ack_set_bit(struct irq_data 
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + ct->regs.ack);
@@ -123,7 +123,7 @@ void irq_gc_ack_clr_bit(struct irq_data 
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = ~(1 << (d->irq - gc->irq_base));
+	u32 mask = ~(d->mask);
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + ct->regs.ack);
@@ -138,7 +138,7 @@ void irq_gc_mask_disable_reg_and_ack(str
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + ct->regs.mask);
@@ -154,7 +154,7 @@ void irq_gc_eoi(struct irq_data *d)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct irq_chip_type *ct = irq_data_get_chip_type(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + ct->regs.eoi);
@@ -172,7 +172,7 @@ void irq_gc_eoi(struct irq_data *d)
 int irq_gc_set_wake(struct irq_data *d, unsigned int on)
 {
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
-	u32 mask = 1 << (d->irq - gc->irq_base);
+	u32 mask = d->mask;
 
 	if (!(mask & gc->wake_enabled))
 		return -EINVAL;
@@ -264,6 +264,11 @@ void irq_setup_generic_chip(struct irq_c
 		if (flags & IRQ_GC_INIT_NESTED_LOCK)
 			irq_set_lockdep_class(i, &irq_nested_lock_class);
 
+		if (!(flags & IRQ_GC_NO_MASK)) {
+			struct irq_data *d = irq_get_irq_data(i);
+
+			d->mask = 1 << (i - gc->irq_base);
+		}
 		irq_set_chip_and_handler(i, &ct->chip, ct->handler);
 		irq_set_chip_data(i, gc);
 		irq_modify_status(i, clr, set);

  parent reply	other threads:[~2013-05-03 21:50 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 18:25 [PATCH] irqchip: add support for Marvell Orion SoCs Sebastian Hesselbarth
     [not found] ` <1367519104-19677-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-02 18:33   ` Sebastian Hesselbarth
2013-05-02 18:45     ` Russell King - ARM Linux
2013-05-02 18:54       ` Sebastian Hesselbarth
2013-05-02 18:56         ` Russell King - ARM Linux
2013-05-02 19:04           ` Sebastian Hesselbarth
2013-05-02 18:53   ` Jason Gunthorpe
2013-05-02 19:05     ` Sebastian Hesselbarth
2013-05-02 19:35       ` Jason Gunthorpe
2013-05-02 19:48         ` Sebastian Hesselbarth
2013-05-02 20:02           ` Andrew Lunn
2013-05-02 20:08             ` Gregory CLEMENT
     [not found]           ` <5182C322.3030304-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-04 17:58             ` Jason Cooper
2013-05-02 19:11     ` Arnd Bergmann
2013-05-02 19:34       ` Sebastian Hesselbarth
2013-05-02 19:37         ` Jason Gunthorpe
2013-05-02 19:39         ` Sebastian Hesselbarth
2013-05-02 19:22   ` Jason Cooper
2013-05-02 23:48   ` [PATCH v2 0/5] ARM: orion: add orion irqchip driver Sebastian Hesselbarth
     [not found]     ` <1367538519-23940-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-02 23:48       ` [PATCH v2 1/5] irqchip: add support for Marvell Orion SoCs Sebastian Hesselbarth
2013-05-03 12:55         ` Russell King - ARM Linux
2013-05-03 13:13           ` Sebastian Hesselbarth
2013-05-03 14:09             ` Thomas Gleixner
2013-05-03 21:50               ` [RFC patch 0/8] genirq: Support for irq domains in generic irq chip Thomas Gleixner
2013-05-03 21:50                 ` [RFC patch 1/8] genirq: generic chip: Remove the local cur_regs() function Thomas Gleixner
     [not found]                   ` <20130503214629.397359626-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-05-27 13:38                     ` Grant Likely
2013-05-03 21:50                 ` [RFC patch 2/8] genirq: generic chip: Add support for per chip type mask cache Thomas Gleixner
2013-05-03 21:50                 ` [RFC patch 3/8] genirq: generic chip: Handle separate mask registers Thomas Gleixner
2013-05-03 21:50                 ` Thomas Gleixner [this message]
2013-05-03 22:24                   ` [RFC patch 4/8] genirq: generic chip: Cache per irq bit mask Russell King - ARM Linux
2013-05-03 22:39                     ` Thomas Gleixner
2013-05-03 21:50                 ` [RFC patch 5/8] genirq: Add a mask calculation function Thomas Gleixner
2013-05-03 21:50                 ` [RFC patch 6/8] genirq: Split out code in generic chip Thomas Gleixner
2013-05-27 13:45                   ` Grant Likely
2013-05-03 21:50                 ` [RFC patch 7/8] genirq: generic chip: Add linear irq domain support Thomas Gleixner
2013-05-03 22:23                   ` Russell King - ARM Linux
2013-05-03 22:38                     ` Thomas Gleixner
2013-05-04  2:30                   ` Sebastian Hesselbarth
2013-05-04  8:04                     ` Thomas Gleixner
2013-05-06 12:32                   ` [RFC patch 7/8] fixup 1/2: " Sebastian Hesselbarth
2013-05-06 12:32                     ` [RFC patch 7/8] fixup 2/2: " Sebastian Hesselbarth
2013-05-06 13:31                       ` Thomas Gleixner
2013-05-06 13:25                     ` [RFC patch 7/8] fixup 1/2: " Thomas Gleixner
2013-05-03 21:50                 ` [RFC patch 8/8] irqchip: sun4i: Convert to generic irq chip Thomas Gleixner
2013-05-04  2:37                   ` Sebastian Hesselbarth
2013-05-06  9:48                 ` [RFC patch 0/8] genirq: Support for irq domains in " Uwe Kleine-König
     [not found]                 ` <20130503212258.385818955-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-05-06 14:30                   ` [patch 0/8] genirq: Support for irq domains in generic irq chip - V2 Thomas Gleixner
2013-05-06 14:30                     ` [patch 1/8] genirq: generic chip: Remove the local cur_regs() function Thomas Gleixner
2013-05-06 14:30                     ` [patch 2/8] genirq: generic chip: Add support for per chip type mask cache Thomas Gleixner
2013-05-06 14:30                     ` [patch 3/8] genirq: generic chip: Handle separate mask registers Thomas Gleixner
2013-05-06 14:30                     ` [patch 4/8] genirq: generic chip: Cache per irq bit mask Thomas Gleixner
2013-05-06 14:30                     ` [patch 5/8] genirq: Add a mask calculation function Thomas Gleixner
2013-05-06 14:30                     ` [patch 6/8] genirq: Split out code in generic chip Thomas Gleixner
2013-05-06 14:30                     ` [patch 7/8] genirq: generic chip: Add linear irq domain support Thomas Gleixner
2013-05-29  2:22                       ` Grant Likely
2013-05-29  8:23                         ` Thomas Gleixner
2013-05-06 14:30                     ` [patch 8/8] irqchip: sun4i: Convert to generic irq chip Thomas Gleixner
2013-05-06 15:18                       ` Rob Herring
2013-05-12 14:05                       ` [PATCH] irq-sun4i: Fix trivial build errors Maxime Ripard
2013-05-12 14:08                       ` [patch 8/8] irqchip: sun4i: Convert to generic irq chip Maxime Ripard
2013-05-12 14:14                         ` Maxime Ripard
2013-05-02 23:48       ` [PATCH v2 2/5] ARM: dove: add DT parsing for legacy mv643xx_eth Sebastian Hesselbarth
     [not found]         ` <1367538519-23940-3-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-03  5:06           ` Andrew Lunn
2013-05-03  9:58             ` Sebastian Hesselbarth
     [not found]             ` <20130503050632.GC24965-g2DYL2Zd6BY@public.gmane.org>
2013-05-04 18:29               ` Jason Cooper
     [not found]                 ` <20130504182935.GO31290-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2013-05-04 19:37                   ` Florian Fainelli
2013-05-02 23:48       ` [PATCH v2 3/5] ARM: dove: add DT parsing for legacy timer Sebastian Hesselbarth
2013-05-02 23:48     ` [PATCH v2 4/5] ARM: dove: move DT boards to orion irqchip driver Sebastian Hesselbarth
2013-05-02 23:48     ` [PATCH v2 5/5] ARM: dove: add DT nodes for irqchip conversion Sebastian Hesselbarth
2013-05-02 21:34 ` [PATCH] irqchip: add support for Marvell Orion SoCs Thomas Gleixner
2013-05-02 21:56   ` Sebastian Hesselbarth
2013-05-02 22:09     ` Arnd Bergmann
2013-05-02 22:37       ` Sebastian Hesselbarth
     [not found]         ` <5182EAA0.9070208-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-04 18:12           ` Jason Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130503214629.599155322@linutronix.de \
    --to=tglx-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=gerlando.falauto-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=moinejf-GANU6spQydw@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).