[PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

STALE4368d

12 messages, 3 authors, 2014-09-05 · open the first message on its own page

[PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-05 13:34:42

Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).

Depends on:
- next-20140804 branch of linux-next kernel tree
- [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
- [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)

Changes since v4:
- rebased on top of next-20140804 +
  [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
  [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- call exynos_save_cp15() only on A9 type core (this is needed for the future
  Exynos3250 SoC support)

Changes since v3:
- rebased on top of next-20140804 +
  [PATCH v4][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35192.html)
  [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- (re-)added patch fixing S5P_CENTRAL_SEQ_OPTION register setup

Changes since v2:
- rebased on top of next-20140708 +
  [PATCH 5/6] ARM: EXYNOS: Fix suspend/resume sequencies
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32809.html)
  [with rejects fixed]
  [PATCH 6/6] ARM: EXYNOS: Register cpuidle device only on Exynos4210 and 5250
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32808.html)
  [PATCH 0/2] Firmware-assisted suspend/resume of Exynos SoCs
  (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32991.html)
  [with rejects fixed in patch #2]
- addressed review comments from Tomasz Figa and Daniel Lezcano

Changes since v1:
- synced against next-20140602
- added missing Acked-by-s

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (5):
  ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines
  ARM: EXYNOS: add AFTR mode support to firmware do_idle method
  ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code
  ARM: EXYNOS: PM: fix register setup for AFTR mode code
  ARM: EXYNOS: cpuidle: allow driver usage on Exynos4x12 SoCs

 arch/arm/include/asm/firmware.h |  2 +-
 arch/arm/mach-exynos/common.h   |  5 ++++
 arch/arm/mach-exynos/exynos.c   |  4 ++-
 arch/arm/mach-exynos/firmware.c | 34 ++++++++++++++++-------
 arch/arm/mach-exynos/pm.c       | 60 ++++++++++++++++++++++++-----------------
 5 files changed, 70 insertions(+), 35 deletions(-)

-- 
1.8.2.3

[PATCH v5 1/5] ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-05 13:34:48

Replace EXYNOS_BOOT_VECTOR_ADDR and EXYNOS_BOOT_VECTOR_FLAG macros
by exynos_boot_vector_addr() and exynos_boot_vector_flag() static
inlines.

This patch shouldn't cause any functionality changes.

Signed-off-by: Bartlomiej Zolnierkiewicz <redacted>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Lezcano <redacted>
---
 arch/arm/mach-exynos/pm.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 454c1cc..78e50ed 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -101,16 +101,23 @@ static int exynos_irq_set_wake(struct irq_data *data, unsigned int state)
 	return -ENOENT;
 }
 
-#define EXYNOS_BOOT_VECTOR_ADDR	(samsung_rev() == EXYNOS4210_REV_1_1 ? \
-			pmu_base_addr + S5P_INFORM7 : \
-			(samsung_rev() == EXYNOS4210_REV_1_0 ? \
-			(sysram_base_addr + 0x24) : \
-			pmu_base_addr + S5P_INFORM0))
-#define EXYNOS_BOOT_VECTOR_FLAG	(samsung_rev() == EXYNOS4210_REV_1_1 ? \
-			pmu_base_addr + S5P_INFORM6 : \
-			(samsung_rev() == EXYNOS4210_REV_1_0 ? \
-			(sysram_base_addr + 0x20) : \
-			pmu_base_addr + S5P_INFORM1))
+static inline void __iomem *exynos_boot_vector_addr(void)
+{
+	if (samsung_rev() == EXYNOS4210_REV_1_1)
+		return pmu_base_addr + S5P_INFORM7;
+	else if (samsung_rev() == EXYNOS4210_REV_1_0)
+		return sysram_base_addr + 0x24;
+	return pmu_base_addr + S5P_INFORM0;
+}
+
+static inline void __iomem *exynos_boot_vector_flag(void)
+{
+	if (samsung_rev() == EXYNOS4210_REV_1_1)
+		return pmu_base_addr + S5P_INFORM6;
+	else if (samsung_rev() == EXYNOS4210_REV_1_0)
+		return sysram_base_addr + 0x20;
+	return pmu_base_addr + S5P_INFORM1;
+}
 
 #define S5P_CHECK_AFTR  0xFCBA0D10
 #define S5P_CHECK_SLEEP 0x00000BAD
@@ -195,8 +202,9 @@ static void exynos_set_wakeupmask(long mask)
 
 static void exynos_cpu_set_boot_vector(long flags)
 {
-	__raw_writel(virt_to_phys(exynos_cpu_resume), EXYNOS_BOOT_VECTOR_ADDR);
-	__raw_writel(flags, EXYNOS_BOOT_VECTOR_FLAG);
+	__raw_writel(virt_to_phys(exynos_cpu_resume),
+		     exynos_boot_vector_addr());
+	__raw_writel(flags, exynos_boot_vector_flag());
 }
 
 static int exynos_aftr_finisher(unsigned long flags)
-- 
1.8.2.3

[PATCH v5 2/5] ARM: EXYNOS: add AFTR mode support to firmware do_idle method

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-05 13:34:51

On some platforms (i.e. EXYNOS ones) more than one idle mode is
available and we need to distinguish them in firmware do_idle method.

Add mode parameter to do_idle firmware method and AFTR mode support
to EXYNOS do_idle implementation.

This change is a preparation for adding secure firmware support to
EXYNOS cpuidle driver.

This patch shouldn't cause any functionality changes (please note
that do_idle firmware method is unused currently).

Signed-off-by: Bartlomiej Zolnierkiewicz <redacted>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/include/asm/firmware.h |  2 +-
 arch/arm/mach-exynos/common.h   |  5 +++++
 arch/arm/mach-exynos/firmware.c | 10 ++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h
index 5904f59..89aefe1 100644
--- a/arch/arm/include/asm/firmware.h
+++ b/arch/arm/include/asm/firmware.h
@@ -28,7 +28,7 @@ struct firmware_ops {
 	/*
 	 * Enters CPU idle mode
 	 */
-	int (*do_idle)(void);
+	int (*do_idle)(unsigned long mode);
 	/*
 	 * Sets boot address of specified physical CPU
 	 */
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index c218200..2d830df 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -119,6 +119,11 @@ extern void __iomem *sysram_base_addr;
 extern void __iomem *pmu_base_addr;
 void exynos_sysram_init(void);
 
+enum {
+	FW_DO_IDLE_SLEEP,
+	FW_DO_IDLE_AFTR,
+};
+
 void exynos_firmware_init(void);
 
 extern u32 exynos_get_eint_wake_mask(void);
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index f5e626d..e57b7c3 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -28,9 +28,15 @@
 #define EXYNOS_BOOT_ADDR	0x8
 #define EXYNOS_BOOT_FLAG	0xc
 
-static int exynos_do_idle(void)
+static int exynos_do_idle(unsigned long mode)
 {
-	exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
+	switch (mode) {
+	case FW_DO_IDLE_AFTR:
+		exynos_smc(SMC_CMD_CPU0AFTR, 0, 0, 0);
+		break;
+	case FW_DO_IDLE_SLEEP:
+		exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
+	}
 	return 0;
 }
 
-- 
1.8.2.3

[PATCH v5 3/5] ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-05 13:34:57

* Move cp15 registers saving to exynos_save_cp15() helper and add
  additional helper usage to do_idle firmware method.

* Use resume firmware method instead of exynos_cpu_restore_register()
  and skip exynos_cpu_save_register() on boards with secure firmware
  enabled.

* Use sysram_ns_base_addr + 0x24/0x20 addresses instead of the default
  ones used by exynos_cpu_set_boot_vector() on boards with secure
  firmware enabled.

* Use do_idle firmware method instead of cpu_do_idle() on boards with
  secure firmware enabled.

Signed-off-by: Bartlomiej Zolnierkiewicz <redacted>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/firmware.c | 24 +++++++++++++++++-------
 arch/arm/mach-exynos/pm.c       | 17 ++++++++++++-----
 2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index e57b7c3..2c5bc6b 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -25,13 +25,28 @@
 #include "smc.h"
 
 #define EXYNOS_SLEEP_MAGIC	0x00000bad
+#define EXYNOS_AFTR_MAGIC	0xfcba0d10
 #define EXYNOS_BOOT_ADDR	0x8
 #define EXYNOS_BOOT_FLAG	0xc
 
+static void exynos_save_cp15(void)
+{
+	/* Save Power control and Diagnostic registers */
+	asm ("mrc p15, 0, %0, c15, c0, 0\n"
+	     "mrc p15, 0, %1, c15, c0, 1\n"
+	     : "=r" (cp15_save_power), "=r" (cp15_save_diag)
+	     : : "cc");
+}
+
 static int exynos_do_idle(unsigned long mode)
 {
 	switch (mode) {
 	case FW_DO_IDLE_AFTR:
+		if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
+			exynos_save_cp15();
+		__raw_writel(virt_to_phys(exynos_cpu_resume_ns),
+			     sysram_ns_base_addr + 0x24);
+		__raw_writel(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20);
 		exynos_smc(SMC_CMD_CPU0AFTR, 0, 0, 0);
 		break;
 	case FW_DO_IDLE_SLEEP:
@@ -96,13 +111,8 @@ static int exynos_cpu_suspend(unsigned long arg)
 
 static int exynos_suspend(void)
 {
-	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
-		/* Save Power control and Diagnostic registers */
-		asm ("mrc p15, 0, %0, c15, c0, 0\n"
-			"mrc p15, 0, %1, c15, c0, 1\n"
-			: "=r" (cp15_save_power), "=r" (cp15_save_diag)
-			: : "cc");
-	}
+	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
+		exynos_save_cp15();
 
 	writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
 	writel(virt_to_phys(exynos_cpu_resume_ns),
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 78e50ed..e0b6885 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -209,11 +209,19 @@ static void exynos_cpu_set_boot_vector(long flags)
 
 static int exynos_aftr_finisher(unsigned long flags)
 {
+	int ret;
+
 	exynos_set_wakeupmask(0x0000ff3e);
-	exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
 	/* Set value of power down register for aftr mode */
 	exynos_sys_powerdown_conf(SYS_AFTR);
-	cpu_do_idle();
+
+	ret = call_firmware_op(do_idle, FW_DO_IDLE_AFTR);
+	if (ret == -ENOSYS) {
+		if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
+			exynos_cpu_save_register();
+		exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
+		cpu_do_idle();
+	}
 
 	return 1;
 }
@@ -223,14 +231,13 @@ void exynos_enter_aftr(void)
 	cpu_pm_enter();
 
 	exynos_pm_central_suspend();
-	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
-		exynos_cpu_save_register();
 
 	cpu_suspend(0, exynos_aftr_finisher);
 
 	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
 		scu_enable(S5P_VA_SCU);
-		exynos_cpu_restore_register();
+		if (call_firmware_op(resume) == -ENOSYS)
+			exynos_cpu_restore_register();
 	}
 
 	exynos_pm_central_resume();
-- 
1.8.2.3

[PATCH v5 4/5] ARM: EXYNOS: PM: fix register setup for AFTR mode code

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-05 13:35:00

Add S5P_CENTRAL_SEQ_OPTION register setup to cpuidle AFTR mode code
by moving the relevant code from exynos_pm_suspend() (used only by
suspend) to exynos_pm_central_suspend() (used by both suspend and
AFTR).  Without this setup AFTR mode doesn't show any benefit over
WFI one (at least on Exynos4412 SoC).  When this setup is applied
AFTR mode reduces power consumption by ~12% (as measured on Trats2
board).

This change is a preparation for adding secure firmware support to
EXYNOS cpuidle driver.

Signed-off-by: Bartlomiej Zolnierkiewicz <redacted>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/pm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e0b6885..3cee123 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -169,6 +169,10 @@ static void exynos_pm_central_suspend(void)
 	tmp = pmu_raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
 	tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
 	pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+
+	/* Setting SEQ_OPTION register */
+	pmu_raw_writel(S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0,
+		       S5P_CENTRAL_SEQ_OPTION);
 }
 
 static int exynos_pm_central_resume(void)
@@ -291,15 +295,8 @@ static void exynos_pm_prepare(void)
 
 static int exynos_pm_suspend(void)
 {
-	unsigned long tmp;
-
 	exynos_pm_central_suspend();
 
-	/* Setting SEQ_OPTION register */
-
-	tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
-	pmu_raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
-
 	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
 		exynos_cpu_save_register();
 
-- 
1.8.2.3

[PATCH v5 5/5] ARM: EXYNOS: cpuidle: allow driver usage on Exynos4x12 SoCs

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-05 13:35:06

Register cpuidle platform device on Exynos4x12 SoCs allowing EXYNOS
cpuidle driver usage on these SoCs.

AFTR mode reduces power consumption on Trats2 board (Exynos4412 SoC
with secure firmware enabled) by ~12% when EXYNOS cpuidle driver is
enabled (in both cases the default exynos_defconfig config is used
and CPU1-3 are offlined).

Signed-off-by: Bartlomiej Zolnierkiewicz <redacted>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/exynos.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 6a24e11..15cf86d 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -317,7 +317,9 @@ static void __init exynos_dt_machine_init(void)
 		exynos_sysram_init();
 
 	if (of_machine_is_compatible("samsung,exynos4210") ||
-			of_machine_is_compatible("samsung,exynos5250"))
+	    of_machine_is_compatible("samsung,exynos4212") ||
+	    of_machine_is_compatible("samsung,exynos4412") ||
+	    of_machine_is_compatible("samsung,exynos5250"))
 		platform_device_register(&exynos_cpuidle);
 
 	platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
-- 
1.8.2.3

Re: [PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Daniel Lezcano <hidden>
Date: 2014-08-05 13:51:05

On 08/05/2014 03:34 PM, Bartlomiej Zolnierkiewicz wrote:
Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).
Hi Bartlomiej,

I tested your patchset on an odroid-u2. When the cpuidle driver is 
enabled and the cpu1-3 are offlined, the kernel hangs.

If I disable the AFTR state on cpuidle, and offline the 1-3, it works as 
expected. So there is something wrong with the AFTR on the odroid board.
Depends on:
- next-20140804 branch of linux-next kernel tree
- [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
- [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)

Changes since v4:
- rebased on top of next-20140804 +
   [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
   [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- call exynos_save_cp15() only on A9 type core (this is needed for the future
   Exynos3250 SoC support)

Changes since v3:
- rebased on top of next-20140804 +
   [PATCH v4][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35192.html)
   [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- (re-)added patch fixing S5P_CENTRAL_SEQ_OPTION register setup

Changes since v2:
- rebased on top of next-20140708 +
   [PATCH 5/6] ARM: EXYNOS: Fix suspend/resume sequencies
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32809.html)
   [with rejects fixed]
   [PATCH 6/6] ARM: EXYNOS: Register cpuidle device only on Exynos4210 and 5250
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32808.html)
   [PATCH 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32991.html)
   [with rejects fixed in patch #2]
- addressed review comments from Tomasz Figa and Daniel Lezcano

Changes since v1:
- synced against next-20140602
- added missing Acked-by-s

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (5):
   ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines
   ARM: EXYNOS: add AFTR mode support to firmware do_idle method
   ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code
   ARM: EXYNOS: PM: fix register setup for AFTR mode code
   ARM: EXYNOS: cpuidle: allow driver usage on Exynos4x12 SoCs

  arch/arm/include/asm/firmware.h |  2 +-
  arch/arm/mach-exynos/common.h   |  5 ++++
  arch/arm/mach-exynos/exynos.c   |  4 ++-
  arch/arm/mach-exynos/firmware.c | 34 ++++++++++++++++-------
  arch/arm/mach-exynos/pm.c       | 60 ++++++++++++++++++++++++-----------------
  5 files changed, 70 insertions(+), 35 deletions(-)

-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Re: [PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Daniel Lezcano <hidden>
Date: 2014-08-05 14:03:28

On 08/05/2014 03:34 PM, Bartlomiej Zolnierkiewicz wrote:
Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).
As a sidenote:

On my odroid-U2:
  * 4 cpus online -> 130 mA
  * 3 cpus online -> 164 mA
  * 2 cpus online -> 160 mA
  * 1 cpu online  -> 157 mA

So were are consuming more when there are unplugged cpu ... any ideas ?

Thanks !

   -- Daniel
Depends on:
- next-20140804 branch of linux-next kernel tree
- [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
- [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)

Changes since v4:
- rebased on top of next-20140804 +
   [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
   [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- call exynos_save_cp15() only on A9 type core (this is needed for the future
   Exynos3250 SoC support)

Changes since v3:
- rebased on top of next-20140804 +
   [PATCH v4][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35192.html)
   [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- (re-)added patch fixing S5P_CENTRAL_SEQ_OPTION register setup

Changes since v2:
- rebased on top of next-20140708 +
   [PATCH 5/6] ARM: EXYNOS: Fix suspend/resume sequencies
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32809.html)
   [with rejects fixed]
   [PATCH 6/6] ARM: EXYNOS: Register cpuidle device only on Exynos4210 and 5250
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32808.html)
   [PATCH 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32991.html)
   [with rejects fixed in patch #2]
- addressed review comments from Tomasz Figa and Daniel Lezcano

Changes since v1:
- synced against next-20140602
- added missing Acked-by-s

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (5):
   ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines
   ARM: EXYNOS: add AFTR mode support to firmware do_idle method
   ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code
   ARM: EXYNOS: PM: fix register setup for AFTR mode code
   ARM: EXYNOS: cpuidle: allow driver usage on Exynos4x12 SoCs

  arch/arm/include/asm/firmware.h |  2 +-
  arch/arm/mach-exynos/common.h   |  5 ++++
  arch/arm/mach-exynos/exynos.c   |  4 ++-
  arch/arm/mach-exynos/firmware.c | 34 ++++++++++++++++-------
  arch/arm/mach-exynos/pm.c       | 60 ++++++++++++++++++++++++-----------------
  5 files changed, 70 insertions(+), 35 deletions(-)

-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Re: [PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Krzysztof Kozlowski <hidden>
Date: 2014-08-05 14:26:25

On 05.08.2014 16:03, Daniel Lezcano wrote:
On 08/05/2014 03:34 PM, Bartlomiej Zolnierkiewicz wrote:
quoted
Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).
As a sidenote:

On my odroid-U2:
  * 4 cpus online -> 130 mA
  * 3 cpus online -> 164 mA
  * 2 cpus online -> 160 mA
  * 1 cpu online  -> 157 mA

So were are consuming more when there are unplugged cpu ... any ideas ?
On which tree are you testing? Current next has ARMCLK down feature 
enabled. ARMCLK down may stop working after hotunplugging CPU:
http://www.spinics.net/lists/arm-kernel/msg352890.html

That was observed especially on Exynos4212 where ARMCLK down stops 
working permanently. On Trats2 (Exynos4412) the clock down stopped only 
a for short period after disabling CPU.

Best regards,
Krzysztof

Re: [PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Daniel Lezcano <hidden>
Date: 2014-08-05 15:07:44

On 08/05/2014 04:26 PM, Krzysztof Kozlowski wrote:
On 05.08.2014 16:03, Daniel Lezcano wrote:
quoted
On 08/05/2014 03:34 PM, Bartlomiej Zolnierkiewicz wrote:
quoted
Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).
As a sidenote:

On my odroid-U2:
  * 4 cpus online -> 130 mA
  * 3 cpus online -> 164 mA
  * 2 cpus online -> 160 mA
  * 1 cpu online  -> 157 mA

So were are consuming more when there are unplugged cpu ... any ideas ?
On which tree are you testing? Current next has ARMCLK down feature
enabled. ARMCLK down may stop working after hotunplugging CPU:
http://www.spinics.net/lists/arm-kernel/msg352890.html

That was observed especially on Exynos4212 where ARMCLK down stops
working permanently. On Trats2 (Exynos4412) the clock down stopped only
a for short period after disabling CPU.
Hi Krzysztof,

I tested the patches you mentioned above on top of this patchset.

You are right this is directly related to the ARMCLK but the behavior 
may be not as you expect I think.

When I boot:

4 cpus online => 131 mA

Then I unplug one by one the cpus:

3 cpus online => 127 mA
2 cpus online => 123 mA
1 cpu online  => 120 mA

This is consistent.

But now, I online the cpus:

2 cpus online => 162 mA
3 cpus online => 165 mA
4 cpus online => 131 mA


-- side note --

Please note, I did not disable the cpuidle neither the AFTR state and 
the kernel did not hang but I don't see the noticeable power saving we 
should be observing when there is one cpu remaining entering the AFTR 
state (cpuidle stats show we enter AFTR). So there is definitively 
something wrong with this state.


-- 
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Re: [PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2014-08-07 17:18:50

On Tuesday, August 05, 2014 03:50:54 PM Daniel Lezcano wrote:
On 08/05/2014 03:34 PM, Bartlomiej Zolnierkiewicz wrote:
quoted
Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).
Hi Bartlomiej,
Hi Daniel,
I tested your patchset on an odroid-u2. When the cpuidle driver is 
enabled and the cpu1-3 are offlined, the kernel hangs.

If I disable the AFTR state on cpuidle, and offline the 1-3, it works as 
expected. So there is something wrong with the AFTR on the odroid board.
Thanks for testing.  I reproduced the problem on ODROID-U3 board.  I also
tested Exynos4412 based Origen board and it also has problem with AFTR mode.
We did some debugging but nothing specific has came up yet (we suspect that
the issue may be caused by incompatibilities of bootloader firmware of
ODROID-U2/U3 and Origen4412 boards).  We will keep investigating this but
in the meantime I would like to have this patchset acked/merged if possible
(with Exynos4412 support limited to Trats2 target currently [*]) as:

- it contains mostly fundamental changes for all secure firmware enabled
  boards (which would be needed also on ODROID/Origen4412 boards if we get
  AFTR mode working on them)

- it adds working AFTR mode support for Exynos4412 Trats2 target

- it prepares support for Exynos4212 and Exynos3250 targets which are
  working fine with AFTR mode in our internal kernels and which are not
  yet upstreamed

[*] In the future it should be possible to enable AFTR mode support per
    board using DT (basing on patches from Lorenzo), for now it should be
    fine to check for Trats2 target directly while registering cpuidle
    platform device.  I will post v6 soon.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
quoted
Depends on:
- next-20140804 branch of linux-next kernel tree
- [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
- [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)

Changes since v4:
- rebased on top of next-20140804 +
   [PATCH v5][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35262.html)
   [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- call exynos_save_cp15() only on A9 type core (this is needed for the future
   Exynos3250 SoC support)

Changes since v3:
- rebased on top of next-20140804 +
   [PATCH v4][next-20140804] ARM: EXYNOS: Fix suspend/resume sequences
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg35192.html)
   [PATCH v2 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg34282.html)
- (re-)added patch fixing S5P_CENTRAL_SEQ_OPTION register setup

Changes since v2:
- rebased on top of next-20140708 +
   [PATCH 5/6] ARM: EXYNOS: Fix suspend/resume sequencies
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32809.html)
   [with rejects fixed]
   [PATCH 6/6] ARM: EXYNOS: Register cpuidle device only on Exynos4210 and 5250
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32808.html)
   [PATCH 0/2] Firmware-assisted suspend/resume of Exynos SoCs
   (http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg32991.html)
   [with rejects fixed in patch #2]
- addressed review comments from Tomasz Figa and Daniel Lezcano

Changes since v1:
- synced against next-20140602
- added missing Acked-by-s

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (5):
   ARM: EXYNOS: PM: replace EXYNOS_BOOT_VECTOR_* macros by static inlines
   ARM: EXYNOS: add AFTR mode support to firmware do_idle method
   ARM: EXYNOS: cpuidle: add secure firmware support to AFTR mode code
   ARM: EXYNOS: PM: fix register setup for AFTR mode code
   ARM: EXYNOS: cpuidle: allow driver usage on Exynos4x12 SoCs

  arch/arm/include/asm/firmware.h |  2 +-
  arch/arm/mach-exynos/common.h   |  5 ++++
  arch/arm/mach-exynos/exynos.c   |  4 ++-
  arch/arm/mach-exynos/firmware.c | 34 ++++++++++++++++-------
  arch/arm/mach-exynos/pm.c       | 60 ++++++++++++++++++++++++-----------------
  5 files changed, 70 insertions(+), 35 deletions(-)

Re: [PATCH v5 0/5] ARM: EXYNOS: cpuidle: fix AFTR mode on boards with secure firmware enabled

From: Krzysztof Kozlowski <hidden>
Date: 2014-09-05 12:28:15

On wto, 2014-08-05 at 17:07 +0200, Daniel Lezcano wrote:
On 08/05/2014 04:26 PM, Krzysztof Kozlowski wrote:
quoted
On 05.08.2014 16:03, Daniel Lezcano wrote:
quoted
On 08/05/2014 03:34 PM, Bartlomiej Zolnierkiewicz wrote:
quoted
Hi,

This patch series adds support for AFTR idle mode on boards with
secure firmware enabled and allows EXYNOS cpuidle driver usage on
Exynos4x12 SoCs.

It has been tested on Trats2 board (using Exynos4412 SoC with secure
firmware enabled) on which AFTR mode reduces power consumption by ~12%
when EXYNOS cpuidle driver is enabled (in both cases the default
exynos_defconfig config is used and CPU1-3 are offlined).
As a sidenote:

On my odroid-U2:
  * 4 cpus online -> 130 mA
  * 3 cpus online -> 164 mA
  * 2 cpus online -> 160 mA
  * 1 cpu online  -> 157 mA

So were are consuming more when there are unplugged cpu ... any ideas ?
On which tree are you testing? Current next has ARMCLK down feature
enabled. ARMCLK down may stop working after hotunplugging CPU:
http://www.spinics.net/lists/arm-kernel/msg352890.html

That was observed especially on Exynos4212 where ARMCLK down stops
working permanently. On Trats2 (Exynos4412) the clock down stopped only
a for short period after disabling CPU.
Hi Krzysztof,

I tested the patches you mentioned above on top of this patchset.

You are right this is directly related to the ARMCLK but the behavior 
may be not as you expect I think.

When I boot:

4 cpus online => 131 mA

Then I unplug one by one the cpus:

3 cpus online => 127 mA
2 cpus online => 123 mA
1 cpu online  => 120 mA

This is consistent.

But now, I online the cpus:

2 cpus online => 162 mA
3 cpus online => 165 mA
4 cpus online => 131 mA


-- side note --

Please note, I did not disable the cpuidle neither the AFTR state and 
the kernel did not hang but I don't see the noticeable power saving we 
should be observing when there is one cpu remaining entering the AFTR 
state (cpuidle stats show we enter AFTR). So there is definitively 
something wrong with this state.
Strange things happen... on current next-20140904 I couldn't reproduce
this inconsistent energy consumption after hotplug. At least on Trats2
(Exynos4412) and Gear1 (Exynos4212) it behaves consistently (and
properly with my patches).

Anyway I'll respin the patchset.

Best regards,
Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help