From patchwork Wed Jan 16 18:03:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1993131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 26D873FE33 for ; Wed, 16 Jan 2013 18:21:07 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TvXXM-0006MI-4D; Wed, 16 Jan 2013 18:16:32 +0000 Received: from mail-vb0-f42.google.com ([209.85.212.42]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TvXKa-0005y3-UR for linux-arm-kernel@lists.infradead.org; Wed, 16 Jan 2013 18:03:24 +0000 Received: by mail-vb0-f42.google.com with SMTP id fa15so1639811vbb.1 for ; Wed, 16 Jan 2013 10:03:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received: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=kYVqL9d2XCp/QRLIJ7MAhPBHwWHpsASDk+lJhtplMmc=; b=La6FZxOZbiQPd5PnQO4WhWXPRz77HllX3tIlhZKY+i/uv/60CXTv4M5Rf6k5PPLPz3 T7wvC4XuYQFz6cc9WsmTW/Yvt9E/l2LVqnaxNm8/8NJ60ABd+1jKNHH6e6mAdGk2kaS5 OmJzAIroMCvwbUE004LgG+iIlo+pMaV+PlSc3Vv62vx+aU4rUTp8eV/K5XHXQNwe+sWV TEbtX0ReVxDjryxKtzC2xCVCyM1UeJn1y4Arb9goI7G2l6bqJiYzYgk8DWAteYJLWHc8 z7VBVEx7EkXkLrPXmzBy4n3UbatSvoFOJPXF5nlP73+/Xh+Wb9dNcNuQr3WmKGA0Df+H GteA== X-Received: by 10.52.18.207 with SMTP id y15mr1988511vdd.8.1358359398785; Wed, 16 Jan 2013 10:03:18 -0800 (PST) Received: from [127.0.1.1] (pool-72-80-83-148.nycmny.fios.verizon.net. [72.80.83.148]) by mx.google.com with ESMTPS id yu4sm9739153veb.7.2013.01.16.10.03.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jan 2013 10:03:18 -0800 (PST) Subject: [PATCH v6 1/4] 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 Date: Wed, 16 Jan 2013 13:03:17 -0500 Message-ID: <20130116180317.29693.63214.stgit@ubuntu> In-Reply-To: <20130116180307.29693.84098.stgit@ubuntu> References: <20130116180307.29693.84098.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmh5Ljlq4UfCMPaA8BWvi1Rz7OtxluILFwEZcpZJVyEHccUiwFxM/JaVuB48DYi9PhCjR2h X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130116_130323_942662_269F01C8 X-CRM114-Status: GOOD ( 13.24 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.42 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marc Zyngier , Will Deacon X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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. Reviewed-by: Will Deacon Signed-off-by: Marc Zyngier --- 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 #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] ||