public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Neeraj Upadhyay <neeraju@codeaurora.org>
To: Linus Walleij <linus.walleij@linaro.org>,
	Hans Verkuil <hverkuil@xs4all.nl>
Cc: Stephen Boyd <sboyd@kernel.org>,
	Tengfei Fan <tengfeif@codeaurora.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	MSM <linux-arm-msm@vger.kernel.org>,
	sramana@codeaurora.org
Subject: Re: Fwd: Re: [PATCH] pinctrl: qcom: Clear status bit on irq_unmask
Date: Mon, 17 Jun 2019 18:52:24 +0530	[thread overview]
Message-ID: <e88903a2-9b07-6eee-3776-0fc0ad429a2d@codeaurora.org> (raw)
In-Reply-To: <CACRpkdahUNNOhQdri3T86jHr+qOBmXH61_AMmoWpv_be2koMrw@mail.gmail.com>

Thanks for the review, Linus.

On 6/17/19 5:20 PM, Linus Walleij wrote:
> On Mon, Jun 17, 2019 at 12:35 PM Neeraj Upadhyay <neeraju@codeaurora.org> wrote:
>
>> Hi Stephen, there is one use case with is not covered by commit
>> b55326dc969e (
>>
>> "pinctrl: msm: Really mask level interrupts to prevent latching"). That
>> happens when
>>
>> gpio line is toggled between i/o mode and interrupt mode :
>>
>> 1. GPIO is configured as irq line. Peripheral raises interrupt.
>>
>> 2. IRQ handler runs and disables the irq line (through wq work).
>>
>> 3. GPIO is configured for input and and data is received from the
>> peripheral.
> There is no distinction between using a GPIO line as input
> and using it for IRQ. All input GPIOs can be used for IRQs,
> if the hardware supports it (has an irqchip).

Ok

>
>> 4. Now, when GPIO is re-enabled as irq, we see spurious irq, and there
>> isn't
>>
>> any data received on the gpio line, when it is read back after
>> configuring as input.
> That's an interesting usecase. Hans Verkuil reworked the
> GPIO irq support very elegantly exactly to support this type
> of usecase (irq switch on and off dynamically), where he
> was even switching the line into output mode between
> the IRQ trains. (one-wire transcactions for CEC).
>
>> Patch https://lkml.org/lkml/2019/6/17/226 tries to cover this use case.
>> Can you please provide your comments?
> What this patch does is clear all pending IRQs at irq
> unmask. This is usually safe, unless there may be cases
> where you *want* to catch any pending IRQs. I guess
> normally you don't so it should be safe?

We want to clear pending status at irq enable. Afaik, no,

we don't normally track these pending irqs. So, should be

fine here.

>
> The corner case is when you start some transaction
> or whatever that gets ACKed by an IRQ and you actually
> get the IRQ back before you had time to execute the code
> enabling the IRQ.
>
> That would be racy and bad code, as you should clearly
> enable the IRQ first, then start the transaction. So I think
> this patch is safe.
>
> But let's see what Bjorn says.
>
> Yours,
> Linus Walleij

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation


      reply	other threads:[~2019-06-17 13:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  6:51 [PATCH] pinctrl: qcom: Clear status bit on irq_unmask Tengfei Fan
2019-06-07 21:08 ` Linus Walleij
2019-06-10 14:51   ` Stephen Boyd
2019-06-11 10:41     ` tengfeif
2019-06-11 18:51       ` Stephen Boyd
     [not found]         ` <671f87d6-f4a4-6d2c-967b-e1aa0677d83e@codeaurora.org>
2019-06-17 10:35           ` Fwd: " Neeraj Upadhyay
2019-06-17 11:50             ` Linus Walleij
2019-06-17 13:22               ` Neeraj Upadhyay [this message]

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=e88903a2-9b07-6eee-3776-0fc0ad429a2d@codeaurora.org \
    --to=neeraju@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sramana@codeaurora.org \
    --cc=tengfeif@codeaurora.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