From patchwork Sat Sep 15 15:39:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1462361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id F36D1DF264 for ; Sat, 15 Sep 2012 15:51:13 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TCuaf-0007KZ-BJ; Sat, 15 Sep 2012 15:47:30 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TCuSW-000156-61 for linux-arm-kernel@lists.infradead.org; Sat, 15 Sep 2012 15:39:05 +0000 Received: by qafk1 with SMTP id k1so581650qaf.15 for ; Sat, 15 Sep 2012 08:39:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding:x-gm-message-state; bh=IUmq+0eY2t1ZCKLsTSpXRMimHj2bwgZM4EnZlDIo8BE=; b=bZxGZoYofcXG+DRNjrSqyD1pzTbCmxEiJifoKDxbdmdLXC5+ou6GRM5adxrdADqkoi 64KGCyA5xz7nSnQMdMS6yeYHBC3hXzOLcjzLdeOg9uKeP7wEdNMrCWosYfQW7uKajzTU 1Ou8HBWIqyPhSUWPyMl97zayKI36N0Nwes7FPzUz67p1AJ+jPC378q1ljYIpLdvyKsGG K4bfk+QOrcXKhoPo+Kz5DtibhQ2atZSCBHjywFkhy+2dHFSl2ywdZdUsBHR7fcdsD421 OY45m7iAG4PJr2vKC8wnIBgCftgoQ3zv972GJSIEmwuG5WhkvQT4jOqlbsceO4QPyNI/ VWng== Received: by 10.224.70.138 with SMTP id d10mr15458667qaj.12.1347723543452; Sat, 15 Sep 2012 08:39:03 -0700 (PDT) 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 ha5sm7025980qab.1.2012.09.15.08.39.02 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Sep 2012 08:39:03 -0700 (PDT) Subject: [PATCH 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, 15 Sep 2012 11:39:02 -0400 Message-ID: <20120915153902.21673.37552.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkC+Eti0NtRVZKPxdvw4kjlStT37KXtPzg4LvADgm3DJteN5XUd2CGvPi7LwJThpXsc2NP0 X-Spam-Note: CRM114 invocation failed 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.216.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 --- 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 c04c2a6..8a30186 100644 --- a/arch/arm/kernel/arch_timer.c +++ b/arch/arm/kernel/arch_timer.c @@ -25,6 +25,7 @@ #include #include #include +#include static unsigned long arch_timer_rate; @@ -490,10 +491,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] ||