Message ID | 20231222213110.660402-2-raymond.mao@linaro.org |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | Handoff bloblist from previous boot stage | expand |
Hi Raymond, On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao <raymond.mao@linaro.org> wrote: > > Add bloblist_check_reg_conv() to check whether the bloblist is compliant > to the register conventions defined in Firmware Handoff specification. > This API can be used for all Arm platforms. > > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> > --- > Changes in v2 > - Refactor of bloblist_check_reg_conv(). > Changes in v3 > - bloblist_check_reg_conv() returns -ENOENT if OF_BOARD is disabled. > > common/bloblist.c | 13 +++++++++++++ > include/bloblist.h | 12 ++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/common/bloblist.c b/common/bloblist.c > index 625e480f6b..ba17dd851a 100644 > --- a/common/bloblist.c > +++ b/common/bloblist.c > @@ -542,3 +542,16 @@ int bloblist_maybe_init(void) > > return 0; > } > + > +int bloblist_check_reg_conv(ulong rfdt, ulong rzero) > +{ > + if (!IS_ENABLED(CONFIG_OF_BOARD)) > + return -ENOENT; > + > + if (rzero || rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) { > + gd->bloblist = NULL; /* Reset the gd bloblist pointer */ > + return -EIO; > + } Where does the magic 4a0fb10b value get checked? > + > + return 0; > +} > diff --git a/include/bloblist.h b/include/bloblist.h > index 84fc943819..bd32e38a06 100644 > --- a/include/bloblist.h > +++ b/include/bloblist.h > @@ -461,4 +461,16 @@ static inline int bloblist_maybe_init(void) > } > #endif /* BLOBLIST */ > > +/** > + * bloblist_check_reg_conv() - Check whether the bloblist is compliant to > + * the register conventions according to the > + * Firmware Handoff spec. > + * > + * @rfdt: Register that holds the FDT base address. > + * @rzero: Register that must be zero. > + * Return: 0 if OK, -EIO if the bloblist is not compliant to the register > + * conventions, -ENOENT if OF_BOARD is disabled. > + */ > +int bloblist_check_reg_conv(ulong rfdt, ulong rzero); > + > #endif /* __BLOBLIST_H */ > -- > 2.25.1 > Regards, Simon
Hi Simon, On Tue, 26 Dec 2023 at 04:48, Simon Glass <sjg@chromium.org> wrote: > Hi Raymond, > > On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao <raymond.mao@linaro.org> > wrote: > > > > Add bloblist_check_reg_conv() to check whether the bloblist is compliant > > to the register conventions defined in Firmware Handoff specification. > > This API can be used for all Arm platforms. > > > > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> > > --- > > Changes in v2 > > - Refactor of bloblist_check_reg_conv(). > > Changes in v3 > > - bloblist_check_reg_conv() returns -ENOENT if OF_BOARD is disabled. > > > > common/bloblist.c | 13 +++++++++++++ > > include/bloblist.h | 12 ++++++++++++ > > 2 files changed, 25 insertions(+) > > > > diff --git a/common/bloblist.c b/common/bloblist.c > > index 625e480f6b..ba17dd851a 100644 > > --- a/common/bloblist.c > > +++ b/common/bloblist.c > > @@ -542,3 +542,16 @@ int bloblist_maybe_init(void) > > > > return 0; > > } > > + > > +int bloblist_check_reg_conv(ulong rfdt, ulong rzero) > > +{ > > + if (!IS_ENABLED(CONFIG_OF_BOARD)) > > + return -ENOENT; > > + > > + if (rzero || rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, > 0)) { > > + gd->bloblist = NULL; /* Reset the gd bloblist pointer */ > > + return -EIO; > > + } > > Where does the magic 4a0fb10b value get checked? > > The magic and version of register conventions cannot be checked now since there is a bug in the spec. PSB: ``` X1[23:0]: set to the TL signature (4a0f_b10b) X1[31:24]: version of the register convention used. Set to 1 for the AArch64 convention specified in this document. ``` Signature (4a0f_b10b) takes all [31:0] and no space for version of the register convention. This needs to be updated on TF-A and OP-TEE as well after the spec is updated. For now I will just skip the checking. [...] Regards, Raymond
Hi Raymond, On Wed, Dec 27, 2023 at 4:06 PM Raymond Mao <raymond.mao@linaro.org> wrote: > > Hi Simon, > > On Tue, 26 Dec 2023 at 04:48, Simon Glass <sjg@chromium.org> wrote: >> >> Hi Raymond, >> >> On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao <raymond.mao@linaro.org> wrote: >> > >> > Add bloblist_check_reg_conv() to check whether the bloblist is compliant >> > to the register conventions defined in Firmware Handoff specification. >> > This API can be used for all Arm platforms. >> > >> > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> >> > --- >> > Changes in v2 >> > - Refactor of bloblist_check_reg_conv(). >> > Changes in v3 >> > - bloblist_check_reg_conv() returns -ENOENT if OF_BOARD is disabled. >> > >> > common/bloblist.c | 13 +++++++++++++ >> > include/bloblist.h | 12 ++++++++++++ >> > 2 files changed, 25 insertions(+) >> > >> > diff --git a/common/bloblist.c b/common/bloblist.c >> > index 625e480f6b..ba17dd851a 100644 >> > --- a/common/bloblist.c >> > +++ b/common/bloblist.c >> > @@ -542,3 +542,16 @@ int bloblist_maybe_init(void) >> > >> > return 0; >> > } >> > + >> > +int bloblist_check_reg_conv(ulong rfdt, ulong rzero) >> > +{ >> > + if (!IS_ENABLED(CONFIG_OF_BOARD)) >> > + return -ENOENT; >> > + >> > + if (rzero || rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) { >> > + gd->bloblist = NULL; /* Reset the gd bloblist pointer */ >> > + return -EIO; >> > + } >> >> Where does the magic 4a0fb10b value get checked? >> > The magic and version of register conventions cannot be checked now since there is > a bug in the spec. PSB: > ``` > X1[23:0]: set to the TL signature (4a0f_b10b) That should say 0f_b10b > X1[31:24]: version of the register convention used. Set to 1 for the AArch64 convention specified in this document. > ``` > Signature (4a0f_b10b) takes all [31:0] and no space for version of the register convention. > This needs to be updated on TF-A and OP-TEE as well after the spec is updated. > For now I will just skip the checking. We should fix the spec instead. Regards, Simon
Hi Simon, On Thu, 28 Dec 2023 at 08:38, Simon Glass <sjg@chromium.org> wrote: > Hi Raymond, > > On Wed, Dec 27, 2023 at 4:06 PM Raymond Mao <raymond.mao@linaro.org> > wrote: > > > > Hi Simon, > > > > On Tue, 26 Dec 2023 at 04:48, Simon Glass <sjg@chromium.org> wrote: > >> > >> Hi Raymond, > >> > >> On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao <raymond.mao@linaro.org> > wrote: > >> > > >> > Add bloblist_check_reg_conv() to check whether the bloblist is > compliant > >> > to the register conventions defined in Firmware Handoff specification. > >> > This API can be used for all Arm platforms. > >> > > >> > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> > >> > --- > >> > Changes in v2 > >> > - Refactor of bloblist_check_reg_conv(). > >> > Changes in v3 > >> > - bloblist_check_reg_conv() returns -ENOENT if OF_BOARD is disabled. > >> > > >> > common/bloblist.c | 13 +++++++++++++ > >> > include/bloblist.h | 12 ++++++++++++ > >> > 2 files changed, 25 insertions(+) > >> > > >> > diff --git a/common/bloblist.c b/common/bloblist.c > >> > index 625e480f6b..ba17dd851a 100644 > >> > --- a/common/bloblist.c > >> > +++ b/common/bloblist.c > >> > @@ -542,3 +542,16 @@ int bloblist_maybe_init(void) > >> > > >> > return 0; > >> > } > >> > + > >> > +int bloblist_check_reg_conv(ulong rfdt, ulong rzero) > >> > +{ > >> > + if (!IS_ENABLED(CONFIG_OF_BOARD)) > >> > + return -ENOENT; > >> > + > >> > + if (rzero || rfdt != > (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) { > >> > + gd->bloblist = NULL; /* Reset the gd bloblist > pointer */ > >> > + return -EIO; > >> > + } > >> > >> Where does the magic 4a0fb10b value get checked? > >> > > The magic and version of register conventions cannot be checked now > since there is > > a bug in the spec. PSB: > > ``` > > X1[23:0]: set to the TL signature (4a0f_b10b) > > That should say 0f_b10b > > However, currently we have switched to `4a0f_b10b` in both TF-A and OP-TEE. I don't want to break the dataflow that is currently working. I prefer to make patches to TF-A, OP-TEE and U-Boot at the same time when spec v1.0 is ready. [...] Thanks and regards, Raymond
Hi Raymond, On Thu, Dec 28, 2023 at 3:13 PM Raymond Mao <raymond.mao@linaro.org> wrote: > > Hi Simon, > > On Thu, 28 Dec 2023 at 08:38, Simon Glass <sjg@chromium.org> wrote: >> >> Hi Raymond, >> >> On Wed, Dec 27, 2023 at 4:06 PM Raymond Mao <raymond.mao@linaro.org> wrote: >> > >> > Hi Simon, >> > >> > On Tue, 26 Dec 2023 at 04:48, Simon Glass <sjg@chromium.org> wrote: >> >> >> >> Hi Raymond, >> >> >> >> On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao <raymond.mao@linaro.org> wrote: >> >> > >> >> > Add bloblist_check_reg_conv() to check whether the bloblist is compliant >> >> > to the register conventions defined in Firmware Handoff specification. >> >> > This API can be used for all Arm platforms. >> >> > >> >> > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> >> >> > --- >> >> > Changes in v2 >> >> > - Refactor of bloblist_check_reg_conv(). >> >> > Changes in v3 >> >> > - bloblist_check_reg_conv() returns -ENOENT if OF_BOARD is disabled. >> >> > >> >> > common/bloblist.c | 13 +++++++++++++ >> >> > include/bloblist.h | 12 ++++++++++++ >> >> > 2 files changed, 25 insertions(+) >> >> > >> >> > diff --git a/common/bloblist.c b/common/bloblist.c >> >> > index 625e480f6b..ba17dd851a 100644 >> >> > --- a/common/bloblist.c >> >> > +++ b/common/bloblist.c >> >> > @@ -542,3 +542,16 @@ int bloblist_maybe_init(void) >> >> > >> >> > return 0; >> >> > } >> >> > + >> >> > +int bloblist_check_reg_conv(ulong rfdt, ulong rzero) >> >> > +{ >> >> > + if (!IS_ENABLED(CONFIG_OF_BOARD)) >> >> > + return -ENOENT; >> >> > + >> >> > + if (rzero || rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) { >> >> > + gd->bloblist = NULL; /* Reset the gd bloblist pointer */ >> >> > + return -EIO; >> >> > + } >> >> >> >> Where does the magic 4a0fb10b value get checked? >> >> >> > The magic and version of register conventions cannot be checked now since there is >> > a bug in the spec. PSB: >> > ``` >> > X1[23:0]: set to the TL signature (4a0f_b10b) >> >> That should say 0f_b10b >> > However, currently we have switched to `4a0f_b10b` in both TF-A and OP-TEE. > I don't want to break the dataflow that is currently working. > I prefer to make patches to TF-A, OP-TEE and U-Boot at the same time when spec v1.0 is ready. Yes, sure, but we should fix them too! > > [...] > > Thanks and regards, > Raymond Regards, Simon
diff --git a/common/bloblist.c b/common/bloblist.c index 625e480f6b..ba17dd851a 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -542,3 +542,16 @@ int bloblist_maybe_init(void) return 0; } + +int bloblist_check_reg_conv(ulong rfdt, ulong rzero) +{ + if (!IS_ENABLED(CONFIG_OF_BOARD)) + return -ENOENT; + + if (rzero || rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) { + gd->bloblist = NULL; /* Reset the gd bloblist pointer */ + return -EIO; + } + + return 0; +} diff --git a/include/bloblist.h b/include/bloblist.h index 84fc943819..bd32e38a06 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -461,4 +461,16 @@ static inline int bloblist_maybe_init(void) } #endif /* BLOBLIST */ +/** + * bloblist_check_reg_conv() - Check whether the bloblist is compliant to + * the register conventions according to the + * Firmware Handoff spec. + * + * @rfdt: Register that holds the FDT base address. + * @rzero: Register that must be zero. + * Return: 0 if OK, -EIO if the bloblist is not compliant to the register + * conventions, -ENOENT if OF_BOARD is disabled. + */ +int bloblist_check_reg_conv(ulong rfdt, ulong rzero); + #endif /* __BLOBLIST_H */
Add bloblist_check_reg_conv() to check whether the bloblist is compliant to the register conventions defined in Firmware Handoff specification. This API can be used for all Arm platforms. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> --- Changes in v2 - Refactor of bloblist_check_reg_conv(). Changes in v3 - bloblist_check_reg_conv() returns -ENOENT if OF_BOARD is disabled. common/bloblist.c | 13 +++++++++++++ include/bloblist.h | 12 ++++++++++++ 2 files changed, 25 insertions(+)