linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler
@ 2017-01-30 11:35 Alexander Stein
  2017-01-30 11:51 ` Mika Westerberg
  2017-01-30 14:53 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Stein @ 2017-01-30 11:35 UTC (permalink / raw)
  To: Mika Westerberg, Heikki Krogerus, Linus Walleij
  Cc: Alexander Stein, linux-gpio

According to VLI64 Intel Atom E3800 Specification Update (#329901)
concurrent read accesses may result in returning 0xffffffff and write
accesses may be dropped silently.
To workaround all accesses must be protected by locks.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
I actually had the case where the read access in byt_irq_unmask returned
0xffffffff. After OR'ing the trigger bits and writing 0xffffffff back to
BYT_CONF0_REG things started to act strange.

Changes in v2:
* Adjusted commit message
* Remove locks in initializiation and suspend/resume functions
  namely: byt_gpio_irq_init_hw, byt_gpio_suspend and byt_gpio_resume
* Simply use raw_spin_lock instead of raw_spin_lock_irqsave inside IRQ handler

 drivers/pinctrl/intel/pinctrl-baytrail.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 9a1bbc1..6c7eed8 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1612,7 +1612,9 @@ static void byt_gpio_irq_handler(struct irq_desc *desc)
 			continue;
 		}
 
+		raw_spin_lock(&vg->lock);
 		pending = readl(reg);
+		raw_spin_unlock(&vg->lock);
 		for_each_set_bit(pin, &pending, 32) {
 			virq = irq_find_mapping(vg->chip.irqdomain, base + pin);
 			generic_handle_irq(virq);
-- 
2.10.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler
  2017-01-30 11:35 [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler Alexander Stein
@ 2017-01-30 11:51 ` Mika Westerberg
  2017-02-01  7:47   ` Alexander Stein
  2017-01-30 14:53 ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2017-01-30 11:51 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Heikki Krogerus, Linus Walleij, linux-gpio

On Mon, Jan 30, 2017 at 12:35:28PM +0100, Alexander Stein wrote:
> According to VLI64 Intel Atom E3800 Specification Update (#329901)
> concurrent read accesses may result in returning 0xffffffff and write
> accesses may be dropped silently.
> To workaround all accesses must be protected by locks.
> 
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Should probably go to stable as well.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler
  2017-01-30 11:35 [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler Alexander Stein
  2017-01-30 11:51 ` Mika Westerberg
@ 2017-01-30 14:53 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2017-01-30 14:53 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Mika Westerberg, Heikki Krogerus, linux-gpio@vger.kernel.org

On Mon, Jan 30, 2017 at 12:35 PM, Alexander Stein
<alexander.stein@systec-electronic.com> wrote:

> According to VLI64 Intel Atom E3800 Specification Update (#329901)
> concurrent read accesses may result in returning 0xffffffff and write
> accesses may be dropped silently.
> To workaround all accesses must be protected by locks.
>
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>

Patch applied for fixes and tagged for stable with Mika's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler
  2017-01-30 11:51 ` Mika Westerberg
@ 2017-02-01  7:47   ` Alexander Stein
  2017-02-02 14:48     ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Stein @ 2017-02-01  7:47 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Heikki Krogerus, Linus Walleij, linux-gpio

On Monday 30 January 2017 13:51:49, Mika Westerberg wrote:
> On Mon, Jan 30, 2017 at 12:35:28PM +0100, Alexander Stein wrote:
> > According to VLI64 Intel Atom E3800 Specification Update (#329901)
> > concurrent read accesses may result in returning 0xffffffff and write
> > accesses may be dropped silently.
> > To workaround all accesses must be protected by locks.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 
> Should probably go to stable as well.

Sure, but I don't know which stable kernels this should go in.

Best regards,
Alexander


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler
  2017-02-01  7:47   ` Alexander Stein
@ 2017-02-02 14:48     ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2017-02-02 14:48 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Mika Westerberg, Heikki Krogerus, linux-gpio@vger.kernel.org

On Wed, Feb 1, 2017 at 8:47 AM, Alexander Stein
<alexander.stein@systec-electronic.com> wrote:
> On Monday 30 January 2017 13:51:49, Mika Westerberg wrote:
>> On Mon, Jan 30, 2017 at 12:35:28PM +0100, Alexander Stein wrote:
>> > According to VLI64 Intel Atom E3800 Specification Update (#329901)
>> > concurrent read accesses may result in returning 0xffffffff and write
>> > accesses may be dropped silently.
>> > To workaround all accesses must be protected by locks.
>> >
>> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
>>
>> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>>
>> Should probably go to stable as well.
>
> Sure, but I don't know which stable kernels this should go in.

More often than not, I *think* Greg will figure that out by:
"does it apply?" "then yes"

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-02 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-30 11:35 [PATCH v2 1/1] pinctrl: baytrail: Add missing spinlock usage in byt_gpio_irq_handler Alexander Stein
2017-01-30 11:51 ` Mika Westerberg
2017-02-01  7:47   ` Alexander Stein
2017-02-02 14:48     ` Linus Walleij
2017-01-30 14:53 ` Linus Walleij

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).