ARM: EXYNOS5250: Enable KVM support
Subsystems (5)
cover ARM: EXYNOS5250: Enable KVM support
While trying to run 3.9 on Arndale with KVM, I ran across a few minor issues. These patches resolve them, but I'm not 100% sure they are correct.
I'd be very happy if someone who's deeply into the respective code paths could take a look here and either ack the patches or suggest alternative patches to fix the issues at hand.
Alex
Alexander Graf (3):
ARM: EXYNOS5250: dts: Declare the gic as a15 compatible
ARM: EXYNOS5250: dts: Add architected timer nodes
ARM: EXYNOS5250: Register architected timers
arch/arm/boot/dts/exynos5250.dtsi | 18 +++++++++++++++--- arch/arm/mach-exynos/mct.c | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/3 ARM: EXYNOS5250: dts: Declare the gic as a15 compatible
The GIC in the exynos5250 SoC is A15 compliant. Show this through the device tree, so that we can use the GIC for KVM.
Also add the respective A15 memory regions and interrupt links.
--- arch/arm/boot/dts/exynos5250.dtsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos5250.dtsi +6 -2
@@ -47,10 +47,14 @@ }; gic:interrupt-controller at 10481000 { - compatible = "arm,cortex-a9-gic"; + compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; #interrupt-cells = <3>; interrupt-controller; - reg = <0x10481000 0x1000>, <0x10482000 0x2000>; + reg = <0x10481000 0x1000>, + <0x10482000 0x1000>, + <0x10484000 0x2000>, + <0x10486000 0x2000>; + interrupts = <1 9 0xf04>; }; combiner:interrupt-controller at 10440000 {
Signature · 1 line
1.7.10.4
PATCH 2/3 ARM: EXYNOS5250: dts: Add architected timer nodes
In reply to Alexander GrafThe exynos 5250 SoC supports A15 style architected timers. Indicate this through the device tree.
This is required by KVM.
--- arch/arm/boot/dts/exynos5250.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/exynos5250.dtsi +8 -0
@@ -57,6 +57,14 @@ interrupts = <1 9 0xf04>; }; + timer { + compatible = "arm,armv7-timer"; + interrupts = <1 13 0xf08>, + <1 14 0xf08>, + <1 11 0xf08>, + <1 10 0xf08>; + }; + combiner:interrupt-controller@10440000 { compatible = "samsung,exynos4210-combiner"; #interrupt-cells = <2>;
Signature · 1 line
1.7.10.4
PATCH 3/3 ARM: EXYNOS5250: Register architected timers
In reply to Alexander GrafWhen running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
--- arch/arm/mach-exynos/mct.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-exynos/mct.c +4 -0
@@ -482,4 +482,8 @@ void __init exynos4_timer_init(void)exynos4_timer_resources ();exynos4_clocksource_init ();exynos4_clockevent_init (); + +if (soc_is_exynos5250 ()) { +arch_timer_of_register (); + } }
Signature · 1 line
1.7.10.4
Re: [kvmarm] [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
Quoted 19 lines · Alexander Graf
When running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
Signed-off-by Alexander Graf <[email protected]>--- arch/arm/mach-exynos/mct.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mach-exynos/mct.c +0
-0
arch/arm/mach-exynos/mct.c void __init exynos4_timer_init(void) · line 489
Quoted 8 lines
arch/arm/mach-exynos/mct.c +4
-0@@ -482,4 +482,8 @@ void __init exynos4_timer_init(void)exynos4_timer_resources ();exynos4_clocksource_init ();exynos4_clockevent_init (); + +if (soc_is_exynos5250 ()) { +arch_timer_of_register (); + } }
I did something similar a while back:
https://github.com/columbia/linux-kvm-arm/commit/2a368f711893e8fb5fe5cf9e237a7631277f3fd1
But I'm not sure how exactly is the right way for exynos. The other patches look good to me (you can find some very similar work around that very commit in my tree).
-Christoffer
Re: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
In reply to Alexander GrafHello.
Quoted 19 lines · Alexander Graf
When running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
Signed-off-by Alexander Graf <[email protected]>--- arch/arm/mach-exynos/mct.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mach-exynos/mct.c +0
-0
arch/arm/mach-exynos/mct.c void __init exynos4_timer_init(void) · line 488
Quoted 7 lines
arch/arm/mach-exynos/mct.c +4
-0@@ -482,4 +482,8 @@ void __init exynos4_timer_init(void)exynos4_timer_resources ();exynos4_clocksource_init ();exynos4_clockevent_init (); + +if (soc_is_exynos5250 ()) { +arch_timer_of_register (); + }
{} not needed here. scripts/checkpatch.pl should probabl;y warn about it.
WBR, Sergei
Re: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
Quoted 18 lines · Sergei Shtylyov
Hello.
Quoted 13 lines · Alexander Graf
When running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
Signed-off-by Alexander Graf <[email protected]>--- arch/arm/mach-exynos/mct.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 14 lines
arch/arm/mach-exynos/mct.c void __init exynos4_timer_init(void) · line 488
Quoted 12 lines
arch/arm/mach-exynos/mct.c +4
-0@@ -482,4 +482,8 @@ void __init exynos4_timer_init(void)exynos4_timer_resources ();exynos4_clocksource_init ();exynos4_clockevent_init (); + +if (soc_is_exynos5250 ()) { +arch_timer_of_register (); + }{} not needed here.
scripts/checkpatch.plshould probabl;y warn about it.
Yeah, I'd leave it to whoever wants to apply this patch to remove the braces :). IMHO it's not worth it to respin just for this.
Alex
RE: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
In reply to Alexander GrafQuoted 4 lines · Alexander Graf
When running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
Yes, exynos5250 can support, mct(multi core timer) is used though.
Quoted 3 lines
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
Yes, right.
Quoted 3 lines
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
Hmm, if you think, this is _really_ a hack, you need to add some comments about that for clearance, and since the mct.c file has been moved into drivers/clocksource/, this should be re-worked.
BTW, I discussed about this with Thomas and Giridhar just now, we reached this 3rd patch could be dropped because the correct way is to add a dts node for arch timer which patch 2nd is already doing after 3.9-rc1 because of CLOCKSOURCE_OF_DECLARE macro.
So if you' OK above, let me know so that I can take only 1st and 2nd patches to support KVM on exynos5250.
Thanks.
- Kukjin
Quoted 20 lines
Signed-off-by Alexander Graf <[email protected]>--- arch/arm/mach-exynos/mct.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mach-exynos/mct.c +4
-1@@ -482,4 +482,8 @@ void __init exynos4_timer_init(void)exynos4_timer_resources ();exynos4_clocksource_init ();exynos4_clockevent_init (); + +if (soc_is_exynos5250 ()) { +arch_timer_of_register (); + } } --1.7.10.4
Re: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
Quoted 18 lines · Kukjin Kim
Quoted 3 lines · Alexander Graf
When running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
Yes, exynos5250 can support, mct(multi core timer) is used though.
Quoted 3 lines
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
Yes, right.
Quoted 3 lines
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
Hmm, if you think, this is _really_ a hack, you need to add some comments about that for clearance, and since the
mct.cfile has been moved intodrivers/clocksource/, this should be re-worked.
Quoted 7 lines
BTW, I discussed about this with Thomas and Giridhar just now, we reached this 3rd patch could be dropped because the correct way is to add a dts node for arch timer which patch 2nd is already doing after 3.9-rc1 because of
CLOCKSOURCE_OF_DECLAREmacro.So if you' OK above, let me know so that I can take only 1st and 2nd patches to support KVM on exynos5250.
I'd say go ahead and take them and I'll verify whether things work on your tree :).
What's the git repo of your branch?
Alex
RE: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
Quoted 25 lines · Alexander Graf
Quoted 9 lines · Kukjin Kim
Quoted 3 lines · Alexander Graf
When running on an exynos 5250 SoC, we don't initialize the architected timers. The chip however supports architected timers.
Yes, exynos5250 can support, mct(multi core timer) is used though.
Quoted 3 lines
When we don't initialize them, KVM will try to access them and run into NULL pointer dereferences attempting to do so.
Quoted 6 lines
Yes, right.
Quoted 3 lines
This patch is really more of a hack than a real fix, but does get me working with KVM on Arndale.
Hmm, if you think, this is _really_ a hack, you need to add some
comments
Quoted 4 lines
about that for clearance, and since the
mct.cfile has been moved intodrivers/clocksource/, this should be re-worked.BTW, I discussed about this with Thomas and Giridhar just now, we
reached
Quoted 2 lines
this 3rd patch could be dropped because the correct way is to add a dts node for arch timer which patch 2nd is already doing after 3.9-rc1
Quoted 9 lines
because
Quoted 4 lines
of
CLOCKSOURCE_OF_DECLAREmacro.So if you' OK above, let me know so that I can take only 1st and 2nd patches to support KVM on exynos5250.
I'd say go ahead and take them and I'll verify whether things work on your tree :).
OK, I will.
Quoted 2 lines
What's the git repo of your branch?
You can test with my for-next branch but this series can be seen tomorrow night(KST) in my public tree.
Any problems, please let me know.
Thanks.
- Kukjin