From patchwork Sat Nov 10 15:46:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1724171 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7EA593FC8F for ; Sat, 10 Nov 2012 15:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306Ab2KJPqK (ORCPT ); Sat, 10 Nov 2012 10:46:10 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:35572 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277Ab2KJPqH (ORCPT ); Sat, 10 Nov 2012 10:46:07 -0500 Received: by mail-we0-f174.google.com with SMTP id t9so2184794wey.19 for ; Sat, 10 Nov 2012 07:46:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=5MuGMTCsiQwlkFxS01FbgoLu6iKzllcq4FLWg1QF6q8=; b=OpOMK6nKoAMvBo++xnj0jMz+dsYcxVb0fSH9rAy4MC/cZ+/8KK05mwMhLL18iCE/Ya X36Mf8CSHviYxYDxRzT1tZ8oruXjkQdEwNweUnRpn3yeP0F5kFsIMoEckwrDIEs/CaUN d96vyd3LJXBaqWweKSoWEmCtqQiut8YxGOfnIgwfew3+fMkFx6i7w0swB8nvSh+qeAzM 4h1a1cv8p5mb83lwjlBufVwwuGOdj5KPGYCWJ7G+ldRMv9eKBXosZP7oob4hjcYCwgKA ejbIJRCELCKhvd6Ho/0dkar/fc4NgnHUhy5jzUgzHgFIMF+nJG3IHbs/nbirG6YriGQk up+g== Received: by 10.180.19.73 with SMTP id c9mr7617084wie.8.1352562366736; Sat, 10 Nov 2012 07:46:06 -0800 (PST) Received: from [127.0.1.1] (ip1.c116.obr91.cust.comxnet.dk. [87.72.8.103]) by mx.google.com with ESMTPS id i6sm6734146wix.5.2012.11.10.07.46.05 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Nov 2012 07:46:06 -0800 (PST) Subject: [PATCH v4 1/5] ARM: arch_timers: switch to physical timers if HYP mode is available To: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu From: Christoffer Dall Cc: Marc Zyngier Date: Sat, 10 Nov 2012 16:46:05 +0100 Message-ID: <20121110154605.3274.70574.stgit@chazy-air> In-Reply-To: <20121110154554.3274.77777.stgit@chazy-air> References: <20121110154554.3274.77777.stgit@chazy-air> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnJi0mPz88bzUKUc4Izb53pZ076k6fJUwLm1n3kDLLnLrBEk0ltbWnRSLxMTamzurNKZCKJ Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Zyngier 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 Reviewed-by: Will Deacon --- arch/arm/kernel/arch_timer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 #include #include +#include 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] ||