diff mbox

[U-Boot,v5,1/2] armv8: Support loading 32-bit OS in AArch32 execution state

Message ID CAD0U-hKbc2d=a55AFEWBxi8LvDahW-F=Ha7PpC7RXRRSvd4HDA@mail.gmail.com
State RFC
Delegated to: York Sun
Headers show

Commit Message

Ryan Harkin July 7, 2016, 12:35 p.m. UTC
On 7 July 2016 at 13:30, Alexander Graf <agraf@suse.de> wrote:
> On 07/07/2016 02:16 PM, Ryan Harkin wrote:
>>
>> On 7 July 2016 at 07:30, Alison Wang <b18965@freescale.com> wrote:
>>>
>>> To support loading a 32-bit OS, the execution state will change from
>>> AArch64 to AArch32 when jumping to kernel.
>>>
>>> The architecture information will be got through checking FIT image,
>>> then U-Boot will load 32-bit OS or 64-bit OS automatically.
>>>
>>> Signed-off-by: Ebony Zhu <ebony.zhu@nxp.com>
>>> Signed-off-by: Alison Wang <alison.wang@nxp.com>
>>> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>
>>
>> Unfortunately, this patch fails to boot for me.
>>
>> On FVP Foundation models, I see this error before the model hangs:
>>
>> [snip]
>> Starting kernel ...
>>
>> resetting ...
>> [snip]
>>
>> And I see the same output on AEMv8 Base models and Juno boards, only
>> they reset continuously rather than hang.
>>
>> I think the problem is that I see this from ARM Trusted Firmware on boot:
>>
>> INFO:    BL31: Preparing for EL3 exit to normal world
>>
>> Looking at the patch, it appears to be changing everything to boot in EL2.
>
>
> That was the case before the patch (with the removal of the EL1 boot thing)
> already. Linux can't run in EL3, that's why it has to boot in EL2 (or EL1,
> but that really should be limited to VMs).
>

Pah!  I misread the patch, specifically this hunk (and the one before
it, I suppose):

That's a "-", not a "+" on the call to armv8_switch_to_el2().

Either way, all my platforms are dead with this patch.


>
> Alex
>

Comments

Alexander Graf July 7, 2016, 12:41 p.m. UTC | #1
On 07/07/2016 02:35 PM, Ryan Harkin wrote:
> On 7 July 2016 at 13:30, Alexander Graf <agraf@suse.de> wrote:
>> On 07/07/2016 02:16 PM, Ryan Harkin wrote:
>>> On 7 July 2016 at 07:30, Alison Wang <b18965@freescale.com> wrote:
>>>> To support loading a 32-bit OS, the execution state will change from
>>>> AArch64 to AArch32 when jumping to kernel.
>>>>
>>>> The architecture information will be got through checking FIT image,
>>>> then U-Boot will load 32-bit OS or 64-bit OS automatically.
>>>>
>>>> Signed-off-by: Ebony Zhu <ebony.zhu@nxp.com>
>>>> Signed-off-by: Alison Wang <alison.wang@nxp.com>
>>>> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>
>>> Unfortunately, this patch fails to boot for me.
>>>
>>> On FVP Foundation models, I see this error before the model hangs:
>>>
>>> [snip]
>>> Starting kernel ...
>>>
>>> resetting ...
>>> [snip]
>>>
>>> And I see the same output on AEMv8 Base models and Juno boards, only
>>> they reset continuously rather than hang.
>>>
>>> I think the problem is that I see this from ARM Trusted Firmware on boot:
>>>
>>> INFO:    BL31: Preparing for EL3 exit to normal world
>>>
>>> Looking at the patch, it appears to be changing everything to boot in EL2.
>>
>> That was the case before the patch (with the removal of the EL1 boot thing)
>> already. Linux can't run in EL3, that's why it has to boot in EL2 (or EL1,
>> but that really should be limited to VMs).
>>
> Pah!  I misread the patch, specifically this hunk (and the one before
> it, I suppose):
>
> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> index e3c9832..59adab8 100644
> --- a/arch/arm/lib/bootm.c
> +++ b/arch/arm/lib/bootm.c
> @@ -193,7 +193,6 @@ static void do_nonsec_virt_switch(void)
>   {
>       smp_kick_all_cpus();
>       dcache_disable();    /* flush cache before swtiching to EL2 */
> -    armv8_switch_to_el2();
>   }
>   #endif
>
> That's a "-", not a "+" on the call to armv8_switch_to_el2().
>
> Either way, all my platforms are dead with this patch.

Since you're running in software models, can you try to figure out where 
exactly it breaks? I'm slightly confused that it's resetting. The switch 
to EL2 shouldn't matter in your setup, because you're executing U-Boot 
in EL2 already, since you're running ATF in EL3.


Alex
Ryan Harkin July 7, 2016, 12:46 p.m. UTC | #2
On 7 July 2016 at 13:41, Alexander Graf <agraf@suse.de> wrote:
> On 07/07/2016 02:35 PM, Ryan Harkin wrote:
>>
>> On 7 July 2016 at 13:30, Alexander Graf <agraf@suse.de> wrote:
>>>
>>> On 07/07/2016 02:16 PM, Ryan Harkin wrote:
>>>>
>>>> On 7 July 2016 at 07:30, Alison Wang <b18965@freescale.com> wrote:
>>>>>
>>>>> To support loading a 32-bit OS, the execution state will change from
>>>>> AArch64 to AArch32 when jumping to kernel.
>>>>>
>>>>> The architecture information will be got through checking FIT image,
>>>>> then U-Boot will load 32-bit OS or 64-bit OS automatically.
>>>>>
>>>>> Signed-off-by: Ebony Zhu <ebony.zhu@nxp.com>
>>>>> Signed-off-by: Alison Wang <alison.wang@nxp.com>
>>>>> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>
>>>>
>>>> Unfortunately, this patch fails to boot for me.
>>>>
>>>> On FVP Foundation models, I see this error before the model hangs:
>>>>
>>>> [snip]
>>>> Starting kernel ...
>>>>
>>>> resetting ...
>>>> [snip]
>>>>
>>>> And I see the same output on AEMv8 Base models and Juno boards, only
>>>> they reset continuously rather than hang.
>>>>
>>>> I think the problem is that I see this from ARM Trusted Firmware on
>>>> boot:
>>>>
>>>> INFO:    BL31: Preparing for EL3 exit to normal world
>>>>
>>>> Looking at the patch, it appears to be changing everything to boot in
>>>> EL2.
>>>
>>>
>>> That was the case before the patch (with the removal of the EL1 boot
>>> thing)
>>> already. Linux can't run in EL3, that's why it has to boot in EL2 (or
>>> EL1,
>>> but that really should be limited to VMs).
>>>
>> Pah!  I misread the patch, specifically this hunk (and the one before
>> it, I suppose):
>>
>> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
>> index e3c9832..59adab8 100644
>> --- a/arch/arm/lib/bootm.c
>> +++ b/arch/arm/lib/bootm.c
>> @@ -193,7 +193,6 @@ static void do_nonsec_virt_switch(void)
>>   {
>>       smp_kick_all_cpus();
>>       dcache_disable();    /* flush cache before swtiching to EL2 */
>> -    armv8_switch_to_el2();
>>   }
>>   #endif
>>
>> That's a "-", not a "+" on the call to armv8_switch_to_el2().
>>
>> Either way, all my platforms are dead with this patch.
>
>
> Since you're running in software models, can you try to figure out where
> exactly it breaks?

You assume that because I have a model that I have the ability to debug it ;-)

ARM's FVP Foundation model is publicly available and free to use.  So
if you want to give it a spin, it's there for the taking.

> I'm slightly confused that it's resetting. The switch to
> EL2 shouldn't matter in your setup, because you're executing U-Boot in EL2
> already, since you're running ATF in EL3.
>
>
> Alex
>
Alexander Graf July 7, 2016, 12:58 p.m. UTC | #3
On 07/07/2016 02:46 PM, Ryan Harkin wrote:
> On 7 July 2016 at 13:41, Alexander Graf <agraf@suse.de> wrote:
>> On 07/07/2016 02:35 PM, Ryan Harkin wrote:
>>> On 7 July 2016 at 13:30, Alexander Graf <agraf@suse.de> wrote:
>>>> On 07/07/2016 02:16 PM, Ryan Harkin wrote:
>>>>> On 7 July 2016 at 07:30, Alison Wang <b18965@freescale.com> wrote:
>>>>>> To support loading a 32-bit OS, the execution state will change from
>>>>>> AArch64 to AArch32 when jumping to kernel.
>>>>>>
>>>>>> The architecture information will be got through checking FIT image,
>>>>>> then U-Boot will load 32-bit OS or 64-bit OS automatically.
>>>>>>
>>>>>> Signed-off-by: Ebony Zhu <ebony.zhu@nxp.com>
>>>>>> Signed-off-by: Alison Wang <alison.wang@nxp.com>
>>>>>> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>
>>>>> Unfortunately, this patch fails to boot for me.
>>>>>
>>>>> On FVP Foundation models, I see this error before the model hangs:
>>>>>
>>>>> [snip]
>>>>> Starting kernel ...
>>>>>
>>>>> resetting ...
>>>>> [snip]
>>>>>
>>>>> And I see the same output on AEMv8 Base models and Juno boards, only
>>>>> they reset continuously rather than hang.
>>>>>
>>>>> I think the problem is that I see this from ARM Trusted Firmware on
>>>>> boot:
>>>>>
>>>>> INFO:    BL31: Preparing for EL3 exit to normal world
>>>>>
>>>>> Looking at the patch, it appears to be changing everything to boot in
>>>>> EL2.
>>>>
>>>> That was the case before the patch (with the removal of the EL1 boot
>>>> thing)
>>>> already. Linux can't run in EL3, that's why it has to boot in EL2 (or
>>>> EL1,
>>>> but that really should be limited to VMs).
>>>>
>>> Pah!  I misread the patch, specifically this hunk (and the one before
>>> it, I suppose):
>>>
>>> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
>>> index e3c9832..59adab8 100644
>>> --- a/arch/arm/lib/bootm.c
>>> +++ b/arch/arm/lib/bootm.c
>>> @@ -193,7 +193,6 @@ static void do_nonsec_virt_switch(void)
>>>    {
>>>        smp_kick_all_cpus();
>>>        dcache_disable();    /* flush cache before swtiching to EL2 */
>>> -    armv8_switch_to_el2();
>>>    }
>>>    #endif
>>>
>>> That's a "-", not a "+" on the call to armv8_switch_to_el2().
>>>
>>> Either way, all my platforms are dead with this patch.
>>
>> Since you're running in software models, can you try to figure out where
>> exactly it breaks?
> You assume that because I have a model that I have the ability to debug it ;-)
>
> ARM's FVP Foundation model is publicly available and free to use.  So
> if you want to give it a spin, it's there for the taking.

I thought the Foundation model doesn't support external debugging? I'd 
basically want to put a breakpoint at the point where the kernel exit 
print goes and then trace it from there :).

But since Alison wrote the patches, I'm sure he can do that too :).


Alex
diff mbox

Patch

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index e3c9832..59adab8 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -193,7 +193,6 @@  static void do_nonsec_virt_switch(void)
 {
     smp_kick_all_cpus();
     dcache_disable();    /* flush cache before swtiching to EL2 */
-    armv8_switch_to_el2();
 }
 #endif