devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/13] cmd: fdt: Add device tree overlays support
@ 2016-07-05  8:26 Maxime Ripard
       [not found] ` <20160705082646.25044-1-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 38+ messages in thread
From: Maxime Ripard @ 2016-07-05  8:26 UTC (permalink / raw)
  To: Pantelis Antoniou, Simon Glass
  Cc: Boris Brezillon, Alexander Kaplan, Thomas Petazzoni,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Antoine Ténart,
	Hans de Goede, Tom Rini, u-boot-0aAXYlwwYIKGBzrmiIFOJg,
	Stefan Agner, David Gibson, Maxime Ripard

Hi,

The device tree overlays are a great solution to the issue raised by
the bunch expandable boards we find everywhere these days, like the
Beaglebone, Raspberry Pi or CHIP.

However, most of the time, the overlays are applied through a
mechanism involving the firmware request interface in Linux, that is
only fully functional once the userspace has been mounted and is
running.

Some expansion boards might need to be enabled before that, because
they simply need to patch the DT early on, or need to be initialized
early in order to be fully functional, or because they provide access
to the root filesystem.

In these cases, having the bootloader applying the overlay before
Linux starts seems like the easiest solution.

This implementation doesn't provide all the Linux fancyness though,
there's no transactional application, which means that if the overlay
cannot be applied for a reason while you're still halfway through the
application, you're probably screwed. It also cannot remove an
overlay, but I don't think that it is currently a use-case.

There's still a bunch of work to extend the libfdt unit tests to test
the new functions introduced, but these patches will be submitted
in a near future, once things settle down.

Let me know what you think,
Maxime

Changes from v3:
  - Moved the patch to introduce fdt_getprop_namelen_w earlier to keep
    bisectability
  - Renamed fdt_setprop_inplace_namelen_by_index in
    fdt_setprop_inplace_namelen_partial
  - Reintroduced the check on the property length in fdt_setprop_inplace
  - Made sure the code was taking the non 32bits-aligned phandles
  - Used memchr instead of strchr in the fixup parsing code, and made
    sure the cases where the fixup format was wrong was reported as an
    error.
  - Fixed a bug where a property in a overlay having multiple phandles
    local to that overlay would only resolve the first one. Also added
    a test case for this
  - Added kerneldocs for all the overlay functions
  - Added a patch to fix a typo in separator
  - A few fixes, function renamings, error checking changes here and there

Changes from v2:
  - Add Kconfig option for the libfdt overlay support
  - Reworked the code to deal with Pantelis and David numerous
    comments, among which:
    * Remove the need for malloc in the overlay code, and added some
      libfdt functions to do that
    * Remove the DT magic in case of an error to not be able to use it
      anymore
    * Removed the fdt_ and _ function prefix for the static functions
    * Plus the usual bunch of rework, error checking and optimizations.

  - Added new tests to deal with bugs reported by David (the overlay
    was not applying when you add a subnode declared that was already
    in the base device tree, and using a local phandle was only
    working if the property storing it only had a length of 4).

Changes from v1:
  - Moved the overlay code to libfdt
  - Added unit tests
  - Refactored the code to reduce the amount of memory allocation
  - No longer modify the overlay itself, but create a copy to operate
    on instead.
  - Removed the limitations on the fixups path, names and properties
    length
  - Fixed a few things here and there according to comments
		    

Maxime Ripard (13):
  cmd: fdt: Narrow the check for fdt addr
  scripts: Makefile.lib: Sanitize DTB names
  vsprintf: Include stdarg for va_list
  libfdt: Add new headers and defines
  libfdt: Add iterator over properties
  libfdt: Add max phandle retrieval function
  libfdt: Fix separator spelling
  libfdt: Add fdt_path_offset_namelen
  libfdt: Add fdt_getprop_namelen_w
  libfdt: Add fdt_setprop_inplace_namelen_partial
  libfdt: Add overlay application function
  cmd: fdt: add fdt overlay application subcommand
  tests: Introduce DT overlay tests

 Makefile                          |   1 +
 cmd/fdt.c                         |  26 +-
 include/libfdt.h                  | 111 ++++++-
 include/libfdt_env.h              |   6 +
 include/test/overlay.h            |  16 +
 include/test/suites.h             |   1 +
 include/vsprintf.h                |   2 +
 lib/Kconfig                       |   5 +
 lib/libfdt/Makefile               |   2 +
 lib/libfdt/fdt_overlay.c          | 618 ++++++++++++++++++++++++++++++++++++++
 lib/libfdt/fdt_ro.c               |  46 ++-
 lib/libfdt/fdt_wip.c              |  29 +-
 scripts/Makefile.lib              |   8 +-
 test/Kconfig                      |   1 +
 test/cmd_ut.c                     |   6 +
 test/overlay/Kconfig              |  11 +
 test/overlay/Makefile             |  15 +
 test/overlay/cmd_ut_overlay.c     | 268 +++++++++++++++++
 test/overlay/test-fdt-base.dts    |  21 ++
 test/overlay/test-fdt-overlay.dts |  96 ++++++
 20 files changed, 1270 insertions(+), 19 deletions(-)
 create mode 100644 include/test/overlay.h
 create mode 100644 lib/libfdt/fdt_overlay.c
 create mode 100644 test/overlay/Kconfig
 create mode 100644 test/overlay/Makefile
 create mode 100644 test/overlay/cmd_ut_overlay.c
 create mode 100644 test/overlay/test-fdt-base.dts
 create mode 100644 test/overlay/test-fdt-overlay.dts

-- 
2.9.0

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2016-08-21 15:08 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-05  8:26 [PATCH v4 00/13] cmd: fdt: Add device tree overlays support Maxime Ripard
     [not found] ` <20160705082646.25044-1-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-05  8:26   ` [PATCH v4 01/13] cmd: fdt: Narrow the check for fdt addr Maxime Ripard
     [not found]     ` <20160705082646.25044-2-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-16  1:52       ` [U-Boot,v4,01/13] " Jaehoon Chung
     [not found]         ` <cf8fe411-8503-78d3-1603-05f1bacd0eb1-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-08-16  1:55           ` Tom Rini
2016-08-17  2:31             ` Jaehoon Chung
     [not found]               ` <3d40964a-47ce-c9cf-302a-c5f960245928-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-08-17 12:48                 ` Tom Rini
2016-08-21 15:06       ` Tom Rini
2016-07-05  8:26   ` [PATCH v4 02/13] scripts: Makefile.lib: Sanitize DTB names Maxime Ripard
     [not found]     ` <20160705082646.25044-3-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:06       ` [U-Boot,v4,02/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 03/13] vsprintf: Include stdarg for va_list Maxime Ripard
     [not found]     ` <20160705082646.25044-4-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:06       ` [U-Boot,v4,03/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 04/13] libfdt: Add new headers and defines Maxime Ripard
     [not found]     ` <20160705082646.25044-5-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:07       ` [U-Boot,v4,04/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 05/13] libfdt: Add iterator over properties Maxime Ripard
     [not found]     ` <20160705082646.25044-6-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:07       ` [U-Boot,v4,05/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 06/13] libfdt: Add max phandle retrieval function Maxime Ripard
     [not found]     ` <20160705082646.25044-7-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-06  1:13       ` David Gibson
2016-08-21 15:07       ` [U-Boot,v4,06/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 07/13] libfdt: Fix separator spelling Maxime Ripard
     [not found]     ` <20160705082646.25044-8-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-06  1:16       ` David Gibson
     [not found]         ` <20160706011641.GQ2251-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2016-07-11  6:59           ` Maxime Ripard
2016-08-21 15:07       ` [U-Boot,v4,07/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 08/13] libfdt: Add fdt_path_offset_namelen Maxime Ripard
     [not found]     ` <20160705082646.25044-9-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-06  1:21       ` David Gibson
2016-08-21 15:07       ` [U-Boot,v4,08/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 09/13] libfdt: Add fdt_getprop_namelen_w Maxime Ripard
     [not found]     ` <20160705082646.25044-10-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-06  1:22       ` David Gibson
2016-07-11  7:12         ` Maxime Ripard
2016-07-12  5:10           ` David Gibson
2016-08-21 15:07       ` [U-Boot,v4,09/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 10/13] libfdt: Add fdt_setprop_inplace_namelen_partial Maxime Ripard
     [not found]     ` <20160705082646.25044-11-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:07       ` [U-Boot,v4,10/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 11/13] libfdt: Add overlay application function Maxime Ripard
     [not found]     ` <20160705082646.25044-12-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:07       ` [U-Boot,v4,11/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 12/13] cmd: fdt: add fdt overlay application subcommand Maxime Ripard
     [not found]     ` <20160705082646.25044-13-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:08       ` [U-Boot,v4,12/13] " Tom Rini
2016-07-05  8:26   ` [PATCH v4 13/13] tests: Introduce DT overlay tests Maxime Ripard
     [not found]     ` <20160705082646.25044-14-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-08-21 15:08       ` [U-Boot,v4,13/13] " Tom Rini

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).