From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Robert Marko" <robert.marko@sartura.hr>,
"Luka Perkov" <luka.perkov@sartura.hr>,
"Michael Walle" <michael@walle.cc>,
linux-kernel@vger.kernel.org,
"Randy Dunlap" <rdunlap@infradead.org>,
"Chen-Yu Tsai" <wenst@chromium.org>,
"Daniel Golle" <daniel@makrotopia.org>,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH v8 6/8] nvmem: core: Rework layouts to become platform devices
Date: Mon, 7 Aug 2023 11:33:21 +0200 [thread overview]
Message-ID: <20230807113321.0f0d46d8@xps-13> (raw)
In-Reply-To: <2023080704-garage-amused-f18b@gregkh>
Hi Greg,
gregkh@linuxfoundation.org wrote on Mon, 7 Aug 2023 11:05:48 +0200:
> On Mon, Aug 07, 2023 at 10:24:17AM +0200, Miquel Raynal wrote:
> > Current layout support was initially written without modules support in
> > mind. When the requirement for module support rose, the existing base
> > was improved to adopt modularization support, but kind of a design flaw
> > was introduced. With the existing implementation, when a storage device
> > registers into NVMEM, the core tries to hook a layout (if any) and
> > populates its cells immediately. This means, if the hardware description
> > expects a layout to be hooked up, but no driver was provided for that,
> > the storage medium will fail to probe and try later from
> > scratch. Technically, the layouts are more like a "plus" and, even we
> > consider that the hardware description shall be correct, we could still
> > probe the storage device (especially if it contains the rootfs).
> >
> > One way to overcome this situation is to consider the layouts as
> > devices, and leverage the existing notifier mechanism. When a new NVMEM
> > device is registered, we can:
> > - populate its nvmem-layout child, if any
> > - try to modprobe the relevant driver, if relevant
> > - try to hook the NVMEM device with a layout in the notifier
> > And when a new layout is registered:
> > - try to hook all the existing NVMEM devices which are not yet hooked to
> > a layout with the new layout
> > This way, there is no strong order to enforce, any NVMEM device creation
> > or NVMEM layout driver insertion will be observed as a new event which
> > may lead to the creation of additional cells, without disturbing the
> > probes with costly (and sometimes endless) deferrals.
>
> This is good, but why are you using a platform device here? Is it a
> real platform device, or just a "fake" one you created? If a fake one,
> please don't do that, use a real device, or a virtual device. Platform
> devices should ONLY represent actual, real, platform devices (i.e. ones
> descibed by the firmware).
NVMEM layouts have their own firmware node (DT only in this case), so I
guess we are in the "real device" situation here? But there is no
specific hardware in the physical world, so I don't know in which class
they should preferably be. I thought platform devices would be a
helpful abstraction.
With this additional information, in case you advise for using virtual
devices, would you mind being more specific on what you expect? What
should be used instead of platform devices?
> Sorry but I couldn't answer this question by looking at this patch, the
> device creation path isn't exactly obvious :)
I would expect this to be handled by the of_platform_populate() call,
but perhaps you were looking for something else.
Thanks,
Miquèl
next prev parent reply other threads:[~2023-08-07 9:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 8:24 [PATCH v8 0/8] NVMEM cells in sysfs Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 1/8] nvmem: core: Create all cells before adding the nvmem device Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 2/8] nvmem: core: Return NULL when no nvmem layout is found Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 3/8] nvmem: core: Do not open-code existing functions Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 4/8] nvmem: core: Track the registered devices Miquel Raynal
2023-08-07 9:02 ` Greg Kroah-Hartman
2023-08-07 12:10 ` Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 5/8] nvmem: core: Notify when a new layout is registered Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 6/8] nvmem: core: Rework layouts to become platform devices Miquel Raynal
2023-08-07 9:05 ` Greg Kroah-Hartman
2023-08-07 9:33 ` Miquel Raynal [this message]
2023-08-07 8:24 ` [PATCH v8 7/8] ABI: sysfs-nvmem-cells: Expose cells through sysfs Miquel Raynal
2023-08-07 8:24 ` [PATCH v8 8/8] nvmem: core: " Miquel Raynal
2023-08-07 8:57 ` [PATCH v8 0/8] NVMEM cells in sysfs Chen-Yu Tsai
2023-08-07 9:20 ` Miquel Raynal
2023-08-07 14:28 ` Miquel Raynal
2023-08-08 2:56 ` Chen-Yu Tsai
2023-08-08 6:29 ` Miquel Raynal
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=20230807113321.0f0d46d8@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=daniel@makrotopia.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luka.perkov@sartura.hr \
--cc=michael@walle.cc \
--cc=rafal@milecki.pl \
--cc=rdunlap@infradead.org \
--cc=robert.marko@sartura.hr \
--cc=srinivas.kandagatla@linaro.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wenst@chromium.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