diff mbox series

[v3,5/9] capsule: kconfig: Select SET_DFU_ALT_INFO config symbol for capsule update

Message ID 20220330145103.1435736-6-sughosh.ganu@linaro.org
State New
Headers show
Series efi: capsule: Capsule Update fixes and enhancements | expand

Commit Message

Sughosh Ganu March 30, 2022, 2:50 p.m. UTC
The capsule update code uses the dfu_alt_info variable for the actual
update of the firmware component. The dfu_alt_info variable gives
information needed to perform the update, like the device on which the
update is to be made, the partition, type of partition etc. Since the
dfu_alt_info is a environmental variable, it can be modified from the
u-boot command line. An incorrect update of the variable will result
in the update being done incorrectly.

Prevent this scenario by forcing an update of the dfu_alt_info
variable from the information obtained through the board file when
UEFI capsule update functionality is enabled.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---

Changes since V2: New Patch

 lib/efi_loader/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

Comments

Masami Hiramatsu March 31, 2022, 2:48 a.m. UTC | #1
Hi,

Even with this patch, if the platform configuration doesn't select
EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the
platform will lose raw DFU availability.

Thank you,

2022年3月30日(水) 23:51 Sughosh Ganu <sughosh.ganu@linaro.org>:
>
> The capsule update code uses the dfu_alt_info variable for the actual
> update of the firmware component. The dfu_alt_info variable gives
> information needed to perform the update, like the device on which the
> update is to be made, the partition, type of partition etc. Since the
> dfu_alt_info is a environmental variable, it can be modified from the
> u-boot command line. An incorrect update of the variable will result
> in the update being done incorrectly.
>
> Prevent this scenario by forcing an update of the dfu_alt_info
> variable from the information obtained through the board file when
> UEFI capsule update functionality is enabled.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>
> Changes since V2: New Patch
>
>  lib/efi_loader/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index e5e35fe51f..09fb8cbe75 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
>         depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
>         select UPDATE_FIT
>         select DFU
> +       select SET_DFU_ALT_INFO
>         select EFI_CAPSULE_FIRMWARE
>         help
>           Select this option if you want to enable firmware management protocol
> @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
>         depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
>         select DFU_WRITE_ALT
>         select DFU
> +       select SET_DFU_ALT_INFO
>         select EFI_CAPSULE_FIRMWARE
>         help
>           Select this option if you want to enable firmware management protocol
> --
> 2.25.1
>
Sughosh Ganu March 31, 2022, 7:41 a.m. UTC | #2
hi Masami,

On Thu, 31 Mar 2022 at 08:18, Masami Hiramatsu
<masami.hiramatsu@linaro.org> wrote:
>
> Hi,
>
> Even with this patch, if the platform configuration doesn't select
> EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the
> platform will lose raw DFU availability.

I will have to rely on feedback from board maintainers for that. Like
I commented in another email, I think that these platforms are setting
dfu_alt_info primarily for capsule updates. But if some board
maintainer asks, I will enable CONFIG_SET_DFU_ALT_INFO the board's
defconfig. Thanks.

-sughosh

>
> Thank you,
>
> 2022年3月30日(水) 23:51 Sughosh Ganu <sughosh.ganu@linaro.org>:
> >
> > The capsule update code uses the dfu_alt_info variable for the actual
> > update of the firmware component. The dfu_alt_info variable gives
> > information needed to perform the update, like the device on which the
> > update is to be made, the partition, type of partition etc. Since the
> > dfu_alt_info is a environmental variable, it can be modified from the
> > u-boot command line. An incorrect update of the variable will result
> > in the update being done incorrectly.
> >
> > Prevent this scenario by forcing an update of the dfu_alt_info
> > variable from the information obtained through the board file when
> > UEFI capsule update functionality is enabled.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> >
> > Changes since V2: New Patch
> >
> >  lib/efi_loader/Kconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > index e5e35fe51f..09fb8cbe75 100644
> > --- a/lib/efi_loader/Kconfig
> > +++ b/lib/efi_loader/Kconfig
> > @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
> >         depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> >         select UPDATE_FIT
> >         select DFU
> > +       select SET_DFU_ALT_INFO
> >         select EFI_CAPSULE_FIRMWARE
> >         help
> >           Select this option if you want to enable firmware management protocol
> > @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
> >         depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
> >         select DFU_WRITE_ALT
> >         select DFU
> > +       select SET_DFU_ALT_INFO
> >         select EFI_CAPSULE_FIRMWARE
> >         help
> >           Select this option if you want to enable firmware management protocol
> > --
> > 2.25.1
> >
>
>
> --
> Masami Hiramatsu
Sughosh Ganu March 31, 2022, 8:37 a.m. UTC | #3
hi Masami,

On Thu, 31 Mar 2022 at 13:11, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> hi Masami,
>
> On Thu, 31 Mar 2022 at 08:18, Masami Hiramatsu
> <masami.hiramatsu@linaro.org> wrote:
> >
> > Hi,
> >
> > Even with this patch, if the platform configuration doesn't select
> > EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the
> > platform will lose raw DFU availability.
>
> I will have to rely on feedback from board maintainers for that. Like
> I commented in another email, I think that these platforms are setting
> dfu_alt_info primarily for capsule updates. But if some board
> maintainer asks, I will enable CONFIG_SET_DFU_ALT_INFO the board's
> defconfig. Thanks.

Another alternative is that we keep the dfu_alt_info settings in the
board config headers. With the capsule update, the
CONFIG_SET_DFU_ALT_INFO will be set, and the variable will be
populated from the board file. For the non capsule update scenario,
the platform can then use the variable set in the board headers. Will
that be fine with you. Let me know. Thanks.

-sughosh

>
> -sughosh
>
> >
> > Thank you,
> >
> > 2022年3月30日(水) 23:51 Sughosh Ganu <sughosh.ganu@linaro.org>:
> > >
> > > The capsule update code uses the dfu_alt_info variable for the actual
> > > update of the firmware component. The dfu_alt_info variable gives
> > > information needed to perform the update, like the device on which the
> > > update is to be made, the partition, type of partition etc. Since the
> > > dfu_alt_info is a environmental variable, it can be modified from the
> > > u-boot command line. An incorrect update of the variable will result
> > > in the update being done incorrectly.
> > >
> > > Prevent this scenario by forcing an update of the dfu_alt_info
> > > variable from the information obtained through the board file when
> > > UEFI capsule update functionality is enabled.
> > >
> > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > > ---
> > >
> > > Changes since V2: New Patch
> > >
> > >  lib/efi_loader/Kconfig | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > > index e5e35fe51f..09fb8cbe75 100644
> > > --- a/lib/efi_loader/Kconfig
> > > +++ b/lib/efi_loader/Kconfig
> > > @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
> > >         depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> > >         select UPDATE_FIT
> > >         select DFU
> > > +       select SET_DFU_ALT_INFO
> > >         select EFI_CAPSULE_FIRMWARE
> > >         help
> > >           Select this option if you want to enable firmware management protocol
> > > @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
> > >         depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
> > >         select DFU_WRITE_ALT
> > >         select DFU
> > > +       select SET_DFU_ALT_INFO
> > >         select EFI_CAPSULE_FIRMWARE
> > >         help
> > >           Select this option if you want to enable firmware management protocol
> > > --
> > > 2.25.1
> > >
> >
> >
> > --
> > Masami Hiramatsu
Masami Hiramatsu March 31, 2022, 9:26 a.m. UTC | #4
Hi Sughosh,

2022年3月31日(木) 17:38 Sughosh Ganu <sughosh.ganu@linaro.org>:
>
> hi Masami,
>
> On Thu, 31 Mar 2022 at 13:11, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
> >
> > hi Masami,
> >
> > On Thu, 31 Mar 2022 at 08:18, Masami Hiramatsu
> > <masami.hiramatsu@linaro.org> wrote:
> > >
> > > Hi,
> > >
> > > Even with this patch, if the platform configuration doesn't select
> > > EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the
> > > platform will lose raw DFU availability.
> >
> > I will have to rely on feedback from board maintainers for that. Like
> > I commented in another email, I think that these platforms are setting
> > dfu_alt_info primarily for capsule updates. But if some board
> > maintainer asks, I will enable CONFIG_SET_DFU_ALT_INFO the board's
> > defconfig. Thanks.
>
> Another alternative is that we keep the dfu_alt_info settings in the
> board config headers. With the capsule update, the
> CONFIG_SET_DFU_ALT_INFO will be set, and the variable will be
> populated from the board file. For the non capsule update scenario,
> the platform can then use the variable set in the board headers. Will
> that be fine with you. Let me know. Thanks.

Yeah, that is good for me :)

Thank you,


>
> -sughosh
>
> >
> > -sughosh
> >
> > >
> > > Thank you,
> > >
> > > 2022年3月30日(水) 23:51 Sughosh Ganu <sughosh.ganu@linaro.org>:
> > > >
> > > > The capsule update code uses the dfu_alt_info variable for the actual
> > > > update of the firmware component. The dfu_alt_info variable gives
> > > > information needed to perform the update, like the device on which the
> > > > update is to be made, the partition, type of partition etc. Since the
> > > > dfu_alt_info is a environmental variable, it can be modified from the
> > > > u-boot command line. An incorrect update of the variable will result
> > > > in the update being done incorrectly.
> > > >
> > > > Prevent this scenario by forcing an update of the dfu_alt_info
> > > > variable from the information obtained through the board file when
> > > > UEFI capsule update functionality is enabled.
> > > >
> > > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > > > ---
> > > >
> > > > Changes since V2: New Patch
> > > >
> > > >  lib/efi_loader/Kconfig | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > > > index e5e35fe51f..09fb8cbe75 100644
> > > > --- a/lib/efi_loader/Kconfig
> > > > +++ b/lib/efi_loader/Kconfig
> > > > @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
> > > >         depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> > > >         select UPDATE_FIT
> > > >         select DFU
> > > > +       select SET_DFU_ALT_INFO
> > > >         select EFI_CAPSULE_FIRMWARE
> > > >         help
> > > >           Select this option if you want to enable firmware management protocol
> > > > @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
> > > >         depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
> > > >         select DFU_WRITE_ALT
> > > >         select DFU
> > > > +       select SET_DFU_ALT_INFO
> > > >         select EFI_CAPSULE_FIRMWARE
> > > >         help
> > > >           Select this option if you want to enable firmware management protocol
> > > > --
> > > > 2.25.1
> > > >
> > >
> > >
> > > --
> > > Masami Hiramatsu
diff mbox series

Patch

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index e5e35fe51f..09fb8cbe75 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -174,6 +174,7 @@  config EFI_CAPSULE_FIRMWARE_FIT
 	depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
 	select UPDATE_FIT
 	select DFU
+	select SET_DFU_ALT_INFO
 	select EFI_CAPSULE_FIRMWARE
 	help
 	  Select this option if you want to enable firmware management protocol
@@ -185,6 +186,7 @@  config EFI_CAPSULE_FIRMWARE_RAW
 	depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
 	select DFU_WRITE_ALT
 	select DFU
+	select SET_DFU_ALT_INFO
 	select EFI_CAPSULE_FIRMWARE
 	help
 	  Select this option if you want to enable firmware management protocol