2015-07-14 05:19:56

by Yingjoe Chen

[permalink] [raw]
Subject: [PATCH v3 0/5] Add SMP bringup support for mt65xx socs

This series add SMP brinup support for MediaTek SoCs. This is based
on v4.2-rc1 and Matthias' next branch (for dts parts).

There are 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 enable arch timer support.
Patch 2,3 add support for cpu enable-method "mediatek,mt6589-smp" and
"mediatek,mt81xx-tz-smp", which support Mediatek SMP bringup for non-TZ
and TZ platform.
Patch 4,5 finally enable SMP bringup for mt8135 and mt8127.

Changes in v3:
- The first 2 patches in v2 are merged in v4.2-rc1.
- Patch 3~4 in v2 are moved to another series [1]
- platsmp.c changes based on Stephen's suggestion
- Change cpu enable-method name to "mediatek,mt6589-smp"

Changes in v2:
- Fix boot issue for THUMB2 kernel.
- Not enable GPT_CLK_EVT when setup to fix GPT spurious interrupt issue
- Change platsmp.c according to Matthias' suggestion
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html

v1:
http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000528.html

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.html

Matthias Brugger (1):
ARM: mediatek: enable gpt6 on boot up to make arch timer working

Yingjoe Chen (4):
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

Documentation/devicetree/bindings/arm/cpus.txt | 2 +
arch/arm/boot/dts/mt8127.dtsi | 16 +++
arch/arm/boot/dts/mt8135.dtsi | 16 +++
arch/arm/mach-mediatek/Makefile | 3 +
arch/arm/mach-mediatek/mediatek.c | 27 +++++
arch/arm/mach-mediatek/platsmp.c | 144 +++++++++++++++++++++++++
6 files changed, 208 insertions(+)
create mode 100644 arch/arm/mach-mediatek/platsmp.c


2015-07-14 05:19:27

by Yingjoe Chen

[permalink] [raw]
Subject: [PATCH v3 1/5] ARM: mediatek: enable gpt6 on boot up to make arch timer working

From: Matthias Brugger <[email protected]>

We enable GTP6 which ungates the arch timer clock.
In the future this should be done in the bootloader.

Signed-off-by: Matthias Brugger <[email protected]>
Signed-off-by: Yingjoe Chen <[email protected]>
---
arch/arm/mach-mediatek/mediatek.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index a954900..19dc738 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -16,6 +16,32 @@
*/
#include <linux/init.h>
#include <asm/mach/arch.h>
+#include <linux/of.h>
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+
+
+#define GPT6_CON_MT65xx 0x10008060
+#define GPT_ENABLE 0x31
+
+static void __init mediatek_timer_init(void)
+{
+ void __iomem *gpt_base;
+
+ if (of_machine_is_compatible("mediatek,mt6589") ||
+ of_machine_is_compatible("mediatek,mt8135") ||
+ of_machine_is_compatible("mediatek,mt8127")) {
+ /* turn on GPT6 which ungates arch timer clocks */
+ gpt_base = ioremap(GPT6_CON_MT65xx, 0x04);
+
+ /* enable clock and set to free-run */
+ writel(GPT_ENABLE, gpt_base);
+ iounmap(gpt_base);
+ }
+
+ of_clk_init(NULL);
+ clocksource_of_init();
+};

static const char * const mediatek_board_dt_compat[] = {
"mediatek,mt6589",
@@ -27,4 +53,5 @@ static const char * const mediatek_board_dt_compat[] = {

DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
.dt_compat = mediatek_board_dt_compat,
+ .init_time = mediatek_timer_init,
MACHINE_END
--
1.8.1.1.dirty

2015-07-14 05:19:55

by Yingjoe Chen

[permalink] [raw]
Subject: [PATCH v3 2/5] devicetree: bindings: add new SMP enable method Mediatek SoC

This commit add new cpu enable method "mediatek,mt65xx-smp" and
"mediatek,mt81xx-tz-smp".

Signed-off-by: Yingjoe Chen <[email protected]>
---
Documentation/devicetree/bindings/arm/cpus.txt | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index d6b794c..d58eb45 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -195,6 +195,8 @@ nodes to be present and contain the properties described below.
"marvell,armada-380-smp"
"marvell,armada-390-smp"
"marvell,armada-xp-smp"
+ "mediatek,mt6589-smp"
+ "mediatek,mt81xx-tz-smp"
"qcom,gcc-msm8660"
"qcom,kpss-acc-v1"
"qcom,kpss-acc-v2"
--
1.8.1.1.dirty

2015-07-14 05:19:35

by Yingjoe Chen

[permalink] [raw]
Subject: [PATCH v3 3/5] ARM: mediatek: add smp bringup code

Add support for booting secondary CPUs on mt6589, mt8127
and mt8135.

Signed-off-by: Yingjoe Chen <[email protected]>
---
arch/arm/mach-mediatek/Makefile | 3 +
arch/arm/mach-mediatek/platsmp.c | 144 +++++++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+)
create mode 100644 arch/arm/mach-mediatek/platsmp.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 43e619f..2116460 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1 +1,4 @@
+ifeq ($(CONFIG_SMP),y)
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+endif
obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
new file mode 100644
index 0000000..a5bc108
--- /dev/null
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -0,0 +1,144 @@
+/*
+ * arch/arm/mach-mediatek/platsmp.c
+ *
+ * Copyright (c) 2014 Mediatek Inc.
+ * Author: Shunli Wang <[email protected]>
+ * Yingjoe Chen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/io.h>
+#include <linux/memblock.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/string.h>
+#include <linux/threads.h>
+
+#define MTK_MAX_CPU 8
+#define MTK_SMP_REG_SIZE 0x1000
+
+struct mtk_smp_boot_info {
+ unsigned long smp_base;
+ unsigned int jump_reg;
+ unsigned int core_keys[MTK_MAX_CPU - 1];
+ unsigned int core_regs[MTK_MAX_CPU - 1];
+};
+
+static const struct mtk_smp_boot_info mtk_mt8135_tz_boot = {
+ 0x80002000, 0x3fc,
+ { 0x534c4131, 0x4c415332, 0x41534c33 },
+ { 0x3f8, 0x3f8, 0x3f8 },
+};
+
+static const struct mtk_smp_boot_info mtk_mt6589_boot = {
+ 0x10002000, 0x34,
+ { 0x534c4131, 0x4c415332, 0x41534c33 },
+ { 0x38, 0x3c, 0x40 },
+};
+
+static const struct of_device_id mtk_tz_smp_boot_infos[] __initconst = {
+ { .compatible = "mediatek,mt8135", .data = &mtk_mt8135_tz_boot },
+ { .compatible = "mediatek,mt8127", .data = &mtk_mt8135_tz_boot },
+};
+
+static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
+ { .compatible = "mediatek,mt6589", .data = &mtk_mt6589_boot },
+};
+
+static void __iomem *mtk_smp_base;
+static const struct mtk_smp_boot_info *mtk_smp_info;
+
+static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+ if (!mtk_smp_base)
+ return -EINVAL;
+
+ if (!mtk_smp_info->core_keys[cpu-1])
+ return -EINVAL;
+
+ writel_relaxed(mtk_smp_info->core_keys[cpu-1],
+ mtk_smp_base + mtk_smp_info->core_regs[cpu-1]);
+
+ arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+ return 0;
+}
+
+static void __init __mtk_smp_prepare_cpus(unsigned int max_cpus, int trustzone)
+{
+ int i, num;
+ const struct of_device_id *infos;
+
+ if (trustzone) {
+ num = ARRAY_SIZE(mtk_tz_smp_boot_infos);
+ infos = mtk_tz_smp_boot_infos;
+ } else {
+ num = ARRAY_SIZE(mtk_smp_boot_infos);
+ infos = mtk_smp_boot_infos;
+ }
+
+ /* Find smp boot info for this SoC */
+ for (i = 0; i < num; i++) {
+ if (of_machine_is_compatible(infos[i].compatible)) {
+ mtk_smp_info = infos[i].data;
+ break;
+ }
+ }
+
+ if (!mtk_smp_info) {
+ pr_err("%s: Device is not supported\n", __func__);
+ return;
+ }
+
+ if (trustzone) {
+ if (memblock_reserve(mtk_smp_info->smp_base, MTK_SMP_REG_SIZE)) {
+ pr_err("%s: Can't reserve smp memory\n", __func__);
+ return;
+ }
+ mtk_smp_base = phys_to_virt(mtk_smp_info->smp_base);
+ } else {
+ mtk_smp_base = ioremap(mtk_smp_info->smp_base, MTK_SMP_REG_SIZE);
+ if (!mtk_smp_base) {
+ pr_err("%s: Can't remap %lx\n", __func__,
+ mtk_smp_info->smp_base);
+ return;
+ }
+ }
+
+ /*
+ * write the address of slave startup address into the system-wide
+ * jump register
+ */
+ writel_relaxed(virt_to_phys(secondary_startup_arm),
+ mtk_smp_base + mtk_smp_info->jump_reg);
+}
+
+static void __init mtk_tz_smp_prepare_cpus(unsigned int max_cpus)
+{
+ __mtk_smp_prepare_cpus(max_cpus, 1);
+}
+
+static void __init mtk_smp_prepare_cpus(unsigned int max_cpus)
+{
+ __mtk_smp_prepare_cpus(max_cpus, 0);
+}
+
+static struct smp_operations mt81xx_tz_smp_ops __initdata = {
+ .smp_prepare_cpus = mtk_tz_smp_prepare_cpus,
+ .smp_boot_secondary = mtk_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt81xx_tz_smp, "mediatek,mt81xx-tz-smp", &mt81xx_tz_smp_ops);
+
+static struct smp_operations mt6589_smp_ops __initdata = {
+ .smp_prepare_cpus = mtk_smp_prepare_cpus,
+ .smp_boot_secondary = mtk_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6589_smp, "mediatek,mt6589-smp", &mt6589_smp_ops);
--
1.8.1.1.dirty

2015-07-14 05:20:04

by Yingjoe Chen

[permalink] [raw]
Subject: [PATCH v3 4/5] ARM: dts: mt8135: enable basic SMP bringup for mt8135

Add arch timer node to enable arch-timer support. MT8135 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This also set cpu enable-method to enable SMP.

Signed-off-by: Yingjoe Chen <[email protected]>
---
arch/arm/boot/dts/mt8135.dtsi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/mt8135.dtsi b/arch/arm/boot/dts/mt8135.dtsi
index 0aba9eb..0264d2e 100644
--- a/arch/arm/boot/dts/mt8135.dtsi
+++ b/arch/arm/boot/dts/mt8135.dtsi
@@ -44,6 +44,7 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
+ enable-method = "mediatek,mt81xx-tz-smp";

cpu0: cpu@0 {
device_type = "cpu";
@@ -96,6 +97,21 @@

};

+ timer {
+ compatible = "arm,armv7-timer";
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>;
+ clock-frequency = <13000000>;
+ arm,cpu-registers-not-fw-configured;
+ };
+
soc {
#address-cells = <2>;
#size-cells = <2>;
--
1.8.1.1.dirty

2015-07-14 05:19:44

by Yingjoe Chen

[permalink] [raw]
Subject: [PATCH v3 5/5] ARM: dts: mt8127: enable basic SMP bringup for mt8127

Add arch timer node to enable arch-timer support. MT8127 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This also set cpu enable-method to enable SMP.

Signed-off-by: Yingjoe Chen <[email protected]>
---
arch/arm/boot/dts/mt8127.dtsi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/mt8127.dtsi b/arch/arm/boot/dts/mt8127.dtsi
index ca3402e..fae84ee 100644
--- a/arch/arm/boot/dts/mt8127.dtsi
+++ b/arch/arm/boot/dts/mt8127.dtsi
@@ -23,6 +23,7 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
+ enable-method = "mediatek,mt81xx-tz-smp";

cpu@0 {
device_type = "cpu";
@@ -72,6 +73,21 @@
};
};

+ timer {
+ compatible = "arm,armv7-timer";
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>;
+ clock-frequency = <13000000>;
+ arm,cpu-registers-not-fw-configured;
+ };
+
soc {
#address-cells = <2>;
#size-cells = <2>;
--
1.8.1.1.dirty

2015-07-14 14:19:12

by Lynch, Nathan

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] ARM: dts: mt8135: enable basic SMP bringup for mt8135

On 07/14/2015 12:18 AM, Yingjoe Chen wrote:
> Add arch timer node to enable arch-timer support. MT8135 firmware
> doesn't correctly setup arch-timer frequency and CNTVOFF, add
> properties to workaround this.

[...]

>
> + timer {
> + compatible = "arm,armv7-timer";
> + interrupt-parent = <&gic>;
> + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
> + IRQ_TYPE_LEVEL_LOW)>,
> + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
> + IRQ_TYPE_LEVEL_LOW)>,
> + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
> + IRQ_TYPE_LEVEL_LOW)>,
> + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
> + IRQ_TYPE_LEVEL_LOW)>;
> + clock-frequency = <13000000>;
> + arm,cpu-registers-not-fw-configured;

It's disappointing to see this property in new DTS submissions. It
prevents taking advantage of the VDSO for gettimeofday/clock_gettime.

2015-07-16 14:44:19

by Yingjoe Chen

[permalink] [raw]
Subject: Re: [PATCH v3 4/5] ARM: dts: mt8135: enable basic SMP bringup for mt8135

On Tue, 2015-07-14 at 09:19 -0500, Nathan Lynch wrote:
> On 07/14/2015 12:18 AM, Yingjoe Chen wrote:
> > Add arch timer node to enable arch-timer support. MT8135 firmware
> > doesn't correctly setup arch-timer frequency and CNTVOFF, add
> > properties to workaround this.
>
> [...]
>
> >
> > + timer {
> > + compatible = "arm,armv7-timer";
> > + interrupt-parent = <&gic>;
> > + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
> > + IRQ_TYPE_LEVEL_LOW)>,
> > + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
> > + IRQ_TYPE_LEVEL_LOW)>,
> > + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
> > + IRQ_TYPE_LEVEL_LOW)>,
> > + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
> > + IRQ_TYPE_LEVEL_LOW)>;
> > + clock-frequency = <13000000>;
> > + arm,cpu-registers-not-fw-configured;
>
> It's disappointing to see this property in new DTS submissions. It
> prevents taking advantage of the VDSO for gettimeofday/clock_gettime.
>

Hi,

I know. But unfortunately this is a more then 1 year SoC, so I can't do
anything to change this :(

Joe.C

2015-08-05 18:44:27

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH v3 0/5] Add SMP bringup support for mt65xx socs

On Tuesday, July 14, 2015 01:18:26 PM Yingjoe Chen wrote:
> This series add SMP brinup support for MediaTek SoCs. This is based
> on v4.2-rc1 and Matthias' next branch (for dts parts).
>
> There are 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 enable arch timer support.
> Patch 2,3 add support for cpu enable-method "mediatek,mt6589-smp" and
> "mediatek,mt81xx-tz-smp", which support Mediatek SMP bringup for non-TZ
> and TZ platform.
> Patch 4,5 finally enable SMP bringup for mt8135 and mt8127.
>
> Changes in v3:
> - The first 2 patches in v2 are merged in v4.2-rc1.
> - Patch 3~4 in v2 are moved to another series [1]
> - platsmp.c changes based on Stephen's suggestion
> - Change cpu enable-method name to "mediatek,mt6589-smp"
>
> Changes in v2:
> - Fix boot issue for THUMB2 kernel.
> - Not enable GPT_CLK_EVT when setup to fix GPT spurious interrupt issue
> - Change platsmp.c according to Matthias' suggestion
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
>
> v1:
> http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000528.html
>
> [1]
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.html
>
> Matthias Brugger (1):
> ARM: mediatek: enable gpt6 on boot up to make arch timer working
>
> Yingjoe Chen (4):
> 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
>
> Documentation/devicetree/bindings/arm/cpus.txt | 2 +
> arch/arm/boot/dts/mt8127.dtsi | 16 +++
> arch/arm/boot/dts/mt8135.dtsi | 16 +++
> arch/arm/mach-mediatek/Makefile | 3 +
> arch/arm/mach-mediatek/mediatek.c | 27 +++++
> arch/arm/mach-mediatek/platsmp.c | 144
> +++++++++++++++++++++++++ 6 files changed, 208 insertions(+)
> create mode 100644 arch/arm/mach-mediatek/platsmp.c

Applied to v4.2-next/soc-2 and v4.2-next/dts-2

Thanks,
Matthias

2015-08-05 22:27:01

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v3 3/5] ARM: mediatek: add smp bringup code

On Tue, Jul 14, 2015 at 01:18:29PM +0800, Yingjoe Chen wrote:
> +static void __init __mtk_smp_prepare_cpus(unsigned int max_cpus, int trustzone)
> +{
> + int i, num;
> + const struct of_device_id *infos;
> +
> + if (trustzone) {
> + num = ARRAY_SIZE(mtk_tz_smp_boot_infos);
> + infos = mtk_tz_smp_boot_infos;
> + } else {
> + num = ARRAY_SIZE(mtk_smp_boot_infos);
> + infos = mtk_smp_boot_infos;
> + }
> +
> + /* Find smp boot info for this SoC */
> + for (i = 0; i < num; i++) {
> + if (of_machine_is_compatible(infos[i].compatible)) {
> + mtk_smp_info = infos[i].data;
> + break;
> + }
> + }
> +
> + if (!mtk_smp_info) {
> + pr_err("%s: Device is not supported\n", __func__);
> + return;
> + }
> +
> + if (trustzone) {
> + if (memblock_reserve(mtk_smp_info->smp_base, MTK_SMP_REG_SIZE)) {

Strong NAK.

This is _FAR_ too late to be calling memblock_reserve(). You won't be
reserving memory as you think you are (it's already handed over to the
kernel's allocators by this stage.)

--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

2015-08-05 22:31:26

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v3 0/5] Add SMP bringup support for mt65xx socs

On Wed, Aug 05, 2015 at 08:44:11PM +0200, Matthias Brugger wrote:
> On Tuesday, July 14, 2015 01:18:26 PM Yingjoe Chen wrote:
> > This series add SMP brinup support for MediaTek SoCs. This is based
> > on v4.2-rc1 and Matthias' next branch (for dts parts).
> >
> > There are 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 enable arch timer support.
> > Patch 2,3 add support for cpu enable-method "mediatek,mt6589-smp" and
> > "mediatek,mt81xx-tz-smp", which support Mediatek SMP bringup for non-TZ
> > and TZ platform.
> > Patch 4,5 finally enable SMP bringup for mt8135 and mt8127.
> >
> > Changes in v3:
> > - The first 2 patches in v2 are merged in v4.2-rc1.
> > - Patch 3~4 in v2 are moved to another series [1]
> > - platsmp.c changes based on Stephen's suggestion
> > - Change cpu enable-method name to "mediatek,mt6589-smp"
> >
> > Changes in v2:
> > - Fix boot issue for THUMB2 kernel.
> > - Not enable GPT_CLK_EVT when setup to fix GPT spurious interrupt issue
> > - Change platsmp.c according to Matthias' suggestion
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
> >
> > v1:
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000528.html
> >
> > [1]
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.html
> >
> > Matthias Brugger (1):
> > ARM: mediatek: enable gpt6 on boot up to make arch timer working
> >
> > Yingjoe Chen (4):
> > 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
> >
> > Documentation/devicetree/bindings/arm/cpus.txt | 2 +
> > arch/arm/boot/dts/mt8127.dtsi | 16 +++
> > arch/arm/boot/dts/mt8135.dtsi | 16 +++
> > arch/arm/mach-mediatek/Makefile | 3 +
> > arch/arm/mach-mediatek/mediatek.c | 27 +++++
> > arch/arm/mach-mediatek/platsmp.c | 144
> > +++++++++++++++++++++++++ 6 files changed, 208 insertions(+)
> > create mode 100644 arch/arm/mach-mediatek/platsmp.c
>
> Applied to v4.2-next/soc-2 and v4.2-next/dts-2

I've just NAK'd one of the patches in this set; I don't tend to even see
mediatek patches normally, as they all head into my junk mailfolder
because mediatek's mail server setup is truely abysmal (it has broken
reverse DNS - the DNS positively says that the mail server is not a
legit owner of the name it claims to be.)

The problem is that this patch series uses memblock_reserve() way after
the memory has been transitioned out of memblock's control, so actually
this has no effect.

I've seen a number of patches doing this. I'm not sure what's soo friggin
hard for people to understand: memblock is about the EARLY stages of
getting the system up and running. Once the memory has been handed
over to the kernel's memory management, memblock MUST NOT BE USED to
reserve memory.

There is one place, and one place only in the ARM kernel where
memblock_reserve() is possible, and that's in the ->reserve machine
callback. NOWHERE ELSE is permissible.

--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

2015-08-07 10:50:24

by Yingjoe Chen

[permalink] [raw]
Subject: Re: [PATCH v3 0/5] Add SMP bringup support for mt65xx socs

On Wed, 2015-08-05 at 23:31 +0100, Russell King - ARM Linux wrote:
> On Wed, Aug 05, 2015 at 08:44:11PM +0200, Matthias Brugger wrote:
> > On Tuesday, July 14, 2015 01:18:26 PM Yingjoe Chen wrote:
> > > This series add SMP brinup support for MediaTek SoCs. This is based
> > > on v4.2-rc1 and Matthias' next branch (for dts parts).
<...>

> > Applied to v4.2-next/soc-2 and v4.2-next/dts-2
>
> I've just NAK'd one of the patches in this set; I don't tend to even see
> mediatek patches normally, as they all head into my junk mailfolder
> because mediatek's mail server setup is truely abysmal (it has broken
> reverse DNS - the DNS positively says that the mail server is not a
> legit owner of the name it claims to be.)

Hi Russell,

Hope you see this.

Thanks for your review. I already pass this information to our IT, hope
they can resolve this soon.


> The problem is that this patch series uses memblock_reserve() way after
> the memory has been transitioned out of memblock's control, so actually
> this has no effect.
>
> I've seen a number of patches doing this. I'm not sure what's soo friggin
> hard for people to understand: memblock is about the EARLY stages of
> getting the system up and running. Once the memory has been handed
> over to the kernel's memory management, memblock MUST NOT BE USED to
> reserve memory.
>
> There is one place, and one place only in the ARM kernel where
> memblock_reserve() is possible, and that's in the ->reserve machine
> callback. NOWHERE ELSE is permissible.


It seems we can write memory-reserve node in device tree to do this as
well. Do you prefer us to reserve memblock in reserve callback or using
device tree?

Joe.C

2015-08-07 17:13:11

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH v3 0/5] Add SMP bringup support for mt65xx socs

On Wednesday, August 05, 2015 11:31:15 PM Russell King - ARM Linux wrote:
> On Wed, Aug 05, 2015 at 08:44:11PM +0200, Matthias Brugger wrote:
> > On Tuesday, July 14, 2015 01:18:26 PM Yingjoe Chen wrote:
> > > This series add SMP brinup support for MediaTek SoCs. This is based
> > > on v4.2-rc1 and Matthias' next branch (for dts parts).
> > >
> > > There are 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 enable arch timer support.
> > > Patch 2,3 add support for cpu enable-method "mediatek,mt6589-smp" and
> > > "mediatek,mt81xx-tz-smp", which support Mediatek SMP bringup for non-TZ
> > > and TZ platform.
> > > Patch 4,5 finally enable SMP bringup for mt8135 and mt8127.
> > >
> > > Changes in v3:
> > > - The first 2 patches in v2 are merged in v4.2-rc1.
> > > - Patch 3~4 in v2 are moved to another series [1]
> > > - platsmp.c changes based on Stephen's suggestion
> > > - Change cpu enable-method name to "mediatek,mt6589-smp"
> > >
> > > Changes in v2:
> > > - Fix boot issue for THUMB2 kernel.
> > > - Not enable GPT_CLK_EVT when setup to fix GPT spurious interrupt issue
> > > - Change platsmp.c according to Matthias' suggestion
> > > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
> > >
> > > v1:
> > > http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000528.html
> > >
> > > [1]
> > > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001544.htm
> > > l
> > >
> > > Matthias Brugger (1):
> > > ARM: mediatek: enable gpt6 on boot up to make arch timer working
> > >
> > > Yingjoe Chen (4):
> > > 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
> > >
> > > Documentation/devicetree/bindings/arm/cpus.txt | 2 +
> > > arch/arm/boot/dts/mt8127.dtsi | 16 +++
> > > arch/arm/boot/dts/mt8135.dtsi | 16 +++
> > > arch/arm/mach-mediatek/Makefile | 3 +
> > > arch/arm/mach-mediatek/mediatek.c | 27 +++++
> > > arch/arm/mach-mediatek/platsmp.c | 144
> > >
> > > +++++++++++++++++++++++++ 6 files changed, 208 insertions(+)
> > >
> > > create mode 100644 arch/arm/mach-mediatek/platsmp.c
> >
> > Applied to v4.2-next/soc-2 and v4.2-next/dts-2
>
> I've just NAK'd one of the patches in this set; I don't tend to even see
> mediatek patches normally, as they all head into my junk mailfolder
> because mediatek's mail server setup is truely abysmal (it has broken
> reverse DNS - the DNS positively says that the mail server is not a
> legit owner of the name it claims to be.)
>
> The problem is that this patch series uses memblock_reserve() way after
> the memory has been transitioned out of memblock's control, so actually
> this has no effect.
>
> I've seen a number of patches doing this. I'm not sure what's soo friggin
> hard for people to understand: memblock is about the EARLY stages of
> getting the system up and running. Once the memory has been handed
> over to the kernel's memory management, memblock MUST NOT BE USED to
> reserve memory.
>
> There is one place, and one place only in the ARM kernel where
> memblock_reserve() is possible, and that's in the ->reserve machine
> callback. NOWHERE ELSE is permissible.

OK, I just dropped the patches. Thanks for reviewing this.

Matthias