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: 1724451 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 4BB463FC8F for ; Sat, 10 Nov 2012 16:00:22 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TXDRG-0000Xj-RB; Sat, 10 Nov 2012 15:57:44 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TXDG4-0000Er-J2 for linux-arm-kernel@lists.infradead.org; Sat, 10 Nov 2012 15:46:11 +0000 Received: by mail-we0-f177.google.com with SMTP id u50so2110186wey.36 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=IeF3AK7tUxgfF52uZkOXAt8qGVYuc3UEo6uyXFjtRVDWAvWycY8DDIs/m3/4ym5y5n UGFJ5T7/MW3Jb8SpCdCfFLBhYF0cJWBE3VNg9IBYCO4nekxawHJ3SOXZc6l48eH9rxvn yZMaf42UPm1ySUC7eslxTiFjGu3n5LPGiafM0MyiBIX5DNhmpHah1J2+kPteO9v5G2of MsrhzP3wYLXy6wLa2/tRJTZLLmRKjTCGIEtsadCv2B0ismg3DLWxUgK937akJJjC0w7Q pk1nhVeUogFM0tC0F5985FUdWhyn7CcyNY6KUiIQVxvJhExySkL4nq9XtK7ME/2dFxGZ EWMg== 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 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: ALoCoQkw3IcB9aJYqxCHoATV7//GP461Xqsroqr0e+WktK25RkN8P9PXbFI8YhVZCwn3/ubpe+Ls X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121110_104610_297126_69980EF2 X-CRM114-Status: GOOD ( 14.45 ) 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 [74.125.82.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marc Zyngier 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. Signed-off-by: Marc Zyngier Reviewed-by: Will Deacon --- 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] ||