diff mbox

[0/7] Add SMP bringup support for mt65xx socs

Message ID 1430896766.15346.13.camel@mtksdaap41
State New
Headers show

Commit Message

Yingjoe Chen May 6, 2015, 7:19 a.m. UTC
Hi Matthias,

On Mon, 2015-05-04 at 09:48 +0200, Matthias Brugger wrote:
> Hi Yingjoe,
> 
> 2015-05-01 9:43 GMT+02:00 Yingjoe Chen <yingjoe.chen@mediatek.com>:
> > This series add SMP brinup support for mediatek SoCs. This is based
> > on v4.1-rc1.
> >
> > There are 2 similar but different SMP bringup up methods on Mediatek
> > mt65xx and mt81xx. On MT8135 & MT8127, system boots with a trustzone
> > firmware. Others, like MT6589, doesn't have trustzone, and run kernel
> > directly in secure world.
> >
> > Patch 1~3 fix issues in mtk_timer(GPT) and enable arch timer support.
> > Patch 4,5 add support for cpu enable-method "mediatek,mt65xx-smp" and
> > "mediatek,mt81xx-tz-smp", which support Mediatek SMP bringup for non-TZ
> > and TZ platform.
> > Patch 6,7 finally enable SMP bringup for mt8135 and mt8127.
> >
> > Matthias Brugger (1):
> >   arm: mediatek: enable gpt6 on boot up to make arch timer working
> >
> > Yingjoe Chen (6):
> >   clocksource: mediatek: Don't run event_handler if it is NULL
> >   clocksource: mediatek: Use GPT as sched clock source
> >   devicetree: bindings: add new SMP enable method Mediatek SoC
> >   ARM: mediatek: add smp bringup code
> >   ARM: dts: mt8135: enable basic SMP bringup for mt8135
> >   ARM: dts: mt8127: enable basic SMP bringup for mt8127
> >
> 
> I tried on the mt8135 eval board but it fails to bring up the CPU.
> 
> When booting:
> [    1.048588] CPU1: failed to come online
> [    2.049914] CPU2: failed to come online
> [    3.051245] CPU3: failed to come online


Thanks for testing, and the config file you provided.
It seems you are running THUMB2 kernel, unfortunately mt8135 trustzone
firmware doesn't support jump to THUMB2 code directly.

I can workaround this with the following patch. I'll include it in my
next round.

Joe.C

-----8<----------------
 {
 	if (!mtk_smp_base)

Comments

Yingjoe Chen May 6, 2015, 7:59 a.m. UTC | #1
On Wed, 2015-05-06 at 15:19 +0800, Yingjoe Chen wrote:
> Hi Matthias,
<...>
> > I tried on the mt8135 eval board but it fails to bring up the CPU.
> > 
> > When booting:
> > [    1.048588] CPU1: failed to come online
> > [    2.049914] CPU2: failed to come online
> > [    3.051245] CPU3: failed to come online
> 
> 
> Thanks for testing, and the config file you provided.
> It seems you are running THUMB2 kernel, unfortunately mt8135 trustzone
> firmware doesn't support jump to THUMB2 code directly.
> 
> I can workaround this with the following patch. I'll include it in my
> next round.
> 
> Joe.C
> 
> -----8<----------------
> diff --git a/arch/arm/mach-mediatek/platsmp.c
> b/arch/arm/mach-mediatek/platsmp.c
> index e266b3d..5dea55a 100644
> --- a/arch/arm/mach-mediatek/platsmp.c
> +++ b/arch/arm/mach-mediatek/platsmp.c
> @@ -57,6 +57,18 @@ static const struct of_device_id mtk_smp_boot_infos[]
> __initconst = {
>  static void __iomem *mtk_smp_base;
>  static const struct mtk_smp_boot_info *mtk_smp_info;
>  
> +#ifdef CONFIG_THUMB2_KERNEL
> +__asm__(
> +	".arm\n"
> +	"mtk_secondary_startup_fixup:\n"
> +	"	b secondary_startup\n"
> +	".thumb\n"
> +);
> +
> +void mtk_secondary_startup_fixup(void);
> +#define secondary_startup mtk_secondary_startup_fixup
> +#endif


Replying myself.

It seems kernel already have secondary_startup_arm which support this
usage. I'll use that in my next version instead.

Joe.C
Matthias Brugger May 6, 2015, 8:29 a.m. UTC | #2
2015-05-06 9:59 GMT+02:00 Yingjoe Chen <yingjoe.chen@mediatek.com>:
> On Wed, 2015-05-06 at 15:19 +0800, Yingjoe Chen wrote:
>> Hi Matthias,
> <...>
>> > I tried on the mt8135 eval board but it fails to bring up the CPU.
>> >
>> > When booting:
>> > [    1.048588] CPU1: failed to come online
>> > [    2.049914] CPU2: failed to come online
>> > [    3.051245] CPU3: failed to come online
>>
>>
>> Thanks for testing, and the config file you provided.
>> It seems you are running THUMB2 kernel, unfortunately mt8135 trustzone
>> firmware doesn't support jump to THUMB2 code directly.
>>
>> I can workaround this with the following patch. I'll include it in my
>> next round.
>>
>> Joe.C
>>
>> -----8<----------------
>> diff --git a/arch/arm/mach-mediatek/platsmp.c
>> b/arch/arm/mach-mediatek/platsmp.c
>> index e266b3d..5dea55a 100644
>> --- a/arch/arm/mach-mediatek/platsmp.c
>> +++ b/arch/arm/mach-mediatek/platsmp.c
>> @@ -57,6 +57,18 @@ static const struct of_device_id mtk_smp_boot_infos[]
>> __initconst = {
>>  static void __iomem *mtk_smp_base;
>>  static const struct mtk_smp_boot_info *mtk_smp_info;
>>
>> +#ifdef CONFIG_THUMB2_KERNEL
>> +__asm__(
>> +     ".arm\n"
>> +     "mtk_secondary_startup_fixup:\n"
>> +     "       b secondary_startup\n"
>> +     ".thumb\n"
>> +);
>> +
>> +void mtk_secondary_startup_fixup(void);
>> +#define secondary_startup mtk_secondary_startup_fixup
>> +#endif
>
>
> Replying myself.
>
> It seems kernel already have secondary_startup_arm which support this
> usage. I'll use that in my next version instead.

With this I was able to get the board up and running. I will try mt6589 ASAP.
Matthias Brugger May 6, 2015, 11:04 a.m. UTC | #3
Hi Joe,

2015-05-06 10:29 GMT+02:00 Matthias Brugger <matthias.bgg@gmail.com>:
> 2015-05-06 9:59 GMT+02:00 Yingjoe Chen <yingjoe.chen@mediatek.com>:
>> On Wed, 2015-05-06 at 15:19 +0800, Yingjoe Chen wrote:
>>> Hi Matthias,
>> <...>
>>> > I tried on the mt8135 eval board but it fails to bring up the CPU.
>>> >
>>> > When booting:
>>> > [    1.048588] CPU1: failed to come online
>>> > [    2.049914] CPU2: failed to come online
>>> > [    3.051245] CPU3: failed to come online
>>>
>>>
>>> Thanks for testing, and the config file you provided.
>>> It seems you are running THUMB2 kernel, unfortunately mt8135 trustzone
>>> firmware doesn't support jump to THUMB2 code directly.
>>>
>>> I can workaround this with the following patch. I'll include it in my
>>> next round.
>>>
>>> Joe.C
>>>
>>> -----8<----------------
>>> diff --git a/arch/arm/mach-mediatek/platsmp.c
>>> b/arch/arm/mach-mediatek/platsmp.c
>>> index e266b3d..5dea55a 100644
>>> --- a/arch/arm/mach-mediatek/platsmp.c
>>> +++ b/arch/arm/mach-mediatek/platsmp.c
>>> @@ -57,6 +57,18 @@ static const struct of_device_id mtk_smp_boot_infos[]
>>> __initconst = {
>>>  static void __iomem *mtk_smp_base;
>>>  static const struct mtk_smp_boot_info *mtk_smp_info;
>>>
>>> +#ifdef CONFIG_THUMB2_KERNEL
>>> +__asm__(
>>> +     ".arm\n"
>>> +     "mtk_secondary_startup_fixup:\n"
>>> +     "       b secondary_startup\n"
>>> +     ".thumb\n"
>>> +);
>>> +
>>> +void mtk_secondary_startup_fixup(void);
>>> +#define secondary_startup mtk_secondary_startup_fixup
>>> +#endif
>>
>>
>> Replying myself.
>>
>> It seems kernel already have secondary_startup_arm which support this
>> usage. I'll use that in my next version instead.
>
> With this I was able to get the board up and running. I will try mt6589 ASAP.

I just realized, that your aforementioned patch for the THUMB2 kernel
breaks SMP on mt6589. Strangely without this patch it works fine.

Regrads,
Matthias
Yingjoe Chen May 16, 2015, 8:09 a.m. UTC | #4
On Wed, 2015-05-06 at 13:04 +0200, Matthias Brugger wrote:
> Hi Joe,
> 
> 2015-05-06 10:29 GMT+02:00 Matthias Brugger <matthias.bgg@gmail.com>:
> > 2015-05-06 9:59 GMT+02:00 Yingjoe Chen <yingjoe.chen@mediatek.com>:
> >> On Wed, 2015-05-06 at 15:19 +0800, Yingjoe Chen wrote:
> >>> Hi Matthias,
> >> <...>
> >>> > I tried on the mt8135 eval board but it fails to bring up the CPU.
> >>> >
> >>> > When booting:
> >>> > [    1.048588] CPU1: failed to come online
> >>> > [    2.049914] CPU2: failed to come online
> >>> > [    3.051245] CPU3: failed to come online
> >>>
> >>>
> >>> Thanks for testing, and the config file you provided.
> >>> It seems you are running THUMB2 kernel, unfortunately mt8135 trustzone
> >>> firmware doesn't support jump to THUMB2 code directly.
> >>>
> >>> I can workaround this with the following patch. I'll include it in my
> >>> next round.
> >>>
> >>> Joe.C
> >>>
> >>> -----8<----------------
> >>> diff --git a/arch/arm/mach-mediatek/platsmp.c
> >>> b/arch/arm/mach-mediatek/platsmp.c
> >>> index e266b3d..5dea55a 100644
> >>> --- a/arch/arm/mach-mediatek/platsmp.c
> >>> +++ b/arch/arm/mach-mediatek/platsmp.c
> >>> @@ -57,6 +57,18 @@ static const struct of_device_id mtk_smp_boot_infos[]
> >>> __initconst = {
> >>>  static void __iomem *mtk_smp_base;
> >>>  static const struct mtk_smp_boot_info *mtk_smp_info;
> >>>
> >>> +#ifdef CONFIG_THUMB2_KERNEL
> >>> +__asm__(
> >>> +     ".arm\n"
> >>> +     "mtk_secondary_startup_fixup:\n"
> >>> +     "       b secondary_startup\n"
> >>> +     ".thumb\n"
> >>> +);
> >>> +
> >>> +void mtk_secondary_startup_fixup(void);
> >>> +#define secondary_startup mtk_secondary_startup_fixup
> >>> +#endif
> >>
> >>
> >> Replying myself.
> >>
> >> It seems kernel already have secondary_startup_arm which support this
> >> usage. I'll use that in my next version instead.
> >
> > With this I was able to get the board up and running. I will try mt6589 ASAP.
> 
> I just realized, that your aforementioned patch for the THUMB2 kernel
> breaks SMP on mt6589. Strangely without this patch it works fine.
> 

Hi Matthias,

Unfortunately I can't reproduce or figure out why this could happen.
I change to use common kernel code secondary_startup_arm in new series,
could you that a try?
Thanks.

Joe.C
Matthias Brugger May 16, 2015, 9:11 a.m. UTC | #5
2015-05-16 10:09 GMT+02:00 Yingjoe Chen <yingjoe.chen@mediatek.com>:
> On Wed, 2015-05-06 at 13:04 +0200, Matthias Brugger wrote:
>> Hi Joe,
>>
>> 2015-05-06 10:29 GMT+02:00 Matthias Brugger <matthias.bgg@gmail.com>:
>> > 2015-05-06 9:59 GMT+02:00 Yingjoe Chen <yingjoe.chen@mediatek.com>:
>> >> On Wed, 2015-05-06 at 15:19 +0800, Yingjoe Chen wrote:
>> >>> Hi Matthias,
>> >> <...>
>> >>> > I tried on the mt8135 eval board but it fails to bring up the CPU.
>> >>> >
>> >>> > When booting:
>> >>> > [    1.048588] CPU1: failed to come online
>> >>> > [    2.049914] CPU2: failed to come online
>> >>> > [    3.051245] CPU3: failed to come online
>> >>>
>> >>>
>> >>> Thanks for testing, and the config file you provided.
>> >>> It seems you are running THUMB2 kernel, unfortunately mt8135 trustzone
>> >>> firmware doesn't support jump to THUMB2 code directly.
>> >>>
>> >>> I can workaround this with the following patch. I'll include it in my
>> >>> next round.
>> >>>
>> >>> Joe.C
>> >>>
>> >>> -----8<----------------
>> >>> diff --git a/arch/arm/mach-mediatek/platsmp.c
>> >>> b/arch/arm/mach-mediatek/platsmp.c
>> >>> index e266b3d..5dea55a 100644
>> >>> --- a/arch/arm/mach-mediatek/platsmp.c
>> >>> +++ b/arch/arm/mach-mediatek/platsmp.c
>> >>> @@ -57,6 +57,18 @@ static const struct of_device_id mtk_smp_boot_infos[]
>> >>> __initconst = {
>> >>>  static void __iomem *mtk_smp_base;
>> >>>  static const struct mtk_smp_boot_info *mtk_smp_info;
>> >>>
>> >>> +#ifdef CONFIG_THUMB2_KERNEL
>> >>> +__asm__(
>> >>> +     ".arm\n"
>> >>> +     "mtk_secondary_startup_fixup:\n"
>> >>> +     "       b secondary_startup\n"
>> >>> +     ".thumb\n"
>> >>> +);
>> >>> +
>> >>> +void mtk_secondary_startup_fixup(void);
>> >>> +#define secondary_startup mtk_secondary_startup_fixup
>> >>> +#endif
>> >>
>> >>
>> >> Replying myself.
>> >>
>> >> It seems kernel already have secondary_startup_arm which support this
>> >> usage. I'll use that in my next version instead.
>> >
>> > With this I was able to get the board up and running. I will try mt6589 ASAP.
>>
>> I just realized, that your aforementioned patch for the THUMB2 kernel
>> breaks SMP on mt6589. Strangely without this patch it works fine.
>>
>
> Hi Matthias,
>
> Unfortunately I can't reproduce or figure out why this could happen.
> I change to use common kernel code secondary_startup_arm in new series,
> could you that a try?
> Thanks.

I just tried it on mt6589 and mt8135 and its works on both.
Actually if you revert patch 1/9 SMP on mt6589 stops working.

Thanks,
Matthias
diff mbox

Patch

diff --git a/arch/arm/mach-mediatek/platsmp.c
b/arch/arm/mach-mediatek/platsmp.c
index e266b3d..5dea55a 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -57,6 +57,18 @@  static const struct of_device_id mtk_smp_boot_infos[]
__initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+#ifdef CONFIG_THUMB2_KERNEL
+__asm__(
+	".arm\n"
+	"mtk_secondary_startup_fixup:\n"
+	"	b secondary_startup\n"
+	".thumb\n"
+);
+
+void mtk_secondary_startup_fixup(void);
+#define secondary_startup mtk_secondary_startup_fixup
+#endif
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct
*idle)