Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
hi Masami, On Thu, 23 Dec 2021 at 06:23, Masami Hiramatsu wrote: > Hi Sughosh, > > Can you move the FWU related configs to lib/fwu_updates/Kconfig ? > FWU multi bank update is an independent feature, thus I think it is > better to have its own Kconfig file and the lib/Kconfig only includes > it. > (I did it on my development series) > Okay, I have moved the FWU config options in a Kconfig file under lib/fwu_updates/. This gets sourced from lib/Kconfig. -sughosh > > Thank you, > > 2021年12月19日(日) 16:07 Sughosh Ganu : > > > > The FWU Multi Bank Update feature supports updation of firmware images > > to one of multiple sets(also called banks) of images. The firmware > > images are clubbed together in banks, with the system booting images > > from the active bank. Information on the images such as which bank > > they belong to is stored as part of the metadata structure, which is > > stored on the same storage media as the firmware images on a dedicated > > partition. > > > > At the time of update, the metadata is read to identify the bank to > > which the images need to be flashed(update bank). On a successful > > update, the metadata is modified to set the updated bank as active > > bank to subsequently boot from. > > > > Signed-off-by: Sughosh Ganu > > --- > > Changes since V1: > > * Call function fwu_update_checks_pass to check if the > > update can be initiated > > * Do not allow firmware update from efi_init_obj_list as the > > fwu boot-time checks need to be run > > > > include/fwu.h| 18 +++- > > lib/Kconfig | 32 ++ > > lib/Makefile | 1 + > > lib/efi_loader/efi_capsule.c | 198 ++- > > lib/efi_loader/efi_setup.c | 3 +- > > lib/fwu_updates/Makefile | 11 ++ > > lib/fwu_updates/fwu.c| 27 + > > 7 files changed, 284 insertions(+), 6 deletions(-) > > create mode 100644 lib/fwu_updates/Makefile > > > > diff --git a/include/fwu.h b/include/fwu.h > > index 2d2e674d6a..bf50fe9277 100644 > > --- a/include/fwu.h > > +++ b/include/fwu.h > > @@ -10,14 +10,28 @@ > > > > #include > > > > -#define FWU_MDATA_VERSION 0x1 > > +#define FWU_MDATA_GUID \ > > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > +0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > + > > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > > +0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > > + > > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > > +0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > > > > #define FWU_MDATA_GUID \ > > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > > > -int fwu_boottime_checks(void); > > +#define FWU_MDATA_VERSION 0x1 > > +#define FWU_IMAGE_ACCEPTED 0x1 > > + > > u8 fwu_update_checks_pass(void); > > +int fwu_boottime_checks(void); > > +int fwu_trial_state_ctr_start(void); > > > > int fwu_get_active_index(u32 *active_idx); > > int fwu_update_active_index(u32 active_idx); > > diff --git a/lib/Kconfig b/lib/Kconfig > > index 807a4c6ade..7cb306317c 100644 > > --- a/lib/Kconfig > > +++ b/lib/Kconfig > > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > > When there are multiple device tree nodes with same name, > >enable this config option to distinguish them using > > phandles in fdtdec_get_alias_seq() function. > > + > > +config FWU_MULTI_BANK_UPDATE > > + bool "Enable FWU Multi Bank Update Feature" > > + depends on EFI_HAVE_CAPSULE_SUPPORT > > + select PARTITION_TYPE_GUID > > + select EFI_SETUP_EARLY > > + help > > + Feature for updating firmware images on platforms having > > + multiple banks(copies) of the firmware images. One of the > > + bank is selected for updating all the firmware components > > + > > +config FWU_NUM_BANKS > > + int "Number of Banks defined by the platform" > > + depends on FWU_MULTI_BANK_UPDATE > > + help > > + Define the number of banks of firmware images on a platform > > + > > +config FWU_NUM_IMAGES_PER_BANK > > + int "Number of firmware images per bank" > > + depends on FWU_MULTI_BANK_UPDATE > > + help > > + Define the number of firmware images per bank. This value > > + should be the same for all the banks. > > + > > +config FWU_TRIAL_STATE_CNT > > + int "Number of times system boots in Trial State" > > + depends on FWU_MULTI_BANK_UPDATE > > + default 3 > > + help > > + With FWU Multi Bank Update feature enabled, number of times > > + the platform is allowed to boot in Trial State after an > > + update. > > diff --git a/lib/Makefile b/lib/Makefile > > index 5ddbc77ed6..bc5c1e22fc 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -9,6 +9,7
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
Hi Sughosh, Can you move the FWU related configs to lib/fwu_updates/Kconfig ? FWU multi bank update is an independent feature, thus I think it is better to have its own Kconfig file and the lib/Kconfig only includes it. (I did it on my development series) Thank you, 2021年12月19日(日) 16:07 Sughosh Ganu : > > The FWU Multi Bank Update feature supports updation of firmware images > to one of multiple sets(also called banks) of images. The firmware > images are clubbed together in banks, with the system booting images > from the active bank. Information on the images such as which bank > they belong to is stored as part of the metadata structure, which is > stored on the same storage media as the firmware images on a dedicated > partition. > > At the time of update, the metadata is read to identify the bank to > which the images need to be flashed(update bank). On a successful > update, the metadata is modified to set the updated bank as active > bank to subsequently boot from. > > Signed-off-by: Sughosh Ganu > --- > Changes since V1: > * Call function fwu_update_checks_pass to check if the > update can be initiated > * Do not allow firmware update from efi_init_obj_list as the > fwu boot-time checks need to be run > > include/fwu.h| 18 +++- > lib/Kconfig | 32 ++ > lib/Makefile | 1 + > lib/efi_loader/efi_capsule.c | 198 ++- > lib/efi_loader/efi_setup.c | 3 +- > lib/fwu_updates/Makefile | 11 ++ > lib/fwu_updates/fwu.c| 27 + > 7 files changed, 284 insertions(+), 6 deletions(-) > create mode 100644 lib/fwu_updates/Makefile > > diff --git a/include/fwu.h b/include/fwu.h > index 2d2e674d6a..bf50fe9277 100644 > --- a/include/fwu.h > +++ b/include/fwu.h > @@ -10,14 +10,28 @@ > > #include > > -#define FWU_MDATA_VERSION 0x1 > +#define FWU_MDATA_GUID \ > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > +0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > + > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > +0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > + > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > +0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > > #define FWU_MDATA_GUID \ > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > -int fwu_boottime_checks(void); > +#define FWU_MDATA_VERSION 0x1 > +#define FWU_IMAGE_ACCEPTED 0x1 > + > u8 fwu_update_checks_pass(void); > +int fwu_boottime_checks(void); > +int fwu_trial_state_ctr_start(void); > > int fwu_get_active_index(u32 *active_idx); > int fwu_update_active_index(u32 active_idx); > diff --git a/lib/Kconfig b/lib/Kconfig > index 807a4c6ade..7cb306317c 100644 > --- a/lib/Kconfig > +++ b/lib/Kconfig > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > When there are multiple device tree nodes with same name, >enable this config option to distinguish them using > phandles in fdtdec_get_alias_seq() function. > + > +config FWU_MULTI_BANK_UPDATE > + bool "Enable FWU Multi Bank Update Feature" > + depends on EFI_HAVE_CAPSULE_SUPPORT > + select PARTITION_TYPE_GUID > + select EFI_SETUP_EARLY > + help > + Feature for updating firmware images on platforms having > + multiple banks(copies) of the firmware images. One of the > + bank is selected for updating all the firmware components > + > +config FWU_NUM_BANKS > + int "Number of Banks defined by the platform" > + depends on FWU_MULTI_BANK_UPDATE > + help > + Define the number of banks of firmware images on a platform > + > +config FWU_NUM_IMAGES_PER_BANK > + int "Number of firmware images per bank" > + depends on FWU_MULTI_BANK_UPDATE > + help > + Define the number of firmware images per bank. This value > + should be the same for all the banks. > + > +config FWU_TRIAL_STATE_CNT > + int "Number of times system boots in Trial State" > + depends on FWU_MULTI_BANK_UPDATE > + default 3 > + help > + With FWU Multi Bank Update feature enabled, number of times > + the platform is allowed to boot in Trial State after an > + update. > diff --git a/lib/Makefile b/lib/Makefile > index 5ddbc77ed6..bc5c1e22fc 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -9,6 +9,7 @@ obj-$(CONFIG_EFI) += efi/ > obj-$(CONFIG_EFI_LOADER) += efi_driver/ > obj-$(CONFIG_EFI_LOADER) += efi_loader/ > obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ > +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ > obj-$(CONFIG_LZMA) += lzma/ > obj-$(CONFIG_BZIP2) += bzip2/ > obj-$(CONFIG_TIZEN) += tizen/ > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 8301eed631..6dfe56bb0f 100644 > ---
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
On Tue, Dec 21, 2021 at 08:30:02AM +0900, Masami Hiramatsu wrote: > Hi Tom, > > 2021年12月21日(火) 1:36 Tom Rini : > > > > On Mon, Dec 20, 2021 at 10:13:35PM +0900, Masami Hiramatsu wrote: > > > Hi Sughosh, > > > > > > 2021年12月20日(月) 18:48 Sughosh Ganu : > > > > > > > > > > > > On Mon, 20 Dec 2021 at 11:44, AKASHI Takahiro > > > > wrote: > > > >> > > > >> On Sun, Dec 19, 2021 at 12:36:04PM +0530, Sughosh Ganu wrote: > > > >> > The FWU Multi Bank Update feature supports updation of firmware > > > >> > images > > > >> > to one of multiple sets(also called banks) of images. The firmware > > > >> > images are clubbed together in banks, with the system booting images > > > >> > from the active bank. Information on the images such as which bank > > > >> > they belong to is stored as part of the metadata structure, which is > > > >> > stored on the same storage media as the firmware images on a > > > >> > dedicated > > > >> > partition. > > > >> > > > > >> > At the time of update, the metadata is read to identify the bank to > > > >> > which the images need to be flashed(update bank). On a successful > > > >> > update, the metadata is modified to set the updated bank as active > > > >> > bank to subsequently boot from. > > > >> > > > > >> > Signed-off-by: Sughosh Ganu > > > >> > --- > > > >> > Changes since V1: > > > >> > * Call function fwu_update_checks_pass to check if the > > > >> > update can be initiated > > > >> > * Do not allow firmware update from efi_init_obj_list as the > > > >> > fwu boot-time checks need to be run > > > >> > > > > >> > include/fwu.h| 18 +++- > > > >> > lib/Kconfig | 32 ++ > > > >> > lib/Makefile | 1 + > > > >> > lib/efi_loader/efi_capsule.c | 198 > > > >> > ++- > > > >> > lib/efi_loader/efi_setup.c | 3 +- > > > >> > lib/fwu_updates/Makefile | 11 ++ > > > >> > lib/fwu_updates/fwu.c| 27 + > > > >> > 7 files changed, 284 insertions(+), 6 deletions(-) > > > >> > create mode 100644 lib/fwu_updates/Makefile > > > >> > > > > >> > diff --git a/include/fwu.h b/include/fwu.h > > > >> > index 2d2e674d6a..bf50fe9277 100644 > > > >> > --- a/include/fwu.h > > > >> > +++ b/include/fwu.h > > > >> > @@ -10,14 +10,28 @@ > > > >> > > > > >> > #include > > > >> > > > > >> > -#define FWU_MDATA_VERSION0x1 > > > >> > +#define FWU_MDATA_GUID \ > > > >> > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > > >> > + 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > > >> > + > > > >> > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > > > >> > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > > > >> > + 0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > > > >> > + > > > >> > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > > > >> > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > > > >> > + 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > > > >> > > > > >> > #define FWU_MDATA_GUID \ > > > >> > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > > >> >0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > > >> > > > > >> > -int fwu_boottime_checks(void); > > > >> > +#define FWU_MDATA_VERSION0x1 > > > >> > +#define FWU_IMAGE_ACCEPTED 0x1 > > > >> > + > > > >> > u8 fwu_update_checks_pass(void); > > > >> > +int fwu_boottime_checks(void); > > > >> > +int fwu_trial_state_ctr_start(void); > > > >> > > > > >> > int fwu_get_active_index(u32 *active_idx); > > > >> > int fwu_update_active_index(u32 active_idx); > > > >> > diff --git a/lib/Kconfig b/lib/Kconfig > > > >> > index 807a4c6ade..7cb306317c 100644 > > > >> > --- a/lib/Kconfig > > > >> > +++ b/lib/Kconfig > > > >> > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > > > >> > When there are multiple device tree nodes with same name, > > > >> >enable this config option to distinguish them using > > > >> > phandles in fdtdec_get_alias_seq() function. > > > >> > + > > > >> > +config FWU_MULTI_BANK_UPDATE > > > >> > + bool "Enable FWU Multi Bank Update Feature" > > > >> > + depends on EFI_HAVE_CAPSULE_SUPPORT > > > >> > + select PARTITION_TYPE_GUID > > > >> > + select EFI_SETUP_EARLY > > > >> > + help > > > >> > + Feature for updating firmware images on platforms having > > > >> > + multiple banks(copies) of the firmware images. One of the > > > >> > + bank is selected for updating all the firmware components > > > >> > + > > > >> > +config FWU_NUM_BANKS > > > >> > + int "Number of Banks defined by the platform" > > > >> > + depends on FWU_MULTI_BANK_UPDATE > > > >> > + help > > > >> > + Define the number of banks of firmware images on a platform > > > >> > + > > > >> > +config FWU_NUM_IMAGES_PER_BANK > > > >> > + int "Number of firmware images per bank" > > > >> > + depends on FWU_MULTI_BANK_UPDATE > > > >> > + help > > > >> > + Define the number of firmware images per bank. This value > > > >> > +
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
Hi Tom, 2021年12月21日(火) 1:36 Tom Rini : > > On Mon, Dec 20, 2021 at 10:13:35PM +0900, Masami Hiramatsu wrote: > > Hi Sughosh, > > > > 2021年12月20日(月) 18:48 Sughosh Ganu : > > > > > > > > > On Mon, 20 Dec 2021 at 11:44, AKASHI Takahiro > > > wrote: > > >> > > >> On Sun, Dec 19, 2021 at 12:36:04PM +0530, Sughosh Ganu wrote: > > >> > The FWU Multi Bank Update feature supports updation of firmware images > > >> > to one of multiple sets(also called banks) of images. The firmware > > >> > images are clubbed together in banks, with the system booting images > > >> > from the active bank. Information on the images such as which bank > > >> > they belong to is stored as part of the metadata structure, which is > > >> > stored on the same storage media as the firmware images on a dedicated > > >> > partition. > > >> > > > >> > At the time of update, the metadata is read to identify the bank to > > >> > which the images need to be flashed(update bank). On a successful > > >> > update, the metadata is modified to set the updated bank as active > > >> > bank to subsequently boot from. > > >> > > > >> > Signed-off-by: Sughosh Ganu > > >> > --- > > >> > Changes since V1: > > >> > * Call function fwu_update_checks_pass to check if the > > >> > update can be initiated > > >> > * Do not allow firmware update from efi_init_obj_list as the > > >> > fwu boot-time checks need to be run > > >> > > > >> > include/fwu.h| 18 +++- > > >> > lib/Kconfig | 32 ++ > > >> > lib/Makefile | 1 + > > >> > lib/efi_loader/efi_capsule.c | 198 ++- > > >> > lib/efi_loader/efi_setup.c | 3 +- > > >> > lib/fwu_updates/Makefile | 11 ++ > > >> > lib/fwu_updates/fwu.c| 27 + > > >> > 7 files changed, 284 insertions(+), 6 deletions(-) > > >> > create mode 100644 lib/fwu_updates/Makefile > > >> > > > >> > diff --git a/include/fwu.h b/include/fwu.h > > >> > index 2d2e674d6a..bf50fe9277 100644 > > >> > --- a/include/fwu.h > > >> > +++ b/include/fwu.h > > >> > @@ -10,14 +10,28 @@ > > >> > > > >> > #include > > >> > > > >> > -#define FWU_MDATA_VERSION0x1 > > >> > +#define FWU_MDATA_GUID \ > > >> > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > >> > + 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > >> > + > > >> > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > > >> > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > > >> > + 0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > > >> > + > > >> > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > > >> > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > > >> > + 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > > >> > > > >> > #define FWU_MDATA_GUID \ > > >> > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > >> >0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > >> > > > >> > -int fwu_boottime_checks(void); > > >> > +#define FWU_MDATA_VERSION0x1 > > >> > +#define FWU_IMAGE_ACCEPTED 0x1 > > >> > + > > >> > u8 fwu_update_checks_pass(void); > > >> > +int fwu_boottime_checks(void); > > >> > +int fwu_trial_state_ctr_start(void); > > >> > > > >> > int fwu_get_active_index(u32 *active_idx); > > >> > int fwu_update_active_index(u32 active_idx); > > >> > diff --git a/lib/Kconfig b/lib/Kconfig > > >> > index 807a4c6ade..7cb306317c 100644 > > >> > --- a/lib/Kconfig > > >> > +++ b/lib/Kconfig > > >> > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > > >> > When there are multiple device tree nodes with same name, > > >> >enable this config option to distinguish them using > > >> > phandles in fdtdec_get_alias_seq() function. > > >> > + > > >> > +config FWU_MULTI_BANK_UPDATE > > >> > + bool "Enable FWU Multi Bank Update Feature" > > >> > + depends on EFI_HAVE_CAPSULE_SUPPORT > > >> > + select PARTITION_TYPE_GUID > > >> > + select EFI_SETUP_EARLY > > >> > + help > > >> > + Feature for updating firmware images on platforms having > > >> > + multiple banks(copies) of the firmware images. One of the > > >> > + bank is selected for updating all the firmware components > > >> > + > > >> > +config FWU_NUM_BANKS > > >> > + int "Number of Banks defined by the platform" > > >> > + depends on FWU_MULTI_BANK_UPDATE > > >> > + help > > >> > + Define the number of banks of firmware images on a platform > > >> > + > > >> > +config FWU_NUM_IMAGES_PER_BANK > > >> > + int "Number of firmware images per bank" > > >> > + depends on FWU_MULTI_BANK_UPDATE > > >> > + help > > >> > + Define the number of firmware images per bank. This value > > >> > + should be the same for all the banks. > > >> > + > > >> > +config FWU_TRIAL_STATE_CNT > > >> > + int "Number of times system boots in Trial State" > > >> > + depends on FWU_MULTI_BANK_UPDATE > > >> > + default 3 > > >> > + help > > >> > + With FWU Multi Bank Update feature enabled, number of
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
On Mon, Dec 20, 2021 at 10:13:35PM +0900, Masami Hiramatsu wrote: > Hi Sughosh, > > 2021年12月20日(月) 18:48 Sughosh Ganu : > > > > > > On Mon, 20 Dec 2021 at 11:44, AKASHI Takahiro > > wrote: > >> > >> On Sun, Dec 19, 2021 at 12:36:04PM +0530, Sughosh Ganu wrote: > >> > The FWU Multi Bank Update feature supports updation of firmware images > >> > to one of multiple sets(also called banks) of images. The firmware > >> > images are clubbed together in banks, with the system booting images > >> > from the active bank. Information on the images such as which bank > >> > they belong to is stored as part of the metadata structure, which is > >> > stored on the same storage media as the firmware images on a dedicated > >> > partition. > >> > > >> > At the time of update, the metadata is read to identify the bank to > >> > which the images need to be flashed(update bank). On a successful > >> > update, the metadata is modified to set the updated bank as active > >> > bank to subsequently boot from. > >> > > >> > Signed-off-by: Sughosh Ganu > >> > --- > >> > Changes since V1: > >> > * Call function fwu_update_checks_pass to check if the > >> > update can be initiated > >> > * Do not allow firmware update from efi_init_obj_list as the > >> > fwu boot-time checks need to be run > >> > > >> > include/fwu.h| 18 +++- > >> > lib/Kconfig | 32 ++ > >> > lib/Makefile | 1 + > >> > lib/efi_loader/efi_capsule.c | 198 ++- > >> > lib/efi_loader/efi_setup.c | 3 +- > >> > lib/fwu_updates/Makefile | 11 ++ > >> > lib/fwu_updates/fwu.c| 27 + > >> > 7 files changed, 284 insertions(+), 6 deletions(-) > >> > create mode 100644 lib/fwu_updates/Makefile > >> > > >> > diff --git a/include/fwu.h b/include/fwu.h > >> > index 2d2e674d6a..bf50fe9277 100644 > >> > --- a/include/fwu.h > >> > +++ b/include/fwu.h > >> > @@ -10,14 +10,28 @@ > >> > > >> > #include > >> > > >> > -#define FWU_MDATA_VERSION0x1 > >> > +#define FWU_MDATA_GUID \ > >> > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > >> > + 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > >> > + > >> > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > >> > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > >> > + 0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > >> > + > >> > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > >> > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > >> > + 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > >> > > >> > #define FWU_MDATA_GUID \ > >> > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > >> >0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > >> > > >> > -int fwu_boottime_checks(void); > >> > +#define FWU_MDATA_VERSION0x1 > >> > +#define FWU_IMAGE_ACCEPTED 0x1 > >> > + > >> > u8 fwu_update_checks_pass(void); > >> > +int fwu_boottime_checks(void); > >> > +int fwu_trial_state_ctr_start(void); > >> > > >> > int fwu_get_active_index(u32 *active_idx); > >> > int fwu_update_active_index(u32 active_idx); > >> > diff --git a/lib/Kconfig b/lib/Kconfig > >> > index 807a4c6ade..7cb306317c 100644 > >> > --- a/lib/Kconfig > >> > +++ b/lib/Kconfig > >> > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > >> > When there are multiple device tree nodes with same name, > >> >enable this config option to distinguish them using > >> > phandles in fdtdec_get_alias_seq() function. > >> > + > >> > +config FWU_MULTI_BANK_UPDATE > >> > + bool "Enable FWU Multi Bank Update Feature" > >> > + depends on EFI_HAVE_CAPSULE_SUPPORT > >> > + select PARTITION_TYPE_GUID > >> > + select EFI_SETUP_EARLY > >> > + help > >> > + Feature for updating firmware images on platforms having > >> > + multiple banks(copies) of the firmware images. One of the > >> > + bank is selected for updating all the firmware components > >> > + > >> > +config FWU_NUM_BANKS > >> > + int "Number of Banks defined by the platform" > >> > + depends on FWU_MULTI_BANK_UPDATE > >> > + help > >> > + Define the number of banks of firmware images on a platform > >> > + > >> > +config FWU_NUM_IMAGES_PER_BANK > >> > + int "Number of firmware images per bank" > >> > + depends on FWU_MULTI_BANK_UPDATE > >> > + help > >> > + Define the number of firmware images per bank. This value > >> > + should be the same for all the banks. > >> > + > >> > +config FWU_TRIAL_STATE_CNT > >> > + int "Number of times system boots in Trial State" > >> > + depends on FWU_MULTI_BANK_UPDATE > >> > + default 3 > >> > + help > >> > + With FWU Multi Bank Update feature enabled, number of times > >> > + the platform is allowed to boot in Trial State after an > >> > + update. > >> > diff --git a/lib/Makefile b/lib/Makefile > >> > index 5ddbc77ed6..bc5c1e22fc 100644 > >> > --- a/lib/Makefile > >> > +++ b/lib/Makefile > >> > @@ -9,6 +9,7 @@
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
Hi Sughosh, 2021年12月20日(月) 18:48 Sughosh Ganu : > > > On Mon, 20 Dec 2021 at 11:44, AKASHI Takahiro > wrote: >> >> On Sun, Dec 19, 2021 at 12:36:04PM +0530, Sughosh Ganu wrote: >> > The FWU Multi Bank Update feature supports updation of firmware images >> > to one of multiple sets(also called banks) of images. The firmware >> > images are clubbed together in banks, with the system booting images >> > from the active bank. Information on the images such as which bank >> > they belong to is stored as part of the metadata structure, which is >> > stored on the same storage media as the firmware images on a dedicated >> > partition. >> > >> > At the time of update, the metadata is read to identify the bank to >> > which the images need to be flashed(update bank). On a successful >> > update, the metadata is modified to set the updated bank as active >> > bank to subsequently boot from. >> > >> > Signed-off-by: Sughosh Ganu >> > --- >> > Changes since V1: >> > * Call function fwu_update_checks_pass to check if the >> > update can be initiated >> > * Do not allow firmware update from efi_init_obj_list as the >> > fwu boot-time checks need to be run >> > >> > include/fwu.h| 18 +++- >> > lib/Kconfig | 32 ++ >> > lib/Makefile | 1 + >> > lib/efi_loader/efi_capsule.c | 198 ++- >> > lib/efi_loader/efi_setup.c | 3 +- >> > lib/fwu_updates/Makefile | 11 ++ >> > lib/fwu_updates/fwu.c| 27 + >> > 7 files changed, 284 insertions(+), 6 deletions(-) >> > create mode 100644 lib/fwu_updates/Makefile >> > >> > diff --git a/include/fwu.h b/include/fwu.h >> > index 2d2e674d6a..bf50fe9277 100644 >> > --- a/include/fwu.h >> > +++ b/include/fwu.h >> > @@ -10,14 +10,28 @@ >> > >> > #include >> > >> > -#define FWU_MDATA_VERSION0x1 >> > +#define FWU_MDATA_GUID \ >> > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ >> > + 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) >> > + >> > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ >> > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ >> > + 0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) >> > + >> > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ >> > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ >> > + 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) >> > >> > #define FWU_MDATA_GUID \ >> > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ >> >0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) >> > >> > -int fwu_boottime_checks(void); >> > +#define FWU_MDATA_VERSION0x1 >> > +#define FWU_IMAGE_ACCEPTED 0x1 >> > + >> > u8 fwu_update_checks_pass(void); >> > +int fwu_boottime_checks(void); >> > +int fwu_trial_state_ctr_start(void); >> > >> > int fwu_get_active_index(u32 *active_idx); >> > int fwu_update_active_index(u32 active_idx); >> > diff --git a/lib/Kconfig b/lib/Kconfig >> > index 807a4c6ade..7cb306317c 100644 >> > --- a/lib/Kconfig >> > +++ b/lib/Kconfig >> > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ >> > When there are multiple device tree nodes with same name, >> >enable this config option to distinguish them using >> > phandles in fdtdec_get_alias_seq() function. >> > + >> > +config FWU_MULTI_BANK_UPDATE >> > + bool "Enable FWU Multi Bank Update Feature" >> > + depends on EFI_HAVE_CAPSULE_SUPPORT >> > + select PARTITION_TYPE_GUID >> > + select EFI_SETUP_EARLY >> > + help >> > + Feature for updating firmware images on platforms having >> > + multiple banks(copies) of the firmware images. One of the >> > + bank is selected for updating all the firmware components >> > + >> > +config FWU_NUM_BANKS >> > + int "Number of Banks defined by the platform" >> > + depends on FWU_MULTI_BANK_UPDATE >> > + help >> > + Define the number of banks of firmware images on a platform >> > + >> > +config FWU_NUM_IMAGES_PER_BANK >> > + int "Number of firmware images per bank" >> > + depends on FWU_MULTI_BANK_UPDATE >> > + help >> > + Define the number of firmware images per bank. This value >> > + should be the same for all the banks. >> > + >> > +config FWU_TRIAL_STATE_CNT >> > + int "Number of times system boots in Trial State" >> > + depends on FWU_MULTI_BANK_UPDATE >> > + default 3 >> > + help >> > + With FWU Multi Bank Update feature enabled, number of times >> > + the platform is allowed to boot in Trial State after an >> > + update. >> > diff --git a/lib/Makefile b/lib/Makefile >> > index 5ddbc77ed6..bc5c1e22fc 100644 >> > --- a/lib/Makefile >> > +++ b/lib/Makefile >> > @@ -9,6 +9,7 @@ obj-$(CONFIG_EFI) += efi/ >> > obj-$(CONFIG_EFI_LOADER) += efi_driver/ >> > obj-$(CONFIG_EFI_LOADER) += efi_loader/ >> > obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ >> > +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ >> > obj-$(CONFIG_LZMA) += lzma/ >> > obj-$(CONFIG_BZIP2) += bzip2/ >> >
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
On Mon, 20 Dec 2021 at 11:44, AKASHI Takahiro wrote: > On Sun, Dec 19, 2021 at 12:36:04PM +0530, Sughosh Ganu wrote: > > The FWU Multi Bank Update feature supports updation of firmware images > > to one of multiple sets(also called banks) of images. The firmware > > images are clubbed together in banks, with the system booting images > > from the active bank. Information on the images such as which bank > > they belong to is stored as part of the metadata structure, which is > > stored on the same storage media as the firmware images on a dedicated > > partition. > > > > At the time of update, the metadata is read to identify the bank to > > which the images need to be flashed(update bank). On a successful > > update, the metadata is modified to set the updated bank as active > > bank to subsequently boot from. > > > > Signed-off-by: Sughosh Ganu > > --- > > Changes since V1: > > * Call function fwu_update_checks_pass to check if the > > update can be initiated > > * Do not allow firmware update from efi_init_obj_list as the > > fwu boot-time checks need to be run > > > > include/fwu.h| 18 +++- > > lib/Kconfig | 32 ++ > > lib/Makefile | 1 + > > lib/efi_loader/efi_capsule.c | 198 ++- > > lib/efi_loader/efi_setup.c | 3 +- > > lib/fwu_updates/Makefile | 11 ++ > > lib/fwu_updates/fwu.c| 27 + > > 7 files changed, 284 insertions(+), 6 deletions(-) > > create mode 100644 lib/fwu_updates/Makefile > > > > diff --git a/include/fwu.h b/include/fwu.h > > index 2d2e674d6a..bf50fe9277 100644 > > --- a/include/fwu.h > > +++ b/include/fwu.h > > @@ -10,14 +10,28 @@ > > > > #include > > > > -#define FWU_MDATA_VERSION0x1 > > +#define FWU_MDATA_GUID \ > > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > > + 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > + > > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > > + 0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > > + > > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > > + 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > > > > #define FWU_MDATA_GUID \ > > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > >0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > > > -int fwu_boottime_checks(void); > > +#define FWU_MDATA_VERSION0x1 > > +#define FWU_IMAGE_ACCEPTED 0x1 > > + > > u8 fwu_update_checks_pass(void); > > +int fwu_boottime_checks(void); > > +int fwu_trial_state_ctr_start(void); > > > > int fwu_get_active_index(u32 *active_idx); > > int fwu_update_active_index(u32 active_idx); > > diff --git a/lib/Kconfig b/lib/Kconfig > > index 807a4c6ade..7cb306317c 100644 > > --- a/lib/Kconfig > > +++ b/lib/Kconfig > > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > > When there are multiple device tree nodes with same name, > >enable this config option to distinguish them using > > phandles in fdtdec_get_alias_seq() function. > > + > > +config FWU_MULTI_BANK_UPDATE > > + bool "Enable FWU Multi Bank Update Feature" > > + depends on EFI_HAVE_CAPSULE_SUPPORT > > + select PARTITION_TYPE_GUID > > + select EFI_SETUP_EARLY > > + help > > + Feature for updating firmware images on platforms having > > + multiple banks(copies) of the firmware images. One of the > > + bank is selected for updating all the firmware components > > + > > +config FWU_NUM_BANKS > > + int "Number of Banks defined by the platform" > > + depends on FWU_MULTI_BANK_UPDATE > > + help > > + Define the number of banks of firmware images on a platform > > + > > +config FWU_NUM_IMAGES_PER_BANK > > + int "Number of firmware images per bank" > > + depends on FWU_MULTI_BANK_UPDATE > > + help > > + Define the number of firmware images per bank. This value > > + should be the same for all the banks. > > + > > +config FWU_TRIAL_STATE_CNT > > + int "Number of times system boots in Trial State" > > + depends on FWU_MULTI_BANK_UPDATE > > + default 3 > > + help > > + With FWU Multi Bank Update feature enabled, number of times > > + the platform is allowed to boot in Trial State after an > > + update. > > diff --git a/lib/Makefile b/lib/Makefile > > index 5ddbc77ed6..bc5c1e22fc 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -9,6 +9,7 @@ obj-$(CONFIG_EFI) += efi/ > > obj-$(CONFIG_EFI_LOADER) += efi_driver/ > > obj-$(CONFIG_EFI_LOADER) += efi_loader/ > > obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ > > +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ > > obj-$(CONFIG_LZMA) += lzma/ > > obj-$(CONFIG_BZIP2) += bzip2/ > > obj-$(CONFIG_TIZEN) += tizen/ > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > > index 8301eed631..6dfe56bb0f 100644 > > ---
Re: [RFC PATCH v2 7/8] FWU: Add support for FWU Multi Bank Update feature
On Sun, Dec 19, 2021 at 12:36:04PM +0530, Sughosh Ganu wrote: > The FWU Multi Bank Update feature supports updation of firmware images > to one of multiple sets(also called banks) of images. The firmware > images are clubbed together in banks, with the system booting images > from the active bank. Information on the images such as which bank > they belong to is stored as part of the metadata structure, which is > stored on the same storage media as the firmware images on a dedicated > partition. > > At the time of update, the metadata is read to identify the bank to > which the images need to be flashed(update bank). On a successful > update, the metadata is modified to set the updated bank as active > bank to subsequently boot from. > > Signed-off-by: Sughosh Ganu > --- > Changes since V1: > * Call function fwu_update_checks_pass to check if the > update can be initiated > * Do not allow firmware update from efi_init_obj_list as the > fwu boot-time checks need to be run > > include/fwu.h| 18 +++- > lib/Kconfig | 32 ++ > lib/Makefile | 1 + > lib/efi_loader/efi_capsule.c | 198 ++- > lib/efi_loader/efi_setup.c | 3 +- > lib/fwu_updates/Makefile | 11 ++ > lib/fwu_updates/fwu.c| 27 + > 7 files changed, 284 insertions(+), 6 deletions(-) > create mode 100644 lib/fwu_updates/Makefile > > diff --git a/include/fwu.h b/include/fwu.h > index 2d2e674d6a..bf50fe9277 100644 > --- a/include/fwu.h > +++ b/include/fwu.h > @@ -10,14 +10,28 @@ > > #include > > -#define FWU_MDATA_VERSION0x1 > +#define FWU_MDATA_GUID \ > + EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ > + 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > + > +#define FWU_OS_REQUEST_FW_REVERT_GUID \ > + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ > + 0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) > + > +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ > + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ > + 0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) > > #define FWU_MDATA_GUID \ > EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ >0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) > > -int fwu_boottime_checks(void); > +#define FWU_MDATA_VERSION0x1 > +#define FWU_IMAGE_ACCEPTED 0x1 > + > u8 fwu_update_checks_pass(void); > +int fwu_boottime_checks(void); > +int fwu_trial_state_ctr_start(void); > > int fwu_get_active_index(u32 *active_idx); > int fwu_update_active_index(u32 active_idx); > diff --git a/lib/Kconfig b/lib/Kconfig > index 807a4c6ade..7cb306317c 100644 > --- a/lib/Kconfig > +++ b/lib/Kconfig > @@ -835,3 +835,35 @@ config PHANDLE_CHECK_SEQ > When there are multiple device tree nodes with same name, >enable this config option to distinguish them using > phandles in fdtdec_get_alias_seq() function. > + > +config FWU_MULTI_BANK_UPDATE > + bool "Enable FWU Multi Bank Update Feature" > + depends on EFI_HAVE_CAPSULE_SUPPORT > + select PARTITION_TYPE_GUID > + select EFI_SETUP_EARLY > + help > + Feature for updating firmware images on platforms having > + multiple banks(copies) of the firmware images. One of the > + bank is selected for updating all the firmware components > + > +config FWU_NUM_BANKS > + int "Number of Banks defined by the platform" > + depends on FWU_MULTI_BANK_UPDATE > + help > + Define the number of banks of firmware images on a platform > + > +config FWU_NUM_IMAGES_PER_BANK > + int "Number of firmware images per bank" > + depends on FWU_MULTI_BANK_UPDATE > + help > + Define the number of firmware images per bank. This value > + should be the same for all the banks. > + > +config FWU_TRIAL_STATE_CNT > + int "Number of times system boots in Trial State" > + depends on FWU_MULTI_BANK_UPDATE > + default 3 > + help > + With FWU Multi Bank Update feature enabled, number of times > + the platform is allowed to boot in Trial State after an > + update. > diff --git a/lib/Makefile b/lib/Makefile > index 5ddbc77ed6..bc5c1e22fc 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -9,6 +9,7 @@ obj-$(CONFIG_EFI) += efi/ > obj-$(CONFIG_EFI_LOADER) += efi_driver/ > obj-$(CONFIG_EFI_LOADER) += efi_loader/ > obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ > +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ > obj-$(CONFIG_LZMA) += lzma/ > obj-$(CONFIG_BZIP2) += bzip2/ > obj-$(CONFIG_TIZEN) += tizen/ > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 8301eed631..6dfe56bb0f 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -30,6 +31,13 @@ static const efi_guid_t > efi_guid_firmware_management_capsule_id = >