Hi Peng,
1-Asynchronous preemption of SP:
The long route is to make changes in the dispatcher and the
corresponding SPD implementation to have synchronous preemption.
ie: OP-TEE dispatcher will implement a G1NS (fiq) handler and invoke
an entry of OP-TEE synchronously. OP-TEE will save the thread context
and return.
I did some POC but the complexity and effort to generalise was not
justified by our requirement at that point especially envisioning the
movement to SPMD in future.
2-Synchronous preemption of SP:
ref:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6345
I used this approach instead to unblock OP-TEE work alongside EHF.
This serves the purpose without changing the routing model with a
limitation that non yielding/fast SMC can
not be preempted. And ofcourse OP-TEE can mask G0 interrupt in
anycase. But I think this is sufficient for your purpose.
Please feedback if the above patch works for you.
Thanks
Sandeep
On Mon, Mar 22, 2021 at 2:43 PM Peng Fan via TF-A
<tf-a(a)lists.trustedfirmware.org> wrote:
>
> Hi Achin,
>
>
>
> We are using SDEI for Jailhouse hypervisor to minimize interrupt latency, however we also wanna use OP-TEE when SDEI enabled.
>
>
>
> So I wanna how to make both work together.
>
>
>
> Thanks,
>
> Peng.
>
>
>
> From: Achin Gupta [mailto:Achin.Gupta@arm.com]
> Sent: 2021年3月17日 17:59
> To: Peng Fan <peng.fan(a)nxp.com>; Jens Wiklander <jens.wiklander(a)linaro.org>
> Cc: op-tee(a)lists.trustedfirmware.org; tf-a(a)lists.trustedfirmware.org
> Subject: Re: EHF + OPTEE on ARM64
>
>
>
> Hi Peng,
>
>
>
> +TF-A folk.
>
>
>
> My 0.02$.
>
>
>
> What is the problem you are trying to solve? Why do you need to run OP-TEE and EHF together? EHF was originally written to support a S-EL0 SP that is managed directly by TF-A in EL3 (TF-A folk can chime in).
>
>
>
> The SP could perform RAS error handling for which it needs the EHF. The EHF triages asynchronous exceptions and hands RAS errors to the SP for further handling.
>
>
>
> This is just one use case but there is no Trusted OS in these configurations.
>
>
>
> So, it would help to understand the requirement.
>
>
>
> cheers,
>
> Achin
>
>
>
> ________________________________
>
> From: OP-TEE <op-tee-bounces(a)lists.trustedfirmware.org> on behalf of Jens Wiklander via OP-TEE <op-tee(a)lists.trustedfirmware.org>
> Sent: 17 March 2021 09:23
> To: Peng Fan <peng.fan(a)nxp.com>
> Cc: op-tee(a)lists.trustedfirmware.org <op-tee(a)lists.trustedfirmware.org>
> Subject: Re: EHF + OPTEE on ARM64
>
>
>
> On Wed, Mar 17, 2021 at 9:43 AM Peng Fan <peng.fan(a)nxp.com> wrote:
> >
> > > Subject: Re: EHF + OPTEE on ARM64
> > >
> > > On Wed, Mar 17, 2021 at 9:02 AM Peng Fan <peng.fan(a)nxp.com> wrote:
> > > >
> > > > > Subject: Re: EHF + OPTEE on ARM64
> > > > >
> > > > > On Wed, Mar 17, 2021 at 8:41 AM Peng Fan <peng.fan(a)nxp.com> wrote:
> > > > > >
> > > > > > > Subject: Re: EHF + OPTEE on ARM64
> > > > > > >
> > > > > > > On Tue, Mar 16, 2021 at 11:08 AM Peng Fan <peng.fan(a)nxp.com>
> > > wrote:
> > > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > In bl31/ehf.c, there are following two lines, per my
> > > > > > > > understanding, when cpu is in secure world, the non-secure
> > > > > > > > interrupt as FIQ(GICv3) will be directly catched by EL3, not S-EL1
> > > > > > > > /* Route EL3 interrupts when in Secure and Non-secure.
> > > */
> > > > > > > > set_interrupt_rm_flag(flags, NON_SECURE);
> > > > > > > > set_interrupt_rm_flag(flags, SECURE);
> > > > > > > >
> > > > > > > > So this will conflict with OP-TEE, because OP-TEE needs catch
> > > > > > > > NS-interrupt as FIQ in S-EL1 world.
> > > > > > >
> > > > > > > In the case of GICv3, OP-TEE is configured to receive the
> > > > > > > non-secure interrupts as FIQ and secure interrupts as IRQ. See
> > > CFG_ARM_GICV3.
> > > > > >
> > > > > > But EHF needs NS-interrupt FIQ be catched by EL3 if I understand
> > > > > > correct, per " set_interrupt_rm_flag(flags, SECURE);"
> > > > > >
> > > > > > So currently EHF could not work together with OP-TEE, right?
> > > > >
> > > > > To be honest, I'm not completely sure what EHF does. From OP-TEE
> > > > > point of view we expect to receive the non-secure interrupts as a
> > > > > way of doing a controlled exit. This allows OP-TEE to resume
> > > > > execution with a different core on re-entry. If EL3 takes the
> > > > > non-secure interrupts directly it will have to make sure to only re-enter
> > > OP-TEE on this core as a return from exception.
> > > >
> > > > Is this easy to be achieved?
> > >
> > > I don't know, it depends on what you intend to do with this non-secure
> > > interrupt. If it's handled at EL3 and then there's a return from exception back
> > > to S-EL1 there's likely no harm done. But if there's a world switch involved
> > > there might be trouble, OP-TEE might not be in a suitable state for a world
> > > switch.
> > >
> > > >
> > > > Or by using opteed_sel1_interrupt_handler, could we have similar
> > > > behavior to allow the other core resume execution?
> > >
> > > Only OP-TEE itself can make a controlled exit as there's an internal state to
> > > maintain. Currently that's signalled with a non-secure interrupt.
> >
> >
> > Per EHF, https://trustedfirmware-a.readthedocs.io/en/latest/components/exception-han…
> > On GICv3 systems, when executing in S-EL1, pending Non-secure interrupts of
> > sufficient priority are signalled as FIQs, and therefore will be routed to EL3.
> > As a result, S-EL1 software cannot expect to handle Non-secure interrupts at S-EL1.
> > Essentially, this deprecates the routing mode described as CSS=0, TEL3=0.
> >
> > In order for S-EL1 software to handle Non-secure interrupts while having EHF enabled,
> > the dispatcher must adopt a model where Non-secure interrupts are received at EL3,
> > but are then synchronously handled over to S-EL1.
> >
> > The issue to me here how to synchronously handled over to S-EL1 and not break optee.
>
> I understand. OP-TEE is masking interrupts in some critical sections,
> while in such a state OP-TEE cannot handle any asynchronous interrupt.
> Temporarily masking interrupts is normally a quick operation so we do
> it in quite a few places.
> So the crux of the problem is to make sure that OP-TEE is in a state
> where it can make a controlled exit. I don't have any good ideas for
> this right now.
>
> Cheers,
> Jens
>
> --
> TF-A mailing list
> TF-A(a)lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/tf-a
This week a 3 day Linaro Virtual Connect event is being held.
There are 60+ sessions many of which may be of interest to the project community including a number of updated TF-A sessions previously presented at the Tech-Forum.
The Linaro Virtual Connect schedule is available here<https://connect.linaro.org/schedule/>.
Virtual Connect notes:
* Free Register here<https://connect.linaro.org/>.
* The virtual sessions occur across various time-zones, but all sessions will be recorded and published shortly after the event for you to be able to watch later.
Thanks
Joanna
I am cancelling this weeks TF-A Tech forum
Although I had hoped to have a session ready for this week unfortunately that is not the case.
However, this week there is a three day Linaro Virtual Connect event March 23-25 where re-runs of a number of previous TF-A Tech Forum sessions are being performed with updated information in a number of cases. Please see the following email with details of the Linaro Virtual Connect event.
Joanna
+tf-a list.
-----Original Message-----
From: raghu.ncstate(a)icloud.com <raghu.ncstate(a)icloud.com>
Sent: Monday, March 22, 2021 7:21 AM
To: 'Grant Likely' <grant.likely(a)arm.com>; 'Harb Abdulhamid OS' <abdulhamid(a)os.amperecomputing.com>; 'Stuart Yoder' <stuart.yoder(a)arm.com>; 'Jose Marinho' <Jose.Marinho(a)arm.com>
Subject: RE: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
I'm also in favor of the proposed method as an alternative(not replace) to the fconf/device tree based method, which works well for vertically integrated systems but not so for systems like Harb has mentioned below. Stuffing/modifying device tree on the fly is awkward even for small pieces of data and not everybody(at least me) would be happy with including something like a device tree library in early boot loader stages and firmware for various reasons(complexity, avoid parsing code for security reasons).
Thanks
Raghu
-----Original Message-----
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> On Behalf Of Grant Likely via TF-A
Sent: Monday, March 22, 2021 4:03 AM
To: Harb Abdulhamid OS <abdulhamid(a)os.amperecomputing.com>; tf-a(a)lists.trustedfirmware.org; Stuart Yoder <stuart.yoder(a)arm.com>; Jose Marinho <Jose.Marinho(a)arm.com>
Subject: Re: [TF-A] Proposal: TF-A to adopt hand-off blocks (HOBs) for information passing between boot stages
Hi Harb,
This sounds like a useful abstraction to me. I can see it being useful when we need to pass TPM logs from one stage to another, or to pass on firmware update status. Things that /could/ be stuffed into a single devicetree, but it is awkward to rewrite the devicetree for every piece of dynamic data that gets generated and passed on. It would also be helpful if a common approach can be used regardless of the normal-world firmware (i.e., EDK2, U-Boot, or something else).
g.
On 22/03/2021 08:34, Harb Abdulhamid OS via TF-A wrote:
> Hello Folks,
>
> I'm emailing to start an open discussion about the adoption of a
> concept known as "hand-off blocks" or HOB to become a part of the TF-A
> Firmware Framework Architecture (FFA).� This is something that is a
> pretty major pain point when it comes to the adoption of TF-A in ARM
> Server SoC�s designed to enable a broad range of highly configurable
> datacenter platforms.
>
> What is a HOB (Background)?
>
> ---------------------------
>
> UEFI PI spec describes a particular definition for how HOB may be used
> for transitioning between the PEI and DXE boot phases, which is a good
> reference point for this discussion, but not necessarily the exact
> solution appropriate for TF-A.
>
> A HOB is simply a dynamically generated data structure passed in
> between two boot phases.� This is information that was obtained
> through discovery and needs to be passed forward to the next boot
> phase *once*, with no API needed to call back (e.g. no call back into
> previous firmware phase is needed to fetch this information at
> run-time - it is simply passed one time during boot).
>
> There may be one or more HOBs passed in between boot phases.� If
> there are more than one HOB that needs to be passed, this can be in a
> form of a "HOB table", which (for example) could be a UUID indexed
> array of pointers to HOB structures, used to locate a HOB of interest
> (based on UUID).� In such cases, instead of passing a single HOB,
> the boot phases may rely on passing the pointer to the HOB table.
>
> This has been extremely useful concept to employ on highly
> configurable systems that must rely on flexible discovery mechanisms
> to initialize and boot the system.� This is especially helpful when
> you have multiple
>
> Why do we need HOBs in TF-A?:
>
> -----------------------------
>
> It is desirable that EL3 firmware (e.g. TF-A) built for ARM Server SoC
> in a way that is SoC specific *but* platform agnostic.� This means
> that a single ARM SoC that a SiP may deliver to customers may provide
> a single TF-A binary (e.g. BL1, BL2, BL31) that could be used to
> support a broad range of platform designs and configurations in order
> to boot a platform specific firmware (e.g. BL33 and possibly even BL32
> code).� In order to achieve this, the platform configuration must be
> *discovered* instead of statically compiled as it is today in TF-A via
> device tree based enumeration.� The mechanisms of discovery may
> differ broadly depending on the relevant industry standard, or in some
> cases may have rely on SiP specific discovery flows.
>
> For example:� On server systems that support a broad range DIMM
> memory population/topologies, all the necessary information required
> to boot is fully discovered via standard JEDEC Serial Presence Detect
> (SPD) over an I2C bus.� Leveraging the SPD bus, may platform
> variants could be supported with a single TF-A binary.� Not only is
> this information required to initialize memory in early boot phases
> (e.g. BL2), the subsequent boot phases will also need this SPD info to
> construct a system physical address map and properly initialize the
> MMU based on the memory present, and where the memory may be
> present.� Subsequent boot phases (e.g. BL33 / UEFI) may need to
> generate standard firmware tables to the operating systems, such as
> SMBIOS tables describing DIMM topology and various ACPI tables (e.g.
> SLIT, SRAT, even NFIT if NVDIMM's are present).
>
> In short, it all starts with a standardized or vendor specific
> discovery flow in an early boot stage (e.g. BL1/BL2), followed by the
> passing of information to the next boot stages (e.g. BL31/BL32/BL33).
>
> Today, every HOB may be a vendor specific structure, but in the future
> there may be benefit of defining standard HOBs.� This may be useful
> for memory discovery, passing the system physical address map,
> enabling TPM measured boot, and potentially many other common HOB use-cases.
>
> It would be extremely beneficial to the datacenter market segment if
> the TF-A community would adopt this concept of information passing
> between all boot phases as opposed to rely solely on device tree enumeration.
> This is not intended to replace device tree, rather intended as an
> alternative way to describe the info that must be discovered and
> dynamically generated.
>
> Conclusion:
>
> -----------
>
> We are proposing that the TF-A community begin pursuing the adoption
> of HOBs as a mechanism used for information exchange between each boot
> stage (e.g. BL1->BL2, BL2->BL31, BL31->BL32, and BL31->BL33)? Longer
> term we want to explore standardizing some HOB structures for the BL33
> phase (e.g. UEFI HOB structures), but initially would like to agree on
> this being a useful mechanism used to pass information between each
> boot stage.
>
> Thanks,
>
> --Harb
>
>
--
TF-A mailing list
TF-A(a)lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
Hi Harb,
This sounds like a useful abstraction to me. I can see it being useful
when we need to pass TPM logs from one stage to another, or to pass on
firmware update status. Things that /could/ be stuffed into a single
devicetree, but it is awkward to rewrite the devicetree for every piece
of dynamic data that gets generated and passed on. It would also be
helpful if a common approach can be used regardless of the normal-world
firmware (i.e., EDK2, U-Boot, or something else).
g.
On 22/03/2021 08:34, Harb Abdulhamid OS via TF-A wrote:
> Hello Folks,
>
> I'm emailing to start an open discussion about the adoption of a concept
> known as "hand-off blocks" or HOB to become a part of the TF-A Firmware
> Framework Architecture (FFA).� This is something that is a pretty major
> pain point when it comes to the adoption of TF-A in ARM Server SoC�s
> designed to enable a broad range of highly configurable datacenter
> platforms.
>
> What is a HOB (Background)?
>
> ---------------------------
>
> UEFI PI spec describes a particular definition for how HOB may be used
> for transitioning between the PEI and DXE boot phases, which is a good
> reference point for this discussion, but not necessarily the exact
> solution appropriate for TF-A.
>
> A HOB is simply a dynamically generated data structure passed in between
> two boot phases.� This is information that was obtained through
> discovery and needs to be passed forward to the next boot phase *once*,
> with no API needed to call back (e.g. no call back into previous
> firmware phase is needed to fetch this information at run-time - it is
> simply passed one time during boot).
>
> There may be one or more HOBs passed in between boot phases.� If there
> are more than one HOB that needs to be passed, this can be in a form of
> a "HOB table", which (for example) could be a UUID indexed array of
> pointers to HOB structures, used to locate a HOB of interest (based on
> UUID).� In such cases, instead of passing a single HOB, the boot phases
> may rely on passing the pointer to the HOB table.
>
> This has been extremely useful concept to employ on highly configurable
> systems that must rely on flexible discovery mechanisms to initialize
> and boot the system.� This is especially helpful when you have multiple
>
> Why do we need HOBs in TF-A?:
>
> -----------------------------
>
> It is desirable that EL3 firmware (e.g. TF-A) built for ARM Server SoC
> in a way that is SoC specific *but* platform agnostic.� This means that
> a single ARM SoC that a SiP may deliver to customers may provide a
> single TF-A binary (e.g. BL1, BL2, BL31) that could be used to support a
> broad range of platform designs and configurations in order to boot a
> platform specific firmware (e.g. BL33 and possibly even BL32 code).� In
> order to achieve this, the platform configuration must be *discovered*
> instead of statically compiled as it is today in TF-A via device tree
> based enumeration.� The mechanisms of discovery may differ broadly
> depending on the relevant industry standard, or in some cases may have
> rely on SiP specific discovery flows.
>
> For example:� On server systems that support a broad range DIMM memory
> population/topologies, all the necessary information required to boot is
> fully discovered via standard JEDEC Serial Presence Detect (SPD) over an
> I2C bus.� Leveraging the SPD bus, may platform variants could be
> supported with a single TF-A binary.� Not only is this information
> required to initialize memory in early boot phases (e.g. BL2), the
> subsequent boot phases will also need this SPD info to construct a
> system physical address map and properly initialize the MMU based on the
> memory present, and where the memory may be present.� Subsequent boot
> phases (e.g. BL33 / UEFI) may need to generate standard firmware tables
> to the operating systems, such as SMBIOS tables describing DIMM topology
> and various ACPI tables (e.g. SLIT, SRAT, even NFIT if NVDIMM's are
> present).
>
> In short, it all starts with a standardized or vendor specific discovery
> flow in an early boot stage (e.g. BL1/BL2), followed by the passing of
> information to the next boot stages (e.g. BL31/BL32/BL33).
>
> Today, every HOB may be a vendor specific structure, but in the future
> there may be benefit of defining standard HOBs.� This may be useful for
> memory discovery, passing the system physical address map, enabling TPM
> measured boot, and potentially many other common HOB use-cases.
>
> It would be extremely beneficial to the datacenter market segment if the
> TF-A community would adopt this concept of information passing between
> all boot phases as opposed to rely solely on device tree enumeration.
> This is not intended to replace device tree, rather intended as an
> alternative way to describe the info that must be discovered and
> dynamically generated.
>
> Conclusion:
>
> -----------
>
> We are proposing that the TF-A community begin pursuing the adoption of
> HOBs as a mechanism used for information exchange between each boot
> stage (e.g. BL1->BL2, BL2->BL31, BL31->BL32, and BL31->BL33)? Longer
> term we want to explore standardizing some HOB structures for the BL33
> phase (e.g. UEFI HOB structures), but initially would like to agree on
> this being a useful mechanism used to pass information between each boot
> stage.
>
> Thanks,
>
> --Harb
>
>
Hi Harb,
This sounds like a useful abstraction to me. I can see it being useful
when we need to pass TPM logs from one stage to another, or to pass on
firmware update status. Things that /could/ be stuffed into a single
devicetree, but it is awkward to rewrite the devicetree for every piece
of dynamic data that gets generated and passed on. It would also be
helpful if a common approach can be used regardless of the normal-world
firmware (i.e., EDK2, U-Boot, or something else).
g.
On 22/03/2021 08:34, Harb Abdulhamid OS via TF-A wrote:
> Hello Folks,
>
> I'm emailing to start an open discussion about the adoption of a concept
> known as "hand-off blocks" or HOB to become a part of the TF-A Firmware
> Framework Architecture (FFA).� This is something that is a pretty major
> pain point when it comes to the adoption of TF-A in ARM Server SoC�s
> designed to enable a broad range of highly configurable datacenter
> platforms.
>
> What is a HOB (Background)?
>
> ---------------------------
>
> UEFI PI spec describes a particular definition for how HOB may be used
> for transitioning between the PEI and DXE boot phases, which is a good
> reference point for this discussion, but not necessarily the exact
> solution appropriate for TF-A.
>
> A HOB is simply a dynamically generated data structure passed in between
> two boot phases.� This is information that was obtained through
> discovery and needs to be passed forward to the next boot phase *once*,
> with no API needed to call back (e.g. no call back into previous
> firmware phase is needed to fetch this information at run-time - it is
> simply passed one time during boot).
>
> There may be one or more HOBs passed in between boot phases.� If there
> are more than one HOB that needs to be passed, this can be in a form of
> a "HOB table", which (for example) could be a UUID indexed array of
> pointers to HOB structures, used to locate a HOB of interest (based on
> UUID).� In such cases, instead of passing a single HOB, the boot phases
> may rely on passing the pointer to the HOB table.
>
> This has been extremely useful concept to employ on highly configurable
> systems that must rely on flexible discovery mechanisms to initialize
> and boot the system.� This is especially helpful when you have multiple
>
> Why do we need HOBs in TF-A?:
>
> -----------------------------
>
> It is desirable that EL3 firmware (e.g. TF-A) built for ARM Server SoC
> in a way that is SoC specific *but* platform agnostic.� This means that
> a single ARM SoC that a SiP may deliver to customers may provide a
> single TF-A binary (e.g. BL1, BL2, BL31) that could be used to support a
> broad range of platform designs and configurations in order to boot a
> platform specific firmware (e.g. BL33 and possibly even BL32 code).� In
> order to achieve this, the platform configuration must be *discovered*
> instead of statically compiled as it is today in TF-A via device tree
> based enumeration.� The mechanisms of discovery may differ broadly
> depending on the relevant industry standard, or in some cases may have
> rely on SiP specific discovery flows.
>
> For example:� On server systems that support a broad range DIMM memory
> population/topologies, all the necessary information required to boot is
> fully discovered via standard JEDEC Serial Presence Detect (SPD) over an
> I2C bus.� Leveraging the SPD bus, may platform variants could be
> supported with a single TF-A binary.� Not only is this information
> required to initialize memory in early boot phases (e.g. BL2), the
> subsequent boot phases will also need this SPD info to construct a
> system physical address map and properly initialize the MMU based on the
> memory present, and where the memory may be present.� Subsequent boot
> phases (e.g. BL33 / UEFI) may need to generate standard firmware tables
> to the operating systems, such as SMBIOS tables describing DIMM topology
> and various ACPI tables (e.g. SLIT, SRAT, even NFIT if NVDIMM's are
> present).
>
> In short, it all starts with a standardized or vendor specific discovery
> flow in an early boot stage (e.g. BL1/BL2), followed by the passing of
> information to the next boot stages (e.g. BL31/BL32/BL33).
>
> Today, every HOB may be a vendor specific structure, but in the future
> there may be benefit of defining standard HOBs.� This may be useful for
> memory discovery, passing the system physical address map, enabling TPM
> measured boot, and potentially many other common HOB use-cases.
>
> It would be extremely beneficial to the datacenter market segment if the
> TF-A community would adopt this concept of information passing between
> all boot phases as opposed to rely solely on device tree enumeration.
> This is not intended to replace device tree, rather intended as an
> alternative way to describe the info that must be discovered and
> dynamically generated.
>
> Conclusion:
>
> -----------
>
> We are proposing that the TF-A community begin pursuing the adoption of
> HOBs as a mechanism used for information exchange between each boot
> stage (e.g. BL1->BL2, BL2->BL31, BL31->BL32, and BL31->BL33)? Longer
> term we want to explore standardizing some HOB structures for the BL33
> phase (e.g. UEFI HOB structures), but initially would like to agree on
> this being a useful mechanism used to pass information between each boot
> stage.
>
> Thanks,
>
> --Harb
>
>
Hi Peng,
+TF-A folk.
My 0.02$.
What is the problem you are trying to solve? Why do you need to run OP-TEE and EHF together? EHF was originally written to support a S-EL0 SP that is managed directly by TF-A in EL3 (TF-A folk can chime in).
The SP could perform RAS error handling for which it needs the EHF. The EHF triages asynchronous exceptions and hands RAS errors to the SP for further handling.
This is just one use case but there is no Trusted OS in these configurations.
So, it would help to understand the requirement.
cheers,
Achin
________________________________
From: OP-TEE <op-tee-bounces(a)lists.trustedfirmware.org> on behalf of Jens Wiklander via OP-TEE <op-tee(a)lists.trustedfirmware.org>
Sent: 17 March 2021 09:23
To: Peng Fan <peng.fan(a)nxp.com>
Cc: op-tee(a)lists.trustedfirmware.org <op-tee(a)lists.trustedfirmware.org>
Subject: Re: EHF + OPTEE on ARM64
On Wed, Mar 17, 2021 at 9:43 AM Peng Fan <peng.fan(a)nxp.com> wrote:
>
> > Subject: Re: EHF + OPTEE on ARM64
> >
> > On Wed, Mar 17, 2021 at 9:02 AM Peng Fan <peng.fan(a)nxp.com> wrote:
> > >
> > > > Subject: Re: EHF + OPTEE on ARM64
> > > >
> > > > On Wed, Mar 17, 2021 at 8:41 AM Peng Fan <peng.fan(a)nxp.com> wrote:
> > > > >
> > > > > > Subject: Re: EHF + OPTEE on ARM64
> > > > > >
> > > > > > On Tue, Mar 16, 2021 at 11:08 AM Peng Fan <peng.fan(a)nxp.com>
> > wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > In bl31/ehf.c, there are following two lines, per my
> > > > > > > understanding, when cpu is in secure world, the non-secure
> > > > > > > interrupt as FIQ(GICv3) will be directly catched by EL3, not S-EL1
> > > > > > > /* Route EL3 interrupts when in Secure and Non-secure.
> > */
> > > > > > > set_interrupt_rm_flag(flags, NON_SECURE);
> > > > > > > set_interrupt_rm_flag(flags, SECURE);
> > > > > > >
> > > > > > > So this will conflict with OP-TEE, because OP-TEE needs catch
> > > > > > > NS-interrupt as FIQ in S-EL1 world.
> > > > > >
> > > > > > In the case of GICv3, OP-TEE is configured to receive the
> > > > > > non-secure interrupts as FIQ and secure interrupts as IRQ. See
> > CFG_ARM_GICV3.
> > > > >
> > > > > But EHF needs NS-interrupt FIQ be catched by EL3 if I understand
> > > > > correct, per " set_interrupt_rm_flag(flags, SECURE);"
> > > > >
> > > > > So currently EHF could not work together with OP-TEE, right?
> > > >
> > > > To be honest, I'm not completely sure what EHF does. From OP-TEE
> > > > point of view we expect to receive the non-secure interrupts as a
> > > > way of doing a controlled exit. This allows OP-TEE to resume
> > > > execution with a different core on re-entry. If EL3 takes the
> > > > non-secure interrupts directly it will have to make sure to only re-enter
> > OP-TEE on this core as a return from exception.
> > >
> > > Is this easy to be achieved?
> >
> > I don't know, it depends on what you intend to do with this non-secure
> > interrupt. If it's handled at EL3 and then there's a return from exception back
> > to S-EL1 there's likely no harm done. But if there's a world switch involved
> > there might be trouble, OP-TEE might not be in a suitable state for a world
> > switch.
> >
> > >
> > > Or by using opteed_sel1_interrupt_handler, could we have similar
> > > behavior to allow the other core resume execution?
> >
> > Only OP-TEE itself can make a controlled exit as there's an internal state to
> > maintain. Currently that's signalled with a non-secure interrupt.
>
>
> Per EHF, https://trustedfirmware-a.readthedocs.io/en/latest/components/exception-han…
> On GICv3 systems, when executing in S-EL1, pending Non-secure interrupts of
> sufficient priority are signalled as FIQs, and therefore will be routed to EL3.
> As a result, S-EL1 software cannot expect to handle Non-secure interrupts at S-EL1.
> Essentially, this deprecates the routing mode described as CSS=0, TEL3=0.
>
> In order for S-EL1 software to handle Non-secure interrupts while having EHF enabled,
> the dispatcher must adopt a model where Non-secure interrupts are received at EL3,
> but are then synchronously handled over to S-EL1.
>
> The issue to me here how to synchronously handled over to S-EL1 and not break optee.
I understand. OP-TEE is masking interrupts in some critical sections,
while in such a state OP-TEE cannot handle any asynchronous interrupt.
Temporarily masking interrupts is normally a quick operation so we do
it in quite a few places.
So the crux of the problem is to make sure that OP-TEE is in a state
where it can make a controlled exit. I don't have any good ideas for
this right now.
Cheers,
Jens
Hello Folks,
I'm emailing to start an open discussion about the adoption of a concept known as "hand-off blocks" or HOB to become a part of the TF-A Firmware Framework Architecture (FFA). This is something that is a pretty major pain point when it comes to the adoption of TF-A in ARM Server SoC's designed to enable a broad range of highly configurable datacenter platforms.
What is a HOB (Background)?
---------------------------
UEFI PI spec describes a particular definition for how HOB may be used for transitioning between the PEI and DXE boot phases, which is a good reference point for this discussion, but not necessarily the exact solution appropriate for TF-A.
A HOB is simply a dynamically generated data structure passed in between two boot phases. This is information that was obtained through discovery and needs to be passed forward to the next boot phase *once*, with no API needed to call back (e.g. no call back into previous firmware phase is needed to fetch this information at run-time - it is simply passed one time during boot).
There may be one or more HOBs passed in between boot phases. If there are more than one HOB that needs to be passed, this can be in a form of a "HOB table", which (for example) could be a UUID indexed array of pointers to HOB structures, used to locate a HOB of interest (based on UUID). In such cases, instead of passing a single HOB, the boot phases may rely on passing the pointer to the HOB table.
This has been extremely useful concept to employ on highly configurable systems that must rely on flexible discovery mechanisms to initialize and boot the system. This is especially helpful when you have multiple
Why do we need HOBs in TF-A?:
-----------------------------
It is desirable that EL3 firmware (e.g. TF-A) built for ARM Server SoC in a way that is SoC specific *but* platform agnostic. This means that a single ARM SoC that a SiP may deliver to customers may provide a single TF-A binary (e.g. BL1, BL2, BL31) that could be used to support a broad range of platform designs and configurations in order to boot a platform specific firmware (e.g. BL33 and possibly even BL32 code). In order to achieve this, the platform configuration must be *discovered* instead of statically compiled as it is today in TF-A via device tree based enumeration. The mechanisms of discovery may differ broadly depending on the relevant industry standard, or in some cases may have rely on SiP specific discovery flows.
For example: On server systems that support a broad range DIMM memory population/topologies, all the necessary information required to boot is fully discovered via standard JEDEC Serial Presence Detect (SPD) over an I2C bus. Leveraging the SPD bus, may platform variants could be supported with a single TF-A binary. Not only is this information required to initialize memory in early boot phases (e.g. BL2), the subsequent boot phases will also need this SPD info to construct a system physical address map and properly initialize the MMU based on the memory present, and where the memory may be present. Subsequent boot phases (e.g. BL33 / UEFI) may need to generate standard firmware tables to the operating systems, such as SMBIOS tables describing DIMM topology and various ACPI tables (e.g. SLIT, SRAT, even NFIT if NVDIMM's are present).
In short, it all starts with a standardized or vendor specific discovery flow in an early boot stage (e.g. BL1/BL2), followed by the passing of information to the next boot stages (e.g. BL31/BL32/BL33).
Today, every HOB may be a vendor specific structure, but in the future there may be benefit of defining standard HOBs. This may be useful for memory discovery, passing the system physical address map, enabling TPM measured boot, and potentially many other common HOB use-cases.
It would be extremely beneficial to the datacenter market segment if the TF-A community would adopt this concept of information passing between all boot phases as opposed to rely solely on device tree enumeration. This is not intended to replace device tree, rather intended as an alternative way to describe the info that must be discovered and dynamically generated.
Conclusion:
-----------
We are proposing that the TF-A community begin pursuing the adoption of HOBs as a mechanism used for information exchange between each boot stage (e.g. BL1->BL2, BL2->BL31, BL31->BL32, and BL31->BL33)? Longer term we want to explore standardizing some HOB structures for the BL33 phase (e.g. UEFI HOB structures), but initially would like to agree on this being a useful mechanism used to pass information between each boot stage.
Thanks,
--Harb
We already have a Deprecated Interfaces removal policy for core interfaces: https://trustedfirmware-a.readthedocs.io/en/latest/about/release-informatio… although this is not quite the same for platforms the proposed purpose is similar of a managed removing of something that someone has a use case for in the short term.
The Arm platforms as mentioned by Manish are targeted as reference platforms for other project users to inspect which is perhaps a little different than other platform providers. So I think it is appropriate to have a transition period as those references platforms become outdated and normally replaced as it is with the sgm775 with the tc0 platform. I can understand for other platform providers they might want a more accelerated or removal approach and that’s fine I think.
I’m not suggesting we need to create a formal policy but leave it up to individual platform providers to decide how they manage their platforms as they know best how they are used.
Ensuring that the OpenCI is not left in a broken state from a build or test perspective during a deprecation period is of course necessary and the steps suggested by Manish look reasonable to me.
Hope this helps on the intent here.
Joanna
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org> on behalf of Varun Wadekar via TF-A <tf-a(a)lists.trustedfirmware.org>
Reply to: Varun Wadekar <vwadekar(a)nvidia.com>
Date: Thursday, 11 March 2021 at 22:12
To: Manish Pandey2 <Manish.Pandey2(a)arm.com>
Cc: "tf-a(a)lists.trustedfirmware.org" <tf-a(a)lists.trustedfirmware.org>
Subject: Re: [TF-A] Deprecating Arm's sgm775 platform
Hi,
I was wondering if there is any value in keeping non-compiling code in the tree, hence the question. For Tegra it is straight forward, so it would be easy to pull the plug.
-Varun
From: Manish Pandey2 <Manish.Pandey2(a)arm.com>
Sent: Thursday, March 11, 2021 2:44 AM
To: Varun Wadekar <vwadekar(a)nvidia.com>
Cc: tf-a(a)lists.trustedfirmware.org
Subject: Re: Deprecating Arm's sgm775 platform
External email: Use caution opening links or attachments
Hi Varun,
For Arm reference platforms, we are not sure who all are using it. That is why i proposed to keep in repo for around a year before deleting it.
But for NV platforms, if you are sure that nobody is going to require it, you can delete it earlier.
Also, instead of proposed step 2 earlier we can have an alternate
- 2. Don't allow it to be built by default. (introducing PLATFORM_DEPRECATED build macro)
+ 2. Instead of purposefully failing the build we can print a warning message (It's also quite possible that someday during cooling off period it stops to build naturally)
thanks
Manish
________________________________
From: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Sent: 11 March 2021 02:35
To: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Cc: tf-a(a)lists.trustedfirmware.org<mailto:tf-a@lists.trustedfirmware.org> <tf-a(a)lists.trustedfirmware.org<mailto:tf-a@lists.trustedfirmware.org>>
Subject: RE: Deprecating Arm's sgm775 platform
Hi Manish,
Just curious, what would be the reason to keep the platform alive for 2 release cycles? I have one Tegra platform that needs to be deprecated and so would like to understand the thought process.
-Varun
From: TF-A <tf-a-bounces(a)lists.trustedfirmware.org<mailto:tf-a-bounces@lists.trustedfirmware.org>> On Behalf Of Manish Pandey2 via TF-A
Sent: Tuesday, March 9, 2021 2:01 PM
To: tf-a(a)lists.trustedfirmware.org<mailto:tf-a@lists.trustedfirmware.org>
Subject: [TF-A] Deprecating Arm's sgm775 platform
External email: Use caution opening links or attachments
Hi,
The purpose of the email is to notify about deprecation of sgm775 platform and proposed process for deprecating a platform.
Arm's System Guidance for Mobile(SGM-775) is an old platform and no longer maintained. It is superseded by Total Compute(tc0) platform.
Proposal for deprecating a platform:
1. Keep the code in repository. (at least for 2 release cycles)
2. Don't allow it to be built by default. (introducing PLATFORM_DEPRECATED build macro)
3. Disable CI testing.
4. Create appropriate documentation for deprecated platforms.
Let me know if you have any suggestions.
Thanks
Manish P
Hi,
Thank you once again for more of your comments.
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…> to
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6167
All the patches from the patch-set, are reviewed and all the comments are disposed-off till date.
Please share any further action, I need to work on.
Looking forward for your continued support.
Regards
Pankaj
From: Varun Wadekar <vwadekar(a)nvidia.com>
Sent: Tuesday, February 2, 2021 12:11 AM
To: Pankaj Gupta <pankaj.gupta(a)nxp.com>; Manish Pandey2 <Manish.Pandey2(a)arm.com>; Olivier Deprez <Olivier.Deprez(a)arm.com>; javier.almansasobrino(a)arm.com; jimmy.brisson(a)arm.com
Cc: Joanna Farley <Joanna.Farley(a)arm.com>; Alexei Fedorov <Alexei.Fedorov(a)arm.com>; Madhukar Pappireddy <Madhukar.Pappireddy(a)arm.com>
Subject: [EXT] RE: NXP Patch-Set for platform lx2160ardb/lx2160aqds/lx2162aqds
Caution: EXT Email
Thanks Pankaj. I don't have further comments.
From: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Sent: Sunday, January 31, 2021 11:14 PM
To: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>; Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>; Olivier Deprez <Olivier.Deprez(a)arm.com<mailto:Olivier.Deprez@arm.com>>; javier.almansasobrino(a)arm.com<mailto:javier.almansasobrino@arm.com>; jimmy.brisson(a)arm.com<mailto:jimmy.brisson@arm.com>
Cc: Joanna Farley <Joanna.Farley(a)arm.com<mailto:Joanna.Farley@arm.com>>; Alexei Fedorov <Alexei.Fedorov(a)arm.com<mailto:Alexei.Fedorov@arm.com>>; Madhukar Pappireddy <Madhukar.Pappireddy(a)arm.com<mailto:Madhukar.Pappireddy@arm.com>>
Subject: NXP Patch-Set for platform lx2160ardb/lx2160aqds/lx2162aqds
External email: Use caution opening links or attachments
Hi all,
Thanks to all of you, for your efforts in reviewing the patches.
All the patches from the patch-set, are reviewed and all the comments are disposed-off till date.
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…> to https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6167<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
Please share any further action, I need to work on.
Looking forward for your continued support.
Thanks & regards
Pankaj
From: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Sent: Friday, December 4, 2020 10:37 PM
To: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>; Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Cc: Joanna Farley <Joanna.Farley(a)arm.com<mailto:Joanna.Farley@arm.com>>; Alexei Fedorov <Alexei.Fedorov(a)arm.com<mailto:Alexei.Fedorov@arm.com>>; Madhukar Pappireddy <Madhukar.Pappireddy(a)arm.com<mailto:Madhukar.Pappireddy@arm.com>>
Subject: RE: [EXT] RE: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
Caution: EXT Email
Thanks Pankaj and Manish. Glad to see us agreeing to a path forward.
From: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Sent: Thursday, December 3, 2020 11:39 PM
To: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>; Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Cc: Joanna Farley <Joanna.Farley(a)arm.com<mailto:Joanna.Farley@arm.com>>; Alexei Fedorov <Alexei.Fedorov(a)arm.com<mailto:Alexei.Fedorov@arm.com>>; Madhukar Pappireddy <Madhukar.Pappireddy(a)arm.com<mailto:Madhukar.Pappireddy@arm.com>>
Subject: RE: [EXT] RE: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
External email: Use caution opening links or attachments
Hi,
Thanks for the email.
Your suggestion is good too. But with your suggestion, two lines are need for one line using the macro.
My concern is that, there are 6 SoC and 15+ platforms based on these 6 SoC, still pending to be added to this code base.
Keeping things simple in soc.mk and platform.mk is of key importance.
To achieve it:
* Complexity of source file addition is moved away from platform makefile to:
o drivers/nxp/driver.mk, and
o drivers/nxp/<ip>/<ip>.mk
* As a result, the soc.mk & platform.mk is less cluttered.
o With the single line addition based on this macro, it is easier to understand, which IP is part of BL2, BL31 or both.
o All the complexity about IP files to be included or not is moved to drivers/nxp/<ip>/<ip>.mk.
I got your point here.
Since it is very much specific to NXP platforms, it is to be moved to "plat/nxp".
I have tried this way. It is working and ready for review.
Regards
Pankaj
From: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Sent: Friday, December 4, 2020 6:24 AM
To: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>; Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Cc: Joanna Farley <Joanna.Farley(a)arm.com<mailto:Joanna.Farley@arm.com>>; Alexei Fedorov <Alexei.Fedorov(a)arm.com<mailto:Alexei.Fedorov@arm.com>>; Madhukar Pappireddy <Madhukar.Pappireddy(a)arm.com<mailto:Madhukar.Pappireddy@arm.com>>
Subject: Re: [EXT] RE: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
Caution: EXT Email
Hi Pankaj,
I am still trying to understand the complete patchset, also trying to understand different level of makefiles e.g drivers/nxp/drivers.mk(is it really needed?)
I think the main concern is complexity added by intermediate mk files, this complexity can be reduced by declaring most of things in specific platform mk file as we know at compile time which all images need a particular driver.
For e.g XSPI driver, it has same source files in all the 3 scenarios (BL2/BL31 & COMMON) and there is no usage of IMAGE_BL31, IMAGE_BL2 in xspi driver suggesting that Image type does not alters functionality of driver.
So, what we can do is keeping driver mk file simpler and other details in platform mk file.
flexspi_xor.mk will be like:
XSPI_BOOT_SOURCES += $(FLEXSPI_DRIVERS_PATH)/flexspi_nor.c \
${FLEXSPI_DRIVERS_PATH}/fspi.c
ifeq ($(DEBUG),1)
XSPI_BOOT_SOURCES += ${FLEXSPI_DRIVERS_PATH}/test_fspi.c
endif
Platform mk file will be like: (say only bl2 needs xspi)
XSPI_NEEDED := yes
bl2_sources += ${XSPI_BOOT_SOURCES}
Regarding NEED_BL31/NEED_BL2, these flags tell if binary for given BL stage needs to be generated or not.
Finally, I am not saying that your approach is wrong but what i suggested is currently done by most of the platforms.
Also, see my comments on your SET_FLAG patch, if we indeed decide to go ahead with your current approach.
Thanks
Manish
________________________________
From: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Sent: 03 December 2020 17:35
To: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Cc: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Subject: RE: [EXT] RE: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
Hi,
Can you point me to a change that uses the newly introduced makefile macro? IIUC, you just need a way to differentiate between a BL2 v BL31 build.
Manish can you confirm if NEED_BL31 and NEED_BL2 can be helpful in this case?
>> I will replace the SET_FLAG macro with these two flags from entire source tree.
I suppose you are alluding to the NXP platform port only. Correct?
-Varun
From: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Sent: Thursday, December 3, 2020 12:57 AM
To: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Cc: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Subject: RE: [EXT] RE: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
External email: Use caution opening links or attachments
Hi Varun,
Thanks for your email.
NXP make files are implemented as :
1. Each IP driver has its own .mk file.
2. Each platform has its own "platform.mk".
* Every "platform.mk" includes "soc.mk" for the SoC on which this platform is based.
1. Based on the SoC, mandatory IP(s) are included(soc.mk) to BL2 or BL31 or both.
* This requires to pass the flag "<BL2 or BL31 or BL_COMM>_<IP>_NEEDED = yes" from soc.mk to mandatory IP(s) .mk.
1. But for certain IP(s), IP file sources inclusions to either BL2 or BL31, is based on optional features.
* This also requires to pass the flag to IP(s) .mk.
For instance:
* If flexspi_nor as a boot-source, This macro sets 2 flags.
i. XSPI_NEEDED = yes
* XSPI_NEEDED help identify if the xspi.mk needs to be included or not.
ii. BL2_ XSPI_NEEDED = yes
* XSPI_NEEDED needs to be included in BL2
* In optional feature WARM_RESET, I need to save the last reset_cause in flexspi_nor in BL31.
i. Again need two flags: XSPI_NEEDED = yes & BL31_ XSPI_NEEDED = yes
ii. XSPI_NEEDED = yes, is still required as it might happen the boot source is SD.
* In this case BL2_XSPI_NEEDED, is not set.
What I am gaining with this macros is:
* Without this macro, I need to add two lines:
* <IP>_NEEDED = yes.
* To include this driver.
* One of the flag to be added depending on the IP source file inclusion to BL2 or BL31 or BL_COMM:
* Flag as BL2_<IP>_NEEDED = yes
* Flag as BL31_<IP>_NEEDED = yes.
* Flag as BLCOMM_<IP>_NEEDED = yes.
* This macros helps me add one line $(eval $(call SET_FLAG, <IP>_NEEDED,BL2)), instead of above two lines.
If you suggest to remove the SET_FLAG macro, I will replace the SET_FLAG macro with these two flags from entire source tree.
Please share your view.
I reviewed the usage of NEED_BL31 and NEED_BL2.
They are set to 'yes' in ./Makefile, only when BL2_SOURCES & BL31_SOURCES is non-null;
They can be over-ridden, but cannot be used for each IP(s) source file.
Regards
Pankaj
From: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Sent: Thursday, December 3, 2020 4:17 AM
To: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Cc: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Subject: [EXT] RE: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
Caution: EXT Email
Hi,
>From your description, I think you are including different makefiles from NXP tree for BL31 versus BL2. Can you please help me understand why this decision needs to be taken at the top level makefile? Alternatively, why can't NXP platform decide which files to include?
Did you get a chance to review the NEED_BL31, NEED_BL2 makefile variables?
>From the gerrit change it is very difficult to understand how the newly introduced macro is used, so trying to suggest already available options to see if they work for you.
-Varun
From: Pankaj Gupta <pankaj.gupta(a)nxp.com<mailto:pankaj.gupta@nxp.com>>
Sent: Wednesday, December 2, 2020 5:21 AM
To: Varun Wadekar <vwadekar(a)nvidia.com<mailto:vwadekar@nvidia.com>>
Cc: Manish Pandey2 <Manish.Pandey2(a)arm.com<mailto:Manish.Pandey2@arm.com>>
Subject: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/6122<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tr…>
External email: Use caution opening links or attachments
Hi Varun,
As suggested by you, IMAGE_BL31, IMAGE_BL2 etc macros are useful for segregating the code within the same source file.
But this will not serve the purpose in our case.
Let me try to explain you with an example:
-- For one platform; and for a particulate IP driver's source file, if it is true to have in both, then :
#if defined(IMAGE_BL2) || #if defined(IMAGE_BL31)
-- But for another platform and for the same IP driver's source file, if it is true to have in BL2 only, then:
#if defined(IMAGE_BL2)
-- And for another SoC and for the same IP driver's source file, it if is true to have in BL31 only, then:
#if defined(IMAGE_BL31)
It will not be possible to write all the three varying inclusion of code for one IP used across multiple SoC and their platforms.
Now, I will explain how this macro helps me with above case:
* Taking an example of flexspi_nor as a boot-source:
* $(eval $(call SET_FLAG, XSPI_NEEDED,BL2))
* This macro sets 2 flags.
* XSPI_NEEDED = yes
* XSPI_NEEDED help identify if the xspi.mk needs to be included or not.
* BL2_ XSPI_NEEDED = yes
* XSPI_NEEDED needs to be included in BL2.
* For a conditional feature to enable in BL31, XSPI is to be included in BL31.
* BL31_XSPI_NEEDED = yes needs to be set.
* The correct solution should be if the feature is enabled, then:
$(eval $(call SET_FLAG, XSPI_NEEDED,BL31))
* In this case, I cannot set BL_COMM_XSPI_NEED = yes for all the platforms.
I hope, I am able to convey my thoughts to you.
This macro is very important for my code orientation. If you think it will not be required by other contributors, then lets rename this macro by prepending it with NXP or any name you suggests.
Thanks.
Regards
Pankaj
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.