From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Phidias Chiang <phidias.chiang@canonical.com>,
Anisse Astier <anisse@astier.eu>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Yu C Chen <yu.c.chen@intel.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: cherryview: Do not mask all interrupts on probe
Date: Tue, 13 Sep 2016 15:52:14 +0300 [thread overview]
Message-ID: <20160913125214.GO1811@lahna.fi.intel.com> (raw)
In-Reply-To: <CACRpkdY9+poXW1cw4K20edGYjiuPN9DH0umsEAh31iHXGJhx6g@mail.gmail.com>
On Tue, Sep 13, 2016 at 02:22:25PM +0200, Linus Walleij wrote:
> On Tue, Sep 13, 2016 at 11:33 AM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> > On Tue, Sep 13, 2016 at 11:18:49AM +0200, Linus Walleij wrote:
> >> On Mon, Sep 12, 2016 at 3:11 PM, Mika Westerberg
> >> <mika.westerberg@linux.intel.com> wrote:
> >> > On Mon, Sep 12, 2016 at 09:04:44PM +0800, Phidias Chiang wrote:
> >> >> On Mon, Sep 12, 2016 at 12:04:01PM +0300, Mika Westerberg wrote:
> >> >> >
> >> >> > OK, I see what is going on now. When I changed handle_simple_irq to
> >> >> > handle_bad_irq, the IRQ core in __irq_do_set_handler() thinks the
> >> >> > handler is uninstalled and masks the line.
> >> >> >
> >> >> > If you change handle_bad_irq to handle_simple_irq, in call to
> >> >> > gpiochip_irqchip_add(), does it work then?
> >> >>
> >> >> Yes it does :), thank you for the support!
> >> >
> >> > Thanks for testing.
> >> >
> >> > So we need to use handle_simple_irq here instead.
> >> >
> >> > Linus, do you see any problems with that?
> >>
> >> I need to see the patch in its context with a commit message,
> >> I can't figure it out from the thread.
> >>
> >> handle_simple_irq() is for something generic not level- or
> >> edge-triggered. If you support specific triggers only, it
> >> should not be used.
> >>
> >> Nominally assigning handle_bad_irq() until a specific
> >> edge or level is requested is the right thing to do, since
> >> the IRQ is really not configured for anything at all and
> >> hence has undefined behaviour.
> >
> > For Cherryview/Braswell some interrupts are actually configured by the
> > BIOS but they are routed directly to the I/O-APIC and are supposed to be
> > handled without involvement of the GPIO driver (an example of this is
> > the ACPI SCI interrupt). However, INTMASK GPIO register can still be
> > used to mask the interrupt in question.
>
> A-ha! But why are you registering a irqdomain entry for an interrupt
> that cannot be used, hm?
Unfortunately there is no way to figure out from the hardware (or
firmware) whether the interrupt is supposed to be used by the GPIO
driver or something else.
> > So when we specify handle_bad_irq as handler the IRQ core thinks the
> > handler is being uninstalled and masks the interrupt.
>
> You should not register any handle for it.
>
> In fact, IMO the irqdomain should reject it being mapped, as it is not
> for the kernel to use.
>
> Check:
> drivers/irqchip/irq-vic.c
>
> We supply a u32 to the driver from the device tree named "valid-mask".
> This has bits set to 1 for the valid (to be mapped) IRQs and zero
> for those we may not touch.
>
> So in our vic_irqdomain_map() call we have:
>
> /* Skip invalid IRQs, only register handlers for the real ones */
> if (!(v->valid_sources & (1 << hwirq)))
> return -EPERM;
>
> So it can never be mapped.
>
> Also notice:
>
> /* create an IRQ mapping for each valid IRQ */
> for (i = 0; i < fls(valid_sources); i++)
> if (valid_sources & (1 << i))
> irq_create_mapping(v->domain, i);
>
> So we only create mappings where there are valid IRQs,
> skipping over any "holes" in the mapping.
>
> We should do something like this.
>
> To make this play nicely with gpiolib_irqchip_add() I suggest
> adding a bitmap valid_mask to struct gpio_chip() in
> include/linux/gpio/driver.h
> inside the CONFIG_GPIOLIB_IRQCHIP
>
> I guess
>
> u32 bitmap[MAX_IRQS_FOR_A_GPIO_CHIP];
>
> Then augment the generic GPIO IRQCHIP helpers in
> drivers/gpio/gpiolib.c per above so that the invalid
> IRQs can't be mapped.
>
> The driver would just:
>
> /* Mark line N as invalid: used by BIOS */
> set_bit(&chip->valid_mask, N);
Otherwise this probably works but it forces us to hardcode these
"special" lines in the driver and I would like to avoid that if
possible.
next prev parent reply other threads:[~2016-09-13 12:52 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 7:56 Mika Westerberg
2015-06-01 9:23 ` Mika Westerberg
2015-06-02 13:53 ` Linus Walleij
2015-06-02 14:15 ` Mika Westerberg
2016-08-16 16:12 ` Anisse Astier
2016-08-17 8:13 ` Mika Westerberg
2016-08-17 13:42 ` Anisse Astier
2016-08-18 12:13 ` Mika Westerberg
2016-08-18 13:52 ` Anisse Astier
2016-08-18 13:58 ` Mika Westerberg
2016-09-08 10:13 ` Phidias Chiang
2016-09-08 10:24 ` Mika Westerberg
2016-09-08 16:28 ` Phidias Chiang
2016-09-09 6:18 ` Mika Westerberg
2016-09-09 8:23 ` Phidias Chiang
2016-09-09 8:58 ` Mika Westerberg
2016-09-11 8:05 ` Mika Westerberg
2016-09-12 6:56 ` Phidias Chiang
2016-09-12 9:04 ` Mika Westerberg
2016-09-12 13:04 ` Phidias Chiang
2016-09-12 13:11 ` Mika Westerberg
2016-09-13 9:18 ` Linus Walleij
2016-09-13 9:33 ` Mika Westerberg
2016-09-13 12:22 ` Linus Walleij
2016-09-13 12:52 ` Mika Westerberg [this message]
2016-09-13 20:57 ` Linus Walleij
2016-09-14 8:26 ` Mika Westerberg
2016-09-14 12:46 ` Linus Walleij
2016-09-14 15:12 ` Mika Westerberg
2016-09-15 12:39 ` Linus Walleij
2016-09-15 15:42 ` Mika Westerberg
2016-09-15 15:52 ` [PATCH 1/2] gpiolib: Add possibility to mask which GPIOs are added to IRQ domain Mika Westerberg
2016-09-15 15:52 ` [PATCH 2/2] pinctrl: cherryview: Do not add all southwest and north GPIOs " Mika Westerberg
2016-09-15 16:07 ` [PATCH 1/2] gpiolib: Add possibility to mask which GPIOs are added " Marc Zyngier
2016-09-15 18:12 ` Mika Westerberg
2016-09-15 18:50 ` Thomas Gleixner
2016-09-18 11:16 ` Linus Walleij
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=20160913125214.GO1811@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=anisse@astier.eu \
--cc=heikki.krogerus@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=phidias.chiang@canonical.com \
--cc=tglx@linutronix.de \
--cc=yu.c.chen@intel.com \
/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
Powered by JetHome