diff mbox series

efi_loader: adjust config options for capsule updates

Message ID 20240618154952.12314-1-ilias.apalodimas@linaro.org
State Superseded
Headers show
Series efi_loader: adjust config options for capsule updates | expand

Commit Message

Ilias Apalodimas June 18, 2024, 3:49 p.m. UTC
EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable
at runtime is not supported and allow the platform to perform capsule
updates on disk. With the recent changes boards can conditionally enable
setvariable at runtime using EFI_RT_VOLATILE_STORE.

So let's make the options depend on each other and clarify their
functionality. When EFI_RT_VOLATILE_STORE, setvariable at runtime is
supported and EFI_IGNORE_OSINDICATIONS, which also breaks the EFI spec, is
not needed anymore.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 lib/efi_loader/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jon Humphreys June 18, 2024, 4:49 p.m. UTC | #1
Ilias Apalodimas <ilias.apalodimas@linaro.org> writes:

> EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable
> at runtime is not supported and allow the platform to perform capsule
> updates on disk. With the recent changes boards can conditionally enable
> setvariable at runtime using EFI_RT_VOLATILE_STORE.
>
> So let's make the options depend on each other and clarify their
> functionality. When EFI_RT_VOLATILE_STORE, setvariable at runtime is
> supported and EFI_IGNORE_OSINDICATIONS, which also breaks the EFI spec, is
> not needed anymore.

Hi Ilias,

Is there a corresponding effort to update fwupdmgr to set OSIndications
(and set it correctly so the change persists a reboot)?

Otherwise, fwupdmgr provided capsules will now get ignored for boards that
enable setvariable at runtime.

Jon

>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  lib/efi_loader/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 430bb7f0f7dc..c84064de1366 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -220,6 +220,8 @@ config EFI_CAPSULE_ON_DISK
>  config EFI_IGNORE_OSINDICATIONS
>  	bool "Ignore OsIndications for CapsuleUpdate on-disk"
>  	depends on EFI_CAPSULE_ON_DISK
> +	depends on !EFI_RT_VOLATILE_STORE
> +	default y
>  	help
>  	  There are boards where U-Boot does not support SetVariable at runtime.
>  	  Select this option if you want to use the capsule-on-disk feature
> -- 
> 2.45.2
Ilias Apalodimas June 18, 2024, 5:25 p.m. UTC | #2
Hi Jon,

On Tue, 18 Jun 2024 at 19:49, Jon Humphreys <jhumphreysti@gmail.com> wrote:
>
> Ilias Apalodimas <ilias.apalodimas@linaro.org> writes:
>
> > EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable
> > at runtime is not supported and allow the platform to perform capsule
> > updates on disk. With the recent changes boards can conditionally enable
> > setvariable at runtime using EFI_RT_VOLATILE_STORE.
> >
> > So let's make the options depend on each other and clarify their
> > functionality. When EFI_RT_VOLATILE_STORE, setvariable at runtime is
> > supported and EFI_IGNORE_OSINDICATIONS, which also breaks the EFI spec, is
> > not needed anymore.
>
> Hi Ilias,
>
> Is there a corresponding effort to update fwupdmgr to set OSIndications
> (and set it correctly so the change persists a reboot)?
>

We are not trying to fix anything atm, we probably will in the future.

> Otherwise, fwupdmgr provided capsules will now get ignored for boards that
> enable setvariable at runtime.

That goes beyond fwupd, EFI variable changes will be ignored in
general unless you sync the file manually -- e.g. dd
if=/sys/firmware/efi/efivars/VarToFile-b2ac5fc9-92b7-4acd-aeac-11e818c3130c
of=/boot/efi/ubootefi.var skip=4 bs=1
after every variable change. Unless you do that, enabling
EFI_RT_VOLATILE_STORE makes little sense (and that's why it's not
enabled by default).
So, I prefer making EFI_IGNORE_OSINDICATIONS, which was a hack,
mutually exclusive and start going in the right direction.

Regards
/Ilias
>
> Jon
>
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >  lib/efi_loader/Kconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > index 430bb7f0f7dc..c84064de1366 100644
> > --- a/lib/efi_loader/Kconfig
> > +++ b/lib/efi_loader/Kconfig
> > @@ -220,6 +220,8 @@ config EFI_CAPSULE_ON_DISK
> >  config EFI_IGNORE_OSINDICATIONS
> >       bool "Ignore OsIndications for CapsuleUpdate on-disk"
> >       depends on EFI_CAPSULE_ON_DISK
> > +     depends on !EFI_RT_VOLATILE_STORE
> > +     default y
> >       help
> >         There are boards where U-Boot does not support SetVariable at runtime.
> >         Select this option if you want to use the capsule-on-disk feature
> > --
> > 2.45.2
Jon Humphreys June 18, 2024, 6:16 p.m. UTC | #3
Ilias Apalodimas <ilias.apalodimas@linaro.org> writes:

> Hi Jon,
>
> On Tue, 18 Jun 2024 at 19:49, Jon Humphreys <jhumphreysti@gmail.com> wrote:
>>
>> Ilias Apalodimas <ilias.apalodimas@linaro.org> writes:
>>
>> > EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable
>> > at runtime is not supported and allow the platform to perform capsule
>> > updates on disk. With the recent changes boards can conditionally enable
>> > setvariable at runtime using EFI_RT_VOLATILE_STORE.
>> >
>> > So let's make the options depend on each other and clarify their
>> > functionality. When EFI_RT_VOLATILE_STORE, setvariable at runtime is
>> > supported and EFI_IGNORE_OSINDICATIONS, which also breaks the EFI spec, is
>> > not needed anymore.
>>
>> Hi Ilias,
>>
>> Is there a corresponding effort to update fwupdmgr to set OSIndications
>> (and set it correctly so the change persists a reboot)?
>>
>
> We are not trying to fix anything atm, we probably will in the future.
>
>> Otherwise, fwupdmgr provided capsules will now get ignored for boards that
>> enable setvariable at runtime.
>
> That goes beyond fwupd, EFI variable changes will be ignored in
> general unless you sync the file manually -- e.g. dd
> if=/sys/firmware/efi/efivars/VarToFile-b2ac5fc9-92b7-4acd-aeac-11e818c3130c
> of=/boot/efi/ubootefi.var skip=4 bs=1
> after every variable change. Unless you do that, enabling
> EFI_RT_VOLATILE_STORE makes little sense (and that's why it's not
> enabled by default).
> So, I prefer making EFI_IGNORE_OSINDICATIONS, which was a hack,
> mutually exclusive and start going in the right direction.
>

I agree with the principle.  My concern is that we want to encourage people
to move to setvariable at runtime, but until LVFS is updated, people who
care about LVFS will be deincentivized.

Jon

> Regards
> /Ilias
>>
>> Jon
>>
>> >
>> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>> > ---
>> >  lib/efi_loader/Kconfig | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
>> > index 430bb7f0f7dc..c84064de1366 100644
>> > --- a/lib/efi_loader/Kconfig
>> > +++ b/lib/efi_loader/Kconfig
>> > @@ -220,6 +220,8 @@ config EFI_CAPSULE_ON_DISK
>> >  config EFI_IGNORE_OSINDICATIONS
>> >       bool "Ignore OsIndications for CapsuleUpdate on-disk"
>> >       depends on EFI_CAPSULE_ON_DISK
>> > +     depends on !EFI_RT_VOLATILE_STORE
>> > +     default y
>> >       help
>> >         There are boards where U-Boot does not support SetVariable at runtime.
>> >         Select this option if you want to use the capsule-on-disk feature
>> > --
>> > 2.45.2
Heinrich Schuchardt June 20, 2024, 3:22 p.m. UTC | #4
On 18.06.24 17:49, Ilias Apalodimas wrote:
> EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable
> at runtime is not supported and allow the platform to perform capsule
> updates on disk. With the recent changes boards can conditionally enable
> setvariable at runtime using EFI_RT_VOLATILE_STORE.
>
> So let's make the options depend on each other and clarify their
> functionality. When EFI_RT_VOLATILE_STORE, setvariable at runtime is
> supported and EFI_IGNORE_OSINDICATIONS, which also breaks the EFI spec, is
> not needed anymore.
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>   lib/efi_loader/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 430bb7f0f7dc..c84064de1366 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -220,6 +220,8 @@ config EFI_CAPSULE_ON_DISK
>   config EFI_IGNORE_OSINDICATIONS
>   	bool "Ignore OsIndications for CapsuleUpdate on-disk"
>   	depends on EFI_CAPSULE_ON_DISK
> +	depends on !EFI_RT_VOLATILE_STORE

EFI_RT_VOLATILE_STORE does not imply that the OS that you are running
supports writing variables to ubootefi.var or eMMC.

How about

default y if !EFI_RT_VOLATILE_STORE

Best regards

Heinrich

> +	default y
>   	help
>   	  There are boards where U-Boot does not support SetVariable at runtime.
>   	  Select this option if you want to use the capsule-on-disk feature
Ilias Apalodimas June 20, 2024, 7:50 p.m. UTC | #5
Hi Heinrich,

On Thu, 20 Jun 2024 at 18:23, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 18.06.24 17:49, Ilias Apalodimas wrote:
> > EFI_IGNORE_OSINDICATIONS is used to ignore OsIndications if setvariable
> > at runtime is not supported and allow the platform to perform capsule
> > updates on disk. With the recent changes boards can conditionally enable
> > setvariable at runtime using EFI_RT_VOLATILE_STORE.
> >
> > So let's make the options depend on each other and clarify their
> > functionality. When EFI_RT_VOLATILE_STORE, setvariable at runtime is
> > supported and EFI_IGNORE_OSINDICATIONS, which also breaks the EFI spec, is
> > not needed anymore.
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >   lib/efi_loader/Kconfig | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > index 430bb7f0f7dc..c84064de1366 100644
> > --- a/lib/efi_loader/Kconfig
> > +++ b/lib/efi_loader/Kconfig
> > @@ -220,6 +220,8 @@ config EFI_CAPSULE_ON_DISK
> >   config EFI_IGNORE_OSINDICATIONS
> >       bool "Ignore OsIndications for CapsuleUpdate on-disk"
> >       depends on EFI_CAPSULE_ON_DISK
> > +     depends on !EFI_RT_VOLATILE_STORE
>
> EFI_RT_VOLATILE_STORE does not imply that the OS that you are running
> supports writing variables to ubootefi.var or eMMC.
>
> How about
>
> default y if !EFI_RT_VOLATILE_STORE

Sure, that works for me. I'll send a v2

Cheers

>
> Best regards
>
> Heinrich
>
> > +     default y
> >       help
> >         There are boards where U-Boot does not support SetVariable at runtime.
> >         Select this option if you want to use the capsule-on-disk feature
>
diff mbox series

Patch

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 430bb7f0f7dc..c84064de1366 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -220,6 +220,8 @@  config EFI_CAPSULE_ON_DISK
 config EFI_IGNORE_OSINDICATIONS
 	bool "Ignore OsIndications for CapsuleUpdate on-disk"
 	depends on EFI_CAPSULE_ON_DISK
+	depends on !EFI_RT_VOLATILE_STORE
+	default y
 	help
 	  There are boards where U-Boot does not support SetVariable at runtime.
 	  Select this option if you want to use the capsule-on-disk feature