Skip to contentSkip to conversation

[PATCH V3: Add Smp support for Allwinner A20. 0/3]

PATCH Superseded Fan Rong 5 participants 19 messages Sep 22, 2013 – Oct 2, 2013 1 message not in the archive

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Fan Rong

author
#0 lore raw

v3 cover [PATCH V3: Add Smp support for Allwinner A20. 0/3]

This is the version3 patch. It delete platform.h and delete some code in platsmp.c that's not necessary. The patchs add smp support for Allwinner A20. It add cpu register node and arch timer node in dts for smp booting. SMP need arch timer as clocksource, It does use virtual counter timer and does not use physical counter timer, so bootloader ***must*** set CNTVOFF register for a20 before kernel booting. I have add support set CNTVOFF register for uboot, if you want to test it in a20 board, you need update uboot. Thanks for advice of Mark Rutland, Marc Zyngier, Ian Campbell, Russell King and Maxime Ripard.

Fan Rong (3):
Add smp support for Allwinner A20(sunxi 7i).
Add cpuconfig nodes in dts for smp configure.
add arch count timer node in dts for Allwinner A20(sunxi 7i).

 arch/arm/boot/dts/sun7i-a20.dtsi | 19 ++++++++-
 arch/arm/mach-sunxi/Makefile     |  2 +
 arch/arm/mach-sunxi/headsmp.S    | 17 ++++++++
 arch/arm/mach-sunxi/platsmp.c    | 86 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-sunxi/sunxi.c      | 31 +++++++++++++++
 5 files changed, 153 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-sunxi/headsmp.S
 create mode 100644 arch/arm/mach-sunxi/platsmp.c
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH v3 1/3 Add smp support for Allwinner A20(sunxi 7i).

---
 arch/arm/mach-sunxi/Makefile  |  2 +
 arch/arm/mach-sunxi/headsmp.S | 17 +++++++++
 arch/arm/mach-sunxi/platsmp.c | 86 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-sunxi/sunxi.c   | 31 ++++++++++++++++
 4 files changed, 136 insertions(+)
 create mode 100644 arch/arm/mach-sunxi/headsmp.S
 create mode 100644 arch/arm/mach-sunxi/platsmp.c
arch/arm/mach-sunxi/Makefile +2 -0
index 93bebfc..d7f1ef4 100644
@@ -1 +1,3 @@
 obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
+obj-$(CONFIG_ARCH_SUNXI) += platsmp.o
+obj-$(CONFIG_ARCH_SUNXI) += headsmp.o
arch/arm/mach-sunxi/headsmp.S new file +17 -0
new file mode 100644
index 0000000..5899399
@@ -0,0 +1,17 @@
+/*
+ * SMP support for A20
+ *
+ *  Copyright (C) 2013 Fan Rong <[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.
+ */
+
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+.section ".text.head", "ax" ENTRY(sun7i_secondary_startup)
+msr cpsr_fsxc,
+#0xd3
+b secondary_startup ENDPROC(sun7i_secondary_startup)
arch/arm/mach-sunxi/platsmp.c new file +86 -0

86 lines not on this page · raw message

arch/arm/mach-sunxi/sunxi.c +31 -0
index e79fb34..a692350 100644
@@ -26,6 +26,8 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
+extern struct smp_operations sun7i_smp_ops;
+
 #define SUN4I_WATCHDOG_CTRL_REG		0x00
 #define SUN4I_WATCHDOG_CTRL_RESTART		BIT(0)
 #define SUN4I_WATCHDOG_MODE_REG		0x04
@@ -42,6 +44,14 @@
 #define SUN6I_WATCHDOG1_MODE_ENABLE		BIT(0)
 
 static void __iomem *wdt_base;
+/*
+ * CPU Configure module support
+ * 1: Software reset for smp cpus
+ * 2: Configure for smp cpus including boot.
+ * 3: Three 64-bit idle counters and two 64-bit common counters
+ * it is needed for smp cpus
+ */
+void __iomem *sunxi7i_cc_base; /*CPU Configure Base*/
 
 static void sun4i_restart(enum reboot_mode mode, const char *cmd)
 {
@@ -98,6 +108,11 @@ static struct of_device_id sunxi_restart_ids[] = {
 	{ /*sentinel*/ }
 };
 
+static struct of_device_id sunxi_cc_ids[] = {
+	{ .compatible = "allwinner,sun7i-a20-cpuconfig"},
+	{ /*sentinel*/ }
+};
+
 static void sunxi_setup_restart(void)
 {
 	const struct of_device_id *of_id;
@@ -138,7 +153,23 @@ static const char * const sunxi_board_dt_compat[] = {
 	NULL,
 };
 
+static int __init sunxi_init_cpuconfig_map(void)
+{
+	struct device_node *np;
+
+	np = of_find_matching_node(NULL, sunxi_cc_ids);
+	if (WARN(!np, "unable to setup cup configure"))
+		return -ENOSYS;
+	sunxi7i_cc_base = of_iomap(np, 0);
+	if (WARN(!sunxi7i_cc_base, "failed to map cup configure base address"))
+		return -ENOSYS;
+	return 0;
+}
+
+early_initcall(sunxi_init_cpuconfig_map);
+
 DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
+	.smp	= smp_ops(sun7i_smp_ops),
 	.init_machine	= sunxi_dt_init,
 	.init_time	= sunxi_timer_init,
 	.dt_compat	= sunxi_board_dt_compat,
Signature · 1 line
1.8.1.2
#2 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

arch/arm/mach-sunxi/headsmp.S line 17

Quoted 4 lines · Fan Rong

+.section ".text.head", "ax" ENTRY(sun7i_secondary_startup)

arch/arm/mach-sunxi/headsmp.S new file +3 -0
+msr cpsr_fsxc,
+#0xd3
+b secondary_startup ENDPROC(sun7i_secondary_startup)

This looks like it's been messed up somehow.

author
#3 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

Yes, I get it, it is cause by using ./scripts/Lindent. I have to remail patch aggin. :)

Quoted 8 lines · Russell King - ARM Linux

arch/arm/mach-sunxi/headsmp.S line 17

Quoted 4 lines · Fan Rong

+.section ".text.head", "ax" ENTRY(sun7i_secondary_startup)

arch/arm/mach-sunxi/headsmp.S new file +3 -0
+msr cpsr_fsxc,
+#0xd3
+b secondary_startup ENDPROC(sun7i_secondary_startup)

This looks like it's been messed up somehow.

#4 lore raw

Re: [linux-sunxi] [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

In reply to Fan Rong

arch/arm/mach-sunxi/platsmp.c line 45

Quoted 3 lines · Fan Rong
arch/arm/mach-sunxi/platsmp.c new file +3 -0
+	/* Set boot addr */
+	paddr = virt_to_phys(sun7i_secondary_startup);
+	writel(paddr, sunxi7i_cc_base + SUN7I_CPUCFG_BOOTADDR);

This means that the secondary cores will miss out on any setup which the bootloader might have done for the primary CPU, e.g. switching to NS HYP mode, setting the CNTFRQ etc.

Wouldn't it be better to do all this stuff in the bootloader and either implement PSCI or have the bootloader do the traditional holding pen and mbox address thing?

A message that is not in the archive (sent off-list or not yet received): CAK3cCBzMXdeeSPC-OpWcHAuef=ocpy5n0=Fc2yBECPnU=2OTXw@mail.gmail.com

#6 lore raw

Re: [PATCH 1/3] Add smp support for Allwinner A20(sunxi 7i).

Quoted 9 lines · cinifr
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Fan Rong
arch/arm/mach-sunxi/platsmp.c new file +3 -0
+     /* Set boot addr */
+     paddr = virt_to_phys(sun7i_secondary_startup);
+     writel(paddr, sunxi7i_cc_base + SUN7I_CPUCFG_BOOTADDR);
Quoted 6 lines
Quoted 1 line

This means that the secondary cores will miss out on any setup which

the

Quoted 1 line

bootloader might have done for the primary CPU, e.g. switching to NS

HYP

Quoted 1 line

mode, setting the CNTFRQ etc.

Yes, I think that is what bootloader should do.

In which case this kernel patch needs instead to speak the bootloader wakeup protocol instead of speaking to the h/w directly like you've done here, right?

Or is it possible for the bootloader to set these things up and then put the CPU back to sleep such that it both retains any settings and is wakable by this patch? This code contains core resets and power control, which makes me suspect not.

Quoted 9 lines
Quoted 1 line

Wouldn't it be better to do all this stuff in the bootloader and

either

Quoted 1 line

implement PSCI or have the bootloader do the traditional holding pen

and

Quoted 2 lines

mbox address thing?

I have modified uboot to set cntfrq and cntvoff in all smp cpus,and it works well. I guess kernel should believe all cpu should be all same when kernel boot. Bootloader should do it to ensure that.

Yes, I think all CPUs must be in the same state at boot.

But if you've done all that then what is this patch for?

Do you have links to your u-boot patches?

Ian.

author
#7 lore raw

Re: [PATCH 1/3] Add smp support for Allwinner A20(sunxi 7i).

Quoted 8 lines

In which case this kernel patch needs instead to speak the bootloader wakeup protocol instead of speaking to the h/w directly like you've done here, right?

Or is it possible for the bootloader to set these things up and then put the CPU back to sleep such that it both retains any settings and is wakable by this patch? This code contains core resets and power control, which makes me suspect not.

And I think secondary cpus remains setting after h/w boot.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Wouldn't it be better to do all this stuff in the bootloader and

either

Quoted 1 line

implement PSCI or have the bootloader do the traditional holding pen

and

Quoted 1 line

mbox address thing?

Uboot doesnot support PSCI, it use traditional holding pen for sunxi platform now.

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

I have modified uboot to set cntfrq and cntvoff in all smp cpus,and it works well. I guess kernel should believe all cpu should be all same when kernel boot. Bootloader should do it to ensure that.

Quoted 7 lines

Yes, I think all CPUs must be in the same state at boot.

But if you've done all that then what is this patch for?

Do you have links to your u-boot patches?

Ian.

Yes, This is my patch for uboot.
My working uboot code is in https://github.com/linux-sunxi/u-boot-sunxi.git
Note this is only test patch. I have not commit it formally for uboot.

Fan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-setting-CNTVOFF-and-CNTFRQ-for-all-smp-cpus.patch
Type: application/octet-stream
Size: 11285 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130923/94ff2a10/attachment.obj>

#8 lore raw

Re: [PATCH 1/3] Add smp support for Allwinner A20(sunxi 7i).

Hi,

Quoted 25 lines · cinifr
Quoted 8 lines

In which case this kernel patch needs instead to speak the bootloader wakeup protocol instead of speaking to the h/w directly like you've done here, right?

Or is it possible for the bootloader to set these things up and then put the CPU back to sleep such that it both retains any settings and is wakable by this patch? This code contains core resets and power control, which makes me suspect not.

And I think secondary cpus remains setting after h/w boot.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Wouldn't it be better to do all this stuff in the bootloader and

either

Quoted 1 line

implement PSCI or have the bootloader do the traditional holding pen

and

Quoted 1 line

mbox address thing?

Uboot doesnot support PSCI, it use traditional holding pen for sunxi platform now.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I have modified uboot to set cntfrq and cntvoff in all smp cpus,and it works well. I guess kernel should believe all cpu should be all same when kernel boot. Bootloader should do it to ensure that.

Yes, I think all CPUs must be in the same state at boot.

Quoted 8 lines
Quoted 5 lines

But if you've done all that then what is this patch for?

Do you have links to your u-boot patches?

Ian.

Yes, This is my patch for uboot.
My working uboot code is in https://github.com/linux-sunxi/u-boot-sunxi.git
Note this is only test patch. I have not commit it formally for uboot.

Please do so. I'd like very much to avoid ending up in a situation where we would break the mainline kernel for the A20, without any bootloader we can point the users to to fix the issues.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130923/16791ec5/attachment.sig>
#9 lore raw

PATCH v3 1/3 Add smp support for Allwinner A20(sunxi 7i).

In reply to Ian Campbell
Quoted 10 lines · Ian Campbell

arch/arm/mach-sunxi/platsmp.c line 45

Quoted 3 lines · Fan Rong
arch/arm/mach-sunxi/platsmp.c new file +3 -0
+	/* Set boot addr */
+	paddr = virt_to_phys(sun7i_secondary_startup);
+	writel(paddr, sunxi7i_cc_base + SUN7I_CPUCFG_BOOTADDR);

This means that the secondary cores will miss out on any setup which the bootloader might have done for the primary CPU, e.g. switching to NS HYP mode, setting the CNTFRQ etc.

Quoted 3 lines

Wouldn't it be better to do all this stuff in the bootloader and either implement PSCI or have the bootloader do the traditional holding pen and mbox address thing?

Out of interest, where is PSCI defined?

Does this also mean it is very difficult or impossible to actually power down CPU cores?

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#10 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

In reply to Fan Rong

Hi Fang,

Quoted 55 lines · Fan Rong
---
 arch/arm/mach-sunxi/Makefile  |  2 +
 arch/arm/mach-sunxi/headsmp.S | 17 +++++++++
 arch/arm/mach-sunxi/platsmp.c | 86 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-sunxi/sunxi.c   | 31 ++++++++++++++++
 4 files changed, 136 insertions(+)
 create mode 100644 arch/arm/mach-sunxi/headsmp.S
 create mode 100644 arch/arm/mach-sunxi/platsmp.c
arch/arm/mach-sunxi/Makefile +2 -0
index 93bebfc..d7f1ef4 100644
@@ -1 +1,3 @@
 obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
+obj-$(CONFIG_ARCH_SUNXI) += platsmp.o
+obj-$(CONFIG_ARCH_SUNXI) += headsmp.o
arch/arm/mach-sunxi/headsmp.S new file +17 -0
new file mode 100644
index 0000000..5899399
@@ -0,0 +1,17 @@
+/*
+ * SMP support for A20
+ *
+ *  Copyright (C) 2013 Fan Rong <[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.
+ */
+
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+.section ".text.head", "ax" ENTRY(sun7i_secondary_startup)
+msr cpsr_fsxc,
+#0xd3
+b secondary_startup ENDPROC(sun7i_secondary_startup)
arch/arm/mach-sunxi/platsmp.c new file +8 -0
new file mode 100644
index 0000000..5e3e994
@@ -0,0 +1,86 @@
+/*
+ *  linux/arch/arm/mach-sun7i/platsmp.c
+ *
+ *  Copyright (C) 2013 Fan Rong <[email protected]>
+ *  All Rights Reserved
+ *
+ * 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

arch/arm/mach-sunxi/platsmp.c line 18

Quoted 10 lines
arch/arm/mach-sunxi/platsmp.c new file +10 -0
+ * published by the Free Software Foundation.
+ */
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <linux/smp.h>
+
+extern void __iomem *sunxi7i_cc_base;

Please use sun7i here as well.

Quoted 116 lines
arch/arm/mach-sunxi/platsmp.c new file +68 -0
+void sun7i_secondary_startup(void);
+
+/*
+ * CPUCFG
+ */
+#define SUN7I_CPUCFG_BOOTADDR	0x01a4
+
+#define SUN7I_CPUCFG_GENCTL	0x0184
+#define SUN7I_CPUCFG_DBGCTL0	0x01e0
+#define SUN7I_CPUCFG_DBGCTL1	0x01e4
+
+#define SUN7I_CPU1_PWR_CLAMP	0x01b0
+#define SUN7I_CPU1_PWROFF_REG	0x01b4
+#define SUN7I_CPUX_RESET_CTL(x)	(0x40 + (x)*0x40)
+
+static int sun7i_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	long paddr;
+	uint32_t pwr_reg;
+	uint32_t j = 0xff << 1;
+	if (!sunxi7i_cc_base) {
+		pr_debug("error map cpu configure\n");
+		return -ENOSYS;
+	}
+	/* Set boot addr */
+	paddr = virt_to_phys(sun7i_secondary_startup);
+	writel(paddr, sunxi7i_cc_base + SUN7I_CPUCFG_BOOTADDR);
+
+	/* Assert cpu core reset */
+	writel(0, sunxi7i_cc_base + SUN7I_CPUX_RESET_CTL(cpu));
+
+	/* Ensure CPU reset also invalidates L1 caches */
+	pwr_reg = readl(sunxi7i_cc_base + SUN7I_CPUCFG_GENCTL);
+	pwr_reg &= ~ BIT(cpu);
+	writel(pwr_reg, sunxi7i_cc_base + SUN7I_CPUCFG_GENCTL);
+
+	/* DBGPWRDUP hold low */
+	pwr_reg = readl(sunxi7i_cc_base + SUN7I_CPUCFG_DBGCTL1);
+	pwr_reg &= ~ BIT(cpu);
+	writel(pwr_reg, sunxi7i_cc_base + SUN7I_CPUCFG_DBGCTL1);
+
+	/* Ramp up power to CPU1 */
+	do {
+		writel(j, sunxi7i_cc_base + SUN7I_CPU1_PWR_CLAMP);
+		j = j >> 1;
+	} while (j != 0);
+
+	mdelay(10);
+
+	pwr_reg = readl(sunxi7i_cc_base + SUN7I_CPU1_PWROFF_REG);
+	pwr_reg &= ~1;
+	writel(pwr_reg, sunxi7i_cc_base + SUN7I_CPU1_PWROFF_REG);
+	mdelay(1);
+
+	/* Release CPU reset */
+	writel(3, sunxi7i_cc_base + SUN7I_CPUX_RESET_CTL(cpu));
+
+	/* Unlock CPU */
+	pwr_reg = readl(sunxi7i_cc_base + SUN7I_CPUCFG_DBGCTL1);
+	pwr_reg |= BIT(cpu);
+	writel(pwr_reg, sunxi7i_cc_base + SUN7I_CPUCFG_DBGCTL1);
+
+	return 0;
+}
+
+struct smp_operations sun7i_smp_ops __initdata = {
+	.smp_boot_secondary = sun7i_boot_secondary,
+};
arch/arm/mach-sunxi/sunxi.c +19 -0
index e79fb34..a692350 100644
@@ -26,6 +26,8 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
+extern struct smp_operations sun7i_smp_ops;
+
 #define SUN4I_WATCHDOG_CTRL_REG		0x00
 #define SUN4I_WATCHDOG_CTRL_RESTART		BIT(0)
 #define SUN4I_WATCHDOG_MODE_REG		0x04
@@ -42,6 +44,14 @@
 #define SUN6I_WATCHDOG1_MODE_ENABLE		BIT(0)
 
 static void __iomem *wdt_base;
+/*
+ * CPU Configure module support
+ * 1: Software reset for smp cpus
+ * 2: Configure for smp cpus including boot.
+ * 3: Three 64-bit idle counters and two 64-bit common counters
+ * it is needed for smp cpus
+ */
+void __iomem *sunxi7i_cc_base; /*CPU Configure Base*/
 
 static void sun4i_restart(enum reboot_mode mode, const char *cmd)
 {
@@ -98,6 +108,11 @@ static struct of_device_id sunxi_restart_ids[] = {
 	{ /*sentinel*/ }
 };
 
+static struct of_device_id sunxi_cc_ids[] = {
+	{ .compatible = "allwinner,sun7i-a20-cpuconfig"},
+	{ /*sentinel*/ }
+};
+
 static void sunxi_setup_restart(void)
 {
 	const struct of_device_id *of_id;
@@ -138,7 +153,23 @@ static const char * const sunxi_board_dt_compat[] = {
 	NULL,
 };
 
+static int __init sunxi_init_cpuconfig_map(void)
+{
+	struct device_node *np;
+

arch/arm/mach-sunxi/sunxi.c static const char * const sunxi_board_dt_compat[] = { · line 169

Quoted 10 lines
arch/arm/mach-sunxi/sunxi.c +10 -0
+	np = of_find_matching_node(NULL, sunxi_cc_ids);
+	if (WARN(!np, "unable to setup cup configure"))
+		return -ENOSYS;
+	sunxi7i_cc_base = of_iomap(np, 0);
+	if (WARN(!sunxi7i_cc_base, "failed to map cup configure base address"))
+		return -ENOSYS;
+	return 0;
+}
+
+early_initcall(sunxi_init_cpuconfig_map);

You still haven't said why you don't want to use smp_init_cpus there.

arch/arm/mach-sunxi/sunxi.c static const char * const sunxi_board_dt_compat[] = { · line 172

Quoted 3 lines
arch/arm/mach-sunxi/sunxi.c +2 -0
+
 DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
+	.smp	= smp_ops(sun7i_smp_ops),

Please align the "=" with the rest of the structure, and please rebase on top of my "ARM: sunxi: Split out the DT machines for sun6i and sun7i" patch.

Thanks a lot,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130923/fd08c702/attachment-0001.sig>
author
#11 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

Quoted 3 lines

Please use sun7i here as well.

Ok, it will be modified by next patch.

Quoted 3 lines
Quoted 1 line

+early_initcall(sunxi_init_cpuconfig_map);

You still haven't said why you don't want to use smp_init_cpus there.

I find that of_funcation liking of_find_matching_node and of_iomap can not run well in smp_init_cpus. It cause kernel crash. So I have to use early_initcall.

Fan

#12 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

Hi Fan,

Quoted 4 lines · cinifr
Quoted 1 line

You still haven't said why you don't want to use smp_init_cpus there.

I find that of_funcation liking of_find_matching_node and of_iomap can not run well in smp_init_cpus. It cause kernel crash. So I have to use early_initcall.

Ah, right.

Then, can't we use smp_prepare_cpus for this? it looks to be late enough so that we can use ioremap there.

I don't want it to be an initcall. The code will be different on the A31, and we don't want it to be run on all the other machines whenever we boot a multiplatform kernel anyway.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130925/27ff960d/attachment.sig>
author
#13 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

Hi Maxime,
I have test it, but I found it does not work. If using
smp_prepare_cpus, the kernenl cannot find the secondary cpus because that smp_prepare_cpus semms not be excuted before kernel is booting secondary cpus. So I have to use early_initcall.

Fan.

Quoted 23 lines · Maxime Ripard

Hi Fan,

Quoted 4 lines · cinifr
Quoted 1 line

You still haven't said why you don't want to use smp_init_cpus there.

I find that of_funcation liking of_find_matching_node and of_iomap can not run well in smp_init_cpus. It cause kernel crash. So I have to use early_initcall.

Ah, right.

Then, can't we use smp_prepare_cpus for this? it looks to be late enough so that we can use ioremap there.

I don't want it to be an initcall. The code will be different on the A31, and we don't want it to be run on all the other machines whenever we boot a multiplatform kernel anyway.

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

#14 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

Hi Fan,

Quoted 5 lines · cinifr

Hi Maxime,
I have test it, but I found it does not work. If using
smp_prepare_cpus, the kernenl cannot find the secondary cpus because that smp_prepare_cpus semms not be excuted before kernel is booting secondary cpus. So I have to use early_initcall.

At least two other platforms (sti and rockchip) do it like that.

And an early_initcall is not an option.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130930/d7a9e4c7/attachment.sig>
#15 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 1/3] Add smp support for Allwinner A20(sunxi 7i).

In reply to cinifr
Quoted 5 lines · cinifr

Hi Maxime,
I have test it, but I found it does not work. If using
smp_prepare_cpus, the kernenl cannot find the secondary cpus because that smp_prepare_cpus semms not be excuted before kernel is booting secondary cpus. So I have to use early_initcall.

Please don't do this - you're hacking around what could be a real problem. Instead, please investigate what is going on and why your smp_prepare_cpus() function never gets called.

Quite honestly, whenever I see crap like the above, it just makes me want to tell the ARM-SoC people to forever /dev/null your emails because you really don't know how to deal with the Linux kernel.

Always *fully* investigate a problem that you find to determine whether it's your problem or some as yet undiscovered kernel bug. Never hack around it and then submit a patch suggesting that your workaround is something that "has" to be done.

author
#16 lore raw

PATCH v3 2/3 Add cpuconfig nodes in dts for smp configure.

In reply to Fan Rong
---
 arch/arm/boot/dts/sun7i-a20.dtsi | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun7i-a20.dtsi +7 -2
index 999ff45..f745e0b 100644
@@ -20,13 +20,13 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu at 0 {
+		cpu0: cpu at 0  {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <0>;
 		};
 
-		cpu at 1 {
+		cpu1: cpu at 1 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <1>;
@@ -167,6 +167,11 @@
 		#size-cells = <1>;
 		ranges;
 
+		cpuconfig: cpuconfig at 01c25c00 {
+			compatible = "allwinner,sun7i-a20-cpuconfig";
+			reg = <0x01c25c00 0x400>;
+		};
+
 		pio: pinctrl at 01c20800 {
 			compatible = "allwinner,sun7i-a20-pinctrl";
 			reg = <0x01c20800 0x400>;
Signature · 1 line
1.8.1.2
#17 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 2/3] Add cpuconfig nodes in dts for smp configure.

Hi Fan,

Quoted 12 lines · Fan Rong
---
 arch/arm/boot/dts/sun7i-a20.dtsi | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun7i-a20.dtsi +0 -0
index 999ff45..f745e0b 100644
@@ -20,13 +20,13 @@
 		#address-cells = <1>;
 		#size-cells = <0>;

arch/arm/boot/dts/sun7i-a20.dtsi line 29

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +2 -2
 
-		cpu at 0 {
+		cpu0: cpu at 0  {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <0>;
 		};
 
-		cpu at 1 {
+		cpu1: cpu at 1 {

You still haven't replied on why you need these two changes.

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130923/5aa20a34/attachment.sig>
author
#18 lore raw

PATCH v3 3/3 add arch count timer node in dts for Allwinner A20(sunxi 7i).

In reply to Fan Rong
---
 arch/arm/boot/dts/sun7i-a20.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +10 -0
index f745e0b..76b8c3f 100644
@@ -312,5 +312,15 @@
 			#interrupt-cells = <3>;
 			interrupts = <1 9 0xf04>;
 		};
+
+		timer {
+			compatible ="arm,armv7-timer";
+			interrupts = <1 13 0x308>,
+				     <1 14 0x308>,
+				     <1 11 0x308>,
+				     <1 10 0x308>;
+			clock-frequency = <24000000>;
+		};
+
 	};
 };
Signature · 1 line
1.8.1.2
#19 lore raw

Re: [PATCH V3: Add Smp support for Allwinner A20. 3/3] add arch count timer node in dts for Allwinner A20(sunxi 7i).

Hi Fang,

Quoted 1 line · Fan Rong

Please be more verbose here, especially on the consequences it has.

Thanks,
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130923/57cf6741/attachment-0001.sig>