Re: [PATCH v2 12/18] bloblist: Reduce bloblist header size

2023-12-04 Thread Simon Glass
Hi,

On Mon, 4 Dec 2023 at 01:39, Ilias Apalodimas
 wrote:
>
> Ah I guess this fixes my concerns on patch #6
>
> On Mon, 27 Nov 2023 at 21:53, Raymond Mao  wrote:
> >
> > From: Simon Glass 
> >
> > The v0.9 spec provides for a 16-byte header with fewer fields. Update
> > the implementation to match this.
> >
> > This also adds an alignment field.
> >
> > Signed-off-by: Simon Glass 
> > Signed-off-by: Raymond Mao 
> > ---
> >  include/bloblist.h | 26 +-
> >  test/bloblist.c|  6 +++---
> >  2 files changed, 16 insertions(+), 16 deletions(-)
>
>
>
>
> >
> > diff --git a/include/bloblist.h b/include/bloblist.h
> > index 745bcdd227..57625ea004 100644
> > --- a/include/bloblist.h
> > +++ b/include/bloblist.h
> > @@ -164,30 +164,30 @@ enum bloblist_tag_t {
> >   * from the last.
> >   *
> >   * @magic: BLOBLIST_MAGIC
> > + * @chksum: checksum for the entire bloblist allocated area. Since any of 
> > the
> > + * blobs can be altered after being created, this checksum is only 
> > valid
> > + * when the bloblist is finalised before jumping to the next stage of 
> > boot.
> > + * This is the value needed to make all chechksummed bytes sum to 0
>
> typos checksummed and finalized

finalised is correct

>
> [...]
>
> With the typos fixed
>
> Reviewed-by: Ilias Apalodimas 

REgards,
Simon


Re: [PATCH v2 12/18] bloblist: Reduce bloblist header size

2023-12-04 Thread Ilias Apalodimas
Ah I guess this fixes my concerns on patch #6

On Mon, 27 Nov 2023 at 21:53, Raymond Mao  wrote:
>
> From: Simon Glass 
>
> The v0.9 spec provides for a 16-byte header with fewer fields. Update
> the implementation to match this.
>
> This also adds an alignment field.
>
> Signed-off-by: Simon Glass 
> Signed-off-by: Raymond Mao 
> ---
>  include/bloblist.h | 26 +-
>  test/bloblist.c|  6 +++---
>  2 files changed, 16 insertions(+), 16 deletions(-)




>
> diff --git a/include/bloblist.h b/include/bloblist.h
> index 745bcdd227..57625ea004 100644
> --- a/include/bloblist.h
> +++ b/include/bloblist.h
> @@ -164,30 +164,30 @@ enum bloblist_tag_t {
>   * from the last.
>   *
>   * @magic: BLOBLIST_MAGIC
> + * @chksum: checksum for the entire bloblist allocated area. Since any of the
> + * blobs can be altered after being created, this checksum is only valid
> + * when the bloblist is finalised before jumping to the next stage of 
> boot.
> + * This is the value needed to make all chechksummed bytes sum to 0

typos checksummed and finalized

[...]

With the typos fixed

Reviewed-by: Ilias Apalodimas 


Re: [PATCH v2 12/18] bloblist: Reduce bloblist header size

2023-12-02 Thread Simon Glass
On Mon, 27 Nov 2023 at 12:53, Raymond Mao  wrote:
>
> From: Simon Glass 
>
> The v0.9 spec provides for a 16-byte header with fewer fields. Update
> the implementation to match this.
>
> This also adds an alignment field.
>
> Signed-off-by: Simon Glass 
> Signed-off-by: Raymond Mao 
> ---
>  include/bloblist.h | 26 +-
>  test/bloblist.c|  6 +++---
>  2 files changed, 16 insertions(+), 16 deletions(-)

Reviewed-by: Simon Glass 

Sadly this will need a later patch to deal with [1]


[1] 
https://github.com/FirmwareHandoff/firmware_handoff/pull/17/commits/331822f1985d70a7903f422789eab03f24355cfb


[PATCH v2 12/18] bloblist: Reduce bloblist header size

2023-11-27 Thread Raymond Mao
From: Simon Glass 

The v0.9 spec provides for a 16-byte header with fewer fields. Update
the implementation to match this.

This also adds an alignment field.

Signed-off-by: Simon Glass 
Signed-off-by: Raymond Mao 
---
 include/bloblist.h | 26 +-
 test/bloblist.c|  6 +++---
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/bloblist.h b/include/bloblist.h
index 745bcdd227..57625ea004 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -164,30 +164,30 @@ enum bloblist_tag_t {
  * from the last.
  *
  * @magic: BLOBLIST_MAGIC
+ * @chksum: checksum for the entire bloblist allocated area. Since any of the
+ * blobs can be altered after being created, this checksum is only valid
+ * when the bloblist is finalised before jumping to the next stage of boot.
+ * This is the value needed to make all chechksummed bytes sum to 0
  * @version: BLOBLIST_VERSION
  * @hdr_size: Size of this header, normally sizeof(struct bloblist_hdr). The
  * first bloblist_rec starts at this offset from the start of the header
- * @size: Total size of the bloblist (non-zero if valid) including this header.
- * The bloblist extends for this many bytes from the start of this header.
- * When adding new records, the bloblist can grow up to this size.
+ * @align_log2: Power of two of the maximum alignment required by this list
  * @alloced: Total size allocated so far for this bloblist. This starts out as
  * sizeof(bloblist_hdr) since we need at least that much space to store a
  * valid bloblist
- * @chksum: checksum for the entire bloblist allocated area. Since any of the
- * blobs can be altered after being created, this checksum is only valid
- * when the bloblist is finalised before jumping to the next stage of boot.
- * This is the value needed to make all checksummed bytes sum to 0
+ * @size: Total size of the bloblist (non-zero if valid) including this header.
+ * The bloblist extends for this many bytes from the start of this header.
+ * When adding new records, the bloblist can grow up to this size.
  */
 struct bloblist_hdr {
u32 magic;
-   u32 version;
-   u32 hdr_size;
-   u32 _flags;
+   u8 chksum;
+   u8 version;
+   u8 hdr_size;
+   u8 align_log2;
 
-   u32 size;
u32 alloced;
-   u32 _spare;
-   u32 chksum;
+   u32 size;
 };
 
 /**
diff --git a/test/bloblist.c b/test/bloblist.c
index 7e65f30518..be237c6155 100644
--- a/test/bloblist.c
+++ b/test/bloblist.c
@@ -78,7 +78,7 @@ static int bloblist_test_init(struct unit_test_state *uts)
ut_asserteq(-EPROTONOSUPPORT, bloblist_check(TEST_ADDR,
 TEST_BLOBLIST_SIZE));
 
-   ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0x10));
+   ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0xc));
ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE));
ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE));
 
@@ -261,8 +261,8 @@ static int bloblist_test_cmd_info(struct unit_test_state 
*uts)
run_command("bloblist info", 0);
ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr));
ut_assert_nextline("size: 4001 KiB");
-   ut_assert_nextline("alloced:  58 88 Bytes");
-   ut_assert_nextline("free: 3a8936 Bytes");
+   ut_assert_nextline("alloced:  48 72 Bytes");
+   ut_assert_nextline("free: 3b8952 Bytes");
ut_assert_console_end();
ut_unsilence_console(uts);
 
-- 
2.25.1