Re: [PATCH v8 05/13] stm32mp1: dk2: Add image information for capsule updates

2022-08-18 Thread Yann Gautier

On 8/18/22 14:06, Sughosh Ganu wrote:

hi Yann,

On Thu, 18 Aug 2022 at 13:35, Yann Gautier  wrote:


On 8/17/22 14:43, Sughosh Ganu wrote:

Enabling capsule update functionality on the platform requires
populating information on the images that are to be updated using the
functionality. Do so for the DK2 board.

Signed-off-by: Sughosh Ganu 
Reviewed-by: Patrick Delaunay 
Reviewed-by: Ilias Apalodimas 
---
Changes since V7: None

   board/st/stm32mp1/stm32mp1.c   | 23 +++
   include/configs/stm32mp15_common.h |  4 
   2 files changed, 27 insertions(+)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 9496890d16..0fda8f150d 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -11,6 +11,7 @@
   #include 
   #include 
   #include 
+#include 
   #include 
   #include 
   #include 
@@ -87,6 +88,16 @@
   #define USB_START_LOW_THRESHOLD_UV  123
   #define USB_START_HIGH_THRESHOLD_UV 215

+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[1];
+
+struct efi_capsule_update_info update_info = {
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
   int board_early_init_f(void)
   {
   /* nothing to do, only used in SPL */
@@ -670,6 +681,18 @@ int board_init(void)

   setup_led(LEDST_ON);

+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+ if (board_is_stm32mp15x_dk2()) {
+ efi_guid_t image_type_guid = STM32MP15_DK2_FIP_IMAGE_GUID;
+ guidcpy(_images[0].image_type_id, _type_guid);
+ fw_images[0].fw_name = u"STM32MP15-DK2-FIP";
+ /*
+  * For FWU multi bank update, the image
+  * index will be computed at runtime
+  */
+ fw_images[0].image_index = 0;
+ }
+#endif
   return 0;
   }

diff --git a/include/configs/stm32mp15_common.h 
b/include/configs/stm32mp15_common.h
index c5412ffeb3..6ab10d8ce5 100644
--- a/include/configs/stm32mp15_common.h
+++ b/include/configs/stm32mp15_common.h
@@ -34,6 +34,10 @@
   #define CONFIG_SERVERIP 192.168.1.1
   #endif



Hi Sugosh,

Sorry for the late review.


+#define STM32MP15_DK2_FIP_IMAGE_GUID \

Although this is now only supported on this STM32MP15_DK2 board, I don't
think this macro should be tight to the board name, as it may be used
for other STM32MP boards. I'd just use STM32MP_FIP_IMAGE_GUID.
This should be the same for the fw_images[0].fw_name.


The idea of this GUID is to identify or associate an image with a
platform. Will the FIP image be common across multiple STM32MP
platforms? If we use a common GUID that might be shared across
multiple ST boards, it would be possible to flash an image generated
for the ev1 board on the dk2 board. However, you would know better
about ST platforms. So I can change this as per your suggestion.
Thanks.

-sughosh



Hi Sughosh,

This GUID is generic in TF-A for all STM32MP platforms.
Having a per board GUID in U-Boot might then be an issue.
And we'll end up with lots of GUIDs for each new board that will support 
FWU.

But maybe I miss something here.


Yann




Best regards,
Yann


+ EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
+  0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
+
   
/*/
   #ifdef CONFIG_DISTRO_DEFAULTS
   
/*/






Re: [PATCH v8 05/13] stm32mp1: dk2: Add image information for capsule updates

2022-08-18 Thread Sughosh Ganu
hi Yann,

On Thu, 18 Aug 2022 at 13:35, Yann Gautier  wrote:
>
> On 8/17/22 14:43, Sughosh Ganu wrote:
> > Enabling capsule update functionality on the platform requires
> > populating information on the images that are to be updated using the
> > functionality. Do so for the DK2 board.
> >
> > Signed-off-by: Sughosh Ganu 
> > Reviewed-by: Patrick Delaunay 
> > Reviewed-by: Ilias Apalodimas 
> > ---
> > Changes since V7: None
> >
> >   board/st/stm32mp1/stm32mp1.c   | 23 +++
> >   include/configs/stm32mp15_common.h |  4 
> >   2 files changed, 27 insertions(+)
> >
> > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> > index 9496890d16..0fda8f150d 100644
> > --- a/board/st/stm32mp1/stm32mp1.c
> > +++ b/board/st/stm32mp1/stm32mp1.c
> > @@ -11,6 +11,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   #include 
> >   #include 
> >   #include 
> > @@ -87,6 +88,16 @@
> >   #define USB_START_LOW_THRESHOLD_UV  123
> >   #define USB_START_HIGH_THRESHOLD_UV 215
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_image fw_images[1];
> > +
> > +struct efi_capsule_update_info update_info = {
> > + .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   int board_early_init_f(void)
> >   {
> >   /* nothing to do, only used in SPL */
> > @@ -670,6 +681,18 @@ int board_init(void)
> >
> >   setup_led(LEDST_ON);
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > + if (board_is_stm32mp15x_dk2()) {
> > + efi_guid_t image_type_guid = STM32MP15_DK2_FIP_IMAGE_GUID;
> > + guidcpy(_images[0].image_type_id, _type_guid);
> > + fw_images[0].fw_name = u"STM32MP15-DK2-FIP";
> > + /*
> > +  * For FWU multi bank update, the image
> > +  * index will be computed at runtime
> > +  */
> > + fw_images[0].image_index = 0;
> > + }
> > +#endif
> >   return 0;
> >   }
> >
> > diff --git a/include/configs/stm32mp15_common.h 
> > b/include/configs/stm32mp15_common.h
> > index c5412ffeb3..6ab10d8ce5 100644
> > --- a/include/configs/stm32mp15_common.h
> > +++ b/include/configs/stm32mp15_common.h
> > @@ -34,6 +34,10 @@
> >   #define CONFIG_SERVERIP 192.168.1.1
> >   #endif
> >
>
> Hi Sugosh,
>
> Sorry for the late review.
>
> > +#define STM32MP15_DK2_FIP_IMAGE_GUID \
> Although this is now only supported on this STM32MP15_DK2 board, I don't
> think this macro should be tight to the board name, as it may be used
> for other STM32MP boards. I'd just use STM32MP_FIP_IMAGE_GUID.
> This should be the same for the fw_images[0].fw_name.

The idea of this GUID is to identify or associate an image with a
platform. Will the FIP image be common across multiple STM32MP
platforms? If we use a common GUID that might be shared across
multiple ST boards, it would be possible to flash an image generated
for the ev1 board on the dk2 board. However, you would know better
about ST platforms. So I can change this as per your suggestion.
Thanks.

-sughosh

>
>
> Best regards,
> Yann
>
> > + EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
> > +  0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
> > +
> >   
> > /*/
> >   #ifdef CONFIG_DISTRO_DEFAULTS
> >   
> > /*/
>


Re: [PATCH v8 05/13] stm32mp1: dk2: Add image information for capsule updates

2022-08-18 Thread Yann Gautier

On 8/17/22 14:43, Sughosh Ganu wrote:

Enabling capsule update functionality on the platform requires
populating information on the images that are to be updated using the
functionality. Do so for the DK2 board.

Signed-off-by: Sughosh Ganu 
Reviewed-by: Patrick Delaunay 
Reviewed-by: Ilias Apalodimas 
---
Changes since V7: None

  board/st/stm32mp1/stm32mp1.c   | 23 +++
  include/configs/stm32mp15_common.h |  4 
  2 files changed, 27 insertions(+)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 9496890d16..0fda8f150d 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -11,6 +11,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -87,6 +88,16 @@
  #define USB_START_LOW_THRESHOLD_UV123
  #define USB_START_HIGH_THRESHOLD_UV   215
  
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)

+struct efi_fw_image fw_images[1];
+
+struct efi_capsule_update_info update_info = {
+   .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
  int board_early_init_f(void)
  {
/* nothing to do, only used in SPL */
@@ -670,6 +681,18 @@ int board_init(void)
  
  	setup_led(LEDST_ON);
  
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)

+   if (board_is_stm32mp15x_dk2()) {
+   efi_guid_t image_type_guid = STM32MP15_DK2_FIP_IMAGE_GUID;
+   guidcpy(_images[0].image_type_id, _type_guid);
+   fw_images[0].fw_name = u"STM32MP15-DK2-FIP";
+   /*
+* For FWU multi bank update, the image
+* index will be computed at runtime
+*/
+   fw_images[0].image_index = 0;
+   }
+#endif
return 0;
  }
  
diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h

index c5412ffeb3..6ab10d8ce5 100644
--- a/include/configs/stm32mp15_common.h
+++ b/include/configs/stm32mp15_common.h
@@ -34,6 +34,10 @@
  #define CONFIG_SERVERIP 192.168.1.1
  #endif
  


Hi Sugosh,

Sorry for the late review.


+#define STM32MP15_DK2_FIP_IMAGE_GUID \
Although this is now only supported on this STM32MP15_DK2 board, I don't 
think this macro should be tight to the board name, as it may be used 
for other STM32MP boards. I'd just use STM32MP_FIP_IMAGE_GUID.

This should be the same for the fw_images[0].fw_name.


Best regards,
Yann


+   EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
+0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
+
  
/*/
  #ifdef CONFIG_DISTRO_DEFAULTS
  
/*/




[PATCH v8 05/13] stm32mp1: dk2: Add image information for capsule updates

2022-08-17 Thread Sughosh Ganu
Enabling capsule update functionality on the platform requires
populating information on the images that are to be updated using the
functionality. Do so for the DK2 board.

Signed-off-by: Sughosh Ganu 
Reviewed-by: Patrick Delaunay 
Reviewed-by: Ilias Apalodimas 
---
Changes since V7: None

 board/st/stm32mp1/stm32mp1.c   | 23 +++
 include/configs/stm32mp15_common.h |  4 
 2 files changed, 27 insertions(+)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 9496890d16..0fda8f150d 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,6 +88,16 @@
 #define USB_START_LOW_THRESHOLD_UV 123
 #define USB_START_HIGH_THRESHOLD_UV215
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[1];
+
+struct efi_capsule_update_info update_info = {
+   .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_early_init_f(void)
 {
/* nothing to do, only used in SPL */
@@ -670,6 +681,18 @@ int board_init(void)
 
setup_led(LEDST_ON);
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+   if (board_is_stm32mp15x_dk2()) {
+   efi_guid_t image_type_guid = STM32MP15_DK2_FIP_IMAGE_GUID;
+   guidcpy(_images[0].image_type_id, _type_guid);
+   fw_images[0].fw_name = u"STM32MP15-DK2-FIP";
+   /*
+* For FWU multi bank update, the image
+* index will be computed at runtime
+*/
+   fw_images[0].image_index = 0;
+   }
+#endif
return 0;
 }
 
diff --git a/include/configs/stm32mp15_common.h 
b/include/configs/stm32mp15_common.h
index c5412ffeb3..6ab10d8ce5 100644
--- a/include/configs/stm32mp15_common.h
+++ b/include/configs/stm32mp15_common.h
@@ -34,6 +34,10 @@
 #define CONFIG_SERVERIP 192.168.1.1
 #endif
 
+#define STM32MP15_DK2_FIP_IMAGE_GUID \
+   EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
+0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
+
 /*/
 #ifdef CONFIG_DISTRO_DEFAULTS
 /*/
-- 
2.34.1