linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Sascha Weisenberger <sascha.weisenberger@siemens.com>
Subject: Re: [PATCH v2 2/3] spi: pxa2xx: Prepare for edge-triggered interrupts
Date: Tue, 17 Jan 2017 15:43:09 +0100	[thread overview]
Message-ID: <2071b852-40e9-75ae-c381-e0254138a9a7@siemens.com> (raw)
In-Reply-To: <d6d9079e-f671-139e-42d8-75158ac9ee17@linux.intel.com>

On 2017-01-17 14:11, Jarkko Nikula wrote:
> On 01/17/2017 10:10 AM, Jan Kiszka wrote:
>> On 2017-01-17 08:58, Robert Jarzmik wrote:
>>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>>>
>>>> When using the a device with edge-triggered interrupts, such as MSIs,
>>>> the interrupt handler has to ensure that there is a point in time
>>>> during
>>>> its execution where all interrupts sources are silent so that a new
>>>> event can trigger a new interrupt again.
>>>>
>>>> This is achieved here by looping over SSSR evaluation. We need to take
>>>> into account that SSCR1 may be changed by the transfer handler, thus we
>>>> need to redo the mask calculation, at least regarding the volatile
>>>> interrupt enable bit (TIE).
>>>
>>> I'd like moreover to add a question here.
>>>
>>> In pxa architecture, SPI interrupts are already edge-triggered, and
>>> it's working
>>> well. The interrupt source disabling is not disabled, but the interrupt
>>> controller doesn't trigger an interrupt anymore (as it is masked),
>>> yet it marks
>>> it as pending if an interrupt arrives while the interrupt handler is
>>> running.
>>>
>>> All of this is handled by the interrupt core. My question is why for
>>> Intel MSI's
>>> is it necessary to make a change in the driver instead or relying on the
>>> interrupt core as for the pxa ?
>>
>> If someone was using this driver with edge-triggered interrupt sources
>> so far, it was probably slower hardware and some luck (I've seen this
>> when driving fast-clocked devices vs. slower ones - only the latter
>> exposed the bug). Or that hardware did some temporary masking at
>> interrupt controller level while the handler was running. But that is
>> also not by design. It's the driver's task to ensure that all interrupt
>> sources are addressed once when returning from an edge-triggered
>> handler, and that is missing in this one.
>>
> Are you seeing actual problem here or adding loop just in case? Is it
> really so that PCI bridge doesn't generate another MSI interrupt if SPI
> controller has interrupt pending when handler returns? I don't know but
> I would expect irq line between SPI controller and PCI bridge is still
> level sensitive even PCI bridge issues MSIs to the CPU.
> 

Yes, I'm seeing real problems, e.g. on the Galileo board when running
against a slower SPI device and using MSI: An interrupt is raised
because the TX queue was flushed towards the device (threshold
underrun). While handling that interrupt, the device starts to respond
and an RX event occurs as well. This raises the related interrupt reason
before the TX source was satisfied. Therefore, the interrupt output of
the SPI master will never go down, and there will be no additional edge
generated. Using level-interrupts, this is no problem, but with
edge-triggered we get stuck.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2017-01-17 14:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 18:44 [PATCH v2 0/3] spi: pca2xx: Prepare for and enable MSI support Jan Kiszka
2017-01-16 18:44 ` [PATCH v2 1/3] spi: pxa2xx: Factor out handle_bad_msg Jan Kiszka
2017-01-17 11:18   ` Jarkko Nikula
2017-01-17 18:46   ` Applied "spi: pxa2xx: Factor out handle_bad_msg" to the spi tree Mark Brown
2017-01-16 18:44 ` [PATCH v2 2/3] spi: pxa2xx: Prepare for edge-triggered interrupts Jan Kiszka
2017-01-16 19:07   ` Andy Shevchenko
2017-01-16 19:46     ` Jan Kiszka
2017-01-17 18:52       ` Jan Kiszka
2017-01-17  7:54   ` Robert Jarzmik
2017-01-17  8:05     ` Jan Kiszka
2017-01-18  8:21       ` Robert Jarzmik
2017-01-18  9:33         ` Jan Kiszka
2017-01-18 12:46           ` Mark Brown
2017-01-19 15:34             ` Jan Kiszka
2017-01-19 19:37               ` [PATCH v3 " Jan Kiszka
2017-01-19 19:57                 ` Mark Brown
2017-01-19 20:04                   ` Andy Shevchenko
2017-01-20 12:21                     ` Mark Brown
2017-01-20 15:29                       ` Jan Kiszka
2017-01-20 16:14                         ` Mark Brown
2017-01-20  7:42                 ` Robert Jarzmik
2017-01-24 18:39               ` Applied "spi: pxa2xx: Prepare for edge-triggered interrupts" to the spi tree Mark Brown
2017-01-17  7:58   ` [PATCH v2 2/3] spi: pxa2xx: Prepare for edge-triggered interrupts Robert Jarzmik
2017-01-17  8:10     ` Jan Kiszka
2017-01-17 13:11       ` Jarkko Nikula
2017-01-17 14:43         ` Jan Kiszka [this message]
2017-01-16 18:44 ` [PATCH v2 3/3] spi: pca2xx-pci: Allow MSI Jan Kiszka
2017-01-16 19:08   ` Andy Shevchenko
2017-01-17 11:18     ` Jarkko Nikula
2017-01-24 18:39   ` Applied "spi: pca2xx-pci: Allow MSI" to the spi tree Mark Brown

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=2071b852-40e9-75ae-c381-e0254138a9a7@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel@zonque.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=robert.jarzmik@free.fr \
    --cc=sascha.weisenberger@siemens.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;
as well as URLs for NNTP newsgroup(s).