From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] genirq: move mask_cache into struct irq_chip_type
Date: Fri, 15 Mar 2013 21:47:23 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.02.1303152101080.22263@ionos> (raw)
In-Reply-To: <1363376175-22312-3-git-send-email-gerlando.falauto@keymile.com>
Gerlando,
On Fri, 15 Mar 2013, Gerlando Falauto wrote:
> This fixes a regression introduced by e59347a
> "arm: orion: Use generic irq chip".
>
> The same interrupt mask cache (stored within struct irq_chip_generic)
> is shared between all the irq_chip_type instances. As each irq_chip_type
> can use a distinct mask register, sharing a single mask cache may not be
> correct. For instance in the case of Orion SoCs, which have separate
> mask registers for edge and level interrupts.
>
> This patch moves mask_cache from struct irq_chip_generic into struct
> irq_chip_type. Note that the interrupt support for Samsung SoCs is also
> slightly affected.
The patch is correct, but we want a more incremental approach.
Step 1:
Add the pointer and the mask_cache to ct
init all ct->pointers in the setup code to gc->mask_cache
switch core code over to use the ct->pointer
Functional equivilent!
Step 2:
Convert each user out of core to the ct->pointer (separate patches)
Functional equivilent!
Step 3:
Rename gc->mask_cache to gc->shared_mask_cache
And we keep that instead of using ct[0].mask_cache simply because
it makes the code simpler to understand.
Step 4:
Add the extra flag and the initializer for the separate mask_caches
Step5:
Convert the affected SOCs (separate patches)
Otherwise I only have a coding style related request:
> @@ -246,9 +246,21 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
> list_add_tail(&gc->list, &gc_list);
> raw_spin_unlock(&gc_lock);
>
> - /* Init mask cache ? */
> - if (flags & IRQ_GC_INIT_MASK_CACHE)
> - gc->mask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask);
> + for (i = 0; i < gc->num_ct; i++) {
> + if (flags & IRQ_GC_SEPARATE_MASK_REGISTERS)
> + /* Define mask cache pointer */
> + ct[i].pmask_cache = &ct[i].mask_cache;
> + else
> + /* They all point to the same mask cache */
> + ct[i].pmask_cache = &ct[0].mask_cache;
> +
> + /* Init mask cache ? */
> + if ((flags & IRQ_GC_INIT_MASK_CACHE)
> + && ((flags & IRQ_GC_SEPARATE_MASK_REGISTER)
> + || (i == 0)))
> + *ct[i].pmask_cache =
> + irq_reg_readl(gc->reg_base + ct[i].regs.mask);
> + }
My eyes are burning, my head is spinning and I have a hard time not to
use swearwords.
bool mskperct = flags & IRQ_GC_SEPARATE_MASK_REGISTERS;
bool mskinit = flags & IRQ_GC_INIT_MASK_CACHE;
u32 *shmsk = &gc->shared_mask_cache;
if (!mskperct && mskinit)
*shmsk = irq_reg_readl(gc->reg_base + ct->regs.mask);
for (i = 0; i < gc->num_ct: i++, ct++) {
ct->pmask_cache = mskperct ? &ct->mask_cache : shmsk;
if (mskperct && mskinit)
ct->mask_cache = irq_reg_readl(gc->reg_base +
ct->regs.mask);
}
Or something like that, perhaps ?
Thanks,
tglx
next prev parent reply other threads:[~2013-03-15 20:47 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 16:10 [PATCH] genirq: allow an alternative setup for the mask cache Holger Brunck
2013-03-14 17:45 ` Simon Guinot
2013-03-15 10:43 ` Holger Brunck
2013-03-15 11:02 ` Thomas Gleixner
2013-03-15 16:26 ` Gerlando Falauto
2013-03-15 19:55 ` Thomas Gleixner
2013-03-14 19:08 ` Thomas Gleixner
2013-03-14 19:42 ` Ezequiel Garcia
2013-03-18 11:05 ` Gerlando Falauto
2013-03-15 19:36 ` [PATCH v2 0/2] refactoring for mask_cache Gerlando Falauto
2013-03-15 19:36 ` [PATCH 1/2] genirq: cosmetic: remove cur_regs Gerlando Falauto
2013-03-15 19:36 ` [PATCH 2/2] genirq: move mask_cache into struct irq_chip_type Gerlando Falauto
2013-03-15 20:47 ` Thomas Gleixner [this message]
2013-03-18 7:59 ` Gerlando Falauto
2013-03-18 8:56 ` Thomas Gleixner
2013-03-15 21:25 ` [PATCH v2 0/2] refactoring for mask_cache Andrew Lunn
2013-03-15 23:34 ` Simon Guinot
2013-03-18 14:00 ` [PATCH v3 0/9] " Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 1/9] genirq: cosmetic: remove cur_regs Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 2/9] genirq: add mask_cache and pmask_cache into struct irq_chip_type Gerlando Falauto
2013-03-19 11:32 ` Thomas Gleixner
2013-03-18 14:00 ` [PATCH v3 3/9] gpio: mvebu: convert to usage of *pmask_cache within irq_chip_type Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 4/9] MIPS: JZ4740: " Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 5/9] ARM: SAMSUNG: " Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 6/9] genirq: rename mask_cache to shared_mask_cache Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 7/9] genirq: handle separate mask registers Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 8/9] orion-gpio: enable IRQ_GC_SEPARATE_MASK_REGISTERS Gerlando Falauto
2013-03-18 14:00 ` [PATCH v3 9/9] gpio: mvebu: " Gerlando Falauto
2013-03-18 14:28 ` [PATCH v3 0/9] refactoring for mask_cache Simon Guinot
2013-03-18 14:39 ` Simon Guinot
2013-03-19 10:03 ` Ezequiel Garcia
2013-03-19 10:09 ` Gerlando Falauto
2013-03-19 11:25 ` Ezequiel Garcia
2013-03-19 11:06 ` Jason Cooper
2013-03-19 11:10 ` Gerlando Falauto
2013-03-19 11:44 ` Jason Cooper
2013-03-19 11:56 ` Jason Cooper
2013-03-20 17:40 ` Gerlando Falauto
2013-03-20 21:42 ` Thomas Gleixner
2013-03-21 10:37 ` Gerlando Falauto
2013-03-21 10:59 ` Simon Guinot
2013-03-19 11:19 ` Ezequiel Garcia
2013-03-21 10:51 ` Simon Guinot
2013-03-21 11:24 ` Gerlando Falauto
2013-04-04 9:31 ` Ezequiel Garcia
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=alpine.LFD.2.02.1303152101080.22263@ionos \
--to=tglx@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.