Linux-Samsung-soc Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos
       [not found] <CGME20200616081248eucas1p168faa343ce333a28c8fd3cf9a6a58b3c@eucas1p1.samsung.com>
@ 2020-06-16  8:12 ` Marek Szyprowski
       [not found]   ` <CGME20200616081249eucas1p151a8892ca0abfa3108955e1fc5054fc3@eucas1p1.samsung.com>
                     ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-16  8:12 UTC (permalink / raw)
  To: linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Lorenzo Pieralisi, Krzysztof Kozlowski,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

The ARM big.LITTLE cpuidle driver has been enabled and tested on Samsung
Exynos 5420/5800 based Peach Pit/Pi Chromebooks and in fact it worked
only on those boards.

However, support for it was broken by the commit 833b5794e330 ("ARM:
EXYNOS: reset Little cores when cpu is up") and then never enabled in the
exynos_defconfig. This patchset provides the needed fix to the common
code and restores support for it. Thanks to Lukasz Luba who motivated me
to take a look into this issue.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland


Patch summary:

Marek Szyprowski (4):
  ARM: exynos: Apply little core workaround only under secure firmware
  cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks
  ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver
  ARM: multi_v7_defconfig: Enable big.LITTLE cpuidle driver

 arch/arm/configs/exynos_defconfig    |  1 +
 arch/arm/configs/multi_v7_defconfig  |  1 +
 arch/arm/mach-exynos/mcpm-exynos.c   | 10 +++++++---
 drivers/cpuidle/cpuidle-big_little.c |  3 +--
 4 files changed, 10 insertions(+), 5 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware
       [not found]   ` <CGME20200616081249eucas1p151a8892ca0abfa3108955e1fc5054fc3@eucas1p1.samsung.com>
@ 2020-06-16  8:12     ` Marek Szyprowski
  2020-06-17 16:26       ` Lukasz Luba
  0 siblings, 1 reply; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-16  8:12 UTC (permalink / raw)
  To: linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Lorenzo Pieralisi, Krzysztof Kozlowski,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

The additional soft-reset call during little core power up was needed
to properly boot all cores on the Exynos5422-based boards with secure
firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
CPUidle driver, which worked only on boards without secure firmware
(like Peach-Pit/Pi Chromebooks).

Apply the workaround only when board is running under secure firmware.

Fixes: 833b 5794 e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 9a681b421ae1..cd861c57d5ad 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -26,6 +26,7 @@
 #define EXYNOS5420_USE_L2_COMMON_UP_STATE	BIT(30)
 
 static void __iomem *ns_sram_base_addr __ro_after_init;
+static bool secure_firmware __ro_after_init;
 
 /*
  * The common v7_exit_coherency_flush API could not be used because of the
@@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
 static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
 {
 	unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
+	bool state;
 
 	pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
 	if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
 		cluster >= EXYNOS5420_NR_CLUSTERS)
 		return -EINVAL;
 
-	if (!exynos_cpu_power_state(cpunr)) {
-		exynos_cpu_power_up(cpunr);
-
+	state = exynos_cpu_power_state(cpunr);
+	exynos_cpu_power_up(cpunr);
+	if (!state && secure_firmware) {
 		/*
 		 * This assumes the cluster number of the big cores(Cortex A15)
 		 * is 0 and the Little cores(Cortex A7) is 1.
@@ -258,6 +260,8 @@ static int __init exynos_mcpm_init(void)
 		return -ENOMEM;
 	}
 
+	secure_firmware = exynos_secure_firmware_available();
+
 	/*
 	 * To increase the stability of KFC reset we need to program
 	 * the PMU SPARE3 register
-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 2/4] cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks
       [not found]   ` <CGME20200616081249eucas1p2ad165b545f265bec88a06270d55fce76@eucas1p2.samsung.com>
@ 2020-06-16  8:12     ` Marek Szyprowski
  2020-06-22 17:19       ` Krzysztof Kozlowski
  2020-06-24 10:05       ` Bartlomiej Zolnierkiewicz
  0 siblings, 2 replies; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-16  8:12 UTC (permalink / raw)
  To: linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Lorenzo Pieralisi, Krzysztof Kozlowski,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

This driver always worked properly only on the Exynos 5420/5800 based
Chromebooks (Peach-Pit/Pi), so change the required compatible string to
the 'google,peach', to avoid enabling it on the other Exynos 542x/5800
boards, which hangs in such case. The main difference between Peach-Pit/Pi
and other Exynos 542x/5800 boards is the firmware - Peach platform doesn't
use secure firmware at all.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/cpuidle/cpuidle-big_little.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
index 7f8ddc04342d..abe51185f243 100644
--- a/drivers/cpuidle/cpuidle-big_little.c
+++ b/drivers/cpuidle/cpuidle-big_little.c
@@ -155,8 +155,7 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int part_id)
 
 static const struct of_device_id compatible_machine_match[] = {
 	{ .compatible = "arm,vexpress,v2p-ca15_a7" },
-	{ .compatible = "samsung,exynos5420" },
-	{ .compatible = "samsung,exynos5800" },
+	{ .compatible = "google,peach" },
 	{},
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver
       [not found]   ` <CGME20200616081250eucas1p2de7110898dad050866d78cb5d5120422@eucas1p2.samsung.com>
@ 2020-06-16  8:12     ` Marek Szyprowski
  2020-06-22 17:20       ` Krzysztof Kozlowski
  2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
  0 siblings, 2 replies; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-16  8:12 UTC (permalink / raw)
  To: linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Lorenzo Pieralisi, Krzysztof Kozlowski,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

Enable big.LITTLE cpuidle driver, which can be used on Exynos-based
Peach Pit/Pi Chromebooks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/configs/exynos_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index 374fbff8eaa6..c928bc710c48 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -28,6 +28,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
 CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
 CONFIG_CPUFREQ_DT=y
 CONFIG_CPU_IDLE=y
+CONFIG_ARM_BIG_LITTLE_CPUIDLE=y
 CONFIG_ARM_EXYNOS_CPUIDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/4] ARM: multi_v7_defconfig: Enable big.LITTLE cpuidle driver
       [not found]   ` <CGME20200616081250eucas1p2a98f8810962ddc692fa5588a74f911b3@eucas1p2.samsung.com>
@ 2020-06-16  8:12     ` Marek Szyprowski
  2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-16  8:12 UTC (permalink / raw)
  To: linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Lorenzo Pieralisi, Krzysztof Kozlowski,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

Enable big.LITTLE cpuidle driver, which can be used on Exynos-based
Peach Pit/Pi Chromebooks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 95543914d3c7..6a922a8ef712 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -111,6 +111,7 @@ CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
 CONFIG_QORIQ_CPUFREQ=y
 CONFIG_CPU_IDLE=y
 CONFIG_ARM_CPUIDLE=y
+CONFIG_ARM_BIG_LITTLE_CPUIDLE=y
 CONFIG_ARM_ZYNQ_CPUIDLE=y
 CONFIG_ARM_EXYNOS_CPUIDLE=y
 CONFIG_ARM_TEGRA_CPUIDLE=y
-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos
  2020-06-16  8:12 ` [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos Marek Szyprowski
                     ` (3 preceding siblings ...)
       [not found]   ` <CGME20200616081250eucas1p2a98f8810962ddc692fa5588a74f911b3@eucas1p2.samsung.com>
@ 2020-06-16 20:58   ` Anand Moon
  2020-06-17  9:48     ` Marek Szyprowski
  4 siblings, 1 reply; 22+ messages in thread
From: Anand Moon @ 2020-06-16 20:58 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Linux PM list, linux-arm-kernel, linux-samsung-soc,
	Lorenzo Pieralisi, Bartlomiej Zolnierkiewicz, Daniel Lezcano,
	Krzysztof Kozlowski, Lukasz Luba

Hi Marek,

On Tue, 16 Jun 2020 at 13:44, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> The ARM big.LITTLE cpuidle driver has been enabled and tested on Samsung
> Exynos 5420/5800 based Peach Pit/Pi Chromebooks and in fact it worked
> only on those boards.
>
> However, support for it was broken by the commit 833b5794e330 ("ARM:
> EXYNOS: reset Little cores when cpu is up") and then never enabled in the
> exynos_defconfig. This patchset provides the needed fix to the common
> code and restores support for it. Thanks to Lukasz Luba who motivated me
> to take a look into this issue.
>
Thanks for this updates.

But I feel some DTS changes are missing for example
d2e5c871ed8a drivers: cpuidle: initialize big.LITTLE driver through DT

But I feel that this feature is not working as desired since
still some missing code changes for cluster idle states are missing.
like clock  PWR_CTR and PWR_CTRL2.

-Anand

> Best regards
> Marek Szyprowski
> Samsung R&D Institute Poland
>
>
> Patch summary:
>
> Marek Szyprowski (4):
>   ARM: exynos: Apply little core workaround only under secure firmware
>   cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks
>   ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver
>   ARM: multi_v7_defconfig: Enable big.LITTLE cpuidle driver
>
>  arch/arm/configs/exynos_defconfig    |  1 +
>  arch/arm/configs/multi_v7_defconfig  |  1 +
>  arch/arm/mach-exynos/mcpm-exynos.c   | 10 +++++++---
>  drivers/cpuidle/cpuidle-big_little.c |  3 +--
>  4 files changed, 10 insertions(+), 5 deletions(-)
>
> --
> 2.17.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos
  2020-06-16 20:58   ` [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos Anand Moon
@ 2020-06-17  9:48     ` Marek Szyprowski
  2020-06-17 10:40       ` Lukasz Luba
  2020-06-17 10:57       ` Anand Moon
  0 siblings, 2 replies; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-17  9:48 UTC (permalink / raw)
  To: Anand Moon
  Cc: Linux PM list, linux-arm-kernel, linux-samsung-soc,
	Lorenzo Pieralisi, Bartlomiej Zolnierkiewicz, Daniel Lezcano,
	Krzysztof Kozlowski, Lukasz Luba

Hi Anand,

On 16.06.2020 22:58, Anand Moon wrote:
> On Tue, 16 Jun 2020 at 13:44, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>> The ARM big.LITTLE cpuidle driver has been enabled and tested on Samsung
>> Exynos 5420/5800 based Peach Pit/Pi Chromebooks and in fact it worked
>> only on those boards.
>>
>> However, support for it was broken by the commit 833b5794e330 ("ARM:
>> EXYNOS: reset Little cores when cpu is up") and then never enabled in the
>> exynos_defconfig. This patchset provides the needed fix to the common
>> code and restores support for it. Thanks to Lukasz Luba who motivated me
>> to take a look into this issue.
>>
> Thanks for this updates.
>
> But I feel some DTS changes are missing for example
> d2e5c871ed8a drivers: cpuidle: initialize big.LITTLE driver through DT

This is not strictly needed. The bl-cpuidle matches also to the A7/A15 
CPU product ids and it is properly instantiated on the Peach Pit/Pi 
Chromebooks. Those CPU DT properties were added as a future-proof 
generic solution. I won't hurt to add them though.

> But I feel that this feature is not working as desired since
> still some missing code changes for cluster idle states are missing.
> like clock  PWR_CTR and PWR_CTRL2.

I cannot judge now. All I can test now is a that the boards enters those 
idle states and system works stable. I cannot measure power consumption, 
because currently I have only remote access to the boards.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos
  2020-06-17  9:48     ` Marek Szyprowski
@ 2020-06-17 10:40       ` Lukasz Luba
  2020-06-17 10:57       ` Anand Moon
  1 sibling, 0 replies; 22+ messages in thread
From: Lukasz Luba @ 2020-06-17 10:40 UTC (permalink / raw)
  To: Marek Szyprowski, Anand Moon
  Cc: Linux PM list, linux-arm-kernel, linux-samsung-soc,
	Lorenzo Pieralisi, Bartlomiej Zolnierkiewicz, Daniel Lezcano,
	Krzysztof Kozlowski



On 6/17/20 10:48 AM, Marek Szyprowski wrote:
> Hi Anand,
> 
> On 16.06.2020 22:58, Anand Moon wrote:
>> On Tue, 16 Jun 2020 at 13:44, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>>> The ARM big.LITTLE cpuidle driver has been enabled and tested on Samsung
>>> Exynos 5420/5800 based Peach Pit/Pi Chromebooks and in fact it worked
>>> only on those boards.
>>>
>>> However, support for it was broken by the commit 833b5794e330 ("ARM:
>>> EXYNOS: reset Little cores when cpu is up") and then never enabled in the
>>> exynos_defconfig. This patchset provides the needed fix to the common
>>> code and restores support for it. Thanks to Lukasz Luba who motivated me
>>> to take a look into this issue.
>>>
>> Thanks for this updates.
>>
>> But I feel some DTS changes are missing for example
>> d2e5c871ed8a drivers: cpuidle: initialize big.LITTLE driver through DT
> 
> This is not strictly needed. The bl-cpuidle matches also to the A7/A15
> CPU product ids and it is properly instantiated on the Peach Pit/Pi
> Chromebooks. Those CPU DT properties were added as a future-proof
> generic solution. I won't hurt to add them though.

> 
>> But I feel that this feature is not working as desired since
>> still some missing code changes for cluster idle states are missing.
>> like clock  PWR_CTR and PWR_CTRL2.
> 
> I cannot judge now. All I can test now is a that the boards enters those
> idle states and system works stable. I cannot measure power consumption,
> because currently I have only remote access to the boards.

I agree with Marek. This can be done incrementally. The series fixes the
code path which was working. After the investigation with a power
meter, a proper set of new patches might come if needed.

As a hint to measure this power consumption difference, because it
might be tricky, I would suggest to heat up the SoC. The main
difference between wfi and deeper idle which cut the power
to some components (like caches) should be seen at higher voltage
OPP and higher temperature. It's due to the fact that static power
(leakage) is related to Vdd and temperature -
higher voltage -> higher leakage
higher temp -> higher leakage
This difference (idle state 0 vs 1) should be amplified in the
above scenario and easier to measure.

I am going to review this series after finishing hotplug tests.

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos
  2020-06-17  9:48     ` Marek Szyprowski
  2020-06-17 10:40       ` Lukasz Luba
@ 2020-06-17 10:57       ` Anand Moon
  1 sibling, 0 replies; 22+ messages in thread
From: Anand Moon @ 2020-06-17 10:57 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Linux PM list, linux-arm-kernel, linux-samsung-soc,
	Lorenzo Pieralisi, Bartlomiej Zolnierkiewicz, Daniel Lezcano,
	Krzysztof Kozlowski, Lukasz Luba

Hi Marek,

On Wed, 17 Jun 2020 at 15:18, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>
> Hi Anand,
>
> On 16.06.2020 22:58, Anand Moon wrote:
> > On Tue, 16 Jun 2020 at 13:44, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> >> The ARM big.LITTLE cpuidle driver has been enabled and tested on Samsung
> >> Exynos 5420/5800 based Peach Pit/Pi Chromebooks and in fact it worked
> >> only on those boards.
> >>
> >> However, support for it was broken by the commit 833b5794e330 ("ARM:
> >> EXYNOS: reset Little cores when cpu is up") and then never enabled in the
> >> exynos_defconfig. This patchset provides the needed fix to the common
> >> code and restores support for it. Thanks to Lukasz Luba who motivated me
> >> to take a look into this issue.
> >>
> > Thanks for this updates.
> >
> > But I feel some DTS changes are missing for example
> > d2e5c871ed8a drivers: cpuidle: initialize big.LITTLE driver through DT
>
> This is not strictly needed. The bl-cpuidle matches also to the A7/A15
> CPU product ids and it is properly instantiated on the Peach Pit/Pi
> Chromebooks. Those CPU DT properties were added as a future-proof
> generic solution. I won't hurt to add them though.
>
Ok Thanks.

> > But I feel that this feature is not working as desired since
> > still some missing code changes for cluster idle states are missing.
> > like clock  PWR_CTR and PWR_CTRL2.
>
> I cannot judge now. All I can test now is a that the boards enters those
> idle states and system works stable. I cannot measure power consumption,
> because currently I have only remote access to the boards.
>
Ok, Thanks.

What I meant was in order to cpu cluster to enter into IDLE states,
it's controlled by the EXYNOS5422_PWR_CTRL and EXYNOS5422_PWR_CTRL2 clk fields
See below example from the Exynos5422 cpu idle driver.

[0] https://github.com/hardkernel/linux/blob/odroidxu3-3.10.y/arch/arm/mach-exynos/cpuidle-exynos5422.c#L319-L379

Just link Exynos5250 clk driver we need to Initialize PWR_CTRL and
PWR_CTRL2 for Exynos542x clocks

[1] https://github.com/torvalds/linux/blob/master/drivers/clk/samsung/clk-exynos5250.c#L828-L846

which will help support cpu idle drivers.

-Anand

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware
  2020-06-16  8:12     ` [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware Marek Szyprowski
@ 2020-06-17 16:26       ` Lukasz Luba
  2020-06-22 17:19         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 22+ messages in thread
From: Lukasz Luba @ 2020-06-17 16:26 UTC (permalink / raw)
  To: Marek Szyprowski, linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Lorenzo Pieralisi, Krzysztof Kozlowski, Daniel Lezcano,
	Bartlomiej Zolnierkiewicz

Hi Marek,

I've give it a try with hotplug torture tests and has only one a minor
comment.

On 6/16/20 9:12 AM, Marek Szyprowski wrote:
> The additional soft-reset call during little core power up was needed
> to properly boot all cores on the Exynos5422-based boards with secure
> firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
> CPUidle driver, which worked only on boards without secure firmware
> (like Peach-Pit/Pi Chromebooks).
> 
> Apply the workaround only when board is running under secure firmware.
> 
> Fixes: 833b 5794 e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>   arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
> index 9a681b421ae1..cd861c57d5ad 100644
> --- a/arch/arm/mach-exynos/mcpm-exynos.c
> +++ b/arch/arm/mach-exynos/mcpm-exynos.c
> @@ -26,6 +26,7 @@
>   #define EXYNOS5420_USE_L2_COMMON_UP_STATE	BIT(30)
>   
>   static void __iomem *ns_sram_base_addr __ro_after_init;
> +static bool secure_firmware __ro_after_init;
>   
>   /*
>    * The common v7_exit_coherency_flush API could not be used because of the
> @@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
>   static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
>   {
>   	unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
> +	bool state;
>   
>   	pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
>   	if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
>   		cluster >= EXYNOS5420_NR_CLUSTERS)
>   		return -EINVAL;
>   
> -	if (!exynos_cpu_power_state(cpunr)) {
> -		exynos_cpu_power_up(cpunr);
> -
> +	state = exynos_cpu_power_state(cpunr);
> +	exynos_cpu_power_up(cpunr);

I can see that you have moved this call up, probably to avoid more
'if-else' stuff. I just wanted to notify you that this function
'exynos_cpu_powerup' is called twice when cpu is going up:
1. by the already running cpu i.e. CPU0 and the 'state' is 0 for i.e.
CPU2
2. by the newly starting cpu i.e. CPU2 by running
'secondary_start_kernel' and the state is 3.

In this scenario the 'exynos_cpu_power_up' will be called twice.
I have checked in hotplug that this is not causing any issues, but
thought maybe it's worth share it with you. Maybe you can double check
in TRM that this is not causing anything.

> +	if (!state && secure_firmware) {
>   		/*
>   		 * This assumes the cluster number of the big cores(Cortex A15)
>   		 * is 0 and the Little cores(Cortex A7) is 1.
> @@ -258,6 +260,8 @@ static int __init exynos_mcpm_init(void)
>   		return -ENOMEM;
>   	}
>   
> +	secure_firmware = exynos_secure_firmware_available();
> +
>   	/*
>   	 * To increase the stability of KFC reset we need to program
>   	 * the PMU SPARE3 register
> 

Other than that, the patch set looks good to me.

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware
  2020-06-17 16:26       ` Lukasz Luba
@ 2020-06-22 17:19         ` Krzysztof Kozlowski
  2020-06-29  8:54           ` Marek Szyprowski
  0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2020-06-22 17:19 UTC (permalink / raw)
  To: Lukasz Luba
  Cc: Marek Szyprowski, linux-pm, linux-arm-kernel, linux-samsung-soc,
	Lorenzo Pieralisi, Daniel Lezcano, Bartlomiej Zolnierkiewicz

On Wed, Jun 17, 2020 at 05:26:58PM +0100, Lukasz Luba wrote:
> Hi Marek,
> 
> I've give it a try with hotplug torture tests and has only one a minor
> comment.
> 
> On 6/16/20 9:12 AM, Marek Szyprowski wrote:
> > The additional soft-reset call during little core power up was needed
> > to properly boot all cores on the Exynos5422-based boards with secure
> > firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
> > CPUidle driver, which worked only on boards without secure firmware
> > (like Peach-Pit/Pi Chromebooks).
> > 
> > Apply the workaround only when board is running under secure firmware.
> > 
> > Fixes: 833b 5794 e330 ("ARM: EXYNOS: reset Little cores when cpu is up")

Fix the Fixes tag (in case of resend, otherwise I'll do it).

> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > ---
> >   arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
> >   1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
> > index 9a681b421ae1..cd861c57d5ad 100644
> > --- a/arch/arm/mach-exynos/mcpm-exynos.c
> > +++ b/arch/arm/mach-exynos/mcpm-exynos.c
> > @@ -26,6 +26,7 @@
> >   #define EXYNOS5420_USE_L2_COMMON_UP_STATE	BIT(30)
> >   static void __iomem *ns_sram_base_addr __ro_after_init;
> > +static bool secure_firmware __ro_after_init;
> >   /*
> >    * The common v7_exit_coherency_flush API could not be used because of the
> > @@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
> >   static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
> >   {
> >   	unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
> > +	bool state;
> >   	pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
> >   	if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
> >   		cluster >= EXYNOS5420_NR_CLUSTERS)
> >   		return -EINVAL;
> > -	if (!exynos_cpu_power_state(cpunr)) {
> > -		exynos_cpu_power_up(cpunr);
> > -
> > +	state = exynos_cpu_power_state(cpunr);
> > +	exynos_cpu_power_up(cpunr);
> 
> I can see that you have moved this call up, probably to avoid more
> 'if-else' stuff. I just wanted to notify you that this function
> 'exynos_cpu_powerup' is called twice when cpu is going up:
> 1. by the already running cpu i.e. CPU0 and the 'state' is 0 for i.e.
> CPU2
> 2. by the newly starting cpu i.e. CPU2 by running
> 'secondary_start_kernel' and the state is 3.
> 
> In this scenario the 'exynos_cpu_power_up' will be called twice.
> I have checked in hotplug that this is not causing any issues, but
> thought maybe it's worth share it with you. Maybe you can double check
> in TRM that this is not causing anything.

This brings the old code, before 833b5794e33. I wonder why? I understood
that only soft-reset should be skipped.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/4] cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks
  2020-06-16  8:12     ` [PATCH 2/4] cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks Marek Szyprowski
@ 2020-06-22 17:19       ` Krzysztof Kozlowski
  2020-06-24 10:05       ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2020-06-22 17:19 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

On Tue, Jun 16, 2020 at 10:12:28AM +0200, Marek Szyprowski wrote:
> This driver always worked properly only on the Exynos 5420/5800 based
> Chromebooks (Peach-Pit/Pi), so change the required compatible string to
> the 'google,peach', to avoid enabling it on the other Exynos 542x/5800
> boards, which hangs in such case. The main difference between Peach-Pit/Pi
> and other Exynos 542x/5800 boards is the firmware - Peach platform doesn't
> use secure firmware at all.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/cpuidle/cpuidle-big_little.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver
  2020-06-16  8:12     ` [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver Marek Szyprowski
@ 2020-06-22 17:20       ` Krzysztof Kozlowski
  2020-06-29 11:35         ` Marek Szyprowski
  2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2020-06-22 17:20 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

On Tue, Jun 16, 2020 at 10:12:29AM +0200, Marek Szyprowski wrote:
> Enable big.LITTLE cpuidle driver, which can be used on Exynos-based
> Peach Pit/Pi Chromebooks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  arch/arm/configs/exynos_defconfig | 1 +
>  1 file changed, 1 insertion(+)

I guess this should be enabled after adjusting the compatibles
in patch 2/4? If yes, then it will have to wait.

Best regards,
Krzysztof

> 
> diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
> index 374fbff8eaa6..c928bc710c48 100644
> --- a/arch/arm/configs/exynos_defconfig
> +++ b/arch/arm/configs/exynos_defconfig
> @@ -28,6 +28,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
>  CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
>  CONFIG_CPUFREQ_DT=y
>  CONFIG_CPU_IDLE=y
> +CONFIG_ARM_BIG_LITTLE_CPUIDLE=y
>  CONFIG_ARM_EXYNOS_CPUIDLE=y
>  CONFIG_VFP=y
>  CONFIG_NEON=y
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/4] cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks
  2020-06-16  8:12     ` [PATCH 2/4] cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks Marek Szyprowski
  2020-06-22 17:19       ` Krzysztof Kozlowski
@ 2020-06-24 10:05       ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 22+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-06-24 10:05 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Krzysztof Kozlowski, Daniel Lezcano, Lukasz Luba


On 6/16/20 10:12 AM, Marek Szyprowski wrote:
> This driver always worked properly only on the Exynos 5420/5800 based
> Chromebooks (Peach-Pit/Pi), so change the required compatible string to
> the 'google,peach', to avoid enabling it on the other Exynos 542x/5800
> boards, which hangs in such case. The main difference between Peach-Pit/Pi
> and other Exynos 542x/5800 boards is the firmware - Peach platform doesn't
> use secure firmware at all.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

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

> ---
>  drivers/cpuidle/cpuidle-big_little.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
> index 7f8ddc04342d..abe51185f243 100644
> --- a/drivers/cpuidle/cpuidle-big_little.c
> +++ b/drivers/cpuidle/cpuidle-big_little.c
> @@ -155,8 +155,7 @@ static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int part_id)
>  
>  static const struct of_device_id compatible_machine_match[] = {
>  	{ .compatible = "arm,vexpress,v2p-ca15_a7" },
> -	{ .compatible = "samsung,exynos5420" },
> -	{ .compatible = "samsung,exynos5800" },
> +	{ .compatible = "google,peach" },
>  	{},
>  };
>  
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver
  2020-06-16  8:12     ` [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver Marek Szyprowski
  2020-06-22 17:20       ` Krzysztof Kozlowski
@ 2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 22+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-06-24 10:06 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Krzysztof Kozlowski, Daniel Lezcano, Lukasz Luba


On 6/16/20 10:12 AM, Marek Szyprowski wrote:
> Enable big.LITTLE cpuidle driver, which can be used on Exynos-based
> Peach Pit/Pi Chromebooks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

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

> ---
>  arch/arm/configs/exynos_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
> index 374fbff8eaa6..c928bc710c48 100644
> --- a/arch/arm/configs/exynos_defconfig
> +++ b/arch/arm/configs/exynos_defconfig
> @@ -28,6 +28,7 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
>  CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
>  CONFIG_CPUFREQ_DT=y
>  CONFIG_CPU_IDLE=y
> +CONFIG_ARM_BIG_LITTLE_CPUIDLE=y
>  CONFIG_ARM_EXYNOS_CPUIDLE=y
>  CONFIG_VFP=y
>  CONFIG_NEON=y
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/4] ARM: multi_v7_defconfig: Enable big.LITTLE cpuidle driver
  2020-06-16  8:12     ` [PATCH 4/4] ARM: multi_v7_defconfig: " Marek Szyprowski
@ 2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 22+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-06-24 10:06 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Krzysztof Kozlowski, Daniel Lezcano, Lukasz Luba


On 6/16/20 10:12 AM, Marek Szyprowski wrote:
> Enable big.LITTLE cpuidle driver, which can be used on Exynos-based
> Peach Pit/Pi Chromebooks.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

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

> ---
>  arch/arm/configs/multi_v7_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
> index 95543914d3c7..6a922a8ef712 100644
> --- a/arch/arm/configs/multi_v7_defconfig
> +++ b/arch/arm/configs/multi_v7_defconfig
> @@ -111,6 +111,7 @@ CONFIG_ARM_RASPBERRYPI_CPUFREQ=y
>  CONFIG_QORIQ_CPUFREQ=y
>  CONFIG_CPU_IDLE=y
>  CONFIG_ARM_CPUIDLE=y
> +CONFIG_ARM_BIG_LITTLE_CPUIDLE=y
>  CONFIG_ARM_ZYNQ_CPUIDLE=y
>  CONFIG_ARM_EXYNOS_CPUIDLE=y
>  CONFIG_ARM_TEGRA_CPUIDLE=y
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware
  2020-06-22 17:19         ` Krzysztof Kozlowski
@ 2020-06-29  8:54           ` Marek Szyprowski
  2020-06-29  9:13             ` Krzysztof Kozlowski
  0 siblings, 1 reply; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-29  8:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Lukasz Luba
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Daniel Lezcano, Bartlomiej Zolnierkiewicz

Hi Krzysztof,

On 22.06.2020 19:19, Krzysztof Kozlowski wrote:
> On Wed, Jun 17, 2020 at 05:26:58PM +0100, Lukasz Luba wrote:
>> I've give it a try with hotplug torture tests and has only one a minor
>> comment.
>>
>> On 6/16/20 9:12 AM, Marek Szyprowski wrote:
>>> The additional soft-reset call during little core power up was needed
>>> to properly boot all cores on the Exynos5422-based boards with secure
>>> firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
>>> CPUidle driver, which worked only on boards without secure firmware
>>> (like Peach-Pit/Pi Chromebooks).
>>>
>>> Apply the workaround only when board is running under secure firmware.
>>>
>>> Fixes: 833b 5794 e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
> Fix the Fixes tag (in case of resend, otherwise I'll do it).
>
>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> ---
>>>    arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
>>>    1 file changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
>>> index 9a681b421ae1..cd861c57d5ad 100644
>>> --- a/arch/arm/mach-exynos/mcpm-exynos.c
>>> +++ b/arch/arm/mach-exynos/mcpm-exynos.c
>>> @@ -26,6 +26,7 @@
>>>    #define EXYNOS5420_USE_L2_COMMON_UP_STATE	BIT(30)
>>>    static void __iomem *ns_sram_base_addr __ro_after_init;
>>> +static bool secure_firmware __ro_after_init;
>>>    /*
>>>     * The common v7_exit_coherency_flush API could not be used because of the
>>> @@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
>>>    static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
>>>    {
>>>    	unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
>>> +	bool state;
>>>    	pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
>>>    	if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
>>>    		cluster >= EXYNOS5420_NR_CLUSTERS)
>>>    		return -EINVAL;
>>> -	if (!exynos_cpu_power_state(cpunr)) {
>>> -		exynos_cpu_power_up(cpunr);
>>> -
>>> +	state = exynos_cpu_power_state(cpunr);
>>> +	exynos_cpu_power_up(cpunr);
>> I can see that you have moved this call up, probably to avoid more
>> 'if-else' stuff. I just wanted to notify you that this function
>> 'exynos_cpu_powerup' is called twice when cpu is going up:
>> 1. by the already running cpu i.e. CPU0 and the 'state' is 0 for i.e.
>> CPU2
>> 2. by the newly starting cpu i.e. CPU2 by running
>> 'secondary_start_kernel' and the state is 3.
>>
>> In this scenario the 'exynos_cpu_power_up' will be called twice.
>> I have checked in hotplug that this is not causing any issues, but
>> thought maybe it's worth share it with you. Maybe you can double check
>> in TRM that this is not causing anything.
> This brings the old code, before 833b5794e33. I wonder why? I understood
> that only soft-reset should be skipped.

Because otherwise the Peach boards hangs during the cpuidle. I didn't 
analyze the code that much to judge if it is really necessary in all 
cases, I only restored what worked initially. I can add a comment about 
that to the commit log if needed.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware
  2020-06-29  8:54           ` Marek Szyprowski
@ 2020-06-29  9:13             ` Krzysztof Kozlowski
       [not found]               ` <CGME20200629100230eucas1p1bf07ca4c84ba6be1fbdd80c45d077518@eucas1p1.samsung.com>
  0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2020-06-29  9:13 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Lukasz Luba, linux-pm, linux-arm-kernel, linux-samsung-soc,
	Lorenzo Pieralisi, Daniel Lezcano, Bartlomiej Zolnierkiewicz

On Mon, Jun 29, 2020 at 10:54:27AM +0200, Marek Szyprowski wrote:
> Hi Krzysztof,
> 
> On 22.06.2020 19:19, Krzysztof Kozlowski wrote:
> > On Wed, Jun 17, 2020 at 05:26:58PM +0100, Lukasz Luba wrote:
> >> I've give it a try with hotplug torture tests and has only one a minor
> >> comment.
> >>
> >> On 6/16/20 9:12 AM, Marek Szyprowski wrote:
> >>> The additional soft-reset call during little core power up was needed
> >>> to properly boot all cores on the Exynos5422-based boards with secure
> >>> firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
> >>> CPUidle driver, which worked only on boards without secure firmware
> >>> (like Peach-Pit/Pi Chromebooks).
> >>>
> >>> Apply the workaround only when board is running under secure firmware.
> >>>
> >>> Fixes: 833b 5794 e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
> > Fix the Fixes tag (in case of resend, otherwise I'll do it).
> >
> >>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> >>> ---
> >>>    arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
> >>>    1 file changed, 7 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
> >>> index 9a681b421ae1..cd861c57d5ad 100644
> >>> --- a/arch/arm/mach-exynos/mcpm-exynos.c
> >>> +++ b/arch/arm/mach-exynos/mcpm-exynos.c
> >>> @@ -26,6 +26,7 @@
> >>>    #define EXYNOS5420_USE_L2_COMMON_UP_STATE	BIT(30)
> >>>    static void __iomem *ns_sram_base_addr __ro_after_init;
> >>> +static bool secure_firmware __ro_after_init;
> >>>    /*
> >>>     * The common v7_exit_coherency_flush API could not be used because of the
> >>> @@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
> >>>    static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
> >>>    {
> >>>    	unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
> >>> +	bool state;
> >>>    	pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
> >>>    	if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
> >>>    		cluster >= EXYNOS5420_NR_CLUSTERS)
> >>>    		return -EINVAL;
> >>> -	if (!exynos_cpu_power_state(cpunr)) {
> >>> -		exynos_cpu_power_up(cpunr);
> >>> -
> >>> +	state = exynos_cpu_power_state(cpunr);
> >>> +	exynos_cpu_power_up(cpunr);
> >> I can see that you have moved this call up, probably to avoid more
> >> 'if-else' stuff. I just wanted to notify you that this function
> >> 'exynos_cpu_powerup' is called twice when cpu is going up:
> >> 1. by the already running cpu i.e. CPU0 and the 'state' is 0 for i.e.
> >> CPU2
> >> 2. by the newly starting cpu i.e. CPU2 by running
> >> 'secondary_start_kernel' and the state is 3.
> >>
> >> In this scenario the 'exynos_cpu_power_up' will be called twice.
> >> I have checked in hotplug that this is not causing any issues, but
> >> thought maybe it's worth share it with you. Maybe you can double check
> >> in TRM that this is not causing anything.
> > This brings the old code, before 833b5794e33. I wonder why? I understood
> > that only soft-reset should be skipped.
> 
> Because otherwise the Peach boards hangs during the cpuidle. I didn't 
> analyze the code that much to judge if it is really necessary in all 
> cases, I only restored what worked initially. I can add a comment about 
> that to the commit log if needed.

Yes, please mention this in commit msg.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v2 1/4] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support
       [not found]               ` <CGME20200629100230eucas1p1bf07ca4c84ba6be1fbdd80c45d077518@eucas1p1.samsung.com>
@ 2020-06-29 10:02                 ` Marek Szyprowski
  2020-06-29 11:05                   ` Lukasz Luba
  2020-06-29 18:28                   ` Krzysztof Kozlowski
  0 siblings, 2 replies; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-29 10:02 UTC (permalink / raw)
  To: linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Lorenzo Pieralisi, Krzysztof Kozlowski,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

Call exynos_cpu_power_up(cpunr) unconditionally. This is needed by the
big.LITTLE cpuidle driver and has no side-effects on other code paths.

The additional soft-reset call during little core power up has been added
to properly boot all cores on the Exynos5422-based boards with secure
firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
CPUidle driver, which worked only on boards without secure firmware (like
Peach-Pit/Pi Chromebooks). Apply the workaround only when board is
running under secure firmware.

Fixes: 833b5794e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
v2:
- adjusted patch subject to better describe the change
- added a comment about exynos_cpu_power_up(cpunr) call
---
 arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 9a681b421ae1..cd861c57d5ad 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -26,6 +26,7 @@
 #define EXYNOS5420_USE_L2_COMMON_UP_STATE	BIT(30)
 
 static void __iomem *ns_sram_base_addr __ro_after_init;
+static bool secure_firmware __ro_after_init;
 
 /*
  * The common v7_exit_coherency_flush API could not be used because of the
@@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
 static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
 {
 	unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
+	bool state;
 
 	pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
 	if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
 		cluster >= EXYNOS5420_NR_CLUSTERS)
 		return -EINVAL;
 
-	if (!exynos_cpu_power_state(cpunr)) {
-		exynos_cpu_power_up(cpunr);
-
+	state = exynos_cpu_power_state(cpunr);
+	exynos_cpu_power_up(cpunr);
+	if (!state && secure_firmware) {
 		/*
 		 * This assumes the cluster number of the big cores(Cortex A15)
 		 * is 0 and the Little cores(Cortex A7) is 1.
@@ -258,6 +260,8 @@ static int __init exynos_mcpm_init(void)
 		return -ENOMEM;
 	}
 
+	secure_firmware = exynos_secure_firmware_available();
+
 	/*
 	 * To increase the stability of KFC reset we need to program
 	 * the PMU SPARE3 register
-- 
2.17.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 1/4] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support
  2020-06-29 10:02                 ` [PATCH v2 1/4] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support Marek Szyprowski
@ 2020-06-29 11:05                   ` Lukasz Luba
  2020-06-29 18:28                   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 22+ messages in thread
From: Lukasz Luba @ 2020-06-29 11:05 UTC (permalink / raw)
  To: Marek Szyprowski, linux-pm, linux-arm-kernel, linux-samsung-soc
  Cc: Lorenzo Pieralisi, Krzysztof Kozlowski, Daniel Lezcano,
	Bartlomiej Zolnierkiewicz



On 6/29/20 11:02 AM, Marek Szyprowski wrote:
> Call exynos_cpu_power_up(cpunr) unconditionally. This is needed by the
> big.LITTLE cpuidle driver and has no side-effects on other code paths.
> 
> The additional soft-reset call during little core power up has been added
> to properly boot all cores on the Exynos5422-based boards with secure
> firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
> CPUidle driver, which worked only on boards without secure firmware (like
> Peach-Pit/Pi Chromebooks). Apply the workaround only when board is
> running under secure firmware.
> 
> Fixes: 833b5794e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> v2:
> - adjusted patch subject to better describe the change
> - added a comment about exynos_cpu_power_up(cpunr) call
> ---


Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver
  2020-06-22 17:20       ` Krzysztof Kozlowski
@ 2020-06-29 11:35         ` Marek Szyprowski
  0 siblings, 0 replies; 22+ messages in thread
From: Marek Szyprowski @ 2020-06-29 11:35 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

On 22.06.2020 19:20, Krzysztof Kozlowski wrote:
> On Tue, Jun 16, 2020 at 10:12:29AM +0200, Marek Szyprowski wrote:
>> Enable big.LITTLE cpuidle driver, which can be used on Exynos-based
>> Peach Pit/Pi Chromebooks.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>>   arch/arm/configs/exynos_defconfig | 1 +
>>   1 file changed, 1 insertion(+)
> I guess this should be enabled after adjusting the compatibles
> in patch 2/4? If yes, then it will have to wait.

Indeed, this one and multi_v7 patch have to wait one cycle to avoid 
breaking Odroid XU3/XU4 board family.

Best regards

-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 1/4] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support
  2020-06-29 10:02                 ` [PATCH v2 1/4] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support Marek Szyprowski
  2020-06-29 11:05                   ` Lukasz Luba
@ 2020-06-29 18:28                   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2020-06-29 18:28 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-pm, linux-arm-kernel, linux-samsung-soc, Lorenzo Pieralisi,
	Daniel Lezcano, Lukasz Luba, Bartlomiej Zolnierkiewicz

On Mon, Jun 29, 2020 at 12:02:18PM +0200, Marek Szyprowski wrote:
> Call exynos_cpu_power_up(cpunr) unconditionally. This is needed by the
> big.LITTLE cpuidle driver and has no side-effects on other code paths.
> 
> The additional soft-reset call during little core power up has been added
> to properly boot all cores on the Exynos5422-based boards with secure
> firmware (like Odroid XU3/XU4 family). This however broke big.LITTLE
> CPUidle driver, which worked only on boards without secure firmware (like
> Peach-Pit/Pi Chromebooks). Apply the workaround only when board is
> running under secure firmware.
> 
> Fixes: 833b5794e330 ("ARM: EXYNOS: reset Little cores when cpu is up")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> v2:
> - adjusted patch subject to better describe the change
> - added a comment about exynos_cpu_power_up(cpunr) call
> ---
>  arch/arm/mach-exynos/mcpm-exynos.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Thanks, applied (but somehow your patch did not make it to the
linux-samsung-soc list).

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, back to index

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200616081248eucas1p168faa343ce333a28c8fd3cf9a6a58b3c@eucas1p1.samsung.com>
2020-06-16  8:12 ` [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos Marek Szyprowski
     [not found]   ` <CGME20200616081249eucas1p151a8892ca0abfa3108955e1fc5054fc3@eucas1p1.samsung.com>
2020-06-16  8:12     ` [PATCH 1/4] ARM: exynos: Apply little core workaround only under secure firmware Marek Szyprowski
2020-06-17 16:26       ` Lukasz Luba
2020-06-22 17:19         ` Krzysztof Kozlowski
2020-06-29  8:54           ` Marek Szyprowski
2020-06-29  9:13             ` Krzysztof Kozlowski
     [not found]               ` <CGME20200629100230eucas1p1bf07ca4c84ba6be1fbdd80c45d077518@eucas1p1.samsung.com>
2020-06-29 10:02                 ` [PATCH v2 1/4] ARM: exynos: MCPM: Restore big.LITTLE cpuidle support Marek Szyprowski
2020-06-29 11:05                   ` Lukasz Luba
2020-06-29 18:28                   ` Krzysztof Kozlowski
     [not found]   ` <CGME20200616081249eucas1p2ad165b545f265bec88a06270d55fce76@eucas1p2.samsung.com>
2020-06-16  8:12     ` [PATCH 2/4] cpuidle: big.LITTLE: enable driver only on Peach-Pit/Pi Chromebooks Marek Szyprowski
2020-06-22 17:19       ` Krzysztof Kozlowski
2020-06-24 10:05       ` Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20200616081250eucas1p2de7110898dad050866d78cb5d5120422@eucas1p2.samsung.com>
2020-06-16  8:12     ` [PATCH 3/4] ARM: exynos_defconfig: Enable big.LITTLE cpuidle driver Marek Szyprowski
2020-06-22 17:20       ` Krzysztof Kozlowski
2020-06-29 11:35         ` Marek Szyprowski
2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20200616081250eucas1p2a98f8810962ddc692fa5588a74f911b3@eucas1p2.samsung.com>
2020-06-16  8:12     ` [PATCH 4/4] ARM: multi_v7_defconfig: " Marek Szyprowski
2020-06-24 10:06       ` Bartlomiej Zolnierkiewicz
2020-06-16 20:58   ` [PATCH 0/4] Restore big.LITTLE cpuidle driver for Exynos Anand Moon
2020-06-17  9:48     ` Marek Szyprowski
2020-06-17 10:40       ` Lukasz Luba
2020-06-17 10:57       ` Anand Moon

Linux-Samsung-soc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-samsung-soc/0 linux-samsung-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-samsung-soc linux-samsung-soc/ https://lore.kernel.org/linux-samsung-soc \
		linux-samsung-soc@vger.kernel.org
	public-inbox-index linux-samsung-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-samsung-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git