From: Matt Porter <matt.porter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Pantelis Antoniou
<panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
Cc: Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Koen Kooi
<koen-QLwJDigV5abLmq1fohREcCpxlwaOVQ5f@public.gmane.org>,
Alison Chaiken
<Alison_Chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>,
Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Jan Lubbe <jluebbe-H4yykcOXDpCzQB+pC5nmwQ@public.gmane.org>,
Alexander Sverdlin
<alexander.sverdlin-OYasijW0DpE@public.gmane.org>,
Michael Stickel <ms-g5CePrrZ5ROELgA04lAiVw@public.gmane.org>,
Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
Dirk Behme <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alan Tull
<delicious.quinoa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Michael Bohan <mbohan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Ionut Nicu <ioan.nicu.ext-OYasijW0DpE@public.gmane.org>,
Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>,
Matt Ranostay <mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Joel Becker <jlbec-aKy9MeLSZ9dg9hUCZPvPmw@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 3/3] DT: proc: Add runtime overlay interface in /proc
Date: Tue, 12 Nov 2013 10:27:47 -0500 [thread overview]
Message-ID: <20131112152747.GL8585@beef> (raw)
In-Reply-To: <86657251-2872-4FB2-B71A-519A685B458A-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
On Tue, Nov 12, 2013 at 09:40:38AM +0100, Pantelis Antoniou wrote:
> Hi Grant,
>
> On Nov 11, 2013, at 7:47 PM, Grant Likely wrote:
>
> > On Fri, 8 Nov 2013 17:06:10 +0200, Pantelis Antoniou <panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org> wrote:
> >> Add a runtime interface to /proc to enable generic device tree overlay
> >> usage.
> >>
> >> Two new /proc files are added:
> >>
> >> /proc/device-tree-overlay & /proc/device-tree-overlay-status
> >>
> >> /proc/device-tree-overlay accepts a stream of a device tree objects and
> >> applies it to the running kernel's device tree.
> >>
> >> $ cat ~/BB-UART2-00A0.dtbo >device-tree-overlay
> >> overlay_proc_release: Applied #2 overlay segments @0
> >>
> >> /proc/device-tree-overlay-status displays the the overlays added using
> >> the /proc interface
> >>
> >> $ cat device-tree-overlay-status
> >> 0: 861 bytes BB-UART2:00A0
> >>
> >> The format of the status line is
> >> <ID>: <SIZE> bytes <part-number>:<version>
> >>
> >> <ID> is the id of the overlay
> >> <SIZE> is the size of the overlay in bytes
> >> <part-number>, <version> are (optional) root level properties of the DTBO
> >>
> >> You can remove an overlay by echoing the <ID> number of the overlay
> >> precedded with a '-'
> >>
> >> So
> >> $ echo "-0" >device-tree-overlay-status
> >>
> >> Removes the overlay.
> >>
> >> Note that this seldom works on most platforms since platform_device
> >> removal is something that almost never works without extra patches.
> >>
> >> Signed-off-by: Pantelis Antoniou <panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
> >
> > Why /proc? Did you consider using the firmware loading mechanism? While
> > I expressed concerned about the capebus approach, the loading of
> > overlays needs to remain under the control of either a driver or the
> > platform. By default it should not be possible to drop an arbitrary
> > overlay into /proc/device-tree-overlay and have things change in the
> > base tree. Along the same lines, I would expect for the device driver or
> > platform to be able to filter or limit the parts of the tree that are
> > allowed to be modified.
> >
>
> The firmware loading mechanism is the preferred way to handle it, and is
> in fact what is used in practice by the whole cape manager mechanism.
> But that's part of specific board support, and this is more like a general
> way to use overlays, in any kind of DT enabled system.
>
> I agree this is a) completely dangerous and b) /proc is a bad place to put
> it. I put it here in order to get the ball rolling, about the proper place
> to put device tree related interfaces.
>
> The good thing about this interface is that it's always available, and
> it is good for debugging (especially loading/unloading debugging).
As was pointed out earlier in the thread, /proc just isn't the place to
add these configuration interfaces any longer.
>
>
> > A side benefit of the firmware loader is that the kernel can obtain the
> > overlay on its own if needed at boot time without userspace involvement.
> >
>
> Yes, that is correct, and it is the way we use it on the beaglebone.
> The root fs device is present on a overlay, which is built into the kernel's
> firmware.
Let's be clear that there are two use cases here
1) kernel driven overlay loading
- root device configuration, other early devices, kernel-based h/w
detection
2) userspace driven overlay loading
- s/w defined h/w, hobbyist connecting stuff on a breadboard,
userspace arduino support
Combining a configfs api for userspace configuration of the overlay to
load with the firmware loader interface would address both of these.
As Grant noted, you want the firmware loader support to handle the
standard kernel driver initiated case which you were doing with capebus
already. But for userspace we have configuration to hand to the kernel
in the form of the name of an overlay. This configuration should be
provided via configfs.
Instantiate an overlay:
mkdir /config/dto/0
would create the following attributes:
/config/dto/0/overlay
/config/dto/0/status
Start a firmware load of an overlay:
echo "foo.dtbo" > /config/dto/0/overlay
[loads /lib/firmware/foo.dtbo]
Status of overlay:
cat /config/dto/0/status
0: 861 bytes FOO:BAR0
Remove an overlay:
rmdir /config/dto/0
-Matt
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2013-11-12 15:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-08 15:06 [PATCH v3 0/3] Introducing Device Tree Overlays Pantelis Antoniou
2013-11-08 15:06 ` [PATCH v3 1/3] OF: Introduce Device Tree resolve support Pantelis Antoniou
[not found] ` <1383923170-24914-2-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-11 18:17 ` Grant Likely
[not found] ` <20131111181739.06BC5C42348-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12 8:28 ` Pantelis Antoniou
[not found] ` <F60B2232-94D0-41C6-8D79-5A28FA282D4E-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-13 1:39 ` Grant Likely
[not found] ` <20131113013936.E591FC419FB-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-13 9:06 ` Pantelis Antoniou
2013-11-08 15:06 ` [PATCH v3 2/3] OF: Introduce DT overlay support Pantelis Antoniou
2013-11-08 19:12 ` Guenter Roeck
2013-11-11 18:42 ` Grant Likely
[not found] ` <20131111184245.D569DC4234A-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12 9:30 ` Pantelis Antoniou
2013-11-14 1:31 ` Grant Likely
[not found] ` <20131114013124.7DD0AC404DF-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-14 10:01 ` Pantelis Antoniou
[not found] ` < 20131111184245.D569DC4234A@trevor.secretlab.ca>
[not found] ` < ED51965C-6EC8-48AE-A59C-CD09FFD57731@antoniou-consulting.com>
[not found] ` < 20131114013124.7DD0AC404DF@trevor.secretlab.ca>
[not found] ` < E4922A5F-11B3-4167-91EF-C0D5F3F77D40@antoniou-consulting.com>
[not found] ` <E4922A5F-11B3-4167-91EF-C0D5F3F77D40-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-14 21:22 ` Grant Likely
[not found] ` <20131114212206.EAD1BC402B4-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-15 8:34 ` Pantelis Antoniou
[not found] ` < 20131114212206.EAD1BC402B4@trevor.secretlab.ca>
[not found] ` < D048F1EA-B78C-4B10-9A6D-726A17036B42@antoniou-consulting.com>
[not found] ` <D048F1EA-B78C-4B10-9A6D-726A17036B42-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-15 16:13 ` Grant Likely
2013-11-08 15:06 ` [PATCH v3 3/3] DT: proc: Add runtime overlay interface in /proc Pantelis Antoniou
2013-11-08 20:00 ` Guenter Roeck
[not found] ` <1383923170-24914-4-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-11 10:22 ` Ionut Nicu
[not found] ` <5280AFCF.8050208-OYasijW0DpE@public.gmane.org>
2013-11-11 12:30 ` Pantelis Antoniou
2013-11-11 18:47 ` Grant Likely
[not found] ` <20131111184736.3DE20C4234E-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12 8:40 ` Pantelis Antoniou
[not found] ` <86657251-2872-4FB2-B71A-519A685B458A-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-12 15:27 ` Matt Porter [this message]
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=20131112152747.GL8585@beef \
--to=matt.porter-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=Alison_Chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org \
--cc=alexander.sverdlin-OYasijW0DpE@public.gmane.org \
--cc=delicious.quinoa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=ioan.nicu.ext-OYasijW0DpE@public.gmane.org \
--cc=jlbec-aKy9MeLSZ9dg9hUCZPvPmw@public.gmane.org \
--cc=jluebbe-H4yykcOXDpCzQB+pC5nmwQ@public.gmane.org \
--cc=koen-QLwJDigV5abLmq1fohREcCpxlwaOVQ5f@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mbohan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org \
--cc=mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ms-g5CePrrZ5ROELgA04lAiVw@public.gmane.org \
--cc=panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org \
--cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.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).