mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: anis chali <chalianis1@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] efi: payload: refactor to use the external barebox state driver.
Date: Mon, 3 Nov 2025 15:24:10 +0100	[thread overview]
Message-ID: <2e640c65-0a84-4fce-86a7-c94694b0c9f6@pengutronix.de> (raw)
In-Reply-To: <CAL+1fyAt37CXJ33si=TqLW=v+KgOt6Yi_0fHPno4nrBUverKew@mail.gmail.com>

Hi,

On 11/3/25 3:10 PM, anis chali wrote:
>>> This breaks state for x86-efi, the original user of efi_late_init().
> 
> Was not sure to add it to the efi_defconfig

generally speaking, we try not to break existing users and if we do, an
entry should be added to the migration guide explaining what backward
incompatibility was introduced.

Cheers,
Ahmad

> 
> Le lun. 3 nov. 2025 à 01:40, Ahmad Fatoum <a.fatoum@pengutronix.de> a écrit :
>>
>> Hi,
>>
>> On 03.11.25 05:38, chalianis1@gmail.com wrote:
>>> From: Chali Anis <chalianis1@gmail.com>
>>>
>>> use the external state config to pass the barebox state.
>>>
>>> Signed-off-by: Chali Anis <chalianis1@gmail.com>
>>> ---
>>>  arch/arm/configs/efi_v8_defconfig |  2 ++
>>>  efi/payload/init.c                | 50 -------------------------------
>>
>> This breaks state for x86-efi, the original user of efi_late_init().
>>
>>>  2 files changed, 2 insertions(+), 50 deletions(-)
>>>
>>> diff --git a/arch/arm/configs/efi_v8_defconfig b/arch/arm/configs/efi_v8_defconfig
>>> index 5f946dd51d4a..26682aab304a 100644
>>> --- a/arch/arm/configs/efi_v8_defconfig
>>> +++ b/arch/arm/configs/efi_v8_defconfig
>>> @@ -21,6 +21,8 @@ CONFIG_CONSOLE_RATP=y
>>>  CONFIG_PARTITION_DISK_EFI=y
>>>  CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
>>>  CONFIG_STATE=y
>>> +CONFIG_EXTERNAL_STATE=y
>>> +CONFIG_EXTERNAL_STATE_DTB_PATH="/boot/EFI/barebox/state.dtb"
>>>  CONFIG_BOOTCHOOSER=y
>>>  CONFIG_RESET_SOURCE=y
>>>  CONFIG_MACHINE_ID=y
>>> diff --git a/efi/payload/init.c b/efi/payload/init.c
>>> index 5b827c57ed1f..63d62395cf3f 100644
>>> --- a/efi/payload/init.c
>>> +++ b/efi/payload/init.c
>>> @@ -376,56 +376,6 @@ static int efi_postcore_init(void)
>>>  }
>>>  postcore_efi_initcall(efi_postcore_init);
>>>
>>> -static int efi_late_init(void)
>>> -{
>>> -     const char *state_desc = "/boot/EFI/barebox/state.dtb";
>>> -     struct device_node *state_root = NULL;
>>> -     size_t size;
>>> -     void *fdt;
>>> -     int ret;
>>> -
>>> -     if (!IS_ENABLED(CONFIG_STATE))
>>> -             return 0;
>>> -
>>> -     if (!get_mounted_path("/boot")) {
>>> -             pr_warn("boot device couldn't be determined%s\n",
>>> -                     IS_ENABLED(CONFIG_FS_EFI) ? "" : " without CONFIG_FS_EFI");
>>> -             return 0;
>>> -     }
>>> -
>>> -     fdt = read_file(state_desc, &size);
>>> -     if (!fdt) {
>>> -             pr_info("unable to read %s: %m\n", state_desc);
>>> -             return 0;
>>> -     }
>>> -
>>> -     state_root = of_unflatten_dtb(fdt, size);
>>> -     if (!IS_ERR(state_root)) {
>>> -             struct device_node *np = NULL;
>>> -             struct state *state;
>>> -
>>> -             ret = barebox_register_of(state_root);
>>> -             if (ret)
>>> -                     pr_warn("Failed to register device-tree: %pe\n", ERR_PTR(ret));
>>> -
>>> -             np = of_find_node_by_alias(state_root, "state");
>>> -
>>> -             state = state_new_from_node(np, false);
>>> -             if (IS_ERR(state))
>>> -                     return PTR_ERR(state);
>>> -
>>> -             ret = state_load(state);
>>> -             if (ret != -ENOMEDIUM)
>>> -                     pr_warn("Failed to load persistent state, continuing with defaults, %d\n",
>>> -                             ret);
>>> -
>>> -             return 0;
>>> -     }
>>> -
>>> -     return 0;
>>> -}
>>> -late_efi_initcall(efi_late_init);
>>> -
>>>  static int do_efiexit(int argc, char *argv[])
>>>  {
>>>       if (!BS)
>>
>>
>> --
>> 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 |
> 

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




  reply	other threads:[~2025-11-03 14:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03  4:38 [PATCH 1/2] drivers: misc: external_state: add a barebox external state chalianis1
2025-11-03  4:38 ` [PATCH 2/2] efi: payload: refactor to use the external barebox state driver chalianis1
2025-11-03  6:40   ` Ahmad Fatoum
2025-11-03 14:10     ` anis chali
2025-11-03 14:24       ` Ahmad Fatoum [this message]
2025-11-03 15:28         ` anis chali
2025-11-03  6:46 ` [PATCH 1/2] drivers: misc: external_state: add a barebox external state Ahmad Fatoum
2025-11-03 14:09   ` anis chali
2025-11-03 14:22     ` Ahmad Fatoum
2025-11-03 15:26       ` anis chali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e640c65-0a84-4fce-86a7-c94694b0c9f6@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=chalianis1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox