Skip to contentSkip to conversation

clk: clk-fixed-factor: compile clk of provider only if it is enabled

PATCH In review [email protected] 2 participants 5 messages Jul 30, 2025 – Aug 4, 2025 1 message not in the archive

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

PATCH 1/1 clk: clk-fixed-factor: compile clk of provider only if it is enabled

From: Chali Anis <[email protected]>

This permits to not compile when it's not used, fix undefined reference error.

---
 drivers/clk/clk-fixed-factor.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-fixed-factor.c +3 -0
index d2c808d40c63..ea04a4bf7f0f 100644
@@ -97,6 +97,8 @@ struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
 						       flags, mult, div));
 }
 
+#ifdef CONFIG_COMMON_CLK_OF_PROVIDER
+
 /**
  * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
  */
@@ -130,3 +132,4 @@ static int of_fixed_factor_clk_setup(struct device_node *node)
 }
 CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
 		of_fixed_factor_clk_setup);
+#endif
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 arm: efi: add a dummy efi arch on ARM64

From: Chali Anis <[email protected]>

this arch will forces a generic arm 64 cpu, which will produce an efi payload on ARM 64, this works with a virtual machine using qemu-system-aarch64, need further work to support real hardware.
Submit the patch in case someone is interrested in working to have a full support for efi payload on real hardware.

---
 Documentation/boards/efi.rst   |  11 +++-
 arch/arm/Kconfig               |   1 +
 arch/arm/configs/efi_defconfig | 101 +++++++++++++++++++++++++++++++++
 arch/arm/mach-efi/Kconfig      |  10 ++++
 arch/arm/mach-efi/Makefile     |   1 +
 5 files changed, 123 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/configs/efi_defconfig
 create mode 100644 arch/arm/mach-efi/Kconfig
 create mode 100644 arch/arm/mach-efi/Makefile
Documentation/boards/efi.rst +10 -1
index 869e5e88172f..872b0c2388ce 100644
@@ -23,7 +23,7 @@ x86_64 binary currently is tested.
 Building barebox for EFI
 ------------------------
 
-Use the following to build barebox for EFI:
+Use the following to build barebox for EFI for x86:
 
 .. code-block:: sh
 
@@ -31,6 +31,15 @@ Use the following to build barebox for EFI:
   make efi_defconfig
   make
 
+for EFI on arm 64 use:
+
+.. code-block:: sh
+
+  export ARCH=arm
+  export CROSS_COMPILE=aarch64-linux-gnu-
+  make efi_defconfig
+  make
+
 The resulting EFI image is ``barebox.efi`` (or the barebox-flash-image link).
 
 Running barebox on EFI systems
arch/arm/Kconfig +1 -0
index d283ef7793a1..d5dd6abc416f 100644
@@ -276,6 +276,7 @@ source "arch/arm/mach-vexpress/Kconfig"
 source "arch/arm/mach-tegra/Kconfig"
 source "arch/arm/mach-zynq/Kconfig"
 source "arch/arm/mach-zynqmp/Kconfig"
+source "arch/arm/mach-efi/Kconfig"
 
 config BOARD_ARM_VIRT
 	bool
arch/arm/configs/efi_defconfig new file +101 -0

101 lines not on this page · raw message

arch/arm/mach-efi/Kconfig new file +10 -0
new file mode 100644
index 000000000000..2bc4feca0581
@@ -0,0 +1,10 @@
+config EFI_ARM64
+	bool "EFI on ARM64"
+	select CPU_V8
+	select CPU_SUPPORTS_64BIT_KERNEL
+	select HAVE_EFI_PAYLOAD
+	select EFI_PAYLOAD
+    select CLOCKSOURCE_EFI
+	depends on 64BIT
+	default y
+
arch/arm/mach-efi/Makefile new file +1 -0
new file mode 100644
index 000000000000..16a218658ade
@@ -0,0 +1 @@
+obj- := __dummy__.o
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH] arm: efi: add a dummy efi arch on ARM64

Hi,

Quoted 8 lines · On 30.07.25 05:50, [email protected] wrote:

From: Chali Anis <[email protected]>

this arch will forces a generic arm 64 cpu, which will produce an efi payload on ARM 64, this works with a virtual machine using qemu-system-aarch64, need further work to support real hardware.
Submit the patch in case someone is interrested in working to have a full support for efi payload on real hardware.

Thanks for your patch.

For the Virt platforms we decided to use the multi defconfigs to cut down on the number of configs. I think efi_defconfig is useful to have, because it shares little with other existing configs, but it might confuse users to provide it before it is a viable target, i.e. can actually boot a kernel via EFI...

I just submitted an alternative patch for multi_v8_efi_defconfig, which could be used as stepping stone for further work.

What do you think?

Quoted 36 lines
Documentation/boards/efi.rst +10 -1
-Use the following to build barebox for EFI:
+Use the following to build barebox for EFI for x86:
 
 .. code-block:: sh
@@ -31,6 +31,15 @@ Use the following to build barebox for EFI:
   make efi_defconfig
   make
 
+for EFI on arm 64 use:
+
+.. code-block:: sh
+
+  export ARCH=arm
+  export CROSS_COMPILE=aarch64-linux-gnu-
+  make efi_defconfig
+  make
+
 The resulting EFI image is ``barebox.efi`` (or the barebox-flash-image link).
 
 Running barebox on EFI systems
arch/arm/Kconfig +1 -0
index d283ef7793a1..d5dd6abc416f 100644
@@ -276,6 +276,7 @@ source "arch/arm/mach-vexpress/Kconfig"
 source "arch/arm/mach-tegra/Kconfig"
 source "arch/arm/mach-zynq/Kconfig"
 source "arch/arm/mach-zynqmp/Kconfig"
+source "arch/arm/mach-efi/Kconfig"
 
 config BOARD_ARM_VIRT
 	bool
arch/arm/configs/efi_defconfig new file +0 -0
new file mode 100644
index 000000000000..5fe998ed4d4d

arch/arm/configs/efi_defconfig line 84

Quoted 4 lines
arch/arm/configs/efi_defconfig new file +3 -0
 
+CONFIG_VIDEO=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_DRIVER_VIDEO_EFI_GOP=y

This doesn't work correctly on ARM yet

arch/arm/configs/efi_defconfig line 86

Quoted 2 lines
arch/arm/configs/efi_defconfig new file +2 -0
+CONFIG_FINTEK_SUPERIO=y
+CONFIG_SMSC_SUPERIO=y

These are likely not used with ARM systems

arch/arm/configs/efi_defconfig line 91

Quoted 5 lines
arch/arm/configs/efi_defconfig new file +5 -0
+CONFIG_STATE_DRV=y
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_EFI=y
+CONFIG_F71808E_WDT=y
+CONFIG_ITCO_WDT=y

Not relevant to ARM systems.

arch/arm/configs/efi_defconfig line 6

Quoted 8 lines

+++ b/arch/arm/mach-efi/Kconfig

arch/arm/configs/efi_defconfig new file +6 -0
@@ -0,0 +1,10 @@
+config EFI_ARM64
+	bool "EFI on ARM64"
+	select CPU_V8
+	select CPU_SUPPORTS_64BIT_KERNEL
+	select HAVE_EFI_PAYLOAD
+	select EFI_PAYLOAD

EFI_PAYLOAD is still gated behind COMPILE_TEST, so I think this should result in a warning.

arch/arm/configs/efi_defconfig line 7

Quoted 1 line
arch/arm/configs/efi_defconfig new file +1 -0
+    select CLOCKSOURCE_EFI

Wrong indentation.

Cheers,
Ahmad

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw
In reply to [email protected]

Hi Anis,

Quoted 4 lines · On 30.07.25 05:50, [email protected] wrote:

From: Chali Anis <[email protected]>

This permits to not compile when it's not used, fix undefined reference error.

Normally undefined references are garbage collected by the linker if the code that references them is going to be discarded as well.

We have configurations with and without OF support that make use of clocks in CI I think, so I am curious to know what configuration you used to provoke the error.

Cheers,
Ahma

Quoted 24 lines
---
 drivers/clk/clk-fixed-factor.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/clk-fixed-factor.c +3 -0
index d2c808d40c63..ea04a4bf7f0f 100644
@@ -97,6 +97,8 @@ struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
 						       flags, mult, div));
 }
 
+#ifdef CONFIG_COMMON_CLK_OF_PROVIDER
+
 /**
  * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
  */
@@ -130,3 +132,4 @@ static int of_fixed_factor_clk_setup(struct device_node *node)
 }
 CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
 		of_fixed_factor_clk_setup);
+#endif
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

A message that is not in the archive (sent off-list or not yet received): CAL+1fyCC0V3MO4tmgBJumbdPn7_BhQc-60s3QhGjye0rQQVpPw@mail.gmail.com

#5 lore raw

Hi,

[adding back barebox mailing list]

Quoted 7 lines · anis chali

Hi Ahmad,
I will check back tomorrow,  but I faced the issue when I compiled efi on arm64 using the clocksource efi will compile the stuff inside the fixed clock and there is a code using of variant that raised an undefined reference but maybe it's all good since arm64 support device trees, so adding the config to enable of tree support will eliminate the issue.

If there is a build error, it should be fixed. I was just wondering how you ran into it.

Cheers,
Ahmad

Quoted 69 lines

Cheers,
Anis

Le mer. 30 juil. 2025, 02:23, Ahmad Fatoum <[email protected] <mailto:[email protected]>> a écrit :

    Hi Anis,

    On 30.07.25 05:50, [email protected]
    <mailto:[email protected]> wrote:
    > From: Chali Anis <[email protected] <mailto:[email protected]>>
    >
    > This permits to not compile when it's not used, fix undefined
    > reference error.

    Normally undefined references are garbage collected by the linker if
    the code that references them is going to be discarded as well.

    We have configurations with and without OF support that make use
    of clocks in CI I think, so I am curious to know what configuration
    you used to provoke the error.

    Cheers,
    Ahma

    >
    > Signed-off-by: Chali Anis <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/clk/clk-fixed-factor.c | 3 +++
    >  1 file changed, 3 insertions(+)
    >
    > diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-
    fixed-factor.c
    > index d2c808d40c63..ea04a4bf7f0f 100644
    > --- a/drivers/clk/clk-fixed-factor.c
    > +++ b/drivers/clk/clk-fixed-factor.c
    > @@ -97,6 +97,8 @@ struct clk_hw
    *clk_hw_register_fixed_factor(struct device *dev,
    >                                                      flags, mult,
    div));
    >  }
    > 
    > +#ifdef CONFIG_COMMON_CLK_OF_PROVIDER
    > +
    >  /**
    >   * of_fixed_factor_clk_setup() - Setup function for simple fixed
    factor clock
    >   */
    > @@ -130,3 +132,4 @@ static int of_fixed_factor_clk_setup(struct
    device_node *node)
    >  }
    >  CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
    >               of_fixed_factor_clk_setup);
    > +#endif


    -- 
    Pengutronix e.K.                           |                       
         |
    Steuerwalder Str. 21                       | http://
    www.pengutronix.de/ <http://www.pengutronix.de/>  |
    31137 Hildesheim, Germany                  | Phone:
    +49-5121-206917-0    |
    Amtsgericht Hildesheim, HRA 2686           | Fax: 
     +49-5121-206917-5555 |
Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |