linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Stephen Boyd <sboyd@chromium.org>,
	linux-sunxi <linux-sunxi@googlegroups.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Samuel Holland <samuel@sholland.org>
Subject: Re: [linux-sunxi] [PATCH] bus: sunxi-rsb: Make interrupt handling more robust
Date: Mon, 7 Oct 2019 17:29:48 +0200	[thread overview]
Message-ID: <20191007152948.jgz6l4zmqjxqpzus@gilmour> (raw)
In-Reply-To: <CAGb2v67nuMnN_o1Pvz2bEyUVeg5OMfJMVgih9-ZsgYFYDbffGw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2035 bytes --]

Hi,

On Mon, Oct 07, 2019 at 11:19:06PM +0800, Chen-Yu Tsai wrote:
> On Sun, Aug 25, 2019 at 1:50 AM Samuel Holland <samuel@sholland.org> wrote:
> > The RSB controller has two registers for controlling interrupt inputs:
> > RSB_INTE, which has bits for each possible interrupt, and the global
> > interrupt enable bit in RSB_CTRL.
> >
> > Currently, we enable the bits in RSB_INTE before each transfer, but this
> > is unnecessary because we never disable them. Move the initialization of
> > RSB_INTE so it is done only once.
> >
> > We also set the global interrupt enable bit before each transfer. Unlike
> > other bits in RSB_CTRL, this bit is cleared by writing a zero. Thus, we
> > clear the bit in the post-timeout cleanup code, so note that in the
> > comment.
> >
> > However, if we do receive an interrupt, we do not clear the bit. Nor do
> > we clear interrupt statuses before starting a transfer. Thus, if some
> > other driver uses the RSB bus while Linux is suspended (as both Trusted
> > Firmware and SCP firmware do to control the PMIC), we receive spurious
> > interrupts upon resume. This causes false completion of a transfer, and
> > the next transfer starts prematurely, causing a LOAD_BSY condition. The
> > end result is that some transfers at resume fail with -EBUSY.
>
> If we are expecting the hardware to not be in the state we assume to be
> or left it in, then maybe we should also keep setting the interrupt enable
> bits on each transfer?
>
> Surely we expect to have exclusive use of the controller most of the time.
> If it's to handle suspend/resume, shouldn't we be adding power management
> callbacks instead? That would reset the controller to a known state when
> the system comes out of suspend, including clearing any pending interrupts.
>
> Maxime, anything you want to add? (BTW, Maxime switched email addresses.)

The patch looks pretty harmless, so we can merge it, but if we're
going to share the RSB between those components, we should probably
use the hardware spinlocks as well.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-10-07 15:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-24 17:50 [PATCH] bus: sunxi-rsb: Make interrupt handling more robust Samuel Holland
2019-10-07 12:08 ` Samuel Holland
2019-10-07 15:19 ` [linux-sunxi] " Chen-Yu Tsai
2019-10-07 15:29   ` Maxime Ripard [this message]
2019-10-08  3:56   ` Samuel Holland

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=20191007152948.jgz6l4zmqjxqpzus@gilmour \
    --to=mripard@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=samuel@sholland.org \
    --cc=sboyd@chromium.org \
    --cc=wens@csie.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;
as well as URLs for NNTP newsgroup(s).