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: 1992811 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 BDE0BDF2A2 for ; Wed, 16 Jan 2013 18:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756465Ab3APSDU (ORCPT ); Wed, 16 Jan 2013 13:03:20 -0500 Received: from mail-vc0-f176.google.com ([209.85.220.176]:40767 "EHLO mail-vc0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762Ab3APSDT (ORCPT ); Wed, 16 Jan 2013 13:03:19 -0500 Received: by mail-vc0-f176.google.com with SMTP id fo13so1602679vcb.35 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=TSQfZycuXnwjbG8UTCwxIWsHfg8jgr2aJ7EGOA9MRvkqWFhzFA1pSArwn122QOgumT ZeEqhDfwSU3Cr1nu8XBudGkoc8cxEpVa4oRoon6+km95E+VfU3j9CqE/dgnu7iXODQOe V7xQQ+zRJ6CdOmHa3zAXWb1dwi4Y/iziZLZsbTOw9+eDM2AGfyIDmPXcRKk+xLozmT8C QPdxlac5Rt594o4utW7aBARdK4f8Z3Zw5cWB3IjZUekX87ur8Ieh8p0oUStpztmrrtGF XlXZCeDLLFDRxcnkUnX4lOVCW9togZrny+TBw3N22PKJVoRfIuUlo3acDpn0AWQsd353 Nbyw== 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 Cc: Marc Zyngier , Will Deacon 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: ALoCoQmAGEPlelSC6Cc5jKidtU5Db5Z74dqdufbEoYt/QA7qUAE7e98Ql9Kkj/yiS652+/T0R9Dm 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. Reviewed-by: Will Deacon 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] ||