From patchwork Mon Oct 1 09:15:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1530141 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C053B3FE1C for ; Mon, 1 Oct 2012 09:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573Ab2JAJPs (ORCPT ); Mon, 1 Oct 2012 05:15:48 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:61903 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429Ab2JAJPs (ORCPT ); Mon, 1 Oct 2012 05:15:48 -0400 Received: by qchd3 with SMTP id d3so3492273qch.19 for ; Mon, 01 Oct 2012 02:15:47 -0700 (PDT) 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=IUmq+0eY2t1ZCKLsTSpXRMimHj2bwgZM4EnZlDIo8BE=; b=BajzOona5cAoX6aXa3nKBqFWPiE1WiCnV3hEF8H3bxlf7RIfQyJw2yGYbFoU4ZfypV Hs4K3P7xTiIe1pE3gx0vHUYBRiti9DUwgf0xLeS04pyYzl5CP/EBNzAc2PuEOs4JqhPt Hq0TZvcfBDNEPuRoNbxN2wEoRiR9GDBk1VFiBP1gd8Nzo7cKKMq/TSO3mJTualeklPFh zxm0UYooeEG5cMTaycuBWL6P/MIPdGOjbGYlyElcZRAE0deafmIdipZf6w3tW/syihxs U8/KiEgs1MfqfvNudXycctixlcWAAy6v8tF8SLXekV+V4QZAPgEuf0xH/ADKnMDyWnzy reug== Received: by 10.224.58.134 with SMTP id g6mr35331291qah.40.1349082947402; Mon, 01 Oct 2012 02:15:47 -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 fy1sm23789880qab.10.2012.10.01.02.15.46 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Oct 2012 02:15:46 -0700 (PDT) Subject: [PATCH v2 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 Cc: Marc Zyngier Date: Mon, 01 Oct 2012 05:15:45 -0400 Message-ID: <20121001091545.49694.51281.stgit@ubuntu> In-Reply-To: <20121001091528.49694.69990.stgit@ubuntu> References: <20121001091528.49694.69990.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQk6YbCFu3JF5O1yJmTtrdwj9Vu6BHMCeZgXIksFS0MJp7U3Doa1K0h3c+2Zt0OjLJLgsEz8 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 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] ||