kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: EXYNOS5250: Enable KVM support
@ 2013-03-14  0:58 Alexander Graf
  2013-03-14  0:59 ` [PATCH 1/3] ARM: EXYNOS5250: dts: Declare the gic as a15 compatible Alexander Graf
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alexander Graf @ 2013-03-14  0:58 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kvm, linux-arm-kernel, kvmarm, Kukjin Kim

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(-)

-- 
1.7.10.4


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

* [PATCH 1/3] ARM: EXYNOS5250: dts: Declare the gic as a15 compatible
  2013-03-14  0:58 [PATCH 0/3] ARM: EXYNOS5250: Enable KVM support Alexander Graf
@ 2013-03-14  0:59 ` Alexander Graf
  2013-03-14  0:59 ` [PATCH 2/3] ARM: EXYNOS5250: dts: Add architected timer nodes Alexander Graf
  2013-03-14  0:59 ` [PATCH 3/3] ARM: EXYNOS5250: Register architected timers Alexander Graf
  2 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2013-03-14  0:59 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kvm, linux-arm-kernel, kvmarm, Kukjin Kim

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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/boot/dts/exynos5250.dtsi |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index b1ac73e..768cb42 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -47,10 +47,14 @@
 	};
 
 	gic:interrupt-controller@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@10440000 {
-- 
1.7.10.4


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

* [PATCH 2/3] ARM: EXYNOS5250: dts: Add architected timer nodes
  2013-03-14  0:58 [PATCH 0/3] ARM: EXYNOS5250: Enable KVM support Alexander Graf
  2013-03-14  0:59 ` [PATCH 1/3] ARM: EXYNOS5250: dts: Declare the gic as a15 compatible Alexander Graf
@ 2013-03-14  0:59 ` Alexander Graf
  2013-03-14  0:59 ` [PATCH 3/3] ARM: EXYNOS5250: Register architected timers Alexander Graf
  2 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2013-03-14  0:59 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kvm, linux-arm-kernel, kvmarm, Kukjin Kim

The exynos 5250 SoC supports A15 style architected timers. Indicate
this through the device tree.

This is required by KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/arm/boot/dts/exynos5250.dtsi |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 768cb42..9fb4a38 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -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>;
-- 
1.7.10.4

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

* [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-03-14  0:58 [PATCH 0/3] ARM: EXYNOS5250: Enable KVM support Alexander Graf
  2013-03-14  0:59 ` [PATCH 1/3] ARM: EXYNOS5250: dts: Declare the gic as a15 compatible Alexander Graf
  2013-03-14  0:59 ` [PATCH 2/3] ARM: EXYNOS5250: dts: Add architected timer nodes Alexander Graf
@ 2013-03-14  0:59 ` Alexander Graf
  2013-03-14  3:26   ` [kvmarm] " Christoffer Dall
                     ` (2 more replies)
  2 siblings, 3 replies; 10+ messages in thread
From: Alexander Graf @ 2013-03-14  0:59 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kvm, linux-arm-kernel, kvmarm, Kukjin Kim

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 <agraf@suse.de>
---
 arch/arm/mach-exynos/mct.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index c9d6650..eefb8af 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -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

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

* Re: [kvmarm] [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-03-14  0:59 ` [PATCH 3/3] ARM: EXYNOS5250: Register architected timers Alexander Graf
@ 2013-03-14  3:26   ` Christoffer Dall
  2013-03-14 19:07   ` Sergei Shtylyov
  2013-04-02 10:44   ` Kukjin Kim
  2 siblings, 0 replies; 10+ messages in thread
From: Christoffer Dall @ 2013-03-14  3:26 UTC (permalink / raw)
  To: Alexander Graf
  Cc: linux-samsung-soc, Kukjin Kim, linux-arm-kernel, kvm, kvmarm

On Wed, Mar 13, 2013 at 5:59 PM, Alexander Graf <agraf@suse.de> wrote:
> 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 <agraf@suse.de>
> ---
>  arch/arm/mach-exynos/mct.c |    4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
> index c9d6650..eefb8af 100644
> --- a/arch/arm/mach-exynos/mct.c
> +++ b/arch/arm/mach-exynos/mct.c
> @@ -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

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

* Re: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-03-14  0:59 ` [PATCH 3/3] ARM: EXYNOS5250: Register architected timers Alexander Graf
  2013-03-14  3:26   ` [kvmarm] " Christoffer Dall
@ 2013-03-14 19:07   ` Sergei Shtylyov
  2013-03-21 15:40     ` Alexander Graf
  2013-04-02 10:44   ` Kukjin Kim
  2 siblings, 1 reply; 10+ messages in thread
From: Sergei Shtylyov @ 2013-03-14 19:07 UTC (permalink / raw)
  To: Alexander Graf
  Cc: linux-samsung-soc, Kukjin Kim, linux-arm-kernel, kvm, kvmarm

Hello.

On 14-03-2013 4:59, Alexander Graf wrote:

> 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 <agraf@suse.de>
> ---
>   arch/arm/mach-exynos/mct.c |    4 ++++
>   1 file changed, 4 insertions(+)

> diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
> index c9d6650..eefb8af 100644
> --- a/arch/arm/mach-exynos/mct.c
> +++ b/arch/arm/mach-exynos/mct.c
> @@ -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

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

* Re: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-03-14 19:07   ` Sergei Shtylyov
@ 2013-03-21 15:40     ` Alexander Graf
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2013-03-21 15:40 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-samsung-soc, Kukjin Kim, linux-arm-kernel, kvm, kvmarm


On 14.03.2013, at 20:07, Sergei Shtylyov wrote:

> Hello.
> 
> On 14-03-2013 4:59, Alexander Graf wrote:
> 
>> 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 <agraf@suse.de>
>> ---
>>  arch/arm/mach-exynos/mct.c |    4 ++++
>>  1 file changed, 4 insertions(+)
> 
>> diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
>> index c9d6650..eefb8af 100644
>> --- a/arch/arm/mach-exynos/mct.c
>> +++ b/arch/arm/mach-exynos/mct.c
>> @@ -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.

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

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

* RE: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-03-14  0:59 ` [PATCH 3/3] ARM: EXYNOS5250: Register architected timers Alexander Graf
  2013-03-14  3:26   ` [kvmarm] " Christoffer Dall
  2013-03-14 19:07   ` Sergei Shtylyov
@ 2013-04-02 10:44   ` Kukjin Kim
  2013-04-02 11:45     ` Alexander Graf
  2 siblings, 1 reply; 10+ messages in thread
From: Kukjin Kim @ 2013-04-02 10:44 UTC (permalink / raw)
  To: 'Alexander Graf', linux-samsung-soc
  Cc: kvm, linux-arm-kernel, kvmarm,
	THOMAS P
	ABRAHAM/SRI-Bangalore-SLG/./삼성전자,
	'Giridhar BM'

Alexander Graf wrote:
> 
> 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.

> When we don't initialize them, KVM will try to access them and run into
> NULL pointer dereferences attempting to do so.
> 
Yes, right.

> 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

> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/arm/mach-exynos/mct.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
> index c9d6650..eefb8af 100644
> --- a/arch/arm/mach-exynos/mct.c
> +++ b/arch/arm/mach-exynos/mct.c
> @@ -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


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

* Re: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-04-02 10:44   ` Kukjin Kim
@ 2013-04-02 11:45     ` Alexander Graf
  2013-04-03  4:56       ` Kukjin Kim
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2013-04-02 11:45 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: linux-samsung-soc, kvm, linux-arm-kernel, kvmarm,
	"THOMAS P
	ABRAHAM/SRI-Bangalore-SLG/./삼성전자",
	'Giridhar BM'

On 04/02/2013 12:44 PM, Kukjin Kim wrote:
> Alexander Graf wrote:
>> 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.
>
>> When we don't initialize them, KVM will try to access them and run into
>> NULL pointer dereferences attempting to do so.
>>
> Yes, right.
>
>> 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.

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


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

* RE: [PATCH 3/3] ARM: EXYNOS5250: Register architected timers
  2013-04-02 11:45     ` Alexander Graf
@ 2013-04-03  4:56       ` Kukjin Kim
  0 siblings, 0 replies; 10+ messages in thread
From: Kukjin Kim @ 2013-04-03  4:56 UTC (permalink / raw)
  To: 'Alexander Graf'
  Cc: linux-samsung-soc, kvm, linux-arm-kernel, kvmarm,
	'"THOMAS P
	ABRAHAM/SRI-Bangalore-SLG/./삼성전자"',
	'Giridhar BM'

Alexander Graf wrote:
> 
> On 04/02/2013 12:44 PM, Kukjin Kim wrote:
> > Alexander Graf wrote:
> >> 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.
> >
> >> When we don't initialize them, KVM will try to access them and run into
> >> NULL pointer dereferences attempting to do so.
> >>
> > Yes, right.
> >
> >> 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.
> 
> I'd say go ahead and take them and I'll verify whether things work on
> your tree :).
> 
OK, I will.

> 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

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

end of thread, other threads:[~2013-04-03  4:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-14  0:58 [PATCH 0/3] ARM: EXYNOS5250: Enable KVM support Alexander Graf
2013-03-14  0:59 ` [PATCH 1/3] ARM: EXYNOS5250: dts: Declare the gic as a15 compatible Alexander Graf
2013-03-14  0:59 ` [PATCH 2/3] ARM: EXYNOS5250: dts: Add architected timer nodes Alexander Graf
2013-03-14  0:59 ` [PATCH 3/3] ARM: EXYNOS5250: Register architected timers Alexander Graf
2013-03-14  3:26   ` [kvmarm] " Christoffer Dall
2013-03-14 19:07   ` Sergei Shtylyov
2013-03-21 15:40     ` Alexander Graf
2013-04-02 10:44   ` Kukjin Kim
2013-04-02 11:45     ` Alexander Graf
2013-04-03  4:56       ` Kukjin Kim

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox