From patchwork Tue Jan 8 18:43:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1947371 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 98FCBDF23A for ; Tue, 8 Jan 2013 18:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757114Ab3AHSnQ (ORCPT ); Tue, 8 Jan 2013 13:43:16 -0500 Received: from mail-vc0-f180.google.com ([209.85.220.180]:37337 "EHLO mail-vc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756991Ab3AHSnP (ORCPT ); Tue, 8 Jan 2013 13:43:15 -0500 Received: by mail-vc0-f180.google.com with SMTP id p16so724698vcq.39 for ; Tue, 08 Jan 2013 10:43:15 -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=5MuGMTCsiQwlkFxS01FbgoLu6iKzllcq4FLWg1QF6q8=; b=Tgn+cXFKq96yDkiVuJIlvnq02ArY3/Vl3lYv01Zjqz0i/0V3mj3rN8rroJ1mwF0t20 7OOU2/65hUuRPbvCtfmVvTDONdMq45OAdGXNjbQ7lXdsiIlDL71jvPbdQSLTElmB2XYM Xh5b5oR0A25e7A6ejuuDjlGxWhSX90mdp7kuY8ZG60DL0PqCIripHCxHK9QlIFnhSzJg iUS1hSGuVq5dtoIxaUiGq3rqMtXoniYrg2V5/77FyjfcpiP9d90YLCWShAyk/6ZTv2sk kEVfrqAJhGr47nGoYT4frj2m+DzWW5ZzTk32LkTUiWI6AtkFV6I8KGvgrqHQdBBb8coX Z7oQ== X-Received: by 10.220.155.84 with SMTP id r20mr5952925vcw.19.1357670595283; Tue, 08 Jan 2013 10:43:15 -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 w4sm44858726vdj.21.2013.01.08.10.43.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 10:43:14 -0800 (PST) Subject: [PATCH v5 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 Cc: Marc Zyngier Date: Tue, 08 Jan 2013 13:43:13 -0500 Message-ID: <20130108184313.46758.23099.stgit@ubuntu> In-Reply-To: <20130108184259.46758.17939.stgit@ubuntu> References: <20130108184259.46758.17939.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQn3Rt2Uh1zNsdADGbbQBvfPe4dPbh0OteqQ0HqxN8AKtKWio6CUvNa36EK6ebdED/q0hJC7 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 --- 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] ||