netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Rob Herring <robh@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Kevin Hilman <khilman@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	Android Kernel Team <kernel-team@android.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"open list:THERMAL" <linux-pm@vger.kernel.org>,
	Linux IOMMU <iommu@lists.linux-foundation.org>,
	netdev <netdev@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Alexander Stein <alexander.stein@ew.tq-group.com>
Subject: Re: [PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state()
Date: Fri, 1 Jul 2022 01:10:48 -0700	[thread overview]
Message-ID: <CAGETcx-0bStPx8sF3BtcJFiu74NwiB0btTQ+xx_B=8B37TEb8w@mail.gmail.com> (raw)
In-Reply-To: <Yr6QUzdoFWv/eAI6@atomide.com>

On Thu, Jun 30, 2022 at 11:12 PM Tony Lindgren <tony@atomide.com> wrote:
>
> * Tony Lindgren <tony@atomide.com> [220701 08:33]:
> > * Saravana Kannan <saravanak@google.com> [220630 23:25]:
> > > On Thu, Jun 30, 2022 at 4:26 PM Rob Herring <robh@kernel.org> wrote:
> > > >
> > > > On Thu, Jun 30, 2022 at 5:11 PM Saravana Kannan <saravanak@google.com> wrote:
> > > > >
> > > > > On Mon, Jun 27, 2022 at 2:10 AM Tony Lindgren <tony@atomide.com> wrote:
> > > > > >
> > > > > > * Saravana Kannan <saravanak@google.com> [220623 08:17]:
> > > > > > > On Thu, Jun 23, 2022 at 12:01 AM Tony Lindgren <tony@atomide.com> wrote:
> > > > > > > >
> > > > > > > > * Saravana Kannan <saravanak@google.com> [220622 19:05]:
> > > > > > > > > On Tue, Jun 21, 2022 at 9:59 PM Tony Lindgren <tony@atomide.com> wrote:
> > > > > > > > > > This issue is no directly related fw_devlink. It is a side effect of
> > > > > > > > > > removing driver_deferred_probe_check_state(). We no longer return
> > > > > > > > > > -EPROBE_DEFER at the end of driver_deferred_probe_check_state().
> > > > > > > > >
> > > > > > > > > Yes, I understand the issue. But driver_deferred_probe_check_state()
> > > > > > > > > was deleted because fw_devlink=on should have short circuited the
> > > > > > > > > probe attempt with an  -EPROBE_DEFER before reaching the bus/driver
> > > > > > > > > probe function and hitting this -ENOENT failure. That's why I was
> > > > > > > > > asking the other questions.
> > > > > > > >
> > > > > > > > OK. So where is the -EPROBE_DEFER supposed to happen without
> > > > > > > > driver_deferred_probe_check_state() then?
> > > > > > >
> > > > > > > device_links_check_suppliers() call inside really_probe() would short
> > > > > > > circuit and return an -EPROBE_DEFER if the device links are created as
> > > > > > > expected.
> > > > > >
> > > > > > OK
> > > > > >
> > > > > > > > Hmm so I'm not seeing any supplier for the top level ocp device in
> > > > > > > > the booting case without your patches. I see the suppliers for the
> > > > > > > > ocp child device instances only.
> > > > > > >
> > > > > > > Hmmm... this is strange (that the device link isn't there), but this
> > > > > > > is what I suspected.
> > > > > >
> > > > > > Yup, maybe it's because of the supplier being a device in the child
> > > > > > interconnect for the ocp.
> > > > >
> > > > > Ugh... yeah, this is why the normal (not SYNC_STATE_ONLY) device link
> > > > > isn't being created.
> > > > >
> > > > > So the aggregated view is something like (I had to set tabs = 4 space
> > > > > to fit it within 80 cols):
> > > > >
> > > > >     ocp: ocp {         <========================= Consumer
> > > > >         compatible = "simple-pm-bus";
> > > > >         power-domains = <&prm_per>; <=========== Supplier ref
> > > > >
> > > > >                 l4_wkup: interconnect@44c00000 {
> > > > >             compatible = "ti,am33xx-l4-wkup", "simple-pm-bus";
> > > > >
> > > > >             segment@200000 {  /* 0x44e00000 */
> > > > >                 compatible = "simple-pm-bus";
> > > > >
> > > > >                 target-module@0 { /* 0x44e00000, ap 8 58.0 */
> > > > >                     compatible = "ti,sysc-omap4", "ti,sysc";
> > > > >
> > > > >                     prcm: prcm@0 {
> > > > >                         compatible = "ti,am3-prcm", "simple-bus";
> > > > >
> > > > >                         prm_per: prm@c00 { <========= Actual Supplier
> > > > >                             compatible = "ti,am3-prm-inst", "ti,omap-prm-inst";
> > > > >                         };
> > > > >                     };
> > > > >                 };
> > > > >             };
> > > > >         };
> > > > >     };
> > > > >
> > > > > The power-domain supplier is the great-great-great-grand-child of the
> > > > > consumer. It's not clear to me how this is valid. What does it even
> > > > > mean?
> > > > >
> > > > > Rob, is this considered a valid DT?
> > > >
> > > > Valid DT for broken h/w.
> > >
> > > I'm not sure even in that case it's valid. When the parent device is
> > > in reset (when the SoC is coming out of reset), there's no way the
> > > descendant is functional. And if the descendant is not functional, how
> > > is the parent device powered up? This just feels like an incorrect
> > > representation of the real h/w.
> >
> > It should be correct representation based on scanning the interconnects
> > and looking at the documentation. Some interconnect parts are wired
> > always-on and some interconnect instances may be dual-mapped.

Thanks for helping to debug this. Appreciate it.

> >
> > We have a quirk to probe prm/prcm first with pdata_quirks_init_clocks().

:'(

I checked out the code. These prm devices just get populated with NULL
as the parent. So they are effectively top level devices from the
perspective of driver core.

> > Maybe that also now fails in addition to the top level interconnect
> > probing no longer producing -EPROBE_DEFER.

As far as I can tell pdata_quirks_init_clocks() is just adding these
prm devices (amongst other drivers). So I don't expect that to fail.

> >
> > > > So the domain must be default on and then simple-pm-bus is going to
> > > > hold a reference to the domain preventing it from ever getting powered
> > > > off and things seem to work. Except what happens during suspend?
> > >
> > > But how can simple-pm-bus even get a reference? The PM domain can't
> > > get added until we are well into the probe of the simple-pm-bus and
> > > AFAICT the genpd attach is done before the driver probe is even
> > > called.
> >
> > The prm/prcm gets of_platform_populate() called on it early.

:'(

> The hackish patch below makes things boot for me, not convinced this
> is the preferred fix compared to earlier deferred probe handling though.
> Going back to the init level tinkering seems like a step back to me.

The goal of fw_devlink is to avoid init level tinkering and it does
help with that in general. But these kinds of quirks are going to need
a few exceptions -- with them being quirks and all. And this change
will avoid an unnecessary deferred probe (that used to happen even
before my change).

The other option to handle this quirk is to create the invalid
(consumer is parent of supplier) fwnode_link between the prm device
and its consumers when the prm device is populated. Then fw_devlink
will end up creating a device link when ocp gets added. But I'm not
sure if it's going to be easy to find and add all those consumers.

I'd say, for now, let's go with this patch below. I'll see if I can
get fw_devlink to handle these odd quirks without breaking the normal
cases or making them significantly slower. But that'll take some time
and I'm not sure there'll be a nice solution.

Thanks,
Saravana

> Regards,
>
> Tony
>
> 8< ----------------
> diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
> --- a/drivers/soc/ti/omap_prm.c
> +++ b/drivers/soc/ti/omap_prm.c
> @@ -991,4 +991,9 @@ static struct platform_driver omap_prm_driver = {
>                 .of_match_table = omap_prm_id_table,
>         },
>  };
> -builtin_platform_driver(omap_prm_driver);
> +
> +static int __init omap_prm_init(void)
> +{
> +        return platform_driver_register(&omap_prm_driver);
> +}
> +subsys_initcall(omap_prm_init);
> --
> 2.36.1
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>

  reply	other threads:[~2022-07-01  8:11 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  7:06 [PATCH v2 0/9] deferred_probe_timeout logic clean up Saravana Kannan
2022-06-01  7:06 ` [PATCH v2 1/9] PM: domains: Delete usage of driver_deferred_probe_check_state() Saravana Kannan
2022-06-09 11:44   ` Ulf Hansson
2022-06-09 19:29     ` Saravana Kannan
2022-06-21  7:28   ` Tony Lindgren
2022-06-21 19:34     ` Saravana Kannan
2022-06-22  4:58       ` Tony Lindgren
2022-06-22 19:09         ` Saravana Kannan
2022-06-23  7:01           ` Tony Lindgren
2022-06-23  8:21             ` Saravana Kannan
2022-06-27  9:10               ` Tony Lindgren
2022-06-30 23:10                 ` Saravana Kannan
2022-06-30 23:26                   ` Rob Herring
2022-06-30 23:30                     ` Saravana Kannan
2022-07-01  5:33                       ` Tony Lindgren
2022-07-01  6:12                         ` Tony Lindgren
2022-07-01  8:10                           ` Saravana Kannan [this message]
2022-07-01  8:26                             ` Saravana Kannan
2022-07-01 13:00                               ` Tony Lindgren
2022-07-12  7:12                                 ` Tony Lindgren
2022-07-13  0:49                                   ` Saravana Kannan
2022-07-13  8:06                                     ` Tony Lindgren
2022-07-01 15:08                               ` Sudeep Holla
2022-07-01 19:13                                 ` Saravana Kannan
2022-07-05  8:44                                   ` Saravana Kannan
2022-07-01  7:38                   ` Geert Uytterhoeven
2022-06-23 12:08     ` Alexander Stein
2022-07-01  0:37       ` Saravana Kannan
2022-07-01  6:01         ` (EXT) " Alexander Stein
2022-07-01  7:02           ` Saravana Kannan
2022-07-04  7:07             ` (EXT) " Alexander Stein
2022-07-05  1:24               ` Saravana Kannan
2022-07-06 13:02                 ` Re: " Alexander Stein
2022-07-13  0:45                   ` Saravana Kannan
2022-07-14  6:41                     ` Alexander Stein
2022-07-15 22:08                       ` Saravana Kannan
2022-07-01  7:30         ` Geert Uytterhoeven
2022-06-01  7:06 ` [PATCH v2 2/9] pinctrl: devicetree: " Saravana Kannan
2022-06-01  7:06 ` [PATCH v2 3/9] net: mdio: " Saravana Kannan
2022-07-05  9:11   ` Geert Uytterhoeven
2022-07-13  1:40     ` Saravana Kannan
2022-07-13 11:39       ` Geert Uytterhoeven
2022-08-15  8:38     ` Geert Uytterhoeven
2022-06-01  7:07 ` [PATCH v2 4/9] driver core: Add wait_for_init_devices_probe helper function Saravana Kannan
2022-06-01  7:07 ` [PATCH v2 5/9] net: ipconfig: Relax fw_devlink if we need to mount a network rootfs Saravana Kannan
2022-06-01  7:07 ` [PATCH v2 6/9] Revert "driver core: Set default deferred_probe_timeout back to 0." Saravana Kannan
2022-07-20 17:31   ` Geert Uytterhoeven
2022-07-20 19:01     ` Saravana Kannan
2022-07-21  8:40       ` Geert Uytterhoeven
2022-06-01  7:07 ` [PATCH v2 7/9] driver core: Set fw_devlink.strict=1 by default Saravana Kannan
2022-06-22  7:47   ` Sascha Hauer
2022-06-22  8:44     ` Linus Walleij
2022-06-22 10:52       ` Andy Shevchenko
2022-06-22 11:18         ` Sascha Hauer
2022-06-22 19:40       ` Saravana Kannan
2022-06-22 20:35         ` Saravana Kannan
2022-06-22 22:30           ` Saravana Kannan
2022-06-28 13:09         ` Linus Walleij
2022-06-01  7:07 ` [PATCH v2 8/9] iommu/of: Delete usage of driver_deferred_probe_check_state() Saravana Kannan
2022-06-01  7:07 ` [PATCH v2 9/9] driver core: Delete driver_deferred_probe_check_state() Saravana Kannan
2022-06-07 18:07 ` [PATCH v2 0/9] deferred_probe_timeout logic clean up Geert Uytterhoeven
2022-06-08  0:55   ` Saravana Kannan
2022-06-08  4:17     ` Saravana Kannan
2022-06-08 10:25       ` Geert Uytterhoeven
2022-06-08 18:12         ` Saravana Kannan
2022-06-08 18:47           ` Geert Uytterhoeven
2022-06-08 21:07             ` Saravana Kannan
2022-06-08 22:49               ` Jakub Kicinski
2022-06-08 23:15                 ` Saravana Kannan

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='CAGETcx-0bStPx8sF3BtcJFiu74NwiB0btTQ+xx_B=8B37TEb8w@mail.gmail.com' \
    --to=saravanak@google.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kernel-team@android.com \
    --cc=khilman@kernel.org \
    --cc=kuba@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    --cc=will@kernel.org \
    --cc=yoshfuji@linux-ipv6.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).