linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: c.dall@virtualopensystems.com (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/5] ARM: arch_timers: switch to physical timers if HYP mode is available
Date: Sat, 10 Nov 2012 16:46:05 +0100	[thread overview]
Message-ID: <20121110154605.3274.70574.stgit@chazy-air> (raw)
In-Reply-To: <20121110154554.3274.77777.stgit@chazy-air>

From: Marc Zyngier <marc.zyngier@arm.com>

If we're booted in HYP mode, it is possible that we'll run some
kind of virtualized environment. In this case, it is a better to
switch to the physical timers, and leave the virtual timers to
guests.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/kernel/arch_timer.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index c8ef207..8adcd04 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -26,6 +26,7 @@
 #include <asm/arch_timer.h>
 #include <asm/system_info.h>
 #include <asm/sched_clock.h>
+#include <asm/virt.h>
 
 static unsigned long arch_timer_rate;
 
@@ -489,10 +490,14 @@ int __init arch_timer_of_register(void)
 		arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
 
 	/*
+	 * If HYP mode is available, we know that the physical timer
+	 * has been configured to be accessible from PL1. Use it, so
+	 * that a guest can use the virtual timer instead.
+	 *
 	 * If no interrupt provided for virtual timer, we'll have to
 	 * stick to the physical timer. It'd better be accessible...
 	 */
-	if (!arch_timer_ppi[VIRT_PPI]) {
+	if (is_hyp_mode_available() || !arch_timer_ppi[VIRT_PPI]) {
 		arch_timer_use_virtual = false;
 
 		if (!arch_timer_ppi[PHYS_SECURE_PPI] ||

  reply	other threads:[~2012-11-10 15:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-10 15:45 [PATCH v4 0/5] KVM/ARM Architected Timers support Christoffer Dall
2012-11-10 15:46 ` Christoffer Dall [this message]
2012-11-23 15:18   ` [PATCH v4 1/5] ARM: arch_timers: switch to physical timers if HYP mode is available Will Deacon
2012-11-10 15:46 ` [PATCH v4 2/5] ARM: KVM: arch_timers: Add minimal infrastructure Christoffer Dall
2012-11-23 15:23   ` Will Deacon
2012-11-30 22:24     ` Christoffer Dall
2012-11-10 15:46 ` [PATCH v4 3/5] ARM: KVM: arch_timers: Add guest timer core support Christoffer Dall
2012-11-23 16:17   ` Will Deacon
2012-11-23 16:52     ` Marc Zyngier
2012-11-23 17:00       ` Will Deacon
2012-11-23 17:11         ` Marc Zyngier
2012-11-30 23:11           ` Christoffer Dall
2012-11-10 15:46 ` [PATCH v4 4/5] ARM: KVM: arch_timers: Add timer world switch Christoffer Dall
2012-11-23 16:30   ` Will Deacon
2012-11-23 17:04     ` Marc Zyngier
2012-12-01  0:56       ` Christoffer Dall
2012-11-10 15:46 ` [PATCH v4 5/5] ARM: KVM: arch_timers: Wire the init code and config option Christoffer Dall
2012-11-23 16:31   ` Will Deacon
2012-12-01  1:05     ` Christoffer Dall

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=20121110154605.3274.70574.stgit@chazy-air \
    --to=c.dall@virtualopensystems.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).