On Wed, 4 Sept 2024 at 13:45, Michal Simek <michal.si...@amd.com> wrote:
>
>
>
> On 8/30/24 13:40, Sughosh Ganu wrote:
> >
> > The following set of patches are miscellaneous fixes and some
> > hardening of the FWU update logic.
> >
> > Sughosh Ganu (6):
> >    fwu: v2: perform some checks before reading metadata
> >    fwu: v2: try reading both copies of metadata
> >    fwu: v1: do a version check for the metadata
> >    fwu: check all images for transitioning out of Trial State
> >    fwu: add dependency checks for selecting FWU metadata version
> >    fwu: do not allow capsule processing on exceeding Trial Counter
> >      threshold
> >
> >   include/fwu.h            | 11 ++++++
> >   lib/fwu_updates/Kconfig  |  1 +
> >   lib/fwu_updates/fwu.c    | 31 +++++++++++++++-
> >   lib/fwu_updates/fwu_v1.c | 18 +++++++--
> >   lib/fwu_updates/fwu_v2.c | 80 ++++++++++++++++++++++------------------
> >   5 files changed, 99 insertions(+), 42 deletions(-)
> >
>
> I think there is still issue with returning values.
> Take a look at my log. I am in trial state - I accepted both images already
> that's why fwu has everything accepted. But I can still apply empty capsules
> which are passing.
> 1. if they are accepted status should be reflected and visible via fwu
> 2. if they are not accepted error from command should be returned.

The code currently, does not behave incorrectly, but we can indeed
return an error status if the empty capsule checks fail, like is done
for normal capsules. I will add this change in the next version.
Thanks.

-sughosh

>
> Thanks,
> Michal
>
> ZynqMP> fwu
>         FWU Metadata
> crc32: 0x12fd554e
> version: 0x2
> size: 0xda
> active_index: 0x0
> previous_active_index: 0x1
> bank_state[0]: 0xfc
> bank_state[1]: 0xfc
> bank_state[2]: 0xff
> bank_state[3]: 0xff
>         Image Info
>
> Image Type Guid: DE6066E8-0256-4FAD-8238-E406E274C4CF
> Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
> Image Guid:  F64A0548-2CCE-ED11-8F66-7BC4531CFE6B
> Image Acceptance: yes
> Image Guid:  3E9C814B-2CCE-ED11-BEC8-23DE4C6D2CF2
> Image Acceptance: yes
>
> Image Type Guid: CF9ECFD4-938B-41C5-8551-1F883AB7DC18
> Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
> Image Guid:  52DA04FB-9D0E-EE11-A57F-637805837C3F
> Image Acceptance: yes
> Image Guid:  46926007-9E0E-EE11-A23A-A38980B779A1
> Image Acceptance: yes
> Custom fields covered by CRC 0x12
> CUSTOM 00000000: 31 32 33 34 35 36 37 38 64 65 61 64 62 65 65 66  
> 12345678deadbeef
> CUSTOM 00000010: 0a 0b                                            ..
> 0xffd80050 = 0xb002c001
> 0xffd80054 = 0xb0020ff0
> 0xffd80058 = 0x1d000048
> 0xffd8005c = 0x0
> ZynqMP>   tftpboot 0x100000 192.168.0.105:capsule1-revert.bin && efidebug
> capsule update -v 0x100000
> Set rate id 48/125000000
> Using ethernet@ff0e0000 device
> TFTP from server 192.168.0.105; our IP address is 192.168.0.155
> Filename 'capsule1-revert.bin'.
> Load address: 0x100000
> Loading: #
>          3.9 KiB/s
> done
> Bytes transferred = 28 (1c hex)
> Capsule guid: acd58b4b-c0e8-475f-99b5-6b3f7e07aaf0
> Capsule flags: 0x0
> Capsule header size: 0x1c
> Capsule image size: 0x1c
> ZynqMP> echo $?
> 0
> ZynqMP> fwu
>         FWU Metadata
> crc32: 0x4aef4913
> version: 0x2
> size: 0xda
> active_index: 0x1
> previous_active_index: 0x0
> bank_state[0]: 0xfc
> bank_state[1]: 0xfc
> bank_state[2]: 0xff
> bank_state[3]: 0xff
>         Image Info
>
> Image Type Guid: DE6066E8-0256-4FAD-8238-E406E274C4CF
> Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
> Image Guid:  F64A0548-2CCE-ED11-8F66-7BC4531CFE6B
> Image Acceptance: yes
> Image Guid:  3E9C814B-2CCE-ED11-BEC8-23DE4C6D2CF2
> Image Acceptance: yes
>
> Image Type Guid: CF9ECFD4-938B-41C5-8551-1F883AB7DC18
> Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
> Image Guid:  52DA04FB-9D0E-EE11-A57F-637805837C3F
> Image Acceptance: yes
> Image Guid:  46926007-9E0E-EE11-A23A-A38980B779A1
> Image Acceptance: yes
> Custom fields covered by CRC 0x12
> CUSTOM 00000000: 31 32 33 34 35 36 37 38 64 65 61 64 62 65 65 66  
> 12345678deadbeef
> CUSTOM 00000010: 0a 0b                                            ..
> 0xffd80050 = 0xb002c001
> 0xffd80054 = 0xb0020ff0
> 0xffd80058 = 0x1d000048
> 0xffd8005c = 0x0
> ZynqMP>   tftpboot 0x100000 192.168.0.105:capsule2-accept.bin && efidebug
> capsule update -v 0x100000
> Set rate id 48/125000000
> Using ethernet@ff0e0000 device
> TFTP from server 192.168.0.105; our IP address is 192.168.0.155
> Filename 'capsule2-accept.bin'.
> Load address: 0x100000
> Loading: #
>          5.9 KiB/s
> done
> Bytes transferred = 44 (2c hex)
> Capsule guid: 0c996046-bcc0-4d04-85ec-e1fcedf1c6f8
> Capsule flags: 0x0
> Capsule header size: 0x1c
> Capsule image size: 0x2c
> ZynqMP> echo $?
> 0
> ZynqMP> fwu
>         FWU Metadata
> crc32: 0x4aef4913
> version: 0x2
> size: 0xda
> active_index: 0x1
> previous_active_index: 0x0
> bank_state[0]: 0xfc
> bank_state[1]: 0xfc
> bank_state[2]: 0xff
> bank_state[3]: 0xff
>         Image Info
>
> Image Type Guid: DE6066E8-0256-4FAD-8238-E406E274C4CF
> Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
> Image Guid:  F64A0548-2CCE-ED11-8F66-7BC4531CFE6B
> Image Acceptance: yes
> Image Guid:  3E9C814B-2CCE-ED11-BEC8-23DE4C6D2CF2
> Image Acceptance: yes
>
> Image Type Guid: CF9ECFD4-938B-41C5-8551-1F883AB7DC18
> Location Guid: D7CE8A58-CE2C-11ED-81CD-D324E93AC223
> Image Guid:  52DA04FB-9D0E-EE11-A57F-637805837C3F
> Image Acceptance: yes
> Image Guid:  46926007-9E0E-EE11-A23A-A38980B779A1
> Image Acceptance: yes
> Custom fields covered by CRC 0x12
> CUSTOM 00000000: 31 32 33 34 35 36 37 38 64 65 61 64 62 65 65 66  
> 12345678deadbeef
> CUSTOM 00000010: 0a 0b                                            ..
> 0xffd80050 = 0xb002c001
> 0xffd80054 = 0xb0020ff0
> 0xffd80058 = 0x1d000048
> 0xffd8005c = 0x0
> ZynqMP>
>

Reply via email to