2013-04-03 23:35:10

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 1/7] kbuild: create an "include chroot" for DT bindings

From: Stephen Warren <[email protected]>

The recent dtc+cpp support allows header files and C pre-processor
defines/macros to be used when compiling device tree files. These
headers will typically define various constants that are part of the
device tree bindings.

The original patch which set up the dtc+cpp include path only considered
using those headers from device tree files. However, most are also
useful for kernel code which needs to interpret the device tree.

In both the DT files and the kernel, I'd like to include the DT-related
headers in the same way, for example, <dt-bindings/gpio/tegra-gpio.h>.
That will simplify any text which discusses the DT header locations.

Creating a <dt-bindings/> for kernel source to use is as simple as
placing files into include/dt-bindings/.

However, when compiling DT files, the include path should be restricted
so that only the dt-bindings path is available; arbitrary kernel headers
shouldn't be exposed. For this reason, create a specific include
directory for use by dtc+cpp, and symlink dt-bindings from there to the
actual location of include/dt-bindings/. For want of a better location,
place this "include chroot" into the existing dts/ directory.

arch/*/boot/dts/include/dt-bindings -> ../../../../../include/dt-bindings

Some headers used by device tree files may not be useful to the kernel;
they may be used simply to aid in constructing the DT file (e.g. macros
to create a node), but not define any information that the kernel needs
to share. These may be placed directly into arch/*/boot/dts/ along with
the DT files themselves.

Cc: Shawn Guo <[email protected]>
Cc: Hiroshi Doyu <[email protected]>
Acked-by: Michal Marek <[email protected]>
Acked-by: Shawn Guo <[email protected]>
Acked-by: Rob Herring <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
Grant, Rob, Michal, I'm hoping for acks or comments from you so this
series can be placed into a topic branch in the arm-soc repo, for others
to build on during the 3.10 kernel cycle. Thanks.

This first patch was previously posted separately as V2. I'm including
it here to keep it with the whole series. I hope this series can be
applied as a topic branch in arm-soc.
---
arch/arm/boot/dts/include/dt-bindings | 1 +
scripts/Makefile.lib | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
create mode 120000 arch/arm/boot/dts/include/dt-bindings

diff --git a/arch/arm/boot/dts/include/dt-bindings b/arch/arm/boot/dts/include/dt-bindings
new file mode 120000
index 0000000..08c00e4
--- /dev/null
+++ b/arch/arm/boot/dts/include/dt-bindings
@@ -0,0 +1 @@
+../../../../../include/dt-bindings
\ No newline at end of file
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 07125e6..af35521 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -158,7 +158,7 @@ ld_flags = $(LDFLAGS) $(ldflags-y)

dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \
-I$(srctree)/arch/$(SRCARCH)/boot/dts \
- -I$(srctree)/arch/$(SRCARCH)/include/dts \
+ -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
-undef -D__DTS__

# Finds the multi-part object the current object will be linked into
--
1.7.10.4


2013-04-03 23:35:19

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 4/7] kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp

From: Stephen Warren <[email protected]>

Replace cmd_dtc with cmd_dtc_cpp, and delete the latter.

Previously, a special file extension (.dtsp) was required to trigger
the C pre-processor to run on device tree files. This was ugly. Now that
previous changes have enhanced cmd_dtc_cpp to collect dependency
information from both gcc -E and dtc, we can transparently run the pre-
processor on all device tree files, irrespective of whether they

Signed-off-by: Stephen Warren <[email protected]>
---
v2: Add boot/dts from the source tree to dtc include path, so that make
O= works; that puts the .dts file that's passed to dtc outside the
source tree, so the include path adjustment is required to find
include files in the source tree.
---
scripts/Makefile.lib | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 6104335..3e73dfd 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -269,21 +269,17 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
$(call cmd,dt_S_dtb)

quiet_cmd_dtc = DTC [email protected]
-cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o [email protected] -b 0 $(DTC_FLAGS) -d $(depfile) $<
+cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+ $(objtree)/scripts/dtc/dtc -O dtb -o [email protected] -b 0 \
+ -i $(srctree)/arch/$(SRCARCH)/boot/dts $(DTC_FLAGS) \
+ -d $(depfile).dtc $(dtc-tmp) ; \
+ cat $(depfile).pre $(depfile).dtc > $(depfile)

$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)

dtc-tmp = $(subst $(comma),_,$(dot-target).dts)

-quiet_cmd_dtc_cpp = DTC+CPP [email protected]
-cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(objtree)/scripts/dtc/dtc -O dtb -o [email protected] -b 0 $(DTC_FLAGS) -d $(depfile).dtc $(dtc-tmp) ; \
- cat $(depfile).pre $(depfile).dtc > $(depfile)
-
-$(obj)/%.dtb: $(src)/%.dtsp FORCE
- $(call if_changed_dep,dtc_cpp)
-
# Bzip2
# ---------------------------------------------------------------------------

--
1.7.10.4

2013-04-03 23:35:42

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 7/7] ARM: dt: create a DT header for the GIC

From: Stephen Warren <[email protected]>

The ARM GIC binding defines a few custom cells and flags for its IRQ
specifier. Provide names for those.

Signed-off-by: Stephen Warren <[email protected]>
---
v2: No change.
v1: Moved header. Added include guard.
(this patch was previously posted separately, hence there are
changes in v1!)
---
include/dt-bindings/interrupt-controller/arm-gic.h | 22 ++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 include/dt-bindings/interrupt-controller/arm-gic.h

diff --git a/include/dt-bindings/interrupt-controller/arm-gic.h b/include/dt-bindings/interrupt-controller/arm-gic.h
new file mode 100644
index 0000000..1ea1b70
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/arm-gic.h
@@ -0,0 +1,22 @@
+/*
+ * This header provides constants for the ARM GIC.
+ */
+
+#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_ARM_GIC_H
+#define _DT_BINDINGS_INTERRUPT_CONTROLLER_ARM_GIC_H
+
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/* interrupt specific cell 0 */
+
+#define GIC_SPI 0
+#define GIC_PPI 1
+
+/*
+ * Interrupt specifier cell 2.
+ * The flaggs in irq.h are valid, plus those below.
+ */
+#define GIC_CPU_MASK_RAW(x) ((x) << 8)
+#define GIC_CPU_MASK_SIMPLE(num) GIC_CPU_MASK_RAW((1 << (num)) - 1)
+
+#endif
--
1.7.10.4

2013-04-03 23:35:16

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 5/7] ARM: dt: add header to define GPIO flags

From: Stephen Warren <[email protected]>

Many GPIO device tree bindings use the same flags. Create a header to
define those.

Signed-off-by: Stephen Warren <[email protected]>
---
v2: No change.
v1: Moved header. Added include guard.
(this patch was previously posted separately, hence there are
changes in v1!)
---
include/dt-bindings/gpio/gpio.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 include/dt-bindings/gpio/gpio.h

diff --git a/include/dt-bindings/gpio/gpio.h b/include/dt-bindings/gpio/gpio.h
new file mode 100644
index 0000000..e6b1e0a
--- /dev/null
+++ b/include/dt-bindings/gpio/gpio.h
@@ -0,0 +1,15 @@
+/*
+ * This header provides constants for most GPIO bindings.
+ *
+ * Most GPIO bindings include a flags cell as part of the GPIO specifier.
+ * In most cases, the format of the flags cell uses the standard values
+ * defined in this header.
+ */
+
+#ifndef _DT_BINDINGS_GPIO_GPIO_H
+#define _DT_BINDINGS_GPIO_GPIO_H
+
+#define GPIO_ACTIVE_HIGH 0
+#define GPIO_ACTIVE_LOW 1
+
+#endif
--
1.7.10.4

2013-04-03 23:36:13

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 6/7] ARM: dt: add header to define IRQ flags

From: Stephen Warren <[email protected]>

Many IRQ device tree bindings use the same flags. Create a header to
define those.

Signed-off-by: Stephen Warren <[email protected]>
---
v2: No change.
v1: Moved header. Added include guard.
(this patch was previously posted separately, hence there are
changes in v1!)
---
include/dt-bindings/interrupt-controller/irq.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 include/dt-bindings/interrupt-controller/irq.h

diff --git a/include/dt-bindings/interrupt-controller/irq.h b/include/dt-bindings/interrupt-controller/irq.h
new file mode 100644
index 0000000..33a1003
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/irq.h
@@ -0,0 +1,19 @@
+/*
+ * This header provides constants for most IRQ bindings.
+ *
+ * Most IRQ bindings include a flags cell as part of the IRQ specifier.
+ * In most cases, the format of the flags cell uses the standard values
+ * defined in this header.
+ */
+
+#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H
+#define _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H
+
+#define IRQ_TYPE_NONE 0
+#define IRQ_TYPE_EDGE_RISING 1
+#define IRQ_TYPE_EDGE_FALLING 2
+#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
+#define IRQ_TYPE_LEVEL_HIGH 4
+#define IRQ_TYPE_LEVEL_LOW 8
+
+#endif
--
1.7.10.4

2013-04-03 23:36:34

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 3/7] kbuild: cmd_dtc_cpp: extract deps from both gcc -E and dtc

From: Stephen Warren <[email protected]>

Prior to this change, when compiling *.dts to *.dtb, the dependency
output from dtc would be used, and when compiling *.dtsp to *.dtb, the
dependency output from gcc -E alone would be used, despite dtc also
being invoked (on a temporary file that was guaranteed to have no
dependencies).

With this change, when compiling *.dtsp to *.dtb, the dependency files
from both gcc -E and dtc are used. This will allow cmd_dtc_cpp to
replace cmd_dtc in a future change. In turn, that will allow the C pre-
processor to be run transparently on *.dts, without the need to a
separate rule or file extension to trigger it.

Signed-off-by: Stephen Warren <[email protected]>
---
scripts/Makefile.lib | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index af35521..6104335 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -156,7 +156,7 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \

ld_flags = $(LDFLAGS) $(ldflags-y)

-dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \
+dtc_cpp_flags = -Wp,-MD,$(depfile).pre -nostdinc \
-I$(srctree)/arch/$(SRCARCH)/boot/dts \
-I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
-undef -D__DTS__
@@ -278,7 +278,8 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts)

quiet_cmd_dtc_cpp = DTC+CPP [email protected]
cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(objtree)/scripts/dtc/dtc -O dtb -o [email protected] -b 0 $(DTC_FLAGS) $(dtc-tmp)
+ $(objtree)/scripts/dtc/dtc -O dtb -o [email protected] -b 0 $(DTC_FLAGS) -d $(depfile).dtc $(dtc-tmp) ; \
+ cat $(depfile).pre $(depfile).dtc > $(depfile)

$(obj)/%.dtb: $(src)/%.dtsp FORCE
$(call if_changed_dep,dtc_cpp)
--
1.7.10.4

2013-04-03 23:36:50

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 2/7] kbuild: fixdep: support concatenated dep files

From: Stephen Warren <[email protected]>

The current use-case for fixdep is: a source file is run through a single
processing step, which creates a single dependency file as a side-effect,
which fixdep transforms into the file used by the kernel build process.

In order to transparently run the C pre-processor on device-tree files,
we wish to run both gcc -E and dtc on a source file in a single rule.
This generates two dependency files, which must be transformed together
into the file used by the kernel build process. This change modifies
fixdep so it can process the concatenation of multiple separate input
dependency files, and produce a correct unified output.

The code changes have the slight benefit of transforming the loop in
parse_dep_file() into more of a lexer/tokenizer, with the loop body being
more of a parser. Previously, some of this logic was mixed together
before the loop. I also added some comments, which I hope are useful.

Benchmarking shows that on a cross-compiled ARM tegra_defconfig build,
there is less than 0.5 seconds speed decrease with this change, on top
of a build time of ~2m24s. This is probably within the noise.

Signed-off-by: Stephen Warren <[email protected]>
---
scripts/basic/fixdep.c | 93 +++++++++++++++++++++++++++++++-----------------
1 file changed, 61 insertions(+), 32 deletions(-)

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 7f6425e..078fe1d 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -320,49 +320,78 @@ static void parse_dep_file(void *map, size_t len)
char *end = m + len;
char *p;
char s[PATH_MAX];
- int first;
-
- p = strchr(m, ':');
- if (!p) {
- fprintf(stderr, "fixdep: parse error\n");
- exit(1);
- }
- memcpy(s, m, p-m); s[p-m] = 0;
- m = p+1;
+ int is_target;
+ int saw_any_target = 0;
+ int is_first_dep = 0;

clear_config();

- first = 1;
while (m < end) {
+ /* Skip any "white space" */
while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
m++;
+ /* Find next "white space" */
p = m;
- while (p < end && *p != ' ') p++;
- if (p == end) {
- do p--; while (!isalnum(*p));
+ while (p < end && *p != ' ' && *p != '\\' && *p != '\n')
p++;
+ /* Is the token we found a target name? */
+ is_target = (*(p-1) == ':');
+ /* Don't write any target names into the dependency file */
+ if (is_target) {
+ /* The /next/ file is the first dependency */
+ is_first_dep = 1;
+ } else {
+ /* Save this token/filename */
+ memcpy(s, m, p-m);
+ s[p - m] = 0;
+
+ /* Ignore certain dependencies */
+ if (strrcmp(s, "include/generated/autoconf.h") &&
+ strrcmp(s, "arch/um/include/uml-config.h") &&
+ strrcmp(s, "include/linux/kconfig.h") &&
+ strrcmp(s, ".ver")) {
+ /*
+ * Do not list the source file as dependency,
+ * so that kbuild is not confused if a .c file
+ * is rewritten into .S or vice versa. Storing
+ * it in source_* is needed for modpost to
+ * compute srcversions.
+ */
+ if (is_first_dep) {
+ /*
+ * If processing the concatenation of
+ * multiple dependency files, only
+ * process the first target name, which
+ * will be the original source name,
+ * and ignore any other target names,
+ * which will be intermediate temporary
+ * files.
+ */
+ if (!saw_any_target) {
+ saw_any_target = 1;
+ printf("source_%s := %s\n\n",
+ target, s);
+ printf("deps_%s := \\\n",
+ target);
+ }
+ is_first_dep = 0;
+ } else
+ printf(" %s \\\n", s);
+ do_config_file(s);
+ }
}
- memcpy(s, m, p-m); s[p-m] = 0;
- if (strrcmp(s, "include/generated/autoconf.h") &&
- strrcmp(s, "arch/um/include/uml-config.h") &&
- strrcmp(s, "include/linux/kconfig.h") &&
- strrcmp(s, ".ver")) {
- /*
- * Do not list the source file as dependency, so that
- * kbuild is not confused if a .c file is rewritten
- * into .S or vice versa. Storing it in source_* is
- * needed for modpost to compute srcversions.
- */
- if (first) {
- printf("source_%s := %s\n\n", target, s);
- printf("deps_%s := \\\n", target);
- } else
- printf(" %s \\\n", s);
- do_config_file(s);
- }
- first = 0;
+ /*
+ * Start searching for next token immediately after the first
+ * "whitespace" character that follows this token.
+ */
m = p + 1;
}
+
+ if (!saw_any_target) {
+ fprintf(stderr, "fixdep: parse error; no targets found\n");
+ exit(1);
+ }
+
printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
}
--
1.7.10.4

2013-04-04 00:45:13

by Emilio López

[permalink] [raw]
Subject: Re: [PATCH V2 4/7] kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp

Hi Stephen,

El 03/04/13 20:34, Stephen Warren escribi?:
> From: Stephen Warren <[email protected]>
>
> Replace cmd_dtc with cmd_dtc_cpp, and delete the latter.
>
> Previously, a special file extension (.dtsp) was required to trigger
> the C pre-processor to run on device tree files. This was ugly. Now that
> previous changes have enhanced cmd_dtc_cpp to collect dependency
> information from both gcc -E and dtc, we can transparently run the pre-
> processor on all device tree files, irrespective of whether they
>

I think a line got dropped on the commit description by mistake.

Regards,

Emilio

2013-04-04 16:41:56

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH V2 4/7] kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp

On 04/03/2013 06:02 PM, Emilio L?pez wrote:
> Hi Stephen,
>
> El 03/04/13 20:34, Stephen Warren escribi?:
>> From: Stephen Warren <[email protected]>
>>
>> Replace cmd_dtc with cmd_dtc_cpp, and delete the latter.
>>
>> Previously, a special file extension (.dtsp) was required to trigger
>> the C pre-processor to run on device tree files. This was ugly. Now that
>> previous changes have enhanced cmd_dtc_cpp to collect dependency
>> information from both gcc -E and dtc, we can transparently run the pre-
>> processor on all device tree files, irrespective of whether they
>>
>
> I think a line got dropped on the commit description by mistake.

Thanks for noticing. I've locally added the following line to the end of
the description, but won't repost unless there's some other reason, or
the series is ack'd enough to actually be applied:

use /include/ or #include syntax to include *.dtsi.

2013-04-04 23:17:21

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V2 1/7] kbuild: create an "include chroot" for DT bindings

On 04/03/2013 06:34 PM, Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> The recent dtc+cpp support allows header files and C pre-processor
> defines/macros to be used when compiling device tree files. These
> headers will typically define various constants that are part of the
> device tree bindings.
>
> The original patch which set up the dtc+cpp include path only considered
> using those headers from device tree files. However, most are also
> useful for kernel code which needs to interpret the device tree.
>
> In both the DT files and the kernel, I'd like to include the DT-related
> headers in the same way, for example, <dt-bindings/gpio/tegra-gpio.h>.
> That will simplify any text which discusses the DT header locations.
>
> Creating a <dt-bindings/> for kernel source to use is as simple as
> placing files into include/dt-bindings/.
>
> However, when compiling DT files, the include path should be restricted
> so that only the dt-bindings path is available; arbitrary kernel headers
> shouldn't be exposed. For this reason, create a specific include
> directory for use by dtc+cpp, and symlink dt-bindings from there to the
> actual location of include/dt-bindings/. For want of a better location,
> place this "include chroot" into the existing dts/ directory.
>
> arch/*/boot/dts/include/dt-bindings -> ../../../../../include/dt-bindings
>
> Some headers used by device tree files may not be useful to the kernel;
> they may be used simply to aid in constructing the DT file (e.g. macros
> to create a node), but not define any information that the kernel needs
> to share. These may be placed directly into arch/*/boot/dts/ along with
> the DT files themselves.
>
> Cc: Shawn Guo <[email protected]>
> Cc: Hiroshi Doyu <[email protected]>
> Acked-by: Michal Marek <[email protected]>
> Acked-by: Shawn Guo <[email protected]>
> Acked-by: Rob Herring <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>
> ---
> Grant, Rob, Michal, I'm hoping for acks or comments from you so this
> series can be placed into a topic branch in the arm-soc repo, for others
> to build on during the 3.10 kernel cycle. Thanks.

Well, you have mine here and the rest looks fine, so add it to the others.

Rob

>
> This first patch was previously posted separately as V2. I'm including
> it here to keep it with the whole series. I hope this series can be
> applied as a topic branch in arm-soc.
> ---
> arch/arm/boot/dts/include/dt-bindings | 1 +
> scripts/Makefile.lib | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
> create mode 120000 arch/arm/boot/dts/include/dt-bindings
>
> diff --git a/arch/arm/boot/dts/include/dt-bindings b/arch/arm/boot/dts/include/dt-bindings
> new file mode 120000
> index 0000000..08c00e4
> --- /dev/null
> +++ b/arch/arm/boot/dts/include/dt-bindings
> @@ -0,0 +1 @@
> +../../../../../include/dt-bindings
> \ No newline at end of file
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 07125e6..af35521 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -158,7 +158,7 @@ ld_flags = $(LDFLAGS) $(ldflags-y)
>
> dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \
> -I$(srctree)/arch/$(SRCARCH)/boot/dts \
> - -I$(srctree)/arch/$(SRCARCH)/include/dts \
> + -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
> -undef -D__DTS__
>
> # Finds the multi-part object the current object will be linked into
>

2013-04-05 01:01:15

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH V2 1/7] kbuild: create an "include chroot" for DT bindings

On 04/04/2013 05:17 PM, Rob Herring wrote:
> On 04/03/2013 06:34 PM, Stephen Warren wrote:
>> From: Stephen Warren <[email protected]>
>>
>> The recent dtc+cpp support allows header files and C pre-processor
>> defines/macros to be used when compiling device tree files. These
>> headers will typically define various constants that are part of the
>> device tree bindings.
>>
>> The original patch which set up the dtc+cpp include path only considered
>> using those headers from device tree files. However, most are also
>> useful for kernel code which needs to interpret the device tree.
>>
>> In both the DT files and the kernel, I'd like to include the DT-related
>> headers in the same way, for example, <dt-bindings/gpio/tegra-gpio.h>.
>> That will simplify any text which discusses the DT header locations.
>>
>> Creating a <dt-bindings/> for kernel source to use is as simple as
>> placing files into include/dt-bindings/.
>>
>> However, when compiling DT files, the include path should be restricted
>> so that only the dt-bindings path is available; arbitrary kernel headers
>> shouldn't be exposed. For this reason, create a specific include
>> directory for use by dtc+cpp, and symlink dt-bindings from there to the
>> actual location of include/dt-bindings/. For want of a better location,
>> place this "include chroot" into the existing dts/ directory.
>>
>> arch/*/boot/dts/include/dt-bindings -> ../../../../../include/dt-bindings
>>
>> Some headers used by device tree files may not be useful to the kernel;
>> they may be used simply to aid in constructing the DT file (e.g. macros
>> to create a node), but not define any information that the kernel needs
>> to share. These may be placed directly into arch/*/boot/dts/ along with
>> the DT files themselves.
>>
>> Cc: Shawn Guo <[email protected]>
>> Cc: Hiroshi Doyu <[email protected]>
>> Acked-by: Michal Marek <[email protected]>
>> Acked-by: Shawn Guo <[email protected]>
>> Acked-by: Rob Herring <[email protected]>
>> Signed-off-by: Stephen Warren <[email protected]>
>> ---
>> Grant, Rob, Michal, I'm hoping for acks or comments from you so this
>> series can be placed into a topic branch in the arm-soc repo, for others
>> to build on during the 3.10 kernel cycle. Thanks.
>
> Well, you have mine here and the rest looks fine, so add it to the others.

Rob,

I had originally hoped for this to go into an arm-soc branch so that a
number of SoCs could convert to use the feature in the same release,
hence I was looking for acks to let that happen.

However, it's too late in the 3.10 cycle now for that to happen. Can the
series be applied to the DT tree instead; people can convert during the
3.11 cycle.

2013-04-05 16:06:39

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V2 1/7] kbuild: create an "include chroot" for DT bindings

On 04/04/2013 08:01 PM, Stephen Warren wrote:
> On 04/04/2013 05:17 PM, Rob Herring wrote:
>> On 04/03/2013 06:34 PM, Stephen Warren wrote:
>>> From: Stephen Warren <[email protected]>
>>>
>>> The recent dtc+cpp support allows header files and C pre-processor
>>> defines/macros to be used when compiling device tree files. These
>>> headers will typically define various constants that are part of the
>>> device tree bindings.
>>>
>>> The original patch which set up the dtc+cpp include path only considered
>>> using those headers from device tree files. However, most are also
>>> useful for kernel code which needs to interpret the device tree.
>>>
>>> In both the DT files and the kernel, I'd like to include the DT-related
>>> headers in the same way, for example, <dt-bindings/gpio/tegra-gpio.h>.
>>> That will simplify any text which discusses the DT header locations.
>>>
>>> Creating a <dt-bindings/> for kernel source to use is as simple as
>>> placing files into include/dt-bindings/.
>>>
>>> However, when compiling DT files, the include path should be restricted
>>> so that only the dt-bindings path is available; arbitrary kernel headers
>>> shouldn't be exposed. For this reason, create a specific include
>>> directory for use by dtc+cpp, and symlink dt-bindings from there to the
>>> actual location of include/dt-bindings/. For want of a better location,
>>> place this "include chroot" into the existing dts/ directory.
>>>
>>> arch/*/boot/dts/include/dt-bindings -> ../../../../../include/dt-bindings
>>>
>>> Some headers used by device tree files may not be useful to the kernel;
>>> they may be used simply to aid in constructing the DT file (e.g. macros
>>> to create a node), but not define any information that the kernel needs
>>> to share. These may be placed directly into arch/*/boot/dts/ along with
>>> the DT files themselves.
>>>
>>> Cc: Shawn Guo <[email protected]>
>>> Cc: Hiroshi Doyu <[email protected]>
>>> Acked-by: Michal Marek <[email protected]>
>>> Acked-by: Shawn Guo <[email protected]>
>>> Acked-by: Rob Herring <[email protected]>
>>> Signed-off-by: Stephen Warren <[email protected]>
>>> ---
>>> Grant, Rob, Michal, I'm hoping for acks or comments from you so this
>>> series can be placed into a topic branch in the arm-soc repo, for others
>>> to build on during the 3.10 kernel cycle. Thanks.
>>
>> Well, you have mine here and the rest looks fine, so add it to the others.
>
> Rob,
>
> I had originally hoped for this to go into an arm-soc branch so that a
> number of SoCs could convert to use the feature in the same release,
> hence I was looking for acks to let that happen.
>
> However, it's too late in the 3.10 cycle now for that to happen. Can the
> series be applied to the DT tree instead; people can convert during the
> 3.11 cycle.

That is fine. Can you send me a pull request.

Rob

2013-04-19 10:01:37

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH V2 1/7] kbuild: create an "include chroot" for DT bindings

On Wed, 3 Apr 2013 17:34:52 -0600, Stephen Warren <[email protected]> wrote:
> Grant, Rob, Michal, I'm hoping for acks or comments from you so this
> series can be placed into a topic branch in the arm-soc repo, for others
> to build on during the 3.10 kernel cycle. Thanks.

Thanks for doing all this work Stephen. It looks really good.

g.