* [PATCH 1/5] ARM: hyp: initialize CNTVOFF to zero
2013-03-27 17:11 [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Mark Rutland
@ 2013-03-27 17:11 ` Mark Rutland
2013-03-27 17:11 ` [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host Mark Rutland
` (4 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2013-03-27 17:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Marc Zyngier <Marc.Zyngier@arm.com>
In order to be able to use the virtual counter in a safe way,
make sure it is initialized to zero before dropping to SVC.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Dave Martin <dave.martin@linaro.org>
---
arch/arm/kernel/hyp-stub.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
index 1315c4c..dbe2110 100644
--- a/arch/arm/kernel/hyp-stub.S
+++ b/arch/arm/kernel/hyp-stub.S
@@ -153,6 +153,8 @@ THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE
mrc p15, 4, r7, c14, c1, 0 @ CNTHCTL
orr r7, r7, #3 @ PL1PCEN | PL1PCTEN
mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL
+ mov r7, #0
+ mcrr p15, 4, r7, r7, c14 @ CNTVOFF
1:
#endif
--
1.8.1.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host
2013-03-27 17:11 [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Mark Rutland
2013-03-27 17:11 ` [PATCH 1/5] ARM: hyp: initialize CNTVOFF to zero Mark Rutland
@ 2013-03-27 17:11 ` Mark Rutland
2013-04-03 23:39 ` Christoffer Dall
2013-03-27 17:11 ` [PATCH 3/5] clocksource: arch_timer: use virtual counters Mark Rutland
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Mark Rutland @ 2013-03-27 17:11 UTC (permalink / raw)
To: linux-arm-kernel
To use the virtual counters from the host, we need to ensure that
CNTVOFF doesn't change unexpectedly. When we change to a guest, we
replace the host's CNTVOFF, but we don't restore it when returning to
the host.
As the host sets CNTVOFF to zero, and never changes it, we can simply
zero CNTVOFF when returning to the host. This patch adds said zeroing to
the return to host path.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <cdall@cs.columbia.edu>
---
arch/arm/kvm/interrupts_head.S | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index 3c8f2f0..d43cfb5 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -497,6 +497,10 @@ vcpu .req r0 @ vcpu pointer always in r0
add r5, vcpu, r4
strd r2, r3, [r5]
+ @ Ensure host CNTVCT == CNTPCT
+ mov r2, #0
+ mcrr p15, 4, r2, r2, c14 @ CNTVOFF
+
1:
#endif
@ Allow physical timer/counter access for the host
--
1.8.1.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host
2013-03-27 17:11 ` [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host Mark Rutland
@ 2013-04-03 23:39 ` Christoffer Dall
2013-04-04 9:29 ` Mark Rutland
0 siblings, 1 reply; 14+ messages in thread
From: Christoffer Dall @ 2013-04-03 23:39 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 27, 2013 at 10:11 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> To use the virtual counters from the host, we need to ensure that
> CNTVOFF doesn't change unexpectedly. When we change to a guest, we
> replace the host's CNTVOFF, but we don't restore it when returning to
> the host.
>
> As the host sets CNTVOFF to zero, and never changes it, we can simply
> zero CNTVOFF when returning to the host. This patch adds said zeroing to
> the return to host path.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Christoffer Dall <cdall@cs.columbia.edu>
> ---
> arch/arm/kvm/interrupts_head.S | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
> index 3c8f2f0..d43cfb5 100644
> --- a/arch/arm/kvm/interrupts_head.S
> +++ b/arch/arm/kvm/interrupts_head.S
> @@ -497,6 +497,10 @@ vcpu .req r0 @ vcpu pointer always in r0
> add r5, vcpu, r4
> strd r2, r3, [r5]
>
> + @ Ensure host CNTVCT == CNTPCT
> + mov r2, #0
> + mcrr p15, 4, r2, r2, c14 @ CNTVOFF
> +
> 1:
> #endif
> @ Allow physical timer/counter access for the host
> --
> 1.8.1.1
>
>
looks good to me.
Merged into kvm-arm-fixes.
-Christoffer
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host
2013-04-03 23:39 ` Christoffer Dall
@ 2013-04-04 9:29 ` Mark Rutland
2013-04-04 15:27 ` Christoffer Dall
0 siblings, 1 reply; 14+ messages in thread
From: Mark Rutland @ 2013-04-04 9:29 UTC (permalink / raw)
To: linux-arm-kernel
Hi Christoffer,
On Thu, Apr 04, 2013 at 12:39:27AM +0100, Christoffer Dall wrote:
> On Wed, Mar 27, 2013 at 10:11 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > To use the virtual counters from the host, we need to ensure that
> > CNTVOFF doesn't change unexpectedly. When we change to a guest, we
> > replace the host's CNTVOFF, but we don't restore it when returning to
> > the host.
> >
> > As the host sets CNTVOFF to zero, and never changes it, we can simply
> > zero CNTVOFF when returning to the host. This patch adds said zeroing to
> > the return to host path.
> >
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> > Cc: Christoffer Dall <cdall@cs.columbia.edu>
> > ---
> > arch/arm/kvm/interrupts_head.S | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
> > index 3c8f2f0..d43cfb5 100644
> > --- a/arch/arm/kvm/interrupts_head.S
> > +++ b/arch/arm/kvm/interrupts_head.S
> > @@ -497,6 +497,10 @@ vcpu .req r0 @ vcpu pointer always in r0
> > add r5, vcpu, r4
> > strd r2, r3, [r5]
> >
> > + @ Ensure host CNTVCT == CNTPCT
> > + mov r2, #0
> > + mcrr p15, 4, r2, r2, c14 @ CNTVOFF
> > +
> > 1:
> > #endif
> > @ Allow physical timer/counter access for the host
> > --
> > 1.8.1.1
> >
> >
>
> looks good to me.
>
> Merged into kvm-arm-fixes.
As this patch depends on the previous patch (which sets CNTVOFF to 0 in the hyp
stub), and the rest of the patches depend on both this patch and the previous
for correct operation, the series really needs to be taken together.
Would you be able to give your ack instead?
This patch is only required because the later patches in this series need it to
allow the host to use virtual counters, nothing else requires the host's
CNTVOFF to be 0 at the moment as both physical counters and timers are used by
the host.
Thanks,
Mark.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host
2013-04-04 9:29 ` Mark Rutland
@ 2013-04-04 15:27 ` Christoffer Dall
2013-04-04 15:38 ` Mark Rutland
0 siblings, 1 reply; 14+ messages in thread
From: Christoffer Dall @ 2013-04-04 15:27 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 4, 2013 at 2:29 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> Hi Christoffer,
>
> On Thu, Apr 04, 2013 at 12:39:27AM +0100, Christoffer Dall wrote:
>> On Wed, Mar 27, 2013 at 10:11 AM, Mark Rutland <mark.rutland@arm.com> wrote:
>> > To use the virtual counters from the host, we need to ensure that
>> > CNTVOFF doesn't change unexpectedly. When we change to a guest, we
>> > replace the host's CNTVOFF, but we don't restore it when returning to
>> > the host.
>> >
>> > As the host sets CNTVOFF to zero, and never changes it, we can simply
>> > zero CNTVOFF when returning to the host. This patch adds said zeroing to
>> > the return to host path.
>> >
>> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
>> > Acked-by: Marc Zyngier <marc.zyngier@arm.com>
>> > Cc: Christoffer Dall <cdall@cs.columbia.edu>
>> > ---
>> > arch/arm/kvm/interrupts_head.S | 4 ++++
>> > 1 file changed, 4 insertions(+)
>> >
>> > diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
>> > index 3c8f2f0..d43cfb5 100644
>> > --- a/arch/arm/kvm/interrupts_head.S
>> > +++ b/arch/arm/kvm/interrupts_head.S
>> > @@ -497,6 +497,10 @@ vcpu .req r0 @ vcpu pointer always in r0
>> > add r5, vcpu, r4
>> > strd r2, r3, [r5]
>> >
>> > + @ Ensure host CNTVCT == CNTPCT
>> > + mov r2, #0
>> > + mcrr p15, 4, r2, r2, c14 @ CNTVOFF
>> > +
>> > 1:
>> > #endif
>> > @ Allow physical timer/counter access for the host
>> > --
>> > 1.8.1.1
>> >
>> >
>>
>> looks good to me.
>>
>> Merged into kvm-arm-fixes.
>
> As this patch depends on the previous patch (which sets CNTVOFF to 0 in the hyp
> stub), and the rest of the patches depend on both this patch and the previous
> for correct operation, the series really needs to be taken together.
>
I don't see why this patch depends on the prior patches, I see it the
other way around.
> Would you be able to give your ack instead?
But sure, I definitely ack the patch.
>
> This patch is only required because the later patches in this series need it to
> allow the host to use virtual counters, nothing else requires the host's
> CNTVOFF to be 0 at the moment as both physical counters and timers are used by
> the host.
>
I understand, it doesn't hurt either though.
-Christoffer
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host
2013-04-04 15:27 ` Christoffer Dall
@ 2013-04-04 15:38 ` Mark Rutland
0 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2013-04-04 15:38 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 04, 2013 at 04:27:50PM +0100, Christoffer Dall wrote:
> On Thu, Apr 4, 2013 at 2:29 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > Hi Christoffer,
> >
> > On Thu, Apr 04, 2013 at 12:39:27AM +0100, Christoffer Dall wrote:
> >> On Wed, Mar 27, 2013 at 10:11 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> >> > To use the virtual counters from the host, we need to ensure that
> >> > CNTVOFF doesn't change unexpectedly. When we change to a guest, we
> >> > replace the host's CNTVOFF, but we don't restore it when returning to
> >> > the host.
> >> >
> >> > As the host sets CNTVOFF to zero, and never changes it, we can simply
> >> > zero CNTVOFF when returning to the host. This patch adds said zeroing to
> >> > the return to host path.
> >> >
> >> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> >> > Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> >> > Cc: Christoffer Dall <cdall@cs.columbia.edu>
> >> > ---
> >> > arch/arm/kvm/interrupts_head.S | 4 ++++
> >> > 1 file changed, 4 insertions(+)
> >> >
> >> > diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
> >> > index 3c8f2f0..d43cfb5 100644
> >> > --- a/arch/arm/kvm/interrupts_head.S
> >> > +++ b/arch/arm/kvm/interrupts_head.S
> >> > @@ -497,6 +497,10 @@ vcpu .req r0 @ vcpu pointer always in r0
> >> > add r5, vcpu, r4
> >> > strd r2, r3, [r5]
> >> >
> >> > + @ Ensure host CNTVCT == CNTPCT
> >> > + mov r2, #0
> >> > + mcrr p15, 4, r2, r2, c14 @ CNTVOFF
> >> > +
> >> > 1:
> >> > #endif
> >> > @ Allow physical timer/counter access for the host
> >> > --
> >> > 1.8.1.1
> >> >
> >> >
> >>
> >> looks good to me.
> >>
> >> Merged into kvm-arm-fixes.
> >
> > As this patch depends on the previous patch (which sets CNTVOFF to 0 in the hyp
> > stub), and the rest of the patches depend on both this patch and the previous
> > for correct operation, the series really needs to be taken together.
> >
>
> I don't see why this patch depends on the prior patches, I see it the
> other way around.
The patch itself doesn't stricly depend on the others, but the description
does: "As the host sets CNTVOFF to zero" - this is only true once the previous
patch has been applied. As the later patches have a dependence on this patch, I
don't think it makes sense for it to go in on its own -- if anything it makes
it more difficult to apply the rest of the series as it now has a dependence on
or conflict with kvm-arm-fixes.
>
> > Would you be able to give your ack instead?
>
> But sure, I definitely ack the patch.
Cheers.
Mark.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/5] clocksource: arch_timer: use virtual counters
2013-03-27 17:11 [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Mark Rutland
2013-03-27 17:11 ` [PATCH 1/5] ARM: hyp: initialize CNTVOFF to zero Mark Rutland
2013-03-27 17:11 ` [PATCH 2/5] ARM: KVM: arch_timers: zero CNTVOFF upon return to host Mark Rutland
@ 2013-03-27 17:11 ` Mark Rutland
2013-03-27 17:11 ` [PATCH 4/5] arm: fix up ARM_ARCH_TIMER selects Mark Rutland
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2013-03-27 17:11 UTC (permalink / raw)
To: linux-arm-kernel
Switching between reading the virtual or physical counters is
problematic, as some core code wants a view of time before we're fully
set up. Using a function pointer and switching the source after the
first read can make time appear to go backwards, and having a check in
the read function is an unfortunate block on what we want to be a fast
path.
Instead, this patch makes us always use the virtual counters. If we're a
guest, or don't have hyp mode, we'll use the virtual timers, and as such
don't care about CNTVOFF as long as it doesn't change in such a way as
to make time travel backwards. If we do have hyp mode, and might be a
KVM host, we have to use the physical timers, and require CNTVOFF to be
zero so as to have a consistent view of time between the physical timers
and virtual counters.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Rob Herring <rob.herring@calxeda.com>
---
arch/arm/include/asm/arch_timer.h | 9 ---------
arch/arm64/include/asm/arch_timer.h | 10 ----------
drivers/clocksource/arm_arch_timer.c | 23 +++++------------------
include/clocksource/arm_arch_timer.h | 2 +-
4 files changed, 6 insertions(+), 38 deletions(-)
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 7ade91d..35fea17 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -81,15 +81,6 @@ static inline u32 arch_timer_get_cntfrq(void)
return val;
}
-static inline u64 arch_counter_get_cntpct(void)
-{
- u64 cval;
-
- isb();
- asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
- return cval;
-}
-
static inline u64 arch_counter_get_cntvct(void)
{
u64 cval;
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index 91e2a6a..5307737 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -110,16 +110,6 @@ static inline void __cpuinit arch_counter_set_user_access(void)
asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
}
-static inline u64 arch_counter_get_cntpct(void)
-{
- u64 cval;
-
- isb();
- asm volatile("mrs %0, cntpct_el0" : "=r" (cval));
-
- return cval;
-}
-
static inline u64 arch_counter_get_cntvct(void)
{
u64 cval;
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index d7ad425..2abb861 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -186,27 +186,19 @@ u32 arch_timer_get_rate(void)
return arch_timer_rate;
}
-/*
- * Some external users of arch_timer_read_counter (e.g. sched_clock) may try to
- * call it before it has been initialised. Rather than incur a performance
- * penalty checking for initialisation, provide a default implementation that
- * won't lead to time appearing to jump backwards.
- */
-static u64 arch_timer_read_zero(void)
+u64 arch_timer_read_counter(void)
{
- return 0;
+ return arch_counter_get_cntvct();
}
-u64 (*arch_timer_read_counter)(void) = arch_timer_read_zero;
-
static cycle_t arch_counter_read(struct clocksource *cs)
{
- return arch_timer_read_counter();
+ return arch_counter_get_cntvct();
}
static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
{
- return arch_timer_read_counter();
+ return arch_counter_get_cntvct();
}
static struct clocksource clocksource_counter = {
@@ -285,7 +277,7 @@ static int __init arch_timer_register(void)
cyclecounter.mult = clocksource_counter.mult;
cyclecounter.shift = clocksource_counter.shift;
timecounter_init(&timecounter, &cyclecounter,
- arch_counter_get_cntpct());
+ arch_counter_get_cntvct());
if (arch_timer_use_virtual) {
ppi = arch_timer_ppi[VIRT_PPI];
@@ -382,10 +374,5 @@ int __init arch_timer_init(void)
}
}
- if (arch_timer_use_virtual)
- arch_timer_read_counter = arch_counter_get_cntvct;
- else
- arch_timer_read_counter = arch_counter_get_cntpct;
-
return arch_timer_register();
}
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index 2603267..3883812 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -33,7 +33,7 @@
extern int arch_timer_init(void);
extern u32 arch_timer_get_rate(void);
-extern u64 (*arch_timer_read_counter)(void);
+extern u64 arch_timer_read_counter(void);
extern struct timecounter *arch_timer_get_timecounter(void);
#else
--
1.8.1.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] arm: fix up ARM_ARCH_TIMER selects
2013-03-27 17:11 [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Mark Rutland
` (2 preceding siblings ...)
2013-03-27 17:11 ` [PATCH 3/5] clocksource: arch_timer: use virtual counters Mark Rutland
@ 2013-03-27 17:11 ` Mark Rutland
2013-03-27 19:47 ` Stephen Warren
2013-03-27 17:11 ` [PATCH 5/5] ARM: arch_timer: stop virtual timer when booted in HYP mode Mark Rutland
2013-03-27 17:51 ` [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Santosh Shilimkar
5 siblings, 1 reply; 14+ messages in thread
From: Mark Rutland @ 2013-03-27 17:11 UTC (permalink / raw)
To: linux-arm-kernel
In 8a4da6e: "arm: arch_timer: move core to drivers/clocksource", the
selection of ARM_ARCH_TIMER was indirected via HAVE_ARM_ARCH_TIMER,
though mach-exynos's selection of ARM_ARCH_TIMER was missed, and since
then mach-virt and mach-tegra have begun selecting ARM_ARCH_TIMER. This
can lead to architected timer support erroneously appearing to not be
selected in menuconfig.
This patch fixes up the Kconfigs for those platforms to select
HAVE_ARM_ARCH_TIMER.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-exynos/Kconfig | 2 +-
arch/arm/mach-tegra/Kconfig | 2 +-
arch/arm/mach-virt/Kconfig | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 70f94c8..fd45ec0 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -72,7 +72,7 @@ config SOC_EXYNOS5440
bool "SAMSUNG EXYNOS5440"
default y
depends on ARCH_EXYNOS5
- select ARM_ARCH_TIMER
+ select HAVE_ARM_ARCH_TIMER
select AUTO_ZRELADDR
select PINCTRL
select PINCTRL_EXYNOS5440
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index d1c4893..2a4c9b8 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -45,7 +45,7 @@ config ARCH_TEGRA_3x_SOC
config ARCH_TEGRA_114_SOC
bool "Enable support for Tegra114 family"
- select ARM_ARCH_TIMER
+ select HAVE_ARM_ARCH_TIMER
select ARM_GIC
select ARM_L1_CACHE_SHIFT_6
select CPU_V7
diff --git a/arch/arm/mach-virt/Kconfig b/arch/arm/mach-virt/Kconfig
index 8958f0d..081d469 100644
--- a/arch/arm/mach-virt/Kconfig
+++ b/arch/arm/mach-virt/Kconfig
@@ -2,7 +2,7 @@ config ARCH_VIRT
bool "Dummy Virtual Machine" if ARCH_MULTI_V7
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARM_GIC
- select ARM_ARCH_TIMER
+ select HAVE_ARM_ARCH_TIMER
select ARM_PSCI
select HAVE_SMP
select CPU_V7
--
1.8.1.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] arm: fix up ARM_ARCH_TIMER selects
2013-03-27 17:11 ` [PATCH 4/5] arm: fix up ARM_ARCH_TIMER selects Mark Rutland
@ 2013-03-27 19:47 ` Stephen Warren
2013-04-02 13:28 ` Mark Rutland
0 siblings, 1 reply; 14+ messages in thread
From: Stephen Warren @ 2013-03-27 19:47 UTC (permalink / raw)
To: linux-arm-kernel
On 03/27/2013 11:11 AM, Mark Rutland wrote:
> In 8a4da6e: "arm: arch_timer: move core to drivers/clocksource", the
> selection of ARM_ARCH_TIMER was indirected via HAVE_ARM_ARCH_TIMER,
> though mach-exynos's selection of ARM_ARCH_TIMER was missed, and since
> then mach-virt and mach-tegra have begun selecting ARM_ARCH_TIMER. This
> can lead to architected timer support erroneously appearing to not be
> selected in menuconfig.
>
> This patch fixes up the Kconfigs for those platforms to select
> HAVE_ARM_ARCH_TIMER.
Acked-by: Stephen Warren <swarren@nvidia.com>
I assume you'll take this patch through some tree of yours.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/5] arm: fix up ARM_ARCH_TIMER selects
2013-03-27 19:47 ` Stephen Warren
@ 2013-04-02 13:28 ` Mark Rutland
0 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2013-04-02 13:28 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 27, 2013 at 07:47:00PM +0000, Stephen Warren wrote:
> On 03/27/2013 11:11 AM, Mark Rutland wrote:
> > In 8a4da6e: "arm: arch_timer: move core to drivers/clocksource", the
> > selection of ARM_ARCH_TIMER was indirected via HAVE_ARM_ARCH_TIMER,
> > though mach-exynos's selection of ARM_ARCH_TIMER was missed, and since
> > then mach-virt and mach-tegra have begun selecting ARM_ARCH_TIMER. This
> > can lead to architected timer support erroneously appearing to not be
> > selected in menuconfig.
> >
> > This patch fixes up the Kconfigs for those platforms to select
> > HAVE_ARM_ARCH_TIMER.
>
> Acked-by: Stephen Warren <swarren@nvidia.com>
Cheers.
>
> I assume you'll take this patch through some tree of yours.
>
Yup, that's the plan.
Mark.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 5/5] ARM: arch_timer: stop virtual timer when booted in HYP mode
2013-03-27 17:11 [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Mark Rutland
` (3 preceding siblings ...)
2013-03-27 17:11 ` [PATCH 4/5] arm: fix up ARM_ARCH_TIMER selects Mark Rutland
@ 2013-03-27 17:11 ` Mark Rutland
2013-03-27 17:51 ` [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Santosh Shilimkar
5 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2013-03-27 17:11 UTC (permalink / raw)
To: linux-arm-kernel
From: Marc Zyngier <Marc.Zyngier@arm.com>
When booting the kernel, a bootloader could have left the virtual
timer ticking away, potentially generating interrupts. This could
be troublesome if the user of the virtual timer is not careful
when enabling the interrupt.
In order to avoid any surprise, stop the virtual timer from
interrupting us when booted in HYP mode, as we'll use the physical
timer in this case.
Reported-by: Giridhar Maruthy <giridhar.m@samsung.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Dave Martin <dave.martin@linaro.org>
---
arch/arm/kernel/hyp-stub.S | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
index dbe2110..4910232 100644
--- a/arch/arm/kernel/hyp-stub.S
+++ b/arch/arm/kernel/hyp-stub.S
@@ -155,6 +155,11 @@ THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE
mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL
mov r7, #0
mcrr p15, 4, r7, r7, c14 @ CNTVOFF
+
+ @ Disable virtual timer in case it was counting
+ mrc p15, 0, r7, c14, c3, 1 @ CNTV_CTL
+ bic r7, #1 @ Clear ENABLE
+ mcr p15, 0, r7, c14, c3, 1 @ CNTV_CTL
1:
#endif
--
1.8.1.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10
2013-03-27 17:11 [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Mark Rutland
` (4 preceding siblings ...)
2013-03-27 17:11 ` [PATCH 5/5] ARM: arch_timer: stop virtual timer when booted in HYP mode Mark Rutland
@ 2013-03-27 17:51 ` Santosh Shilimkar
2013-04-02 13:29 ` Mark Rutland
5 siblings, 1 reply; 14+ messages in thread
From: Santosh Shilimkar @ 2013-03-27 17:51 UTC (permalink / raw)
To: linux-arm-kernel
Mark,
On Wednesday 27 March 2013 10:41 PM, Mark Rutland wrote:
> The following patches clean up some (harmless) fallout from the changes
> in 3.9, and make the driver always use the virtual counter, eliminating
> problems relating to choosing which counters to use (racy
> initialisation, branches in hot paths).
>
> The patches are based on v3.9-rc4, and have been tested on a TC2 with
> KVM.
>
> The patches can also be found in my public git tree:
> git://linux-arm.org/git/linux-mr.git clocks/arch-timer-cleanups
>
> Rob, patch 3 "clocksource: arch_timer: use virtual counters" clashes
> with your CLKSRC_OF patches, but only by the fact nearby lines are
> alterered. The resolution is trivial and I'm happy to rebase this series
> as necessary.
>
After scanning the patches, most of them I see as fixes rather than
clean-up. Patches as such looks fine to me.
FWIW,
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10
2013-03-27 17:51 ` [PATCH 0/5] arm: arch_timer cleanups and niceties for 3.10 Santosh Shilimkar
@ 2013-04-02 13:29 ` Mark Rutland
0 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2013-04-02 13:29 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 27, 2013 at 05:51:36PM +0000, Santosh Shilimkar wrote:
> Mark,
>
> On Wednesday 27 March 2013 10:41 PM, Mark Rutland wrote:
> > The following patches clean up some (harmless) fallout from the changes
> > in 3.9, and make the driver always use the virtual counter, eliminating
> > problems relating to choosing which counters to use (racy
> > initialisation, branches in hot paths).
> >
> > The patches are based on v3.9-rc4, and have been tested on a TC2 with
> > KVM.
> >
> > The patches can also be found in my public git tree:
> > git://linux-arm.org/git/linux-mr.git clocks/arch-timer-cleanups
> >
> > Rob, patch 3 "clocksource: arch_timer: use virtual counters" clashes
> > with your CLKSRC_OF patches, but only by the fact nearby lines are
> > alterered. The resolution is trivial and I'm happy to rebase this series
> > as necessary.
> >
> After scanning the patches, most of them I see as fixes rather than
> clean-up. Patches as such looks fine to me.
> FWIW,
> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cheers.
Mark.
^ permalink raw reply [flat|nested] 14+ messages in thread