diff mbox

[U-Boot] arm: re-implement proper ISB instruction for ARMv7-A

Message ID 1469700807-22212-1-git-send-email-xzy.xu@rock-chips.com
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Xu Ziyuan July 28, 2016, 10:13 a.m. UTC
For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").

This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
booting linux kernel, which occurred on rk3288-base development board
such as evb-rk3288, rock2-rk3288. And something output via console like:

=> bootz 0x2000000
0x02000000
   ramdisk start = 0x00000000, ramdisk end = 0x00000000
   Continuing to boot without FDT
   Initial value for argc=3
   Final value for argc=3
   using: ATAGS

   Starting kernel ...

Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
---

 arch/arm/include/asm/system.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Alexander Graf July 28, 2016, 10:39 a.m. UTC | #1
On 07/28/2016 12:13 PM, Ziyuan Xu wrote:
> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>
> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> booting linux kernel, which occurred on rk3288-base development board
> such as evb-rk3288, rock2-rk3288. And something output via console like:
>
> => bootz 0x2000000
> 0x02000000
>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>     Continuing to boot without FDT
>     Initial value for argc=3
>     Final value for argc=3
>     using: ATAGS
>
>     Starting kernel ...
>
> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>

Perfect! So with this, EFI support can still be in and things work fine?


Alex
Chen-Yu Tsai July 28, 2016, 11:03 a.m. UTC | #2
Hi,

On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>
> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> booting linux kernel, which occurred on rk3288-base development board
> such as evb-rk3288, rock2-rk3288. And something output via console like:
>
> => bootz 0x2000000
> 0x02000000
>    ramdisk start = 0x00000000, ramdisk end = 0x00000000
>    Continuing to boot without FDT
>    Initial value for argc=3
>    Final value for argc=3
>    using: ATAGS
>
>    Starting kernel ...
>
> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>
> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> ---
>
>  arch/arm/include/asm/system.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 2bdc0be..12d4ba0 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>   */
>  void save_boot_params_ret(void);
>
> -#define isb() __asm__ __volatile__ ("" : : : "memory")
> -
>  #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>
>  #ifdef __ARM_ARCH_7A__
> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
> +
>  #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>  #else
> +#define isb() __asm__ __volatile__ ("" : : : "memory")
> +
>  #define wfi()
>  #endif
>

arch/arm/include/asm/barriers.h already has a proper set of
ISB/DSB macros. Please consider using those instead.

You'll see they also support ARMv6's CP15 ISB/DSB.

Regards
ChenYu
Xu Ziyuan July 28, 2016, 11:51 a.m. UTC | #3
Hi,

On 2016年07月28日 19:03, Chen-Yu Tsai wrote:
> Hi,
>
> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
>> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>>
>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>> booting linux kernel, which occurred on rk3288-base development board
>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>
>> => bootz 0x2000000
>> 0x02000000
>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>     Continuing to boot without FDT
>>     Initial value for argc=3
>>     Final value for argc=3
>>     using: ATAGS
>>
>>     Starting kernel ...
>>
>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>
>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>> ---
>>
>>   arch/arm/include/asm/system.h | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>> index 2bdc0be..12d4ba0 100644
>> --- a/arch/arm/include/asm/system.h
>> +++ b/arch/arm/include/asm/system.h
>> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>>    */
>>   void save_boot_params_ret(void);
>>
>> -#define isb() __asm__ __volatile__ ("" : : : "memory")
>> -
>>   #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>>
>>   #ifdef __ARM_ARCH_7A__
>> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
>> +
>>   #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>>   #else
>> +#define isb() __asm__ __volatile__ ("" : : : "memory")
>> +
>>   #define wfi()
>>   #endif
>>
> arch/arm/include/asm/barriers.h already has a proper set of
> ISB/DSB macros. Please consider using those instead.
I know just what you mean.
arch/arm/include/asm/barriers.h defined ISB macro.  If I only want to 
fix the issue which I hit on rk3288 board, I just use ISB in 
arch/arm/include/asm/system.h::set_cr() instead of isb(). But isb() had 
been invoked in some places, IMHO, this patch is more apposite.:-)
>
> You'll see they also support ARMv6's CP15 ISB/DSB.
>
> Regards
> ChenYu
>
>
>
Xu Ziyuan July 28, 2016, 12:03 p.m. UTC | #4
Hi Alexander,

On 2016年07月28日 18:39, Alexander Graf wrote:
> On 07/28/2016 12:13 PM, Ziyuan Xu wrote:
>> For ARMv7-A architecture, the valid ISB instruction is asm 
>> volatile("isb").
>>
>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>> booting linux kernel, which occurred on rk3288-base development board
>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>
>> => bootz 0x2000000
>> 0x02000000
>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>     Continuing to boot without FDT
>>     Initial value for argc=3
>>     Final value for argc=3
>>     using: ATAGS
>>
>>     Starting kernel ...
>>
>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>
>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>
> Perfect! So with this, EFI support can still be in and things work fine?

I had not test EFI feature, in fact, I have no experience about it. Any 
progress I will promptly inform you.

>
>
> Alex
>
>
>
>
Sandy Patterson July 28, 2016, 12:41 p.m. UTC | #5
Ziyuan,

I tested this patch and it works for me with the current u-boot.git/master.

Re the EFI support. The problem was that when you compile in efi_runtime.c
it breaks booting the kernel. Probably rubbing the caching system the wrong
way. With this patch we are able to boot the kernel with the EFI parts
compiled in. I don't believe anyone has tested the functionality of EFI
wtih rk3288.

Sandy Patterson

On Thu, Jul 28, 2016 at 8:03 AM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:

> Hi Alexander,
>
> On 2016年07月28日 18:39, Alexander Graf wrote:
>
>> On 07/28/2016 12:13 PM, Ziyuan Xu wrote:
>>
>>> For ARMv7-A architecture, the valid ISB instruction is asm
>>> volatile("isb").
>>>
>>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>>> booting linux kernel, which occurred on rk3288-base development board
>>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>>
>>> => bootz 0x2000000
>>> 0x02000000
>>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>>     Continuing to boot without FDT
>>>     Initial value for argc=3
>>>     Final value for argc=3
>>>     using: ATAGS
>>>
>>>     Starting kernel ...
>>>
>>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>>
>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>>
>>
>> Perfect! So with this, EFI support can still be in and things work fine?
>>
>
> I had not test EFI feature, in fact, I have no experience about it. Any
> progress I will promptly inform you.
>
>
>>
>> Alex
>>
>>
>>
>>
>>
>
>
Tom Rini July 28, 2016, 10:15 p.m. UTC | #6
On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
> > For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
> >
> > This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> > booting linux kernel, which occurred on rk3288-base development board
> > such as evb-rk3288, rock2-rk3288. And something output via console like:
> >
> > => bootz 0x2000000
> > 0x02000000
> >    ramdisk start = 0x00000000, ramdisk end = 0x00000000
> >    Continuing to boot without FDT
> >    Initial value for argc=3
> >    Final value for argc=3
> >    using: ATAGS
> >
> >    Starting kernel ...
> >
> > Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
> >
> > Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> > ---
> >
> >  arch/arm/include/asm/system.h | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> > index 2bdc0be..12d4ba0 100644
> > --- a/arch/arm/include/asm/system.h
> > +++ b/arch/arm/include/asm/system.h
> > @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
> >   */
> >  void save_boot_params_ret(void);
> >
> > -#define isb() __asm__ __volatile__ ("" : : : "memory")
> > -
> >  #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
> >
> >  #ifdef __ARM_ARCH_7A__
> > +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
> > +
> >  #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
> >  #else
> > +#define isb() __asm__ __volatile__ ("" : : : "memory")
> > +
> >  #define wfi()
> >  #endif
> >
> 
> arch/arm/include/asm/barriers.h already has a proper set of
> ISB/DSB macros. Please consider using those instead.

Please fix arch/arm/include/asm/system.h to use the macros found in
barriers.h rather than have their own versions.  Thanks!
Tom Rini July 28, 2016, 10:16 p.m. UTC | #7
On Thu, Jul 28, 2016 at 06:13:26PM +0800, Ziyuan Xu wrote:
`
> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
> 
> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> booting linux kernel, which occurred on rk3288-base development board
> such as evb-rk3288, rock2-rk3288. And something output via console like:
> 
> => bootz 0x2000000
> 0x02000000
>    ramdisk start = 0x00000000, ramdisk end = 0x00000000
>    Continuing to boot without FDT
>    Initial value for argc=3
>    Final value for argc=3
>    using: ATAGS
> 
>    Starting kernel ...
> 
> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).

Good catch!
Xu Ziyuan July 28, 2016, 11:34 p.m. UTC | #8
Hi Tom,

On 2016年07月29日 06:15, Tom Rini wrote:
> On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
>> Hi,
>>
>> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
>>> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>>>
>>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>>> booting linux kernel, which occurred on rk3288-base development board
>>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>>
>>> => bootz 0x2000000
>>> 0x02000000
>>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>>     Continuing to boot without FDT
>>>     Initial value for argc=3
>>>     Final value for argc=3
>>>     using: ATAGS
>>>
>>>     Starting kernel ...
>>>
>>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>>
>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>> ---
>>>
>>>   arch/arm/include/asm/system.h | 6 ++++--
>>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>>> index 2bdc0be..12d4ba0 100644
>>> --- a/arch/arm/include/asm/system.h
>>> +++ b/arch/arm/include/asm/system.h
>>> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>>>    */
>>>   void save_boot_params_ret(void);
>>>
>>> -#define isb() __asm__ __volatile__ ("" : : : "memory")
>>> -
>>>   #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>>>
>>>   #ifdef __ARM_ARCH_7A__
>>> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
>>> +
>>>   #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>>>   #else
>>> +#define isb() __asm__ __volatile__ ("" : : : "memory")
>>> +
>>>   #define wfi()
>>>   #endif
>>>
>> arch/arm/include/asm/barriers.h already has a proper set of
>> ISB/DSB macros. Please consider using those instead.
> Please fix arch/arm/include/asm/system.h to use the macros found in
> barriers.h rather than have their own versions.  Thanks!

If I understand correctly, I can change into as bellow:
#define isb() ISB
How about it?
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Tom Rini July 29, 2016, 12:34 a.m. UTC | #9
On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
> Hi Tom,
> 
> On 2016年07月29日 06:15, Tom Rini wrote:
> >On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
> >>Hi,
> >>
> >>On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
> >>>For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
> >>>
> >>>This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> >>>booting linux kernel, which occurred on rk3288-base development board
> >>>such as evb-rk3288, rock2-rk3288. And something output via console like:
> >>>
> >>>=> bootz 0x2000000
> >>>0x02000000
> >>>    ramdisk start = 0x00000000, ramdisk end = 0x00000000
> >>>    Continuing to boot without FDT
> >>>    Initial value for argc=3
> >>>    Final value for argc=3
> >>>    using: ATAGS
> >>>
> >>>    Starting kernel ...
> >>>
> >>>Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
> >>>
> >>>Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> >>>---
> >>>
> >>>  arch/arm/include/asm/system.h | 6 ++++--
> >>>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>>
> >>>diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> >>>index 2bdc0be..12d4ba0 100644
> >>>--- a/arch/arm/include/asm/system.h
> >>>+++ b/arch/arm/include/asm/system.h
> >>>@@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
> >>>   */
> >>>  void save_boot_params_ret(void);
> >>>
> >>>-#define isb() __asm__ __volatile__ ("" : : : "memory")
> >>>-
> >>>  #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
> >>>
> >>>  #ifdef __ARM_ARCH_7A__
> >>>+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
> >>>+
> >>>  #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
> >>>  #else
> >>>+#define isb() __asm__ __volatile__ ("" : : : "memory")
> >>>+
> >>>  #define wfi()
> >>>  #endif
> >>>
> >>arch/arm/include/asm/barriers.h already has a proper set of
> >>ISB/DSB macros. Please consider using those instead.
> >Please fix arch/arm/include/asm/system.h to use the macros found in
> >barriers.h rather than have their own versions.  Thanks!
> 
> If I understand correctly, I can change into as bellow:
> #define isb() ISB
> How about it?

Well, I'd rather not have ISB and isb, just ISB, which means we might
have to fix other places too.  If that starts looking too huge, we can
do this in steps and just do what you suggested for now and for next
release move everything over.
Xu Ziyuan July 29, 2016, 1:06 a.m. UTC | #10
Hi Tom,

On 2016年07月29日 08:34, Tom Rini wrote:
> On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
>> Hi Tom,
>>
>> On 2016年07月29日 06:15, Tom Rini wrote:
>>> On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
>>>> Hi,
>>>>
>>>> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
>>>>> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>>>>>
>>>>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>>>>> booting linux kernel, which occurred on rk3288-base development board
>>>>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>>>>
>>>>> => bootz 0x2000000
>>>>> 0x02000000
>>>>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>>>>     Continuing to boot without FDT
>>>>>     Initial value for argc=3
>>>>>     Final value for argc=3
>>>>>     using: ATAGS
>>>>>
>>>>>     Starting kernel ...
>>>>>
>>>>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>>>>
>>>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>>>> ---
>>>>>
>>>>>   arch/arm/include/asm/system.h | 6 ++++--
>>>>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>>>>> index 2bdc0be..12d4ba0 100644
>>>>> --- a/arch/arm/include/asm/system.h
>>>>> +++ b/arch/arm/include/asm/system.h
>>>>> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>>>>>    */
>>>>>   void save_boot_params_ret(void);
>>>>>
>>>>> -#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>> -
>>>>>   #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>>>>>
>>>>>   #ifdef __ARM_ARCH_7A__
>>>>> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
>>>>> +
>>>>>   #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>>>>>   #else
>>>>> +#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>> +
>>>>>   #define wfi()
>>>>>   #endif
>>>>>
>>>> arch/arm/include/asm/barriers.h already has a proper set of
>>>> ISB/DSB macros. Please consider using those instead.
>>> Please fix arch/arm/include/asm/system.h to use the macros found in
>>> barriers.h rather than have their own versions.  Thanks!
>> If I understand correctly, I can change into as bellow:
>> #define isb() ISB
>> How about it?
> Well, I'd rather not have ISB and isb, just ISB, which means we might
> have to fix other places too.  If that starts looking too huge, we can
> do this in steps and just do what you suggested for now and for next
> release move everything over.
As I mentioned before, arch/arm/include/asm/barriers.h defined ISB 
macro.  If I only want to fix the issue which I hit on rk3288 board, I 
just use ISB in arch/arm/include/asm/system.h::set_cr() instead of 
isb(). But isb() had been invoked in some places.

I can't verify integrallty after all revision, it involve some boards 
and feature. But this does fix for rk3288, if you agree with me, could 
you apply it provisionally?:-)

>
Tom Rini July 29, 2016, 1:12 a.m. UTC | #11
On Fri, Jul 29, 2016 at 09:06:29AM +0800, Ziyuan Xu wrote:
> Hi Tom,
> 
> On 2016年07月29日 08:34, Tom Rini wrote:
> >On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
> >>Hi Tom,
> >>
> >>On 2016年07月29日 06:15, Tom Rini wrote:
> >>>On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
> >>>>Hi,
> >>>>
> >>>>On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
> >>>>>For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
> >>>>>
> >>>>>This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> >>>>>booting linux kernel, which occurred on rk3288-base development board
> >>>>>such as evb-rk3288, rock2-rk3288. And something output via console like:
> >>>>>
> >>>>>=> bootz 0x2000000
> >>>>>0x02000000
> >>>>>    ramdisk start = 0x00000000, ramdisk end = 0x00000000
> >>>>>    Continuing to boot without FDT
> >>>>>    Initial value for argc=3
> >>>>>    Final value for argc=3
> >>>>>    using: ATAGS
> >>>>>
> >>>>>    Starting kernel ...
> >>>>>
> >>>>>Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
> >>>>>
> >>>>>Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> >>>>>---
> >>>>>
> >>>>>  arch/arm/include/asm/system.h | 6 ++++--
> >>>>>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>>>>
> >>>>>diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> >>>>>index 2bdc0be..12d4ba0 100644
> >>>>>--- a/arch/arm/include/asm/system.h
> >>>>>+++ b/arch/arm/include/asm/system.h
> >>>>>@@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
> >>>>>   */
> >>>>>  void save_boot_params_ret(void);
> >>>>>
> >>>>>-#define isb() __asm__ __volatile__ ("" : : : "memory")
> >>>>>-
> >>>>>  #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
> >>>>>
> >>>>>  #ifdef __ARM_ARCH_7A__
> >>>>>+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
> >>>>>+
> >>>>>  #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
> >>>>>  #else
> >>>>>+#define isb() __asm__ __volatile__ ("" : : : "memory")
> >>>>>+
> >>>>>  #define wfi()
> >>>>>  #endif
> >>>>>
> >>>>arch/arm/include/asm/barriers.h already has a proper set of
> >>>>ISB/DSB macros. Please consider using those instead.
> >>>Please fix arch/arm/include/asm/system.h to use the macros found in
> >>>barriers.h rather than have their own versions.  Thanks!
> >>If I understand correctly, I can change into as bellow:
> >>#define isb() ISB
> >>How about it?
> >Well, I'd rather not have ISB and isb, just ISB, which means we might
> >have to fix other places too.  If that starts looking too huge, we can
> >do this in steps and just do what you suggested for now and for next
> >release move everything over.
> As I mentioned before, arch/arm/include/asm/barriers.h defined ISB
> macro.  If I only want to fix the issue which I hit on rk3288 board,
> I just use ISB in arch/arm/include/asm/system.h::set_cr() instead of
> isb(). But isb() had been invoked in some places.
> 
> I can't verify integrallty after all revision, it involve some
> boards and feature. But this does fix for rk3288, if you agree with
> me, could you apply it provisionally?:-)

I would really like to try and fix the other possibly latent issues that
we have by not calling a real ISB.  Please try moving towards all places
that need an isb calling the correct one from barriers.h and giving it a
spin on the hardware you have available.
Xu Ziyuan July 29, 2016, 1:30 a.m. UTC | #12
On 2016年07月29日 09:12, Tom Rini wrote:
> On Fri, Jul 29, 2016 at 09:06:29AM +0800, Ziyuan Xu wrote:
>> Hi Tom,
>>
>> On 2016年07月29日 08:34, Tom Rini wrote:
>>> On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
>>>> Hi Tom,
>>>>
>>>> On 2016年07月29日 06:15, Tom Rini wrote:
>>>>> On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
>>>>>>> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>>>>>>>
>>>>>>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>>>>>>> booting linux kernel, which occurred on rk3288-base development board
>>>>>>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>>>>>>
>>>>>>> => bootz 0x2000000
>>>>>>> 0x02000000
>>>>>>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>>>>>>     Continuing to boot without FDT
>>>>>>>     Initial value for argc=3
>>>>>>>     Final value for argc=3
>>>>>>>     using: ATAGS
>>>>>>>
>>>>>>>     Starting kernel ...
>>>>>>>
>>>>>>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>>>>>>
>>>>>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>>>>>> ---
>>>>>>>
>>>>>>>   arch/arm/include/asm/system.h | 6 ++++--
>>>>>>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>>>>>>> index 2bdc0be..12d4ba0 100644
>>>>>>> --- a/arch/arm/include/asm/system.h
>>>>>>> +++ b/arch/arm/include/asm/system.h
>>>>>>> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>>>>>>>    */
>>>>>>>   void save_boot_params_ret(void);
>>>>>>>
>>>>>>> -#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>>>> -
>>>>>>>   #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>>>>>>>
>>>>>>>   #ifdef __ARM_ARCH_7A__
>>>>>>> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
>>>>>>> +
>>>>>>>   #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>>>>>>>   #else
>>>>>>> +#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>>>> +
>>>>>>>   #define wfi()
>>>>>>>   #endif
>>>>>>>
>>>>>> arch/arm/include/asm/barriers.h already has a proper set of
>>>>>> ISB/DSB macros. Please consider using those instead.
>>>>> Please fix arch/arm/include/asm/system.h to use the macros found in
>>>>> barriers.h rather than have their own versions.  Thanks!
>>>> If I understand correctly, I can change into as bellow:
>>>> #define isb() ISB
>>>> How about it?
>>> Well, I'd rather not have ISB and isb, just ISB, which means we might
>>> have to fix other places too.  If that starts looking too huge, we can
>>> do this in steps and just do what you suggested for now and for next
>>> release move everything over.
>> As I mentioned before, arch/arm/include/asm/barriers.h defined ISB
>> macro.  If I only want to fix the issue which I hit on rk3288 board,
>> I just use ISB in arch/arm/include/asm/system.h::set_cr() instead of
>> isb(). But isb() had been invoked in some places.
>>
>> I can't verify integrallty after all revision, it involve some
>> boards and feature. But this does fix for rk3288, if you agree with
>> me, could you apply it provisionally?:-)
> I would really like to try and fix the other possibly latent issues that
> we have by not calling a real ISB.  Please try moving towards all places
> that need an isb calling the correct one from barriers.h and giving it a
> spin on the hardware you have available.

Okay,  I will confirm it on my boards.:-)

>
Xu Ziyuan July 31, 2016, 3:59 a.m. UTC | #13
Hi Tom,


On 2016年07月29日 09:12, Tom Rini wrote:
> On Fri, Jul 29, 2016 at 09:06:29AM +0800, Ziyuan Xu wrote:
>> Hi Tom,
>>
>> On 2016年07月29日 08:34, Tom Rini wrote:
>>> On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
>>>> Hi Tom,
>>>>
>>>> On 2016年07月29日 06:15, Tom Rini wrote:
>>>>> On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
>>>>>>> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>>>>>>>
>>>>>>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>>>>>>> booting linux kernel, which occurred on rk3288-base development board
>>>>>>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>>>>>>
>>>>>>> => bootz 0x2000000
>>>>>>> 0x02000000
>>>>>>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>>>>>>     Continuing to boot without FDT
>>>>>>>     Initial value for argc=3
>>>>>>>     Final value for argc=3
>>>>>>>     using: ATAGS
>>>>>>>
>>>>>>>     Starting kernel ...
>>>>>>>
>>>>>>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>>>>>>
>>>>>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>>>>>> ---
>>>>>>>
>>>>>>>   arch/arm/include/asm/system.h | 6 ++++--
>>>>>>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>>>>>>> index 2bdc0be..12d4ba0 100644
>>>>>>> --- a/arch/arm/include/asm/system.h
>>>>>>> +++ b/arch/arm/include/asm/system.h
>>>>>>> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>>>>>>>    */
>>>>>>>   void save_boot_params_ret(void);
>>>>>>>
>>>>>>> -#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>>>> -
>>>>>>>   #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>>>>>>>
>>>>>>>   #ifdef __ARM_ARCH_7A__
>>>>>>> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
>>>>>>> +
>>>>>>>   #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>>>>>>>   #else
>>>>>>> +#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>>>> +
>>>>>>>   #define wfi()
>>>>>>>   #endif
>>>>>>>
>>>>>> arch/arm/include/asm/barriers.h already has a proper set of
>>>>>> ISB/DSB macros. Please consider using those instead.
>>>>> Please fix arch/arm/include/asm/system.h to use the macros found in
>>>>> barriers.h rather than have their own versions.  Thanks!
>>>> If I understand correctly, I can change into as bellow:
>>>> #define isb() ISB
>>>> How about it?
>>> Well, I'd rather not have ISB and isb, just ISB, which means we might
>>> have to fix other places too.  If that starts looking too huge, we can
>>> do this in steps and just do what you suggested for now and for next
>>> release move everything over.
>> As I mentioned before, arch/arm/include/asm/barriers.h defined ISB
>> macro.  If I only want to fix the issue which I hit on rk3288 board,
>> I just use ISB in arch/arm/include/asm/system.h::set_cr() instead of
>> isb(). But isb() had been invoked in some places.
>>
>> I can't verify integrallty after all revision, it involve some
>> boards and feature. But this does fix for rk3288, if you agree with
>> me, could you apply it provisionally?:-)
> I would really like to try and fix the other possibly latent issues that
> we have by not calling a real ISB.  Please try moving towards all places
> that need an isb calling the correct one from barriers.h and giving it a
> spin on the hardware you have available.
I used ISB instead of isb(), everything works sane on my rockchip rk3288 
boards.:-)
Will you send a patch to fix it and other possibly latent issues? Or 
apply this temporarily?

>
Tom Rini July 31, 2016, 2:27 p.m. UTC | #14
On Sun, Jul 31, 2016 at 11:59:19AM +0800, Ziyuan Xu wrote:
> Hi Tom,
> 
> 
> On 2016年07月29日 09:12, Tom Rini wrote:
> >On Fri, Jul 29, 2016 at 09:06:29AM +0800, Ziyuan Xu wrote:
> >>Hi Tom,
> >>
> >>On 2016年07月29日 08:34, Tom Rini wrote:
> >>>On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
> >>>>Hi Tom,
> >>>>
> >>>>On 2016年07月29日 06:15, Tom Rini wrote:
> >>>>>On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
> >>>>>>Hi,
> >>>>>>
> >>>>>>On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
> >>>>>>>For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
> >>>>>>>
> >>>>>>>This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
> >>>>>>>booting linux kernel, which occurred on rk3288-base development board
> >>>>>>>such as evb-rk3288, rock2-rk3288. And something output via console like:
> >>>>>>>
> >>>>>>>=> bootz 0x2000000
> >>>>>>>0x02000000
> >>>>>>>    ramdisk start = 0x00000000, ramdisk end = 0x00000000
> >>>>>>>    Continuing to boot without FDT
> >>>>>>>    Initial value for argc=3
> >>>>>>>    Final value for argc=3
> >>>>>>>    using: ATAGS
> >>>>>>>
> >>>>>>>    Starting kernel ...
> >>>>>>>
> >>>>>>>Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
> >>>>>>>
> >>>>>>>Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
> >>>>>>>---
> >>>>>>>
> >>>>>>>  arch/arm/include/asm/system.h | 6 ++++--
> >>>>>>>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>>>>>>
> >>>>>>>diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> >>>>>>>index 2bdc0be..12d4ba0 100644
> >>>>>>>--- a/arch/arm/include/asm/system.h
> >>>>>>>+++ b/arch/arm/include/asm/system.h
> >>>>>>>@@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
> >>>>>>>   */
> >>>>>>>  void save_boot_params_ret(void);
> >>>>>>>
> >>>>>>>-#define isb() __asm__ __volatile__ ("" : : : "memory")
> >>>>>>>-
> >>>>>>>  #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
> >>>>>>>
> >>>>>>>  #ifdef __ARM_ARCH_7A__
> >>>>>>>+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
> >>>>>>>+
> >>>>>>>  #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
> >>>>>>>  #else
> >>>>>>>+#define isb() __asm__ __volatile__ ("" : : : "memory")
> >>>>>>>+
> >>>>>>>  #define wfi()
> >>>>>>>  #endif
> >>>>>>>
> >>>>>>arch/arm/include/asm/barriers.h already has a proper set of
> >>>>>>ISB/DSB macros. Please consider using those instead.
> >>>>>Please fix arch/arm/include/asm/system.h to use the macros found in
> >>>>>barriers.h rather than have their own versions.  Thanks!
> >>>>If I understand correctly, I can change into as bellow:
> >>>>#define isb() ISB
> >>>>How about it?
> >>>Well, I'd rather not have ISB and isb, just ISB, which means we might
> >>>have to fix other places too.  If that starts looking too huge, we can
> >>>do this in steps and just do what you suggested for now and for next
> >>>release move everything over.
> >>As I mentioned before, arch/arm/include/asm/barriers.h defined ISB
> >>macro.  If I only want to fix the issue which I hit on rk3288 board,
> >>I just use ISB in arch/arm/include/asm/system.h::set_cr() instead of
> >>isb(). But isb() had been invoked in some places.
> >>
> >>I can't verify integrallty after all revision, it involve some
> >>boards and feature. But this does fix for rk3288, if you agree with
> >>me, could you apply it provisionally?:-)
> >I would really like to try and fix the other possibly latent issues that
> >we have by not calling a real ISB.  Please try moving towards all places
> >that need an isb calling the correct one from barriers.h and giving it a
> >spin on the hardware you have available.
> I used ISB instead of isb(), everything works sane on my rockchip
> rk3288 boards.:-)
> Will you send a patch to fix it and other possibly latent issues? Or
> apply this temporarily?

Please send a patch of all of the changes you did, thanks!
Xu Ziyuan Aug. 1, 2016, 1:07 a.m. UTC | #15
On 2016年07月31日 22:27, Tom Rini wrote:
> On Sun, Jul 31, 2016 at 11:59:19AM +0800, Ziyuan Xu wrote:
>> Hi Tom,
>>
>>
>> On 2016年07月29日 09:12, Tom Rini wrote:
>>> On Fri, Jul 29, 2016 at 09:06:29AM +0800, Ziyuan Xu wrote:
>>>> Hi Tom,
>>>>
>>>> On 2016年07月29日 08:34, Tom Rini wrote:
>>>>> On Fri, Jul 29, 2016 at 07:34:09AM +0800, Ziyuan Xu wrote:
>>>>>> Hi Tom,
>>>>>>
>>>>>> On 2016年07月29日 06:15, Tom Rini wrote:
>>>>>>> On Thu, Jul 28, 2016 at 07:03:17PM +0800, Chen-Yu Tsai wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> On Thu, Jul 28, 2016 at 6:13 PM, Ziyuan Xu <xzy.xu@rock-chips.com> wrote:
>>>>>>>>> For ARMv7-A architecture, the valid ISB instruction is asm volatile("isb").
>>>>>>>>>
>>>>>>>>> This patch fixes the U-Boot was stuck in invalidate_dcache_all() before
>>>>>>>>> booting linux kernel, which occurred on rk3288-base development board
>>>>>>>>> such as evb-rk3288, rock2-rk3288. And something output via console like:
>>>>>>>>>
>>>>>>>>> => bootz 0x2000000
>>>>>>>>> 0x02000000
>>>>>>>>>     ramdisk start = 0x00000000, ramdisk end = 0x00000000
>>>>>>>>>     Continuing to boot without FDT
>>>>>>>>>     Initial value for argc=3
>>>>>>>>>     Final value for argc=3
>>>>>>>>>     using: ATAGS
>>>>>>>>>
>>>>>>>>>     Starting kernel ...
>>>>>>>>>
>>>>>>>>> Linux kernel exactly the same way(see arch/arm/include/asm/barrier.h).
>>>>>>>>>
>>>>>>>>> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
>>>>>>>>> ---
>>>>>>>>>
>>>>>>>>>   arch/arm/include/asm/system.h | 6 ++++--
>>>>>>>>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>>>>>>>>
>>>>>>>>> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
>>>>>>>>> index 2bdc0be..12d4ba0 100644
>>>>>>>>> --- a/arch/arm/include/asm/system.h
>>>>>>>>> +++ b/arch/arm/include/asm/system.h
>>>>>>>>> @@ -227,13 +227,15 @@ void __noreturn psci_system_reset(bool smc);
>>>>>>>>>    */
>>>>>>>>>   void save_boot_params_ret(void);
>>>>>>>>>
>>>>>>>>> -#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>>>>>> -
>>>>>>>>>   #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
>>>>>>>>>
>>>>>>>>>   #ifdef __ARM_ARCH_7A__
>>>>>>>>> +#define isb() __asm__ __volatile__ ("isb" : : : "memory")
>>>>>>>>> +
>>>>>>>>>   #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
>>>>>>>>>   #else
>>>>>>>>> +#define isb() __asm__ __volatile__ ("" : : : "memory")
>>>>>>>>> +
>>>>>>>>>   #define wfi()
>>>>>>>>>   #endif
>>>>>>>>>
>>>>>>>> arch/arm/include/asm/barriers.h already has a proper set of
>>>>>>>> ISB/DSB macros. Please consider using those instead.
>>>>>>> Please fix arch/arm/include/asm/system.h to use the macros found in
>>>>>>> barriers.h rather than have their own versions.  Thanks!
>>>>>> If I understand correctly, I can change into as bellow:
>>>>>> #define isb() ISB
>>>>>> How about it?
>>>>> Well, I'd rather not have ISB and isb, just ISB, which means we might
>>>>> have to fix other places too.  If that starts looking too huge, we can
>>>>> do this in steps and just do what you suggested for now and for next
>>>>> release move everything over.
>>>> As I mentioned before, arch/arm/include/asm/barriers.h defined ISB
>>>> macro.  If I only want to fix the issue which I hit on rk3288 board,
>>>> I just use ISB in arch/arm/include/asm/system.h::set_cr() instead of
>>>> isb(). But isb() had been invoked in some places.
>>>>
>>>> I can't verify integrallty after all revision, it involve some
>>>> boards and feature. But this does fix for rk3288, if you agree with
>>>> me, could you apply it provisionally?:-)
>>> I would really like to try and fix the other possibly latent issues that
>>> we have by not calling a real ISB.  Please try moving towards all places
>>> that need an isb calling the correct one from barriers.h and giving it a
>>> spin on the hardware you have available.
>> I used ISB instead of isb(), everything works sane on my rockchip
>> rk3288 boards.:-)
>> Will you send a patch to fix it and other possibly latent issues? Or
>> apply this temporarily?
> Please send a patch of all of the changes you did, thanks!
Tom, it's impracticable only use ISB for all situation instead of isb(). 
There're two isb() invocation in drivers/ddr/fsl/fsl_ddr_gen4.c, and not 
only used on ARM architecture board, but also powerpc. See below:

arch/powerpc/include/asm/config_mpc85xx.h:769:#define 
CONFIG_SYS_FSL_DDRC_GEN4
arch/powerpc/include/asm/config_mpc85xx.h:822:#define 
CONFIG_SYS_FSL_DDRC_GEN4
arch/powerpc/include/asm/config_mpc85xx.h:955: 
!defined(CONFIG_SYS_FSL_DDRC_GEN4)
arch/arm/include/asm/arch-ls102xa/config.h:100:#define 
CONFIG_SYS_FSL_DDRC_GEN4
arch/arm/include/asm/arch-fsl-layerscape/config.h:13:#define 
CONFIG_SYS_FSL_DDRC_GEN4

If you insist on ISB only, we have to differentiate arch via 
CONFIG_SYS_ARCH, seems twisted.
How about it?
#define isb() ISB
>
diff mbox

Patch

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 2bdc0be..12d4ba0 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -227,13 +227,15 @@  void __noreturn psci_system_reset(bool smc);
  */
 void save_boot_params_ret(void);
 
-#define isb() __asm__ __volatile__ ("" : : : "memory")
-
 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
 
 #ifdef __ARM_ARCH_7A__
+#define isb() __asm__ __volatile__ ("isb" : : : "memory")
+
 #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
 #else
+#define isb() __asm__ __volatile__ ("" : : : "memory")
+
 #define wfi()
 #endif