Skip to contentSkip to conversation

imx: skip unused compatible strings in drivers

RFC PATCH New Anatolij Gustschin 4 participants 10 messages May 25, 2020 – May 26, 2020

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel. Try to drop not required compatible strings in drivers when building for different iMX variants. This saves a few bytes when building for i.MX6, with current buildman default GCC 9.2:

    all -843.0 bss +8.0 data -40.0 rodata -547.0 text -264.0
Cc Heiko Schocher <[email protected]>
Cc Peng Fan <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/i2c/mxc_i2c.c              |  3 +++
 drivers/mmc/fsl_esdhc_imx.c        | 18 ++++++++++++++++++
 drivers/net/fec_mxc.c              | 16 ++++++++++++++++
 drivers/pinctrl/nxp/pinctrl-imx6.c | 14 ++++++++++++++
 drivers/serial/serial_mxc.c        | 10 ++++++++++
 5 files changed, 61 insertions(+)
drivers/i2c/mxc_i2c.c +3 -0
index 3b0d27e6cd..abef9d888e 100644
@@ -1058,7 +1058,10 @@ static const struct dm_i2c_ops mxc_i2c_ops = {
 
 static const struct udevice_id mxc_i2c_ids[] = {
 	{ .compatible = "fsl,imx21-i2c", },
+#if defined(CONFIG_VF610) || defined(CONFIG_FSL_LSCH2) || \
+    defined(CONFIG_FSL_LSCH3) || defined(CONFIG_ARCH_LS1021A)
 	{ .compatible = "fsl,vf610-i2c", .data = I2C_QUIRK_FLAG, },
+#endif
 	{}
 };
 
drivers/mmc/fsl_esdhc_imx.c +18 -0
index 588d6a9d76..6943e4867e 100644
@@ -1601,31 +1601,49 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
 };
 #endif
 
+#if defined(CONFIG_ARCH_MX7)
 static struct esdhc_soc_data usdhc_imx7d_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
 			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
 			| ESDHC_FLAG_HS400,
 };
+#endif
 
+#if defined(CONFIG_ARCH_IMX8) || defined(CONFIG_ARCH_IMX8M)
 static struct esdhc_soc_data usdhc_imx8qm_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING |
 		ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 |
 		ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES,
 };
+#endif
 
 static const struct udevice_id fsl_esdhc_ids[] = {
+#ifdef CONFIG_ARCH_MX5
 	{ .compatible = "fsl,imx53-esdhc", },
+#endif
+#ifdef CONFIG_ARCH_MX6
 	{ .compatible = "fsl,imx6ul-usdhc", },
 	{ .compatible = "fsl,imx6sx-usdhc", },
 	{ .compatible = "fsl,imx6sl-usdhc", },
 	{ .compatible = "fsl,imx6q-usdhc", },
+#endif
+#ifdef CONFIG_ARCH_MX7
 	{ .compatible = "fsl,imx7d-usdhc", .data = (ulong)&usdhc_imx7d_data,},
+#endif
+#ifdef CONFIG_ARCH_MX7ULP
 	{ .compatible = "fsl,imx7ulp-usdhc", },
+#endif
+#ifdef CONFIG_ARCH_IMX8
 	{ .compatible = "fsl,imx8qm-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+#endif
+#ifdef CONFIG_ARCH_IMX8M
 	{ .compatible = "fsl,imx8mm-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
 	{ .compatible = "fsl,imx8mn-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
 	{ .compatible = "fsl,imx8mq-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+#endif
+#ifdef CONFIG_ARCH_IMXRT
 	{ .compatible = "fsl,imxrt-usdhc", },
+#endif
 	{ .compatible = "fsl,esdhc", },
 	{ /* sentinel */ }
 };
drivers/net/fec_mxc.c +16 -0
index 9ae2db033e..d829b5b5ba 100644
@@ -1574,14 +1574,30 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
 }
 
 static const struct udevice_id fecmxc_ids[] = {
+#ifdef CONFIG_ARCH_MX28
 	{ .compatible = "fsl,imx28-fec" },
+#endif
+#ifdef CONFIG_ARCH_MX6
 	{ .compatible = "fsl,imx6q-fec" },
+#endif
+#ifdef CONFIG_MX6SL
 	{ .compatible = "fsl,imx6sl-fec" },
+#endif
+#ifdef CONFIG_MX6SX
 	{ .compatible = "fsl,imx6sx-fec" },
+#endif
+#ifdef CONFIG_MX6UL
 	{ .compatible = "fsl,imx6ul-fec" },
+#endif
+#ifdef CONFIG_ARCH_MX5
 	{ .compatible = "fsl,imx53-fec" },
+#endif
+#ifdef CONFIG_ARCH_MX7
 	{ .compatible = "fsl,imx7d-fec" },
+#endif
+#ifdef CONFIG_ARCH_VF610
 	{ .compatible = "fsl,mvf600-fec" },
+#endif
 	{ }
 };
 
drivers/pinctrl/nxp/pinctrl-imx6.c +14 -0
index aafa3057ad..dff4954344 100644
@@ -12,14 +12,18 @@
 
 static struct imx_pinctrl_soc_info imx6_pinctrl_soc_info __section(".data");
 
+#ifdef CONFIG_MX6UL
 /* FIXME Before reloaction, BSS is overlapped with DT area */
 static struct imx_pinctrl_soc_info imx6ul_pinctrl_soc_info = {
 	.flags = ZERO_OFFSET_VALID,
 };
+#endif
 
+#if defined(CONFIG_MX6SLL) || defined(CONFIG_MX6ULL)
 static struct imx_pinctrl_soc_info imx6_snvs_pinctrl_soc_info = {
 	.flags = ZERO_OFFSET_VALID,
 };
+#endif
 
 static int imx6_pinctrl_probe(struct udevice *dev)
 {
@@ -32,12 +36,22 @@ static int imx6_pinctrl_probe(struct udevice *dev)
 static const struct udevice_id imx6_pinctrl_match[] = {
 	{ .compatible = "fsl,imx6q-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
 	{ .compatible = "fsl,imx6dl-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#ifdef CONFIG_MX6SL
 	{ .compatible = "fsl,imx6sl-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6SLL
 	{ .compatible = "fsl,imx6sll-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info },
 	{ .compatible = "fsl,imx6sll-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6SX
 	{ .compatible = "fsl,imx6sx-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6UL
 	{ .compatible = "fsl,imx6ul-iomuxc", .data = (ulong)&imx6ul_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6ULL
 	{ .compatible = "fsl,imx6ull-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/serial/serial_mxc.c +10 -0
index 42abb96a26..f4a0d56e09 100644
@@ -343,11 +343,21 @@ static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
 
 static const struct udevice_id mxc_serial_ids[] = {
 	{ .compatible = "fsl,imx21-uart" },
+#ifdef CONFIG_ARCH_MX5
 	{ .compatible = "fsl,imx53-uart" },
+#endif
+#ifdef CONFIG_ARCH_MX6SX
 	{ .compatible = "fsl,imx6sx-uart" },
+#endif
+#if defined(CONFIG_ARCH_MX6UL) || defined(CONFIG_ARCH_MX6ULL)
 	{ .compatible = "fsl,imx6ul-uart" },
+#endif
+#ifdef CONFIG_ARCH_MX7
 	{ .compatible = "fsl,imx7d-uart" },
+#endif
+#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX6SL) || defined(CONFIG_ARCH_MX6SLL)
 	{ .compatible = "fsl,imx6q-uart" },
+#endif
 	{ }
 };
 #endif
Signature · 1 line
2.17.1
#1 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Soeren

Quoted 198 lines

Try to drop not
required compatible strings in drivers when building for different iMX variants. This saves a few bytes when building for i.MX6, with current buildman default GCC 9.2:

    all -843.0 bss +8.0 data -40.0 rodata -547.0 text -264.0
Cc Heiko Schocher <[email protected]>
Cc Peng Fan <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Lukasz Majewski <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/i2c/mxc_i2c.c              |  3 +++
 drivers/mmc/fsl_esdhc_imx.c        | 18 ++++++++++++++++++
 drivers/net/fec_mxc.c              | 16 ++++++++++++++++
 drivers/pinctrl/nxp/pinctrl-imx6.c | 14 ++++++++++++++
 drivers/serial/serial_mxc.c        | 10 ++++++++++
 5 files changed, 61 insertions(+)
drivers/i2c/mxc_i2c.c +3 -0
index 3b0d27e6cd..abef9d888e 100644
@@ -1058,7 +1058,10 @@ static const struct dm_i2c_ops mxc_i2c_ops = {
 
 static const struct udevice_id mxc_i2c_ids[] = {
 	{ .compatible = "fsl,imx21-i2c", },
+#if defined(CONFIG_VF610) || defined(CONFIG_FSL_LSCH2) || \
+    defined(CONFIG_FSL_LSCH3) || defined(CONFIG_ARCH_LS1021A)
 	{ .compatible = "fsl,vf610-i2c", .data = I2C_QUIRK_FLAG, },
+#endif
 	{}
 };
 
drivers/mmc/fsl_esdhc_imx.c +18 -0
index 588d6a9d76..6943e4867e 100644
@@ -1601,31 +1601,49 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
 };
 #endif
 
+#if defined(CONFIG_ARCH_MX7)
 static struct esdhc_soc_data usdhc_imx7d_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
 			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
 			| ESDHC_FLAG_HS400,
 };
+#endif
 
+#if defined(CONFIG_ARCH_IMX8) || defined(CONFIG_ARCH_IMX8M)
 static struct esdhc_soc_data usdhc_imx8qm_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING |
 		ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 |
 		ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES,
 };
+#endif
 
 static const struct udevice_id fsl_esdhc_ids[] = {
+#ifdef CONFIG_ARCH_MX5
 	{ .compatible = "fsl,imx53-esdhc", },
+#endif
+#ifdef CONFIG_ARCH_MX6
 	{ .compatible = "fsl,imx6ul-usdhc", },
 	{ .compatible = "fsl,imx6sx-usdhc", },
 	{ .compatible = "fsl,imx6sl-usdhc", },
 	{ .compatible = "fsl,imx6q-usdhc", },
+#endif
+#ifdef CONFIG_ARCH_MX7
 	{ .compatible = "fsl,imx7d-usdhc", .data = (ulong)&usdhc_imx7d_data,},
+#endif
+#ifdef CONFIG_ARCH_MX7ULP
 	{ .compatible = "fsl,imx7ulp-usdhc", },
+#endif
+#ifdef CONFIG_ARCH_IMX8
 	{ .compatible = "fsl,imx8qm-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+#endif
+#ifdef CONFIG_ARCH_IMX8M
 	{ .compatible = "fsl,imx8mm-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
 	{ .compatible = "fsl,imx8mn-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
 	{ .compatible = "fsl,imx8mq-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+#endif
+#ifdef CONFIG_ARCH_IMXRT
 	{ .compatible = "fsl,imxrt-usdhc", },
+#endif
 	{ .compatible = "fsl,esdhc", },
 	{ /* sentinel */ }
 };
drivers/net/fec_mxc.c +16 -0
index 9ae2db033e..d829b5b5ba 100644
@@ -1574,14 +1574,30 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
 }
 
 static const struct udevice_id fecmxc_ids[] = {
+#ifdef CONFIG_ARCH_MX28
 	{ .compatible = "fsl,imx28-fec" },
+#endif
+#ifdef CONFIG_ARCH_MX6
 	{ .compatible = "fsl,imx6q-fec" },
+#endif
+#ifdef CONFIG_MX6SL
 	{ .compatible = "fsl,imx6sl-fec" },
+#endif
+#ifdef CONFIG_MX6SX
 	{ .compatible = "fsl,imx6sx-fec" },
+#endif
+#ifdef CONFIG_MX6UL
 	{ .compatible = "fsl,imx6ul-fec" },
+#endif
+#ifdef CONFIG_ARCH_MX5
 	{ .compatible = "fsl,imx53-fec" },
+#endif
+#ifdef CONFIG_ARCH_MX7
 	{ .compatible = "fsl,imx7d-fec" },
+#endif
+#ifdef CONFIG_ARCH_VF610
 	{ .compatible = "fsl,mvf600-fec" },
+#endif
 	{ }
 };
 
drivers/pinctrl/nxp/pinctrl-imx6.c +14 -0
index aafa3057ad..dff4954344 100644
@@ -12,14 +12,18 @@
 
 static struct imx_pinctrl_soc_info imx6_pinctrl_soc_info __section(".data");
 
+#ifdef CONFIG_MX6UL
 /* FIXME Before reloaction, BSS is overlapped with DT area */
 static struct imx_pinctrl_soc_info imx6ul_pinctrl_soc_info = {
 	.flags = ZERO_OFFSET_VALID,
 };
+#endif
 
+#if defined(CONFIG_MX6SLL) || defined(CONFIG_MX6ULL)
 static struct imx_pinctrl_soc_info imx6_snvs_pinctrl_soc_info = {
 	.flags = ZERO_OFFSET_VALID,
 };
+#endif
 
 static int imx6_pinctrl_probe(struct udevice *dev)
 {
@@ -32,12 +36,22 @@ static int imx6_pinctrl_probe(struct udevice *dev)
 static const struct udevice_id imx6_pinctrl_match[] = {
 	{ .compatible = "fsl,imx6q-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
 	{ .compatible = "fsl,imx6dl-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#ifdef CONFIG_MX6SL
 	{ .compatible = "fsl,imx6sl-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6SLL
 	{ .compatible = "fsl,imx6sll-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info },
 	{ .compatible = "fsl,imx6sll-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6SX
 	{ .compatible = "fsl,imx6sx-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6UL
 	{ .compatible = "fsl,imx6ul-iomuxc", .data = (ulong)&imx6ul_pinctrl_soc_info },
+#endif
+#ifdef CONFIG_MX6ULL
 	{ .compatible = "fsl,imx6ull-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/serial/serial_mxc.c +10 -0
index 42abb96a26..f4a0d56e09 100644
@@ -343,11 +343,21 @@ static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
 
 static const struct udevice_id mxc_serial_ids[] = {
 	{ .compatible = "fsl,imx21-uart" },
+#ifdef CONFIG_ARCH_MX5
 	{ .compatible = "fsl,imx53-uart" },
+#endif
+#ifdef CONFIG_ARCH_MX6SX
 	{ .compatible = "fsl,imx6sx-uart" },
+#endif
+#if defined(CONFIG_ARCH_MX6UL) || defined(CONFIG_ARCH_MX6ULL)
 	{ .compatible = "fsl,imx6ul-uart" },
+#endif
+#ifdef CONFIG_ARCH_MX7
 	{ .compatible = "fsl,imx7d-uart" },
+#endif
+#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX6SL) || defined(CONFIG_ARCH_MX6SLL)
 	{ .compatible = "fsl,imx6q-uart" },
+#endif
 	{ }
 };
 #endif
#2 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Quoted 6 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

Quoted 6 lines

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

#3 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Quoted 13 lines · Marek Vasut
Quoted 6 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

Quoted 6 lines

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Quoted 4 lines

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

I think we discussed this idea earlier, and indeed this sounds more promising. Apparently it is more difficult to implement, so this CONFIG_OF_REMOVE_PROPS was done as first step. Unfortunately I'm not familiar with fdt transformations, nor linker scripts. So I cannot really judge the required effort. But I would be happy if someone else implements this.

Soeren

#4 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

In reply to Marek Vasut
Quoted 14 lines · On Tue, 26 May 2020 13:25:00 +0200 Marek Vasut marex at denx.de wrote:
Quoted 6 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

Quoted 6 lines

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Quoted 4 lines

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

This might be a topic again when new bloat causes build breakage again. For now I've succeeded to build the tbs2910 board with default CI tool chain without this patch (by making DM_VIDEO parts optional). Stripping unused compatible entries doesn't save much here (around 800 bytes). So the question is if it is worth the effort to implement such scrubbing.

--
Anatolij

#5 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Quoted 22 lines · Anatolij Gustschin
Quoted 14 lines · On Tue, 26 May 2020 13:25:00 +0200 Marek Vasut marex at denx.de wrote:
Quoted 6 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

Quoted 6 lines

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Quoted 4 lines

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

Quoted 6 lines

This might be a topic again when new bloat causes build breakage again. For now I've succeeded to build the tbs2910 board with default CI tool chain without this patch (by making DM_VIDEO parts optional). Stripping unused compatible entries doesn't save much here (around 800 bytes). So the question is if it is worth the effort to implement such scrubbing.

It is if you can remove all the unused compatibles and all the data/rodata they reference. I think it would be nice to prototype this at least and see how much this really saves. I suspect for SPL this might be interesting even more.

#6 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

In reply to Anatolij Gustschin
Quoted 25 lines

Subject: Re: [RFC PATCH] imx: skip unused compatible strings in drivers

Quoted 8 lines · On Tue, 26 May 2020 13:25:00 +0200 Marek Vasut marex at denx.de wrote:
Quoted 7 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names

interrupt-parent

Quoted 10 lines
Quoted 5 lines

interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

Quoted 5 lines

This might be a topic again when new bloat causes build breakage again. For now I've succeeded to build the tbs2910 board with default CI tool chain without this patch (by making DM_VIDEO parts optional). Stripping unused compatible entries doesn't save much here (around 800 bytes). So the question is if it is worth the effort to implement such scrubbing.

I vote for this. Whether u-boot or SPL, currently the size is larger and larger.

Thanks,
Peng.

Quoted 3 lines

--
Anatolij

#7 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Quoted 25 lines · Peng Fan
Quoted 25 lines

Subject: Re: [RFC PATCH] imx: skip unused compatible strings in drivers

Quoted 8 lines · On Tue, 26 May 2020 13:25:00 +0200 Marek Vasut marex at denx.de wrote:
Quoted 7 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names

interrupt-parent

Quoted 10 lines
Quoted 5 lines

interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

Quoted 7 lines
Quoted 5 lines

This might be a topic again when new bloat causes build breakage again. For now I've succeeded to build the tbs2910 board with default CI tool chain without this patch (by making DM_VIDEO parts optional). Stripping unused compatible entries doesn't save much here (around 800 bytes). So the question is if it is worth the effort to implement such scrubbing.

I vote for this. Whether u-boot or SPL, currently the size is larger and larger.

Can you send a patch prototyping this ?

#8 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

Quoted 32 lines · On Tue, 26 May 2020 14:42:08 +0200 Marek Vasut marex at denx.de wrote:
Quoted 31 lines · Peng Fan
Quoted 30 lines

Subject: Re: [RFC PATCH] imx: skip unused compatible strings in drivers

Quoted 8 lines · On Tue, 26 May 2020 13:25:00 +0200 Marek Vasut marex at denx.de wrote:
Quoted 7 lines · Soeren Moch
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names

interrupt-parent

Quoted 10 lines
Quoted 5 lines

interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Why don't we turn this the other way around -- put the { compat string , driver } tuple list into a U-Boot linker list, then filter this linker list against a DT which will be used for the platform (what if there are multiple DTs?), and then scrub all unreferrenced symbols.

This might be a topic again when new bloat causes build breakage again. For now I've succeeded to build the tbs2910 board with default CI tool chain without this patch (by making DM_VIDEO parts optional). Stripping unused compatible entries doesn't save much here (around 800 bytes). So the question is if it is worth the effort to implement such scrubbing.

Quoted 3 lines
Quoted 1 line

I vote for this. Whether u-boot or SPL, currently the size is larger and larger.

Can you send a patch prototyping this ?

I'm not working on this, so do not expect patches from me, at least not in the near future.

--
Anatolij

#9 lore raw

RFC PATCH 1/1 imx: skip unused compatible strings in drivers

In reply to Soeren Moch
Quoted 6 lines · On Tue, 26 May 2020 13:12:46 +0200 Soeren Moch smoch at web.de wrote:
Quoted 5 lines · Anatolij Gustschin

Converting to DM increases binary size and breaks building some boards (i.e. tbs2910, gcc 9.2). The approach to address this issue via cutting off unused properties/nodes in device tree via custom u-boot.dtsi was not welcome, even if the affected boards do not pass the built-in device tree to the kernel.

Quoted 6 lines

But there is CONFIG_OF_REMOVE_PROPS="dmas dma-names interrupt-parent interrupts interrupts-extended interrupt-names interrupt-map interrupt-map-mask" in tbs2910_defconfig. So removing properties is already done via this config option. Removing nodes is not implemented (yet? AFAIK). But would be welcome if someone implements this in a similar way, I think.

Yes, I've added this CONFIG_OF_REMOVE_PROPS list on request because an earlier patch [1] was not very welcome. But this older patch already did deleting unused nodes, in a different way.

[1] http://patchwork.ozlabs.org/project/uboot/patch/20191206183047.1313-1-agust at denx.de

--
Anatolij