bloblist: fix bloblist convention check.
PATCH v4 1/1 bloblist: fix bloblist convention check.
According to recently firmware handsoff spec [1]'s "Register usage at handoff boundary", Transfer List's signature value was changed from 0x40_b10b (3 bytes) to 4a0f_b10b (4 bytes).
As updating of TL's signature, register value of x1/r1 should be:
In aarch32's r1 value should be
R1[23:0]: set to the TL signature (4a0f_b10b -> masked range value: 0f_b10b)
R1[31:24]: version of the register convention == 1and
In aarch64's x1 value should be
X1[31:0]: set to the TL signature (4a0f_b10b)
X1[39:32]: version of the register convention == 1
X1[63:40]: MBZ(See the [2] and [3]).
This patch fix problems:
1. breaking X1 value with updated specification in aarch64
- change of length of signature field.
2. previous error value set in R1 in arm32.
- length of signature should be 24, but it uses 32bit signature.
This patch is a breaking change. It works only TF-A is updated.
---
v4:
- Remove FIXME tags on xfterlist.h
- Modify commit message
v3:
- Restore arch/arm/lib/xferlist.c
v2:
- Modify commit message
- Remove wrong swaping check in xferlist_from_boot_arg()
common/bloblist.c | 11 ++++++++++- include/bloblist.h | 10 ++++------ 2 files changed, 14 insertions(+), 7 deletions(-)
common/bloblist.c +10 -1
@@ -576,7 +576,16 @@ int bloblist_maybe_init(void)int bloblist_check_reg_conv (ulong rfdt,ulong rzero,ulong rsig) { -if (rzero || rsig != (BLOBLIST_MAGIC |BLOBLIST_REGCONV_VER ) || +ulong version =BLOBLIST_REGCONV_VER ; +ulong sigval; + + sigval = (IS_ENABLED (CONFIG_64BIT )) ? + ((BLOBLIST_MAGIC & ((1UL <<BLOBLIST_REGCONV_SHIFT_64 ) -1 )) | + ((version &BLOBLIST_REGCONV_MASK ) <<BLOBLIST_REGCONV_SHIFT_64 )) : + ((BLOBLIST_MAGIC & ((1UL <<BLOBLIST_REGCONV_SHIFT_32 ) -1 )) | + ((version &BLOBLIST_REGCONV_MASK ) <<BLOBLIST_REGCONV_SHIFT_32 )); + +if (rzero || rsig != sigval || rfdt != (ulong )bloblist_find (BLOBLISTT_CONTROL_FDT ,0 )) { gd->bloblist =NULL ;/* Reset the gd bloblist pointer */ return -EIO ;
include/bloblist.h +4 -6
@@ -78,12 +78,10 @@ enum {BLOBLIST_VERSION =1 ,BLOBLIST_MAGIC =0x4a0fb10b , -/* -* FIXME: -* Register convention version should be placed into a higher byte -* https://github.com/FirmwareHandoff/firmware_handoff/issues/32 -*/ -BLOBLIST_REGCONV_VER =1 <<24 , +BLOBLIST_REGCONV_SHIFT_64 =32 , +BLOBLIST_REGCONV_SHIFT_32 =24 , +BLOBLIST_REGCONV_MASK =0xff , +BLOBLIST_REGCONV_VER =1 ,BLOBLIST_BLOB_ALIGN_LOG2 =3 , BLOBLIST_BLOB_ALIGN = 1 << BLOBLIST_BLOB_ALIGN_LOG2,
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Hi Levi,
Quoted 101 lines · Levi Yun
According to recently firmware handsoff spec [1]'s "Register usage at handoff
boundary", Transfer List's signature value was changed from 0x40_b10b (3 bytes) to 4a0f_b10b (4 bytes).As updating of TL's signature, register value of x1/r1 should be:
In aarch32's r1 value should be
R1[23:0]: set to the TL signature (4a0f_b10b -> masked range value: 0f_b10b) R1[31:24]: version of the register convention == 1and
In aarch64's x1 value should be
X1[31:0]: set to the TL signature (4a0f_b10b) X1[39:32]: version of the register convention == 1 X1[63:40]: MBZ(See the [2] and [3]).
This patch fix problems:
1. breaking X1 value with updated specification in aarch64
- change of length of signature field.2. previous error value set in R1 in arm32.
- length of signature should be 24, but it uses 32bit signature.This patch is a breaking change. It works only TF-A is updated.
Link:
https://github.com/FirmwareHandoff/firmware_handoff/commit/5aa7aa1d3a1db75213e458d392b751f0707de027[3]Signed-off-by Levi Yun <[email protected]>---
v4:
- Remove FIXME tags onxfterlist.h
- Modify commit messagev3:
- Restorearch/arm/lib/xferlist.cv2:
- Modify commit message
- Remove wrong swaping check inxferlist_from_boot_arg()common/bloblist.c | 11 ++++++++++- include/bloblist.h | 10 ++++------ 2 files changed, 14 insertions(+), 7 deletions(-)common/bloblist.c +5
-1@@ -576,7 +576,16 @@ int bloblist_maybe_init(void)int bloblist_check_reg_conv (ulong rfdt,ulong rzero,ulong rsig) { - if (rzero || rsig != (BLOBLIST_MAGIC | BLOBLIST_REGCONV_VER) || +ulong version =BLOBLIST_REGCONV_VER ; +ulong sigval; + + sigval = (IS_ENABLED(CONFIG_64BIT)) ? + ((BLOBLIST_MAGIC & ((1UL <<
BLOBLIST_REGCONV_SHIFT_64) - 1)) |
+ ((version &BLOBLIST_REGCONV_MASK) <<BLOBLIST_REGCONV_SHIFT_64)) :
+ ((BLOBLIST_MAGIC& ((1UL <<BLOBLIST_REGCONV_SHIFT_32) - 1)) |
+ ((version &BLOBLIST_REGCONV_MASK) <<BLOBLIST_REGCONV_SHIFT_32));common/bloblist.c +2
-0+ +if (rzero || rsig != sigval || rfdt != (ulong )bloblist_find (BLOBLISTT_CONTROL_FDT ,0 )) { gd->bloblist =NULL ;/* Reset the gd bloblist pointer */ return -EIO ;include/bloblist.h +4
-7@@ -78,12 +78,10 @@ enum {BLOBLIST_VERSION =1 ,BLOBLIST_MAGIC =0x4a0fb10b , -/* -* FIXME: -* Register convention version should be placed into a higher byte -* https://github.com/FirmwareHandoff/firmware_handoff/issues/32 -*/ -BLOBLIST_REGCONV_VER =1 <<24 , +BLOBLIST_REGCONV_SHIFT_64 =32 , +BLOBLIST_REGCONV_SHIFT_32 =24 , +BLOBLIST_REGCONV_MASK =0xff , +BLOBLIST_REGCONV_VER =1 ,BLOBLIST_BLOB_ALIGN_LOG2 =3 , BLOBLIST_BLOB_ALIGN = 1 << BLOBLIST_BLOB_ALIGN_LOG2, --LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Quoted 1 line
Feel free to add tag:
Regards,
Raymond
Simon Glass
Reviewed-byQuoted 51 lines · Raymond Mao
Hi Levi,
Quoted 47 lines · Levi Yun
According to recently firmware handsoff spec [1]'s "Register usage at handoff boundary", Transfer List's signature value was changed from 0x40_b10b (3 bytes) to 4a0f_b10b (4 bytes).
As updating of TL's signature, register value of x1/r1 should be:
In aarch32's r1 value should be
R1[23:0]: set to the TL signature (4a0f_b10b -> masked range value: 0f_b10b) R1[31:24]: version of the register convention == 1and
In aarch64's x1 value should be
X1[31:0]: set to the TL signature (4a0f_b10b) X1[39:32]: version of the register convention == 1 X1[63:40]: MBZ(See the [2] and [3]).
This patch fix problems:
1. breaking X1 value with updated specification in aarch64
- change of length of signature field.2. previous error value set in R1 in arm32.
- length of signature should be 24, but it uses 32bit signature.This patch is a breaking change. It works only TF-A is updated.
Link https://github.com/FirmwareHandoff/firmware_handoff/commit/5aa7aa1d3a1db75213e458d392b751f0707de027 [3]Signed-off-by Levi Yun <[email protected]>---
v4:
- Remove FIXME tags onxfterlist.h
- Modify commit messagev3:
- Restorearch/arm/lib/xferlist.cv2:
- Modify commit message
- Remove wrong swaping check inxferlist_from_boot_arg()common/bloblist.c | 11 ++++++++++- include/bloblist.h | 10 ++++------ 2 files changed, 14 insertions(+), 7 deletions(-)
Quoted 7 lines
Quoted 7 lines
common/bloblist.c +0
-0@@ -576,7 +576,16 @@ int bloblist_maybe_init(void)
Quoted 14 lines
Quoted 4 lines
common/bloblist.c +1
-1int bloblist_check_reg_conv (ulong rfdt,ulong rzero,ulong rsig) { - if (rzero || rsig != (BLOBLIST_MAGIC | BLOBLIST_REGCONV_VER) || +ulong version =BLOBLIST_REGCONV_VER ;common/bloblist.c int bloblist_maybe_init(void) · line 589
Quoted 10 lines
common/bloblist.c +9
-0+ulong sigval; + + sigval = (IS_ENABLED (CONFIG_64BIT )) ? + ((BLOBLIST_MAGIC & ((1UL <<BLOBLIST_REGCONV_SHIFT_64 ) -1 )) | + ((version &BLOBLIST_REGCONV_MASK ) <<BLOBLIST_REGCONV_SHIFT_64 )) : + ((BLOBLIST_MAGIC & ((1UL <<BLOBLIST_REGCONV_SHIFT_32 ) -1 )) | + ((version &BLOBLIST_REGCONV_MASK ) <<BLOBLIST_REGCONV_SHIFT_32 )); + +if (rzero || rsig != sigval || rfdt != (ulong )bloblist_find (BLOBLISTT_CONTROL_FDT ,0 )) {
I'd argue that this is unnecessary, since the point of passing fdt in a register is to avoid having to search the bloblist for it.
Quoted 27 lines
Quoted 24 lines
common/bloblist.c +0
-0gd->bloblist =NULL ;/* Reset the gd bloblist pointer */ return -EIO ;include/bloblist.h +4
-7@@ -78,12 +78,10 @@ enum {BLOBLIST_VERSION =1 ,BLOBLIST_MAGIC =0x4a0fb10b , -/* -* FIXME: -* Register convention version should be placed into a higher byte -* https://github.com/FirmwareHandoff/firmware_handoff/issues/32 -*/ -BLOBLIST_REGCONV_VER =1 <<24 , +BLOBLIST_REGCONV_SHIFT_64 =32 , +BLOBLIST_REGCONV_SHIFT_32 =24 , +BLOBLIST_REGCONV_MASK =0xff , +BLOBLIST_REGCONV_VER =1 ,BLOBLIST_BLOB_ALIGN_LOG2 =3 , BLOBLIST_BLOB_ALIGN = 1 << BLOBLIST_BLOB_ALIGN_LOG2, --Quoted 2 lines
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Feel free to add tag:
Quoted 5 lines
Reviewed-by Raymond Mao <[email protected]>Regards,
Raymond
Regards,
Simon
Quoted 11 lines · Levi Yun
According to recently firmware handsoff spec [1]'s "Register usage at handoff boundary", Transfer List's signature value was changed from 0x40_b10b (3 bytes) to 4a0f_b10b (4 bytes).
As updating of TL's signature, register value of x1/r1 should be:
In aarch32's r1 value should be
R1[23:0]: set to the TL signature (4a0f_b10b -> masked range value: 0f_b10b) R1[31:24]: version of the register convention == 1[...]
Applied to u-boot/master, thanks!
Signature · 1 line
Tom