From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] ARM: arch_timer: stop virtual timer when booted in HYP mode
Date: Wed, 27 Mar 2013 17:11:52 +0000 [thread overview]
Message-ID: <1364404312-4427-6-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1364404312-4427-1-git-send-email-mark.rutland@arm.com>
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
next prev parent reply other threads:[~2013-03-27 17:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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-04-03 23:39 ` Christoffer Dall
2013-04-04 9:29 ` Mark Rutland
2013-04-04 15:27 ` Christoffer Dall
2013-04-04 15:38 ` Mark Rutland
2013-03-27 17:11 ` [PATCH 3/5] clocksource: arch_timer: use virtual counters Mark Rutland
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
2013-03-27 17:11 ` Mark Rutland [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1364404312-4427-6-git-send-email-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).