mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* load BL31 on imx8mm and imx8mq
@ 2019-06-26  8:46 Yazdani, Reyhaneh
  2019-06-26  9:28 ` Rouven Czerwinski
  0 siblings, 1 reply; 5+ messages in thread
From: Yazdani, Reyhaneh @ 2019-06-26  8:46 UTC (permalink / raw)
  To: barebox

Hello everyone,


On the process of bring-up imx8mm board, I am at the point that load bl31 and
jump to ATF.Upon exit from ATF's initialization routine, the execution level
should be EL2.

My question is about imx8mq_atf_load_bl31 function.
After copy BL31 into OCRAM address, the function sets up the sp_el2 to
"MX8MQ_ATF_BL33_BASE_ADDR - 16".

Can anyone explain me why this address? Because I am using the same address for
imx8mm and it seems Barebox does not return to this point.

Best,
Reyhaneh

--
Reyhaneh Yazdani
Data Modul AG                            TEL:    +49-89-56017-154
Embedded development                 FAX:    +49-89-56017-119
Linux - Development                      RG: HR-Muenchen B-85591
Landsberger Str. 322 D-80687 Muenchen - http://www.data-modul.com

Vertrauliche E-Mail von / Confidential e-mail from: DATA MODUL AG
Vorstand / CEO: Dr. Florian Pesahl
Vorsitzende des Aufsichtsrates / Chairwoman of the Supervisory Board: Kristin D. Russell
Sitz der Gesellschaft / Registered Office: München
Registergericht / Registration Court: München Handelsregister B 85 591



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: load BL31 on imx8mm and imx8mq
  2019-06-26  8:46 load BL31 on imx8mm and imx8mq Yazdani, Reyhaneh
@ 2019-06-26  9:28 ` Rouven Czerwinski
  2019-06-26  9:51   ` AW: " Yazdani, Reyhaneh
  0 siblings, 1 reply; 5+ messages in thread
From: Rouven Czerwinski @ 2019-06-26  9:28 UTC (permalink / raw)
  To: Yazdani, Reyhaneh; +Cc: barebox

On Wed, 2019-06-26 at 08:46 +0000, Yazdani, Reyhaneh wrote:
> Hello everyone,
> 
> 
> On the process of bring-up imx8mm board, I am at the point that load
> bl31 and
> jump to ATF.Upon exit from ATF's initialization routine, the
> execution level
> should be EL2.
> 
> My question is about imx8mq_atf_load_bl31 function.
> After copy BL31 into OCRAM address, the function sets up the sp_el2
> to
> "MX8MQ_ATF_BL33_BASE_ADDR - 16".
> 
> Can anyone explain me why this address? Because I am using the same
> address for
> imx8mm and it seems Barebox does not return to this point.

sp_el2 is the address for the stack pointer in el2. This is done so
there is a stack pointer setup after returning from TF-A.
The TF-A return address is compiled into the TF-A and may be different
for the imx8mm. Looking into the TF-A PLAT_NS_IMAGE_OFFSET is set to
0x40200000. So execution should continue after TF-A at this address.

Regards,
Rouven Czerwinski


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* AW: load BL31 on imx8mm and imx8mq
  2019-06-26  9:28 ` Rouven Czerwinski
@ 2019-06-26  9:51   ` Yazdani, Reyhaneh
  2019-06-26 10:25     ` Rouven Czerwinski
  0 siblings, 1 reply; 5+ messages in thread
From: Yazdani, Reyhaneh @ 2019-06-26  9:51 UTC (permalink / raw)
  To: 'Rouven Czerwinski'; +Cc: barebox

Thanks Rouven.

And what is the reason behind decreasing 16 from returning address:

MX8MQ_ATF_BL33_BASE_ADDR - 16

I removed "16" for im8mq in Barebox and still works.

The PLAT_NS_IMAGE_OFFSET is identical for imx8mq and imx8mm. Do you have any idea why the firmware is not returned to this address?
Do we need to enable any special timer or clock for this point?
I used the same firmware as I have used in UBoot, thus the firmware itself should be correct.

Best,
Reyhaneh

-----Ursprüngliche Nachricht-----
Von: Rouven Czerwinski [mailto:r.czerwinski@pengutronix.de]
Gesendet: Wednesday, June 26, 2019 11:28 AM
An: Yazdani, Reyhaneh
Cc: barebox@lists.infradead.org
Betreff: Re: load BL31 on imx8mm and imx8mq

On Wed, 2019-06-26 at 08:46 +0000, Yazdani, Reyhaneh wrote:
> Hello everyone,
>
>
> On the process of bring-up imx8mm board, I am at the point that load
> bl31 and
> jump to ATF.Upon exit from ATF's initialization routine, the execution
> level should be EL2.
>
> My question is about imx8mq_atf_load_bl31 function.
> After copy BL31 into OCRAM address, the function sets up the sp_el2 to
> "MX8MQ_ATF_BL33_BASE_ADDR - 16".
>
> Can anyone explain me why this address? Because I am using the same
> address for imx8mm and it seems Barebox does not return to this point.

sp_el2 is the address for the stack pointer in el2. This is done so there is a stack pointer setup after returning from TF-A.
The TF-A return address is compiled into the TF-A and may be different for the imx8mm. Looking into the TF-A PLAT_NS_IMAGE_OFFSET is set to 0x40200000. So execution should continue after TF-A at this address.

Regards,
Rouven Czerwinski


Vertrauliche E-Mail von / Confidential e-mail from: DATA MODUL AG
Vorstand / CEO: Dr. Florian Pesahl
Vorsitzende des Aufsichtsrates / Chairwoman of the Supervisory Board: Kristin D. Russell
Sitz der Gesellschaft / Registered Office: München
Registergericht / Registration Court: München Handelsregister B 85 591



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AW: load BL31 on imx8mm and imx8mq
  2019-06-26  9:51   ` AW: " Yazdani, Reyhaneh
@ 2019-06-26 10:25     ` Rouven Czerwinski
  2019-06-26 13:12       ` Yazdani, Reyhaneh
  0 siblings, 1 reply; 5+ messages in thread
From: Rouven Czerwinski @ 2019-06-26 10:25 UTC (permalink / raw)
  To: Yazdani, Reyhaneh; +Cc: barebox

> And what is the reason behind decreasing 16 from returning address:
> 
> MX8MQ_ATF_BL33_BASE_ADDR - 16
> 
> I removed "16" for im8mq in Barebox and still works.

This puts some distance between the stack and your execution address.
As long as nobody is writing to the stack pointer before increasing it
you are save and your return address is not overwritte. Your probably
save anyway since the instructions at the address
MX8MQ_ATF_BL33_BASE_ADDR are only executed once and don't manipulate
the stack.

The stack pointer inherently has nothing to do with the return address,
you just have to make sure that the stack pointer is pointing to a
valid address, othwise you may get aborts on stack usage.

> The PLAT_NS_IMAGE_OFFSET is identical for imx8mq and imx8mm. Do you
> have any idea why the firmware is not returned to this address?
> Do we need to enable any special timer or clock for this point?
> I used the same firmware as I have used in UBoot, thus the firmware
> itself should be correct.

It may be a good idea to build the TF-A yourself and enable the debug
output therein to make sure that TF-A is not missing a crucial setup
step. The TF-A can be found a 
https://source.codeaurora.org/external/imx/imx-atf/
pick one of the release branches, enable the debug console in
plat/imx/imx8mm/include/platform_def.h and build a Debug build with
make plat=imx8mm DEBUG=1.

Regards,
Rouven


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: AW: load BL31 on imx8mm and imx8mq
  2019-06-26 10:25     ` Rouven Czerwinski
@ 2019-06-26 13:12       ` Yazdani, Reyhaneh
  0 siblings, 0 replies; 5+ messages in thread
From: Yazdani, Reyhaneh @ 2019-06-26 13:12 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox



On 6/26/19 12:25 PM, Rouven Czerwinski wrote:
>> And what is the reason behind decreasing 16 from returning address:
>>
>> MX8MQ_ATF_BL33_BASE_ADDR - 16
>>
>> I removed "16" for im8mq in Barebox and still works.
>
> This puts some distance between the stack and your execution address.
> As long as nobody is writing to the stack pointer before increasing it
> you are save and your return address is not overwritte. Your probably
> save anyway since the instructions at the address
> MX8MQ_ATF_BL33_BASE_ADDR are only executed once and don't manipulate
> the stack.
>
> The stack pointer inherently has nothing to do with the return address,
> you just have to make sure that the stack pointer is pointing to a
> valid address, othwise you may get aborts on stack usage.

Thanks for the explanation
>
>> The PLAT_NS_IMAGE_OFFSET is identical for imx8mq and imx8mm. Do you
>> have any idea why the firmware is not returned to this address?
>> Do we need to enable any special timer or clock for this point?
>> I used the same firmware as I have used in UBoot, thus the firmware
>> itself should be correct.
>
> It may be a good idea to build the TF-A yourself and enable the debug
> output therein to make sure that TF-A is not missing a crucial setup
> step. The TF-A can be found a
> https://source.codeaurora.org/external/imx/imx-atf/
> pick one of the release branches, enable the debug console in
> plat/imx/imx8mm/include/platform_def.h and build a Debug build with
> make plat=imx8mm DEBUG=1.

This helped me a lot. I found the reason. Actually the firmware did not execute
to the end. I had to configure GIC to sys_pll2_100m in the first steps of low-level.

Best regards,
Reyhaneh
>
> Regards,
> Rouven
>

--
Reyhaneh Yazdani
Data Modul AG                            TEL:    +49-89-56017-154
Embedded development                 FAX:    +49-89-56017-119
Linux - Development                      RG: HR-Muenchen B-85591
Landsberger Str. 322 D-80687 Muenchen - http://www.data-modul.com

Vertrauliche E-Mail von / Confidential e-mail from: DATA MODUL AG
Vorstand / CEO: Dr. Florian Pesahl
Vorsitzende des Aufsichtsrates / Chairwoman of the Supervisory Board: Kristin D. Russell
Sitz der Gesellschaft / Registered Office: München
Registergericht / Registration Court: München Handelsregister B 85 591



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-26 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26  8:46 load BL31 on imx8mm and imx8mq Yazdani, Reyhaneh
2019-06-26  9:28 ` Rouven Czerwinski
2019-06-26  9:51   ` AW: " Yazdani, Reyhaneh
2019-06-26 10:25     ` Rouven Czerwinski
2019-06-26 13:12       ` Yazdani, Reyhaneh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox