Re: [linux-yocto][v5.15/standard/preempt-rt/base][PATCH] OF: DT-Overlay configfs interface (v8)
In message: Re: [linux-yocto][v5.15/standard/preempt-rt/base][PATCH] OF: DT-Overlay configfs interface (v8) on 30/05/2023 Quanyang Wang wrote: > Hi Bruce, > > I wrote the wrong branch information. It should be: > > v6.1/standard/preempt-rt/base > > v6.1/standard/base > > And this patch will conflict with another patch ("Revert "OF: DT-Overlay > configfs interface (v8)" I just sent which is > > https://lists.yoctoproject.org/g/linux-yocto/topic/v6_1_standard_preempt_rt_sdkv6_1_xlnx_soc_patch/99215104?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,99215104,previd%3D1685429439939095335,nextid%3D1684520876284512837=1685429439939095335=1684520876284512837 > > So the patch in the above URL should be applied first and then this patch. > > Sorry for the inconvenience. No problem! I have it sorted out and the functionality should now be on all BSP branches. The rpi branches carry a similar change, but I reverted the rpi version, otherwise the conflicts are a mess. Bruce > > Thanks, > > Quanyang > > On 5/30/23 14:43, quanyang.wang via lists.yoctoproject.org wrote: > > From: Pantelis Antoniou > > > > commit 999eb1a8fdc4512412c7bc519c895bc2a6fabbe0 from > > https://github.com/Xilinx/linux-xlnx.git > > > > Add a runtime interface to using configfs for generic device tree overlay > > usage. With it its possible to use device tree overlays without having > > to use a per-platform overlay manager. > > > > Please see Documentation/devicetree/configfs-overlays.txt for more info. > > > > Changes since v7: > > - Xilinx alignment > > - of: configfs: Fix error handling from of_overlay_create() > > - of: configfs: lock while resolving and applying > > - of: configfs: Fix memory leak in create overlay > > - of: configfs: Fix compilation warning > > - of: configfs: Use of_overlay_fdt_apply API call > > > > Changes since v6: > > - Default groups properties API changed. > > > > Changes since v5: > > - New style configfs. > > > > Changes since v4: > > - Loading fix for multiple overlays as found out by > >Geert Uytterhoeven > > > > Changes since v3: > > - Fixed compilation on SPARC & Xtensa > > > > Changes since v2: > > - Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) > > - Created a documentation entry > > - Slight rewording in Kconfig > > > > Changes since v1: > > - of_resolve() -> of_resolve_phandles(). > > > > Signed-off-by: Pantelis Antoniou > > Signed-off-by: Nava kishore Manne > > Signed-off-by: Radhey Shyam Pandey > > State: not-upstreamable > > Signed-off-by: Liwei Song > > [Liwei: remove overlay_lock to fix "unused-variable" warning.] > > Signed-off-by: Bruce Ashfield > > --- > > Hi Bruce, > > Would you please help merge this patch to the branches: > > v5.15/standard/preempt-rt/base > > v5.15/standard/base > > Thanks, > > Quanyang > > --- > > .../devicetree/configfs-overlays.txt | 31 ++ > > drivers/of/Kconfig| 11 + > > drivers/of/Makefile | 1 + > > drivers/of/configfs.c | 292 ++ > > 4 files changed, 335 insertions(+) > > create mode 100644 Documentation/devicetree/configfs-overlays.txt > > create mode 100644 drivers/of/configfs.c > > > > diff --git a/Documentation/devicetree/configfs-overlays.txt > > b/Documentation/devicetree/configfs-overlays.txt > > new file mode 100644 > > index 0..5fa43e0643072 > > --- /dev/null > > +++ b/Documentation/devicetree/configfs-overlays.txt > > @@ -0,0 +1,31 @@ > > +Howto use the configfs overlay interface. > > + > > +A device-tree configfs entry is created in /config/device-tree/overlays > > +and and it is manipulated using standard file system I/O. > > +Note that this is a debug level interface, for use by developers and > > +not necessarily something accessed by normal users due to the > > +security implications of having direct access to the kernel's device tree. > > + > > +* To create an overlay you mkdir the directory: > > + > > + # mkdir /config/device-tree/overlays/foo > > + > > +* Either you echo the overlay firmware file to the path property file. > > + > > + # echo foo.dtbo >/config/device-tree/overlays/foo/path > > + > > +* Or you cat the contents of the overlay to the dtbo file > > + > > + # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo >
Re: [linux-yocto][v5.15/standard/preempt-rt/base][PATCH] OF: DT-Overlay configfs interface (v8)
Hi Bruce, I wrote the wrong branch information. It should be: v6.1/standard/preempt-rt/base v6.1/standard/base And this patch will conflict with another patch ("Revert "OF: DT-Overlay configfs interface (v8)" I just sent which is https://lists.yoctoproject.org/g/linux-yocto/topic/v6_1_standard_preempt_rt_sdkv6_1_xlnx_soc_patch/99215104?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,99215104,previd%3D1685429439939095335,nextid%3D1684520876284512837=1685429439939095335=1684520876284512837 So the patch in the above URL should be applied first and then this patch. Sorry for the inconvenience. Thanks, Quanyang On 5/30/23 14:43, quanyang.wang via lists.yoctoproject.org wrote: From: Pantelis Antoniou commit 999eb1a8fdc4512412c7bc519c895bc2a6fabbe0 from https://github.com/Xilinx/linux-xlnx.git Add a runtime interface to using configfs for generic device tree overlay usage. With it its possible to use device tree overlays without having to use a per-platform overlay manager. Please see Documentation/devicetree/configfs-overlays.txt for more info. Changes since v7: - Xilinx alignment - of: configfs: Fix error handling from of_overlay_create() - of: configfs: lock while resolving and applying - of: configfs: Fix memory leak in create overlay - of: configfs: Fix compilation warning - of: configfs: Use of_overlay_fdt_apply API call Changes since v6: - Default groups properties API changed. Changes since v5: - New style configfs. Changes since v4: - Loading fix for multiple overlays as found out by Geert Uytterhoeven Changes since v3: - Fixed compilation on SPARC & Xtensa Changes since v2: - Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) - Created a documentation entry - Slight rewording in Kconfig Changes since v1: - of_resolve() -> of_resolve_phandles(). Signed-off-by: Pantelis Antoniou Signed-off-by: Nava kishore Manne Signed-off-by: Radhey Shyam Pandey State: not-upstreamable Signed-off-by: Liwei Song [Liwei: remove overlay_lock to fix "unused-variable" warning.] Signed-off-by: Bruce Ashfield --- Hi Bruce, Would you please help merge this patch to the branches: v5.15/standard/preempt-rt/base v5.15/standard/base Thanks, Quanyang --- .../devicetree/configfs-overlays.txt | 31 ++ drivers/of/Kconfig| 11 + drivers/of/Makefile | 1 + drivers/of/configfs.c | 292 ++ 4 files changed, 335 insertions(+) create mode 100644 Documentation/devicetree/configfs-overlays.txt create mode 100644 drivers/of/configfs.c diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt new file mode 100644 index 0..5fa43e0643072 --- /dev/null +++ b/Documentation/devicetree/configfs-overlays.txt @@ -0,0 +1,31 @@ +Howto use the configfs overlay interface. + +A device-tree configfs entry is created in /config/device-tree/overlays +and and it is manipulated using standard file system I/O. +Note that this is a debug level interface, for use by developers and +not necessarily something accessed by normal users due to the +security implications of having direct access to the kernel's device tree. + +* To create an overlay you mkdir the directory: + + # mkdir /config/device-tree/overlays/foo + +* Either you echo the overlay firmware file to the path property file. + + # echo foo.dtbo >/config/device-tree/overlays/foo/path + +* Or you cat the contents of the overlay to the dtbo file + + # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo + +The overlay file will be applied, and devices will be created/destroyed +as required. + +To remove it simply rmdir the directory. + + # rmdir /config/device-tree/overlays/foo + +The rationalle of the dual interface (firmware & direct copy) is that each is +better suited to different use patterns. The firmware interface is what's +intended to be used by hardware managers in the kernel, while the copy interface +make sense for developers (since it avoids problems with namespaces). diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 80b5fd44ab1c7..da62bc6766952 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -94,4 +94,15 @@ config OF_DMA_DEFAULT_COHERENT # arches should select this if DMA is coherent by default for OF devices bool +config OF_CONFIGFS + bool "Device Tree Overlay ConfigFS interface" + select CONFIGFS_FS + depends on OF_OVERLAY + help + Select this option to enable simple user-space driven DT overlay + interface to support device tree manipulated at runtime. + Say Y here to include this support. + + If unsure, say N. + endif # OF diff --git a/drivers/of/Makefile b/drivers/of/Makefile index e0360a44306e2..90c92ced24e62 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-y =
[linux-yocto][v5.15/standard/preempt-rt/base][PATCH] OF: DT-Overlay configfs interface (v8)
From: Pantelis Antoniou commit 999eb1a8fdc4512412c7bc519c895bc2a6fabbe0 from https://github.com/Xilinx/linux-xlnx.git Add a runtime interface to using configfs for generic device tree overlay usage. With it its possible to use device tree overlays without having to use a per-platform overlay manager. Please see Documentation/devicetree/configfs-overlays.txt for more info. Changes since v7: - Xilinx alignment - of: configfs: Fix error handling from of_overlay_create() - of: configfs: lock while resolving and applying - of: configfs: Fix memory leak in create overlay - of: configfs: Fix compilation warning - of: configfs: Use of_overlay_fdt_apply API call Changes since v6: - Default groups properties API changed. Changes since v5: - New style configfs. Changes since v4: - Loading fix for multiple overlays as found out by Geert Uytterhoeven Changes since v3: - Fixed compilation on SPARC & Xtensa Changes since v2: - Removed ifdef CONFIG_OF_OVERLAY (since for now it's required) - Created a documentation entry - Slight rewording in Kconfig Changes since v1: - of_resolve() -> of_resolve_phandles(). Signed-off-by: Pantelis Antoniou Signed-off-by: Nava kishore Manne Signed-off-by: Radhey Shyam Pandey State: not-upstreamable Signed-off-by: Liwei Song [Liwei: remove overlay_lock to fix "unused-variable" warning.] Signed-off-by: Bruce Ashfield --- Hi Bruce, Would you please help merge this patch to the branches: v5.15/standard/preempt-rt/base v5.15/standard/base Thanks, Quanyang --- .../devicetree/configfs-overlays.txt | 31 ++ drivers/of/Kconfig| 11 + drivers/of/Makefile | 1 + drivers/of/configfs.c | 292 ++ 4 files changed, 335 insertions(+) create mode 100644 Documentation/devicetree/configfs-overlays.txt create mode 100644 drivers/of/configfs.c diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt new file mode 100644 index 0..5fa43e0643072 --- /dev/null +++ b/Documentation/devicetree/configfs-overlays.txt @@ -0,0 +1,31 @@ +Howto use the configfs overlay interface. + +A device-tree configfs entry is created in /config/device-tree/overlays +and and it is manipulated using standard file system I/O. +Note that this is a debug level interface, for use by developers and +not necessarily something accessed by normal users due to the +security implications of having direct access to the kernel's device tree. + +* To create an overlay you mkdir the directory: + + # mkdir /config/device-tree/overlays/foo + +* Either you echo the overlay firmware file to the path property file. + + # echo foo.dtbo >/config/device-tree/overlays/foo/path + +* Or you cat the contents of the overlay to the dtbo file + + # cat foo.dtbo >/config/device-tree/overlays/foo/dtbo + +The overlay file will be applied, and devices will be created/destroyed +as required. + +To remove it simply rmdir the directory. + + # rmdir /config/device-tree/overlays/foo + +The rationalle of the dual interface (firmware & direct copy) is that each is +better suited to different use patterns. The firmware interface is what's +intended to be used by hardware managers in the kernel, while the copy interface +make sense for developers (since it avoids problems with namespaces). diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 80b5fd44ab1c7..da62bc6766952 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -94,4 +94,15 @@ config OF_DMA_DEFAULT_COHERENT # arches should select this if DMA is coherent by default for OF devices bool +config OF_CONFIGFS + bool "Device Tree Overlay ConfigFS interface" + select CONFIGFS_FS + depends on OF_OVERLAY + help + Select this option to enable simple user-space driven DT overlay + interface to support device tree manipulated at runtime. + Say Y here to include this support. + + If unsure, say N. + endif # OF diff --git a/drivers/of/Makefile b/drivers/of/Makefile index e0360a44306e2..90c92ced24e62 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-y = base.o device.o platform.o property.o obj-$(CONFIG_OF_KOBJ) += kobj.o +obj-$(CONFIG_OF_CONFIGFS) += configfs.o obj-$(CONFIG_OF_DYNAMIC) += dynamic.o obj-$(CONFIG_OF_FLATTREE) += fdt.o obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c new file mode 100644 index 0..64caba77a7193 --- /dev/null +++ b/drivers/of/configfs.c @@ -0,0 +1,292 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Configfs entries for device-tree + * + * Copyright (C) 2013 - Pantelis Antoniou + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software