linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Exynos SoCs: enable support for ARM Architected Timers
       [not found] <CGME20190826103201eucas1p1358f33d8fbdc8cef8ba2ebdcb1b3a51a@eucas1p1.samsung.com>
@ 2019-08-26 10:31 ` Marek Szyprowski
       [not found]   ` <CGME20190826103202eucas1p123d075e3da50b5aa1574ae46aa6aa946@eucas1p1.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Marek Szyprowski @ 2019-08-26 10:31 UTC (permalink / raw)
  To: linux-samsung-soc, linux-arm-kernel
  Cc: Chanwoo Choi, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marek Szyprowski

Dear All,

ARM Architected Timers are present in all CortexA7/A15 based Samsung
Exynos SoCs. So far they were not enabled, because there were some issues
related to their initialization. Samsung Exynos SoCs used custom timer
hardware - Exynos MultiCore Timer. It turned out that enabling MCT it is
also needed to get ARM Architected Timers working, because they both
share some common hardware blocks (global system counter).

This patchset enables support for ARM Architected Timer driver together
with a standard Exynos MultiCore Timer driver, which is kept as a default
timer source on ARM 32bit platforms. Support for ARM architected timers
is essential for enabling proper KVM support on those platforms.

Some of the MCT cleanup patches were earlier a part of the similar
patchset for ARM64-based Exynos5433 SoC.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland

Marek Szyprowski (5):
  clocksource: exynos_mct: Remove dead code
  clocksource: exynos_mct: Fix error path in timer resources
    initialization
  clocksource: exynos_mct: Increase priority over ARM arch timer
  ARM: dts: exynos: Add support ARM architected timers
  ARM: exynos: Enable support for ARM architected timers

 arch/arm/boot/dts/exynos3250.dtsi | 10 ++++++++++
 arch/arm/boot/dts/exynos5250.dtsi |  1 +
 arch/arm/boot/dts/exynos54xx.dtsi | 10 ++++++++++
 arch/arm/mach-exynos/Kconfig      |  1 +
 drivers/clocksource/exynos_mct.c  | 27 +++++++++++++++++----------
 include/linux/cpuhotplug.h        |  2 +-
 6 files changed, 40 insertions(+), 11 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] 8+ messages in thread

* [PATCH v2 0/2] Exynos SoCs: enable support for ARM Architected Timers
       [not found]   ` <CGME20190826103202eucas1p123d075e3da50b5aa1574ae46aa6aa946@eucas1p1.samsung.com>
@ 2019-08-26 10:31     ` Marek Szyprowski
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2019-08-26 10:31 UTC (permalink / raw)
  To: linux-samsung-soc, linux-arm-kernel
  Cc: Chanwoo Choi, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marek Szyprowski

Dear All,

ARM Architected Timers are present in all CortexA7/A15 based Samsung
Exynos SoCs. So far they were not enabled, because there were some issues
related to their initialization. Samsung Exynos SoCs used custom timer
hardware - Exynos MultiCore Timer. It turned out that enabling MCT it is
also needed to get ARM Architected Timers working, because they both
share some common hardware blocks (global system counter).

This patchset enables support for ARM Architected Timer driver together
with a standard Exynos MultiCore Timer driver, which is kept as a default
timer source on ARM 32bit platforms. Support for ARM architected timers
is essential for enabling proper KVM support on those platforms.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland


Changelog:

v2:
- dropped MCT patches (merged to v5.1)
- dropped timer priority change patch (merged to v5.3)

v1: https://patchwork.kernel.org/cover/10814913/
- initial version, covers some MCT patches previously sent as a timer
  rework for Exynos5433


Patch summary:

Marek Szyprowski (2):
  ARM: dts: exynos: Add support ARM architected timers
  ARM: exynos: Enable support for ARM architected timers

 arch/arm/boot/dts/exynos3250.dtsi | 10 ++++++++++
 arch/arm/boot/dts/exynos5250.dtsi |  1 +
 arch/arm/boot/dts/exynos54xx.dtsi | 10 ++++++++++
 arch/arm/mach-exynos/Kconfig      |  1 +
 4 files changed, 22 insertions(+)

-- 
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] 8+ messages in thread

* [PATCH v2 1/2] ARM: dts: exynos: Add support ARM architected timers
       [not found]   ` <CGME20190826103202eucas1p16bd422bd505086e9ee27f528a8b48d57@eucas1p1.samsung.com>
@ 2019-08-26 10:31     ` Marek Szyprowski
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2019-08-26 10:31 UTC (permalink / raw)
  To: linux-samsung-soc, linux-arm-kernel
  Cc: Chanwoo Choi, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marek Szyprowski

All CortexA7/A15 based Exynos SoCs have ARM architected timers, so enable
support for them directly in the base dtsi for Exynos3250, Exynos5250
and Exynos54xx SoCs. None of the known firmware properly configures arch
timer registers, so mark them as not-fw-configured and set frequency
to 24MHz, which is the only configuration supported by the remaining
drivers (clocks) so far.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/boot/dts/exynos3250.dtsi | 10 ++++++++++
 arch/arm/boot/dts/exynos5250.dtsi |  1 +
 arch/arm/boot/dts/exynos54xx.dtsi | 10 ++++++++++
 3 files changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi
index 5659c4a10729..01e06b49d702 100644
--- a/arch/arm/boot/dts/exynos3250.dtsi
+++ b/arch/arm/boot/dts/exynos3250.dtsi
@@ -132,6 +132,16 @@
 			     <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <24000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc: soc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 4157a1315db9..f78897413cbc 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -1089,6 +1089,7 @@
 		 * so we need the value from DT.
 		 */
 		clock-frequency = <24000000>;
+		arm,cpu-registers-not-fw-configured;
 	};
 };
 
diff --git a/arch/arm/boot/dts/exynos54xx.dtsi b/arch/arm/boot/dts/exynos54xx.dtsi
index 9c3b63b7cac6..4e6c29530632 100644
--- a/arch/arm/boot/dts/exynos54xx.dtsi
+++ b/arch/arm/boot/dts/exynos54xx.dtsi
@@ -45,6 +45,16 @@
 		status = "disabled";
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <24000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc: soc {
 		sysram@2020000 {
 			compatible = "mmio-sram";
-- 
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 related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] ARM: exynos: Enable support for ARM architected timers
       [not found]   ` <CGME20190826103203eucas1p2d67b0ef44758eb06252b340f7751701a@eucas1p2.samsung.com>
@ 2019-08-26 10:31     ` Marek Szyprowski
  2019-08-26 10:49       ` Marc Zyngier
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Szyprowski @ 2019-08-26 10:31 UTC (permalink / raw)
  To: linux-samsung-soc, linux-arm-kernel
  Cc: Chanwoo Choi, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Marek Szyprowski

ARM architected timer can be used together with Exynos MultiCore Timer
driver, so enable support for it. Support for ARM architected timers is
essential for enabling proper KVM support.

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

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index d7422233a130..833ab92516fa 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -18,6 +18,7 @@ menuconfig ARCH_EXYNOS
 	select EXYNOS_SROM
 	select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS
 	select GPIOLIB
+	select HAVE_ARM_ARCH_TIMER if VIRTUALIZATION
 	select HAVE_ARM_SCU if SMP
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
-- 
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 related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] ARM: exynos: Enable support for ARM architected timers
  2019-08-26 10:31     ` [PATCH v2 2/2] ARM: exynos: Enable support for " Marek Szyprowski
@ 2019-08-26 10:49       ` Marc Zyngier
  2019-08-28  8:22         ` Marek Szyprowski
  0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2019-08-26 10:49 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Chanwoo Choi, linux-samsung-soc, Krzysztof Kozlowski,
	linux-arm-kernel, Bartlomiej Zolnierkiewicz

On 2019-08-26 11:31, Marek Szyprowski wrote:
> ARM architected timer can be used together with Exynos MultiCore 
> Timer
> driver, so enable support for it. Support for ARM architected timers 
> is
> essential for enabling proper KVM support.

How can you say that this is to "enable KVM support", while in the 
previous
patch, you set "arm,cpu-registers-not-fw-configured" which implies that 
you're
booting in secure mode with the timer's CP15 registers left to 
undefined values?

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
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] 8+ messages in thread

* Re: [PATCH v2 2/2] ARM: exynos: Enable support for ARM architected timers
  2019-08-26 10:49       ` Marc Zyngier
@ 2019-08-28  8:22         ` Marek Szyprowski
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2019-08-28  8:22 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Chanwoo Choi, linux-samsung-soc, Krzysztof Kozlowski,
	linux-arm-kernel, Bartlomiej Zolnierkiewicz

Hi Marc,

On 2019-08-26 12:49, Marc Zyngier wrote:
> On 2019-08-26 11:31, Marek Szyprowski wrote:
>> ARM architected timer can be used together with Exynos MultiCore Timer
>> driver, so enable support for it. Support for ARM architected timers is
>> essential for enabling proper KVM support.
>
> How can you say that this is to "enable KVM support", while in the 
> previous
> patch, you set "arm,cpu-registers-not-fw-configured" which implies 
> that you're
> booting in secure mode with the timer's CP15 registers left to 
> undefined values?

Thanks for asking a good question!

I've did my KVM research mainly on Exynos5422-based OdroidXU3/XU4 boards 
family. After some recently merged patches they all now boot correctly 
in HYP mode.

On all of those boards arch timers are indeed partially not configured 
(CNTFRQ is zero). I was convinced that this also requires adding 
"arm,cpu-registers-not-fw-configured" property to make timers fully 
operational, but it looks that this only disables VDSO on arm32 and 
switches to phys timers if booted in SVC mode.

I've checked and KVM works fine on the mentioned boards regardless of 
the "arm,cpu-registers-not-fw-configured" property. The only issue is 
the lack of proper value in CNTFRQ register, what requires patching 
timer node by adding "clock-frequency = <24000000>" property also to the 
guest dtb.

I've did my test of KVM with QEMU emulator version 3.1.0 (Debian 
1:3.1+dfsg-8) virtualizing vexpress-a15 machine, with patched 
vexpress-v2p-ca15-tc1.dtb and the following command line on OdroidXU3:

taskset 0x30 qemu-system-arm -M vexpress-a15 -smp 2 -cpu host 
-enable-kvm -m 512 -kernel zImage -dtb vexpress-v2p-ca15-tc1.dtb -append 
"console=ttyAMA0 root=/dev/vda rw rootwait" -serial stdio -display none 
-monitor null -device virtio-blk-device,drive=virtio-blk -drive 
file=rootfs.raw,id=virtio-blk,if=none,format=raw -netdev user,id=user 
-device virtio-net-device,netdev=user

Then I've checked other boards that are capable of running in HYP mode. 
Exynos5250 Arndale board with mainline uboot boots to HYP fine. 
Exynos5250-based Snow Chromebook with stock bootloader boots only to SVC 
mode. There exists a way to upgrade uboot to enable HYP, but this 
requires HW fix to enable write access to nvram. Both boards however 
also don't configure CNTFRQ register, but otherwise the arch timer 
registers seems to be configured fine (virt counters are in sync between 
CPUs).

The last group of boards are Exynos5420-based Pit and Exynos5800-based 
Pi Chromebooks. In theory they are capable in running HYP mode with a 
patched bootloader, but stock bootloader boots only to SVC. They also 
truly don't have arch timer registers correctly configured, as virt 
timers are out of sync between CPUs.

I will send v3 with "arm,cpu-registers-not-fw-configured" property moved 
from the timer nodes in dtsi files to respective effected boards.

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


_______________________________________________
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] 8+ messages in thread

* Re: [PATCH 0/5] Exynos SoCs: enable support for ARM Architected Timers
  2019-02-15 12:52 ` [PATCH 0/5] Exynos SoCs: enable support for ARM Architected Timers Marek Szyprowski
@ 2019-02-15 16:36   ` Daniel Lezcano
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Lezcano @ 2019-02-15 16:36 UTC (permalink / raw)
  To: Marek Szyprowski, linux-samsung-soc, linux-arm-kernel
  Cc: Chanwoo Choi, Thomas Gleixner, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz


Hi Marek,

I will pick patch 1 and 2 for 5.1

Thanks

  -- Daniel


On 15/02/2019 13:52, Marek Szyprowski wrote:
> Dear All,
> 
> ARM Architected Timers are present in all CortexA7/A15 based Samsung
> Exynos SoCs. So far they were not enabled, because there were some issues
> related to their initialization. Samsung Exynos SoCs used custom timer
> hardware - Exynos MultiCore Timer. It turned out that enabling MCT it is
> also needed to get ARM Architected Timers working, because they both
> share some common hardware blocks (global system counter).
> 
> This patchset enables support for ARM Architected Timer driver together
> with a standard Exynos MultiCore Timer driver, which is kept as a default
> timer source on ARM 32bit platforms. Support for ARM architected timers
> is essential for enabling proper KVM support on those platforms.
> 
> Some of the MCT cleanup patches were earlier a part of the similar
> patchset for ARM64-based Exynos5433 SoC.
> 
> Best regards
> Marek Szyprowski
> Samsung R&D Institute Poland
> 
> Marek Szyprowski (5):
>   clocksource: exynos_mct: Remove dead code
>   clocksource: exynos_mct: Fix error path in timer resources
>     initialization
>   clocksource: exynos_mct: Increase priority over ARM arch timer
>   ARM: dts: exynos: Add support ARM architected timers
>   ARM: exynos: Enable support for ARM architected timers
> 
>  arch/arm/boot/dts/exynos3250.dtsi | 10 ++++++++++
>  arch/arm/boot/dts/exynos5250.dtsi |  1 +
>  arch/arm/boot/dts/exynos54xx.dtsi | 10 ++++++++++
>  arch/arm/mach-exynos/Kconfig      |  1 +
>  drivers/clocksource/exynos_mct.c  | 27 +++++++++++++++++----------
>  include/linux/cpuhotplug.h        |  2 +-
>  6 files changed, 40 insertions(+), 11 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


_______________________________________________
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] 8+ messages in thread

* [PATCH 0/5] Exynos SoCs: enable support for ARM Architected Timers
       [not found] <CGME20190215125238eucas1p2f56fe48600aedcec048bc378ed184419@eucas1p2.samsung.com>
@ 2019-02-15 12:52 ` Marek Szyprowski
  2019-02-15 16:36   ` Daniel Lezcano
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Szyprowski @ 2019-02-15 12:52 UTC (permalink / raw)
  To: linux-samsung-soc, linux-arm-kernel
  Cc: Bartlomiej Zolnierkiewicz, Daniel Lezcano, Krzysztof Kozlowski,
	Chanwoo Choi, Thomas Gleixner, Marek Szyprowski

Dear All,

ARM Architected Timers are present in all CortexA7/A15 based Samsung
Exynos SoCs. So far they were not enabled, because there were some issues
related to their initialization. Samsung Exynos SoCs used custom timer
hardware - Exynos MultiCore Timer. It turned out that enabling MCT it is
also needed to get ARM Architected Timers working, because they both
share some common hardware blocks (global system counter).

This patchset enables support for ARM Architected Timer driver together
with a standard Exynos MultiCore Timer driver, which is kept as a default
timer source on ARM 32bit platforms. Support for ARM architected timers
is essential for enabling proper KVM support on those platforms.

Some of the MCT cleanup patches were earlier a part of the similar
patchset for ARM64-based Exynos5433 SoC.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland

Marek Szyprowski (5):
  clocksource: exynos_mct: Remove dead code
  clocksource: exynos_mct: Fix error path in timer resources
    initialization
  clocksource: exynos_mct: Increase priority over ARM arch timer
  ARM: dts: exynos: Add support ARM architected timers
  ARM: exynos: Enable support for ARM architected timers

 arch/arm/boot/dts/exynos3250.dtsi | 10 ++++++++++
 arch/arm/boot/dts/exynos5250.dtsi |  1 +
 arch/arm/boot/dts/exynos54xx.dtsi | 10 ++++++++++
 arch/arm/mach-exynos/Kconfig      |  1 +
 drivers/clocksource/exynos_mct.c  | 27 +++++++++++++++++----------
 include/linux/cpuhotplug.h        |  2 +-
 6 files changed, 40 insertions(+), 11 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] 8+ messages in thread

end of thread, other threads:[~2019-08-28  8:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190826103201eucas1p1358f33d8fbdc8cef8ba2ebdcb1b3a51a@eucas1p1.samsung.com>
2019-08-26 10:31 ` [PATCH 0/5] Exynos SoCs: enable support for ARM Architected Timers Marek Szyprowski
     [not found]   ` <CGME20190826103202eucas1p123d075e3da50b5aa1574ae46aa6aa946@eucas1p1.samsung.com>
2019-08-26 10:31     ` [PATCH v2 0/2] " Marek Szyprowski
     [not found]   ` <CGME20190826103202eucas1p16bd422bd505086e9ee27f528a8b48d57@eucas1p1.samsung.com>
2019-08-26 10:31     ` [PATCH v2 1/2] ARM: dts: exynos: Add support ARM architected timers Marek Szyprowski
     [not found]   ` <CGME20190826103203eucas1p2d67b0ef44758eb06252b340f7751701a@eucas1p2.samsung.com>
2019-08-26 10:31     ` [PATCH v2 2/2] ARM: exynos: Enable support for " Marek Szyprowski
2019-08-26 10:49       ` Marc Zyngier
2019-08-28  8:22         ` Marek Szyprowski
     [not found] <CGME20190215125238eucas1p2f56fe48600aedcec048bc378ed184419@eucas1p2.samsung.com>
2019-02-15 12:52 ` [PATCH 0/5] Exynos SoCs: enable support for ARM Architected Timers Marek Szyprowski
2019-02-15 16:36   ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).