All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Auger Eric <eric.auger@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	KVM list <kvm@vger.kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH v2] reset: Exclusive resets must be dedicated to a single hardware block
Date: Mon, 8 Oct 2018 13:47:51 +0200	[thread overview]
Message-ID: <CAMuHMdV3yt7S9sKgEuy7vJsCqSCfm8caNSNLwLVX4H8pNxpOzA@mail.gmail.com> (raw)
In-Reply-To: <1538996273.11512.13.camel@pengutronix.de>

Hi Philipp,

On Mon, Oct 8, 2018 at 12:57 PM Philipp Zabel <p.zabel@pengutronix.de> wrote:
> On Mon, 2018-10-08 at 11:59 +0200, Geert Uytterhoeven wrote:
> > On Fri, Oct 5, 2018 at 5:16 PM Philipp Zabel <p.zabel@pengutronix.de> wrote:
> > > On Fri, 2018-10-05 at 14:31 +0200, Geert Uytterhoeven wrote:
> > > [...]
> > > > > > > +                     eq = (args2.np == args.np &&
> > > > > > > +                           args2.args_count == args.args_count &&
> > > > > > > +                           !memcmp(args2.args, args.args,
> > > > > > > +                                   args.args_count * sizeof(args.args[0])));
> > > > >
> > > > > As there's at least one other function in -next that compares of_phandle_args,
> > > > > I will add a helper of_phandle_args_eq().
> > > > >
> > > > > > > +                     of_node_put(args2.np);
> > > > > > > +                     if (eq)
> > > > > >
> > > > > > Emitting a loud warning here could be very helpful if it contains
> > > > > > both the reset controller node and the reset index, as well as the
> > > >
> > > > Actually on DT-based systems, the index is a driver-specific
> > > > implementation detail, and may differ from the actual reset specifier in DT.
> > > > E.g. on R-Car systems, DT uses a human-readable representation matching
> > > > the datasheet, while internally, the driver uses a packed representation.
> > > > Hence printing the index may confuse the user.
> > > >
> > > > For lookup-based systems, this is different.
> > >
> > > Correct. I'm so used to #reset-cells = <1>, it's hard to remember the
> > > exceptions. So let's not try to print indices or args.
> > >
> > > > > > consumer nodes: node and node2.
> > > > >
> > > > > Indeed, will do, also for lookup resets.
> > > > >
> > > > > We already have of_print_phandle_args(), but that is a bit inflexible.
> > > > > Adding support for "%pOFa" looks like the modern thing to do.
> > > >
> > > > Scrap that: of_phandle_args is not derived from a device_node, so %pOFa
> > > > is not appropriate (and would crash instead of fall back to a pointer before
> > > > %pOFa support is implemented). And without more users, it doesn't make much
> > > > sense to go for a new type (e.g. "%pOA")...
> > > >
> > > > Actually, printing the full reset specifier is not needed. A message like
> > > >
> > > >     /soc/pwm@e6e31000 and /soc/pwm@e6e30000 share a reset on
> > > > /soc/clock-controller@e6150000
> > > >
> > > > should give sufficient clue to the user.
> > >
> > > Yes. You could also pass con_id into __of_reset_is_exclusive and print
> > > that. It would be nice to indicate which consumer requested exclusive
> > > access.
> >
> > con_id is used for lookup-based resets only?
> >
> > But the value passed there is the "id" parameter of
> > reset_control_get_exclusive().
>
> Sorry, I did mean the id parameter in the __of_reset_control_get case.

OK.

> > However, that is not the consumer name,
>
> It is the name of the reset signal from point of view of the consumer.
> It specifies, via its position in the reset-names property, which of
> potentially multiple reset phandles in the resets property is the one
> causing the conflict.
>
> > and usually NULL.
>
> In which case the resets property usually only contains one phandle, so
> it is not needed to determine the conflicting reset control.

For a device-specific driver knowing about all resets, that is indeed the case.
For the generic case (e.g. my vfio-platform use case), it just wants to reset
the device, and thus passes NULL.

Perhaps I should use devm_reset_control_array_get_exclusive() instead of
reset_control_get_exclusive(), to assert all resets?

However, that makes the detection of shared resets more tricky, as it needs
to consider all combinations. Currently e.g.
    resets = <&rst1> <&rst2>;
and
    resets = <&rst2> <&rst1>;
is not detected as reset sharing...

As device_reset() also uses the first reset only, I'll keep it that way...

> > I'm afraid the only way to know the consumer is to print a backtrace with
> > WARN()?
>
> I'm just suggesting to augment the warning message with the reset id, if
> available. For example:
>
>     /soc/pwm@e6e31000 requests exclusive control over reset "pwm"
>     shared with /soc/pwm@e6e30000 on /soc/clock-controller@e6150000

Thanks, consider it done for next version.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2018-10-08 11:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27 18:00 [PATCH v2] reset: Exclusive resets must be dedicated to a single hardware block Geert Uytterhoeven
2018-10-04 10:14 ` Philipp Zabel
2018-10-05  8:55   ` Geert Uytterhoeven
2018-10-05  8:55     ` Geert Uytterhoeven
2018-10-05 12:31     ` Geert Uytterhoeven
2018-10-05 12:31       ` Geert Uytterhoeven
2018-10-05 15:16       ` Philipp Zabel
2018-10-05 15:16         ` Philipp Zabel
2018-10-08  9:59         ` Geert Uytterhoeven
2018-10-08  9:59           ` Geert Uytterhoeven
2018-10-08 10:57           ` Philipp Zabel
2018-10-08 10:57             ` Philipp Zabel
2018-10-08 11:47             ` Geert Uytterhoeven [this message]
2018-10-08 11:47               ` Geert Uytterhoeven
2018-10-08 12:57               ` Philipp Zabel
2018-10-08 12:57                 ` Philipp Zabel

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=CAMuHMdV3yt7S9sKgEuy7vJsCqSCfm8caNSNLwLVX4H8pNxpOzA@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=alex.williamson@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eric.auger@redhat.com \
    --cc=geert+renesas@glider.be \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.