diff mbox

[U-Boot,PATCHv2,2/3] ARMv8/layerscape: Add FSL PPA support

Message ID 1453369489-14131-2-git-send-email-Zhiqiang.Hou@freescale.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

Zhiqiang Hou Jan. 21, 2016, 9:44 a.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

The FSL Primary Protected Application (PPA) is a software component
loaded during boot which runs in TrustZone and remains resident
after boot.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
---
Tested on LS1043A RDB board

V2:
 - Added arguments of boot location pointer to ppa_init.

 arch/arm/cpu/armv8/fsl-layerscape/Makefile     |   1 +
 arch/arm/cpu/armv8/fsl-layerscape/ppa.c        | 212 +++++++++++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S  |  42 +++++
 arch/arm/include/asm/arch-fsl-layerscape/ppa.h |  15 ++
 4 files changed, 270 insertions(+)
 create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/ppa.c
 create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S
 create mode 100644 arch/arm/include/asm/arch-fsl-layerscape/ppa.h

Comments

York Sun Jan. 22, 2016, 8:05 p.m. UTC | #1
On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> 
> The FSL Primary Protected Application (PPA) is a software component
> loaded during boot which runs in TrustZone and remains resident
> after boot.
> 
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> ---
> Tested on LS1043A RDB board
> 

I presume PSCI is implemented in PPA. How does the SMP boot flow change with
PPA? U-boot has to remain functional in the absence of PPA, right?

Would it be possible to write a readme for PPA?

York
Crystal Wood Jan. 22, 2016, 8:09 p.m. UTC | #2
On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > 
> > The FSL Primary Protected Application (PPA) is a software component
> > loaded during boot which runs in TrustZone and remains resident
> > after boot.
> > 
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > ---
> > Tested on LS1043A RDB board
> > 
> 
> I presume PSCI is implemented in PPA. How does the SMP boot flow change with
> PPA? U-boot has to remain functional in the absence of PPA, right?
> 
> Would it be possible to write a readme for PPA?

Also, how does the devicetree get updated to indicate the presence of PSCI?

-Scott
Bhupesh Sharma Jan. 22, 2016, 8:14 p.m. UTC | #3
> -----Original Message-----
> From: Scott Wood [mailto:oss@buserror.net]
> Sent: Saturday, January 23, 2016 1:39 AM
> To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> leoli@freescale.com; prabhakar@freescale.com;
> bhupesh.sharma@freescale.com; Zhiqiang Hou
> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> 
> On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > >
> > > The FSL Primary Protected Application (PPA) is a software component
> > > loaded during boot which runs in TrustZone and remains resident
> > > after boot.
> > >
> > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > ---
> > > Tested on LS1043A RDB board
> > >
> >
> > I presume PSCI is implemented in PPA. How does the SMP boot flow
> > change with PPA? U-boot has to remain functional in the absence of PPA,
> right?
> >
> > Would it be possible to write a readme for PPA?
> 
> Also, how does the devicetree get updated to indicate the presence of
> PSCI?
> 

One needs to add PSCI node in the DTS for the same, claiming support for PSCI specification.
The cpu.enable_method needs to be changed from spin-table to psci as well.

See http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/arm/psci.txt for details.
Crystal Wood Jan. 22, 2016, 8:17 p.m. UTC | #4
On Fri, 2016-01-22 at 20:14 +0000, Bhupesh Sharma wrote:
> 
> > -----Original Message-----
> > From: Scott Wood [mailto:oss@buserror.net]
> > Sent: Saturday, January 23, 2016 1:39 AM
> > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
> > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> > leoli@freescale.com; prabhakar@freescale.com;
> > bhupesh.sharma@freescale.com; Zhiqiang Hou
> > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> > 
> > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > 
> > > > The FSL Primary Protected Application (PPA) is a software component
> > > > loaded during boot which runs in TrustZone and remains resident
> > > > after boot.
> > > > 
> > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > ---
> > > > Tested on LS1043A RDB board
> > > > 
> > > 
> > > I presume PSCI is implemented in PPA. How does the SMP boot flow
> > > change with PPA? U-boot has to remain functional in the absence of PPA,
> > right?
> > > 
> > > Would it be possible to write a readme for PPA?
> > 
> > Also, how does the devicetree get updated to indicate the presence of
> > PSCI?
> > 
> 
> One needs to add PSCI node in the DTS for the same, claiming support for
> PSCI specification.

So then we need a different dts based on whether PPA is loaded?  No thanks.

> The cpu.enable_method needs to be changed from spin-table to psci as well.

Right, that's part of updating the devicetree to indicate the presence of
PSCI.

> See http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/a
> rm/psci.txt for details.

I'm familiar with the binding.

-Scott
York Sun Jan. 22, 2016, 8:18 p.m. UTC | #5
On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:
> 
> 
>> -----Original Message-----
>> From: Scott Wood [mailto:oss@buserror.net]
>> Sent: Saturday, January 23, 2016 1:39 AM
>> To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
>> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
>> leoli@freescale.com; prabhakar@freescale.com;
>> bhupesh.sharma@freescale.com; Zhiqiang Hou
>> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
>>
>> On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
>>> On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
>>>> From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
>>>>
>>>> The FSL Primary Protected Application (PPA) is a software component
>>>> loaded during boot which runs in TrustZone and remains resident
>>>> after boot.
>>>>
>>>> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
>>>> ---
>>>> Tested on LS1043A RDB board
>>>>
>>>
>>> I presume PSCI is implemented in PPA. How does the SMP boot flow
>>> change with PPA? U-boot has to remain functional in the absence of PPA,
>> right?
>>>
>>> Would it be possible to write a readme for PPA?
>>
>> Also, how does the devicetree get updated to indicate the presence of
>> PSCI?
>>
> 
> One needs to add PSCI node in the DTS for the same, claiming support for PSCI specification.
> The cpu.enable_method needs to be changed from spin-table to psci as well.
> 
> See http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/arm/psci.txt for details.
> 

Bhupesh,

Before PPA is fully adopted, u-boot has to detect the existence of PPA and
decide to use PSCI or spin table, right? So the device tree node should also be
fixed accordingly.

York
Crystal Wood Jan. 22, 2016, 8:21 p.m. UTC | #6
On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:
> On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:
> > 
> > 
> > > -----Original Message-----
> > > From: Scott Wood [mailto:oss@buserror.net]
> > > Sent: Saturday, January 23, 2016 1:39 AM
> > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
> > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> > > leoli@freescale.com; prabhakar@freescale.com;
> > > bhupesh.sharma@freescale.com; Zhiqiang Hou
> > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> > > 
> > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > 
> > > > > The FSL Primary Protected Application (PPA) is a software component
> > > > > loaded during boot which runs in TrustZone and remains resident
> > > > > after boot.
> > > > > 
> > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > ---
> > > > > Tested on LS1043A RDB board
> > > > > 
> > > > 
> > > > I presume PSCI is implemented in PPA. How does the SMP boot flow
> > > > change with PPA? U-boot has to remain functional in the absence of
> > > > PPA,
> > > right?
> > > > 
> > > > Would it be possible to write a readme for PPA?
> > > 
> > > Also, how does the devicetree get updated to indicate the presence of
> > > PSCI?
> > > 
> > 
> > One needs to add PSCI node in the DTS for the same, claiming support for
> > PSCI specification.
> > The cpu.enable_method needs to be changed from spin-table to psci as well.
> > 
> > See http://lxr.free-electrons.com/source/Documentation/devicetree/bindings
> > /arm/psci.txt for details.
> > 
> 
> Bhupesh,
> 
> Before PPA is fully adopted, u-boot has to detect the existence of PPA and
> decide to use PSCI or spin table, right? So the device tree node should also
> be
> fixed accordingly.

How would U-Boot know what version of PSCI the loaded PPA supports?  Is or
could there be any metadata on the PPA image to convey such information?

-Scott
Bhupesh Sharma Jan. 22, 2016, 8:26 p.m. UTC | #7
> From: Scott Wood [mailto:oss@buserror.net]
> Sent: Saturday, January 23, 2016 1:48 AM
> On Fri, 2016-01-22 at 20:14 +0000, Bhupesh Sharma wrote:
> >
> > > -----Original Message-----
> > > From: Scott Wood [mailto:oss@buserror.net]
> > > Sent: Saturday, January 23, 2016 1:39 AM
> > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
> > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> > > leoli@freescale.com; prabhakar@freescale.com;
> > > bhupesh.sharma@freescale.com; Zhiqiang Hou
> > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> > >
> > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > >
> > > > > The FSL Primary Protected Application (PPA) is a software
> > > > > component loaded during boot which runs in TrustZone and remains
> > > > > resident after boot.
> > > > >
> > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > ---
> > > > > Tested on LS1043A RDB board
> > > > >
> > > >
> > > > I presume PSCI is implemented in PPA. How does the SMP boot flow
> > > > change with PPA? U-boot has to remain functional in the absence of
> > > > PPA,
> > > right?
> > > >
> > > > Would it be possible to write a readme for PPA?
> > >
> > > Also, how does the devicetree get updated to indicate the presence
> > > of PSCI?
> > >
> >
> > One needs to add PSCI node in the DTS for the same, claiming support
> > for PSCI specification.
> 
> So then we need a different dts based on whether PPA is loaded?  No
> thanks.

For e.g the current LS2080A DTS has no separate node for PSCI, the same can be patched-up/added
by the Bootloader.

> 
> > The cpu.enable_method needs to be changed from spin-table to psci as
> well.
> 
> Right, that's part of updating the devicetree to indicate the presence of
> PSCI.

Similarly the cpu.enable-method is also empty in the LS2080A DTS to allow Bootloader to patch
it accordingly.
 
Please see: http://lxr.free-electrons.com/source/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi#L65 

> > See
> > http://lxr.free-electrons.com/source/Documentation/devicetree/bindings
> > /a
> > rm/psci.txt for details.
> 
> I'm familiar with the binding.

Regards,
Bhupesh
Bhupesh Sharma Jan. 22, 2016, 8:27 p.m. UTC | #8
> -----Original Message-----
> From: Scott Wood [mailto:oss@buserror.net]
> Sent: Saturday, January 23, 2016 1:52 AM
> To: york sun; Bhupesh Sharma; Zhiqiang Hou; u-boot@lists.denx.de;
> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> leoli@freescale.com; prabhakar@freescale.com;
> bhupesh.sharma@freescale.com; Zhiqiang Hou
> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> 
> On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:
> > On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Scott Wood [mailto:oss@buserror.net]
> > > > Sent: Saturday, January 23, 2016 1:39 AM
> > > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
> > > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> > > > leoli@freescale.com; prabhakar@freescale.com;
> > > > bhupesh.sharma@freescale.com; Zhiqiang Hou
> > > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> > > >
> > > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> > > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > >
> > > > > > The FSL Primary Protected Application (PPA) is a software
> > > > > > component loaded during boot which runs in TrustZone and
> > > > > > remains resident after boot.
> > > > > >
> > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > > ---
> > > > > > Tested on LS1043A RDB board
> > > > > >
> > > > >
> > > > > I presume PSCI is implemented in PPA. How does the SMP boot flow
> > > > > change with PPA? U-boot has to remain functional in the absence
> > > > > of PPA,
> > > > right?
> > > > >
> > > > > Would it be possible to write a readme for PPA?
> > > >
> > > > Also, how does the devicetree get updated to indicate the presence
> > > > of PSCI?
> > > >
> > >
> > > One needs to add PSCI node in the DTS for the same, claiming support
> > > for PSCI specification.
> > > The cpu.enable_method needs to be changed from spin-table to psci as
> well.
> > >
> > > See
> > > http://lxr.free-electrons.com/source/Documentation/devicetree/bindin
> > > gs
> > > /arm/psci.txt for details.
> > >
> >
> > Bhupesh,
> >
> > Before PPA is fully adopted, u-boot has to detect the existence of PPA
> > and decide to use PSCI or spin table, right? So the device tree node
> > should also be fixed accordingly.

A static CONFIG_ flag is used for enabling the PPA support currently in QorIQ-LS u-boot code.

> 
> How would U-Boot know what version of PSCI the loaded PPA supports?  Is
> or could there be any metadata on the PPA image to convey such
> information?

PSCI specifications support the PSCI_VERSION API which is implemented by PPA and it returns the PSCI_VERSION
supported by PPA.

Regards,
Bhupesh
York Sun Jan. 22, 2016, 8:30 p.m. UTC | #9
On 01/22/2016 12:27 PM, Bhupesh Sharma wrote:
> 
> 
>> -----Original Message-----
>> From: Scott Wood [mailto:oss@buserror.net]
>> Sent: Saturday, January 23, 2016 1:52 AM
>> To: york sun; Bhupesh Sharma; Zhiqiang Hou; u-boot@lists.denx.de;
>> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
>> leoli@freescale.com; prabhakar@freescale.com;
>> bhupesh.sharma@freescale.com; Zhiqiang Hou
>> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
>>
>> On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:
>>> On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Scott Wood [mailto:oss@buserror.net]
>>>>> Sent: Saturday, January 23, 2016 1:39 AM
>>>>> To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
>>>>> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
>>>>> leoli@freescale.com; prabhakar@freescale.com;
>>>>> bhupesh.sharma@freescale.com; Zhiqiang Hou
>>>>> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
>>>>>
>>>>> On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
>>>>>> On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
>>>>>>> From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
>>>>>>>
>>>>>>> The FSL Primary Protected Application (PPA) is a software
>>>>>>> component loaded during boot which runs in TrustZone and
>>>>>>> remains resident after boot.
>>>>>>>
>>>>>>> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
>>>>>>> ---
>>>>>>> Tested on LS1043A RDB board
>>>>>>>
>>>>>>
>>>>>> I presume PSCI is implemented in PPA. How does the SMP boot flow
>>>>>> change with PPA? U-boot has to remain functional in the absence
>>>>>> of PPA,
>>>>> right?
>>>>>>
>>>>>> Would it be possible to write a readme for PPA?
>>>>>
>>>>> Also, how does the devicetree get updated to indicate the presence
>>>>> of PSCI?
>>>>>
>>>>
>>>> One needs to add PSCI node in the DTS for the same, claiming support
>>>> for PSCI specification.
>>>> The cpu.enable_method needs to be changed from spin-table to psci as
>> well.
>>>>
>>>> See
>>>> http://lxr.free-electrons.com/source/Documentation/devicetree/bindin
>>>> gs
>>>> /arm/psci.txt for details.
>>>>
>>>
>>> Bhupesh,
>>>
>>> Before PPA is fully adopted, u-boot has to detect the existence of PPA
>>> and decide to use PSCI or spin table, right? So the device tree node
>>> should also be fixed accordingly.
> 
> A static CONFIG_ flag is used for enabling the PPA support currently in QorIQ-LS u-boot code.

Not enough. The driver parse PPA image and gives up if it is not a valid image.
Before we have a way to deploy PPA image to all our customers, we need to keep
both options open.

York
Crystal Wood Jan. 22, 2016, 8:32 p.m. UTC | #10
On Fri, 2016-01-22 at 20:27 +0000, Bhupesh Sharma wrote:
> 
> > -----Original Message-----
> > From: Scott Wood [mailto:oss@buserror.net]
> > Sent: Saturday, January 23, 2016 1:52 AM
> > To: york sun; Bhupesh Sharma; Zhiqiang Hou; u-boot@lists.denx.de;
> > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> > leoli@freescale.com; prabhakar@freescale.com;
> > bhupesh.sharma@freescale.com; Zhiqiang Hou
> > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> > 
> > On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:
> > > On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:
> > > > 
> > > > 
> > > > > -----Original Message-----
> > > > > From: Scott Wood [mailto:oss@buserror.net]
> > > > > Sent: Saturday, January 23, 2016 1:39 AM
> > > > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;
> > > > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;
> > > > > leoli@freescale.com; prabhakar@freescale.com;
> > > > > bhupesh.sharma@freescale.com; Zhiqiang Hou
> > > > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support
> > > > > 
> > > > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:
> > > > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:
> > > > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > > > 
> > > > > > > The FSL Primary Protected Application (PPA) is a software
> > > > > > > component loaded during boot which runs in TrustZone and
> > > > > > > remains resident after boot.
> > > > > > > 
> > > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
> > > > > > > ---
> > > > > > > Tested on LS1043A RDB board
> > > > > > > 
> > > > > > 
> > > > > > I presume PSCI is implemented in PPA. How does the SMP boot flow
> > > > > > change with PPA? U-boot has to remain functional in the absence
> > > > > > of PPA,
> > > > > right?
> > > > > > 
> > > > > > Would it be possible to write a readme for PPA?
> > > > > 
> > > > > Also, how does the devicetree get updated to indicate the presence
> > > > > of PSCI?
> > > > > 
> > > > 
> > > > One needs to add PSCI node in the DTS for the same, claiming support
> > > > for PSCI specification.
> > > > The cpu.enable_method needs to be changed from spin-table to psci as
> > well.
> > > > 
> > > > See
> > > > http://lxr.free-electrons.com/source/Documentation/devicetree/bindin
> > > > gs
> > > > /arm/psci.txt for details.
> > > > 
> > > 
> > > Bhupesh,
> > > 
> > > Before PPA is fully adopted, u-boot has to detect the existence of PPA
> > > and decide to use PSCI or spin table, right? So the device tree node
> > > should also be fixed accordingly.
> 
> A static CONFIG_ flag is used for enabling the PPA support currently in
> QorIQ-LS u-boot code.
> 
> > 
> > How would U-Boot know what version of PSCI the loaded PPA supports?  Is
> > or could there be any metadata on the PPA image to convey such
> > information?
> 
> PSCI specifications support the PSCI_VERSION API which is implemented by PPA
> and it returns the PSCI_VERSION
> supported by PPA.

That does not answer the question unless we can assume that PPA always
implements PSCI >= 0.2.  And maybe there are other services worth advertising
in the device tree?  Some sort of metadata would be nice.

-Scott
Z.Q. Hou Jan. 25, 2016, 3:02 a.m. UTC | #11
Hi York,

Sorry, I didn't touch the PSCI in u-boot and what works the PPA is doing, I just work on
integrating PPA to u-boot.

Hi Rod and Chenhui,

Can you help to answer the questions about the PSCI and PPA?

> -----Original Message-----

> From: york sun

> Sent: 2016年1月23日 4:05

> To: Zhiqiang Hou <Zhiqiang.Hou@freescale.com>; u-boot@lists.denx.de;

> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder

> <stuart.yoder@nxp.com>; leoli@freescale.com; prabhakar@freescale.com;

> bhupesh.sharma@freescale.com; Zhiqiang Hou <zhiqiang.hou@nxp.com>; Scott

> Wood <oss@buserror.net>

> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:

> > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> >

> > The FSL Primary Protected Application (PPA) is a software component

> > loaded during boot which runs in TrustZone and remains resident after

> > boot.

> >

> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > ---

> > Tested on LS1043A RDB board

> >

> 

> I presume PSCI is implemented in PPA. How does the SMP boot flow change with

> PPA? U-boot has to remain functional in the absence of PPA, right?

> 

> Would it be possible to write a readme for PPA?

> 


Thanks,
Zhiqiang
Z.Q. Hou Jan. 25, 2016, 3:09 a.m. UTC | #12
Hi Rod and Chenhui,

Can you help to answer the questions about PSCI?

> -----Original Message-----

> From: Scott Wood [mailto:oss@buserror.net]

> Sent: 2016年1月23日 4:09

> To: york sun <york.sun@nxp.com>; Zhiqiang Hou <Zhiqiang.Hou@freescale.com>;

> u-boot@lists.denx.de; albert.u.boot@aribaud.net; Mingkai.hu@freescale.com;

> Stuart Yoder <stuart.yoder@nxp.com>; leoli@freescale.com;

> prabhakar@freescale.com; bhupesh.sharma@freescale.com; Zhiqiang Hou

> <zhiqiang.hou@nxp.com>

> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:

> > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:

> > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > >

> > > The FSL Primary Protected Application (PPA) is a software component

> > > loaded during boot which runs in TrustZone and remains resident

> > > after boot.

> > >

> > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > ---

> > > Tested on LS1043A RDB board

> > >

> >

> > I presume PSCI is implemented in PPA. How does the SMP boot flow

> > change with PPA? U-boot has to remain functional in the absence of PPA, right?

> >

> > Would it be possible to write a readme for PPA?

> 

> Also, how does the devicetree get updated to indicate the presence of PSCI?

> 


Thanks,
Zhiqiang
Z.Q. Hou Jan. 25, 2016, 3:11 a.m. UTC | #13
Hi Rod and Chenhui,

Can you help to answer the questions about PSCI?

> -----Original Message-----

> From: Scott Wood [mailto:oss@buserror.net]

> Sent: 2016年1月23日 4:18

> To: Bhupesh Sharma <bhupesh.sharma@nxp.com>; york sun <york.sun@nxp.com>;

> Zhiqiang Hou <Zhiqiang.Hou@freescale.com>; u-boot@lists.denx.de;

> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder

> <stuart.yoder@nxp.com>; leoli@freescale.com; prabhakar@freescale.com;

> bhupesh.sharma@freescale.com; Zhiqiang Hou <zhiqiang.hou@nxp.com>

> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> On Fri, 2016-01-22 at 20:14 +0000, Bhupesh Sharma wrote:

> >

> > > -----Original Message-----

> > > From: Scott Wood [mailto:oss@buserror.net]

> > > Sent: Saturday, January 23, 2016 1:39 AM

> > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;

> > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;

> > > leoli@freescale.com; prabhakar@freescale.com;

> > > bhupesh.sharma@freescale.com; Zhiqiang Hou

> > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> > >

> > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:

> > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:

> > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > > >

> > > > > The FSL Primary Protected Application (PPA) is a software

> > > > > component loaded during boot which runs in TrustZone and remains

> > > > > resident after boot.

> > > > >

> > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > > > ---

> > > > > Tested on LS1043A RDB board

> > > > >

> > > >

> > > > I presume PSCI is implemented in PPA. How does the SMP boot flow

> > > > change with PPA? U-boot has to remain functional in the absence of

> > > > PPA,

> > > right?

> > > >

> > > > Would it be possible to write a readme for PPA?

> > >

> > > Also, how does the devicetree get updated to indicate the presence

> > > of PSCI?

> > >

> >

> > One needs to add PSCI node in the DTS for the same, claiming support

> > for PSCI specification.

> 

> So then we need a different dts based on whether PPA is loaded?  No thanks.

> 

> > The cpu.enable_method needs to be changed from spin-table to psci as well.

> 

> Right, that's part of updating the devicetree to indicate the presence of PSCI.

> 

> > See

> > http://lxr.free-electrons.com/source/Documentation/devicetree/bindings

> > /a

> > rm/psci.txt for details.

> 

> I'm familiar with the binding.

> 

> -Scott
Z.Q. Hou Jan. 25, 2016, 3:15 a.m. UTC | #14
Hi Rod and Chenhui,

Can you help to answer the questions about PSCI and PPA?

> -----Original Message-----

> From: Scott Wood [mailto:oss@buserror.net]

> Sent: 2016年1月23日 4:22

> To: york sun <york.sun@nxp.com>; Bhupesh Sharma <bhupesh.sharma@nxp.com>;

> Zhiqiang Hou <Zhiqiang.Hou@freescale.com>; u-boot@lists.denx.de;

> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder

> <stuart.yoder@nxp.com>; leoli@freescale.com; prabhakar@freescale.com;

> bhupesh.sharma@freescale.com; Zhiqiang Hou <zhiqiang.hou@nxp.com>

> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:

> > On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:

> > >

> > >

> > > > -----Original Message-----

> > > > From: Scott Wood [mailto:oss@buserror.net]

> > > > Sent: Saturday, January 23, 2016 1:39 AM

> > > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;

> > > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;

> > > > leoli@freescale.com; prabhakar@freescale.com;

> > > > bhupesh.sharma@freescale.com; Zhiqiang Hou

> > > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> > > >

> > > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:

> > > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:

> > > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > > > >

> > > > > > The FSL Primary Protected Application (PPA) is a software

> > > > > > component loaded during boot which runs in TrustZone and

> > > > > > remains resident after boot.

> > > > > >

> > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > > > > ---

> > > > > > Tested on LS1043A RDB board

> > > > > >

> > > > >

> > > > > I presume PSCI is implemented in PPA. How does the SMP boot flow

> > > > > change with PPA? U-boot has to remain functional in the absence

> > > > > of PPA,

> > > > right?

> > > > >

> > > > > Would it be possible to write a readme for PPA?

> > > >

> > > > Also, how does the devicetree get updated to indicate the presence

> > > > of PSCI?

> > > >

> > >

> > > One needs to add PSCI node in the DTS for the same, claiming support

> > > for PSCI specification.

> > > The cpu.enable_method needs to be changed from spin-table to psci as well.

> > >

> > > See

> > > http://lxr.free-electrons.com/source/Documentation/devicetree/bindin

> > > gs

> > > /arm/psci.txt for details.

> > >

> >

> > Bhupesh,

> >

> > Before PPA is fully adopted, u-boot has to detect the existence of PPA

> > and decide to use PSCI or spin table, right? So the device tree node

> > should also be fixed accordingly.

> 

> How would U-Boot know what version of PSCI the loaded PPA supports?  Is or

> could there be any metadata on the PPA image to convey such information?

> 


Thanks,
Zhiqiang
Z.Q. Hou Jan. 25, 2016, 3:16 a.m. UTC | #15
+ Rod and Chenhui

> -----Original Message-----

> From: Zhiqiang Hou

> Sent: 2016年1月25日 11:16

> To: 'Scott Wood' <oss@buserror.net>; york sun <york.sun@nxp.com>; Bhupesh

> Sharma <bhupesh.sharma@nxp.com>; Zhiqiang Hou

> <Zhiqiang.Hou@freescale.com>; u-boot@lists.denx.de;

> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder

> <stuart.yoder@nxp.com>; leoli@freescale.com; prabhakar@freescale.com;

> bhupesh.sharma@freescale.com

> Subject: RE: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> Hi Rod and Chenhui,

> 

> Can you help to answer the questions about PSCI and PPA?

> 

> > -----Original Message-----

> > From: Scott Wood [mailto:oss@buserror.net]

> > Sent: 2016年1月23日 4:22

> > To: york sun <york.sun@nxp.com>; Bhupesh Sharma

> > <bhupesh.sharma@nxp.com>; Zhiqiang Hou <Zhiqiang.Hou@freescale.com>;

> > u-boot@lists.denx.de; albert.u.boot@aribaud.net;

> > Mingkai.hu@freescale.com; Stuart Yoder <stuart.yoder@nxp.com>;

> > leoli@freescale.com; prabhakar@freescale.com;

> > bhupesh.sharma@freescale.com; Zhiqiang Hou <zhiqiang.hou@nxp.com>

> > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> >

> > On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:

> > > On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:

> > > >

> > > >

> > > > > -----Original Message-----

> > > > > From: Scott Wood [mailto:oss@buserror.net]

> > > > > Sent: Saturday, January 23, 2016 1:39 AM

> > > > > To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;

> > > > > albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart

> > > > > Yoder; leoli@freescale.com; prabhakar@freescale.com;

> > > > > bhupesh.sharma@freescale.com; Zhiqiang Hou

> > > > > Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> > > > >

> > > > > On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:

> > > > > > On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:

> > > > > > > From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > > > > >

> > > > > > > The FSL Primary Protected Application (PPA) is a software

> > > > > > > component loaded during boot which runs in TrustZone and

> > > > > > > remains resident after boot.

> > > > > > >

> > > > > > > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> > > > > > > ---

> > > > > > > Tested on LS1043A RDB board

> > > > > > >

> > > > > >

> > > > > > I presume PSCI is implemented in PPA. How does the SMP boot

> > > > > > flow change with PPA? U-boot has to remain functional in the

> > > > > > absence of PPA,

> > > > > right?

> > > > > >

> > > > > > Would it be possible to write a readme for PPA?

> > > > >

> > > > > Also, how does the devicetree get updated to indicate the

> > > > > presence of PSCI?

> > > > >

> > > >

> > > > One needs to add PSCI node in the DTS for the same, claiming

> > > > support for PSCI specification.

> > > > The cpu.enable_method needs to be changed from spin-table to psci as well.

> > > >

> > > > See

> > > > http://lxr.free-electrons.com/source/Documentation/devicetree/bind

> > > > in

> > > > gs

> > > > /arm/psci.txt for details.

> > > >

> > >

> > > Bhupesh,

> > >

> > > Before PPA is fully adopted, u-boot has to detect the existence of

> > > PPA and decide to use PSCI or spin table, right? So the device tree

> > > node should also be fixed accordingly.

> >

> > How would U-Boot know what version of PSCI the loaded PPA supports?

> > Is or could there be any metadata on the PPA image to convey such information?

> >

> 

> Thanks,

> Zhiqiang
Z.Q. Hou Jan. 25, 2016, 3:22 a.m. UTC | #16
Hi Rod and Chenhui,

Can you help to answer the questions about PSCI and PPA?

> -----Original Message-----

> From: york sun

> Sent: 2016年1月23日 4:30

> To: Bhupesh Sharma <bhupesh.sharma@nxp.com>; Scott Wood

> <oss@buserror.net>; Zhiqiang Hou <Zhiqiang.Hou@freescale.com>; u-

> boot@lists.denx.de; albert.u.boot@aribaud.net; Mingkai.hu@freescale.com;

> Stuart Yoder <stuart.yoder@nxp.com>; leoli@freescale.com;

> prabhakar@freescale.com; bhupesh.sharma@freescale.com; Zhiqiang Hou

> <zhiqiang.hou@nxp.com>

> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> On 01/22/2016 12:27 PM, Bhupesh Sharma wrote:

> >

> >

> >> -----Original Message-----

> >> From: Scott Wood [mailto:oss@buserror.net]

> >> Sent: Saturday, January 23, 2016 1:52 AM

> >> To: york sun; Bhupesh Sharma; Zhiqiang Hou; u-boot@lists.denx.de;

> >> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;

> >> leoli@freescale.com; prabhakar@freescale.com;

> >> bhupesh.sharma@freescale.com; Zhiqiang Hou

> >> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> >>

> >> On Fri, 2016-01-22 at 20:18 +0000, york sun wrote:

> >>> On 01/22/2016 12:14 PM, Bhupesh Sharma wrote:

> >>>>

> >>>>

> >>>>> -----Original Message-----

> >>>>> From: Scott Wood [mailto:oss@buserror.net]

> >>>>> Sent: Saturday, January 23, 2016 1:39 AM

> >>>>> To: york sun; Zhiqiang Hou; u-boot@lists.denx.de;

> >>>>> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder;

> >>>>> leoli@freescale.com; prabhakar@freescale.com;

> >>>>> bhupesh.sharma@freescale.com; Zhiqiang Hou

> >>>>> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> >>>>>

> >>>>> On Fri, 2016-01-22 at 20:05 +0000, york sun wrote:

> >>>>>> On 01/21/2016 01:53 AM, Zhiqiang Hou wrote:

> >>>>>>> From: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> >>>>>>>

> >>>>>>> The FSL Primary Protected Application (PPA) is a software

> >>>>>>> component loaded during boot which runs in TrustZone and remains

> >>>>>>> resident after boot.

> >>>>>>>

> >>>>>>> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>

> >>>>>>> ---

> >>>>>>> Tested on LS1043A RDB board

> >>>>>>>

> >>>>>>

> >>>>>> I presume PSCI is implemented in PPA. How does the SMP boot flow

> >>>>>> change with PPA? U-boot has to remain functional in the absence

> >>>>>> of PPA,

> >>>>> right?

> >>>>>>

> >>>>>> Would it be possible to write a readme for PPA?

> >>>>>

> >>>>> Also, how does the devicetree get updated to indicate the presence

> >>>>> of PSCI?

> >>>>>

> >>>>

> >>>> One needs to add PSCI node in the DTS for the same, claiming

> >>>> support for PSCI specification.

> >>>> The cpu.enable_method needs to be changed from spin-table to psci

> >>>> as

> >> well.

> >>>>

> >>>> See

> >>>> http://lxr.free-electrons.com/source/Documentation/devicetree/bindi

> >>>> n

> >>>> gs

> >>>> /arm/psci.txt for details.

> >>>>

> >>>

> >>> Bhupesh,

> >>>

> >>> Before PPA is fully adopted, u-boot has to detect the existence of

> >>> PPA and decide to use PSCI or spin table, right? So the device tree

> >>> node should also be fixed accordingly.

> >

> > A static CONFIG_ flag is used for enabling the PPA support currently in QorIQ-LS

> u-boot code.

> 

> Not enough. The driver parse PPA image and gives up if it is not a valid image.

> Before we have a way to deploy PPA image to all our customers, we need to keep

> both options open.

> 


Chenhui is working on it.

Thanks,
Zhiqiang
York Sun March 17, 2016, 9:09 p.m. UTC | #17
On 01/24/2016 07:22 PM, Zhiqiang Hou wrote:
> 
> Chenhui is working on it.
> 

Guys,

Where are we on this set?

York
Z.Q. Hou March 23, 2016, 3:17 a.m. UTC | #18
Hi Chenhui,

Do you have any update about how to fixup the related device node according to the PSCI and spin-table?

> -----Original Message-----

> From: york sun

> Sent: 2016年3月18日 5:09

> To: Zhiqiang Hou <zhiqiang.hou@nxp.com>; Bhupesh Sharma

> <bhupesh.sharma@nxp.com>; Scott Wood <oss@buserror.net>; Zhiqiang Hou

> <Zhiqiang.Hou@freescale.com>; u-boot@lists.denx.de;

> albert.u.boot@aribaud.net; Mingkai.hu@freescale.com; Stuart Yoder

> <stuart.yoder@nxp.com>; leoli@freescale.com; prabhakar@freescale.com;

> bhupesh.sharma@freescale.com; Rod Dorris <rod.dorris@nxp.com>; Chenhui

> Zhao <chenhui.zhao@nxp.com>

> Subject: Re: [PATCHv2 2/3] ARMv8/layerscape: Add FSL PPA support

> 

> On 01/24/2016 07:22 PM, Zhiqiang Hou wrote:

> >

> > Chenhui is working on it.

> >

> 

> Guys,

> 

> Where are we on this set?

> 

> York

> 


Thanks,
Zhiqiang
diff mbox

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Makefile b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
index cce7405..27bfeb1 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Makefile
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
@@ -10,6 +10,7 @@  obj-y += soc.o
 obj-$(CONFIG_MP) += mp.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
 obj-$(CONFIG_SPL) += spl.o
+obj-$(CONFIG_FSL_LS_PPA) += ppa.o ppa_entry.o
 
 ifneq ($(CONFIG_FSL_LSCH3),)
 obj-y += fsl_lsch3_speed.o
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
new file mode 100644
index 0000000..db767f9
--- /dev/null
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
@@ -0,0 +1,212 @@ 
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <config.h>
+#include <errno.h>
+#include <malloc.h>
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/types.h>
+#include <asm/macro.h>
+#include <asm/arch/soc.h>
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#elif defined(CONFIG_FSL_LSCH2)
+#include <asm/arch/immap_lsch2.h>
+#endif
+#include <asm/arch/ppa.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+extern void c_runtime_cpu_setup(void);
+
+#define LS_PPA_FIT_FIRMWARE_IMAGE	"firmware"
+#define LS_PPA_FIT_CNF_NAME		"config@1"
+#define PPA_MEM_SIZE_ENV_VAR		"ppamemsize"
+
+/*
+ * Return the actual size of the PPA private DRAM block.
+ */
+unsigned long ppa_get_dram_block_size(void)
+{
+	unsigned long dram_block_size = CONFIG_SYS_LS_PPA_DRAM_BLOCK_MIN_SIZE;
+
+	char *dram_block_size_env_var = getenv(PPA_MEM_SIZE_ENV_VAR);
+
+	if (dram_block_size_env_var) {
+		dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
+						 10);
+
+		if (dram_block_size < CONFIG_SYS_LS_PPA_DRAM_BLOCK_MIN_SIZE) {
+			printf("fsl-ppa: WARNING: Invalid value for \'"
+			       PPA_MEM_SIZE_ENV_VAR
+			       "\' environment variable: %lu\n",
+			       dram_block_size);
+
+			dram_block_size = CONFIG_SYS_LS_PPA_DRAM_BLOCK_MIN_SIZE;
+		}
+	}
+
+	return dram_block_size;
+}
+
+/*
+ * PPA firmware FIT image parser checks if the image is in FIT
+ * format, verifies integrity of the image and calculates raw
+ * image address and size values.
+ *
+ * Returns 0 on success and a negative errno on error task fail.
+ */
+static int parse_ppa_firmware_fit_image(const void **raw_image_addr,
+				size_t *raw_image_size)
+{
+	const void *ppa_data;
+	size_t ppa_size;
+	void *fit_hdr;
+	int conf_node_off, fw_node_off;
+	char *conf_node_name = NULL;
+
+#ifdef CONFIG_SYS_LS_PPA_FW_IN_NOR
+	fit_hdr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
+#else
+#error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
+#endif
+
+	conf_node_name = LS_PPA_FIT_CNF_NAME;
+
+	if (fdt_check_header(fit_hdr)) {
+		printf("fsl-ppa: Bad firmware image (not a FIT image)\n");
+		return -EINVAL;
+	}
+
+	if (!fit_check_format(fit_hdr)) {
+		printf("fsl-ppa: Bad firmware image (bad FIT header)\n");
+		return -EINVAL;
+	}
+
+	conf_node_off = fit_conf_get_node(fit_hdr, conf_node_name);
+	if (conf_node_off < 0) {
+		printf("fsl-ppa: %s: no such config\n", conf_node_name);
+		return -ENOENT;
+	}
+
+	fw_node_off = fit_conf_get_prop_node(fit_hdr, conf_node_off,
+			LS_PPA_FIT_FIRMWARE_IMAGE);
+	if (fw_node_off < 0) {
+		printf("fsl-ppa: No '%s' in config\n",
+				LS_PPA_FIT_FIRMWARE_IMAGE);
+		return -ENOLINK;
+	}
+
+	/* Verify PPA firmware image */
+	if (!(fit_image_verify(fit_hdr, fw_node_off))) {
+		printf("fsl-ppa: Bad firmware image (bad CRC)\n");
+		return -EINVAL;
+	}
+
+	if (fit_image_get_data(fit_hdr, fw_node_off, &ppa_data, &ppa_size)) {
+		printf("fsl-ppa: Can't get %s subimage data/size",
+				LS_PPA_FIT_FIRMWARE_IMAGE);
+		return -ENOENT;
+	}
+
+	debug("fsl-ppa: raw_image_addr = 0x%p, raw_image_size = 0x%lx\n",
+			ppa_data, ppa_size);
+	*raw_image_addr = ppa_data;
+	*raw_image_size = ppa_size;
+
+	return 0;
+}
+
+static int ppa_copy_image(const char *title,
+			 u64 image_addr, u32 image_size, u64 ppa_ram_addr)
+{
+	debug("%s copied to address 0x%p\n", title, (void *)ppa_ram_addr);
+	memcpy((void *)ppa_ram_addr, (void *)image_addr, image_size);
+	flush_dcache_range(ppa_ram_addr, ppa_ram_addr + image_size);
+
+	return 0;
+}
+
+int ppa_init_pre(u64 *entry)
+{
+	u64 ppa_ram_addr;
+	const void *raw_image_addr;
+	size_t raw_image_size = 0;
+	size_t ppa_ram_size = ppa_get_dram_block_size();
+	int ret;
+
+	debug("fsl-ppa: ppa size(0x%lx)\n", ppa_ram_size);
+
+	/*
+	 * The PPA must be stored in secure memory.
+	 * Append PPA to secure mmu table.
+	 */
+	ppa_ram_addr = (gd->secure_ram & MEM_RESERVE_SECURE_ADDR_MASK) +
+			gd->arch.tlb_size;
+
+	/* Align PPA base address to 4K */
+	ppa_ram_addr = (ppa_ram_addr + 0xfff) & ~0xfff;
+	debug("fsl-ppa: PPA load address (0x%llx)\n", ppa_ram_addr);
+
+	ret = parse_ppa_firmware_fit_image(&raw_image_addr, &raw_image_size);
+	if (ret < 0)
+		goto out;
+
+	if (ppa_ram_size < raw_image_size) {
+		ret = -ENOSPC;
+		goto out;
+	}
+
+	ppa_copy_image("PPA firmware", (u64)raw_image_addr,
+			raw_image_size, ppa_ram_addr);
+
+	debug("fsl-ppa: PPA entry: 0x%llx\n", ppa_ram_addr);
+	*entry = ppa_ram_addr;
+
+	return 0;
+
+out:
+	printf("fsl-ppa: error (%d)\n", ret);
+	*entry = 0;
+
+	return ret;
+}
+
+int ppa_init_entry(void *ppa_entry)
+{
+	int ret;
+	u32 *boot_loc_ptr_l, *boot_loc_ptr_h;
+
+#ifdef CONFIG_FSL_LSCH3
+	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+	boot_loc_ptr_l = &gur->bootlocptrl;
+	boot_loc_ptr_h = &gur->bootlocptrh;
+#elif defined(CONFIG_FSL_LSCH2)
+	struct ccsr_scfg __iomem *scfg = (void *)(CONFIG_SYS_FSL_SCFG_ADDR);
+	boot_loc_ptr_l = &scfg->scratchrw[1];
+	boot_loc_ptr_h = &scfg->scratchrw[0];
+#endif
+
+	debug("fsl-ppa: boot_loc_ptr_l = 0x%p, boot_loc_ptr_h =0x%p\n",
+			boot_loc_ptr_l, boot_loc_ptr_h);
+	ret = ppa_init(ppa_entry, boot_loc_ptr_l, boot_loc_ptr_h);
+	if (ret < 0)
+		return ret;
+
+	debug("fsl-ppa: Return from PPA: current_el = %d\n", current_el());
+
+	/*
+	 * The PE will be turned into EL2 when run out of PPA.
+	 * First, set vector for EL2.
+	 */
+	c_runtime_cpu_setup();
+
+	/* Enable caches and MMU for EL2. */
+	enable_caches();
+
+	return 0;
+}
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S b/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S
new file mode 100644
index 0000000..3a3bb64
--- /dev/null
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ppa_entry.S
@@ -0,0 +1,42 @@ 
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <config.h>
+#include <linux/linkage.h>
+#include <asm/system.h>
+#include <asm/macro.h>
+
+ENTRY(ppa_init)
+	/*
+	 * x0: PPA entry point
+	 * x1: Boot Location Pointer Low
+	 * x2: Boot Location Pointer High
+	 */
+
+	/* Save stack pointer for EL2 */
+	mov	x3, sp
+	msr	sp_el2, x3
+
+	/* Set boot loc pointer */
+        adr	x4, 1f
+        mov	x3, x4
+#if defined(CONFIG_FSL_LSCH2)
+        rev	w3, w3
+#endif
+        str	w3, [x1]
+        lsr	x3, x4, #32
+#if defined(CONFIG_FSL_LSCH2)
+        rev	w3, w3
+#endif
+        str	w3, [x2]
+
+/* Call PPA monitor */
+        br	x0
+
+1:
+        mov	x0, #0
+        ret
+ENDPROC(ppa_init)
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/ppa.h b/arch/arm/include/asm/arch-fsl-layerscape/ppa.h
new file mode 100644
index 0000000..f0f0d10
--- /dev/null
+++ b/arch/arm/include/asm/arch-fsl-layerscape/ppa.h
@@ -0,0 +1,15 @@ 
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __FSL_PPA_H_
+#define __FSL_PPA_H_
+
+int ppa_init_pre(u64 *);
+int ppa_init_entry(void *);
+int ppa_init(void *, u32*, u32*);
+unsigned long ppa_get_dram_block_size(void);
+
+#endif