From patchwork Mon Oct 22 06:53:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1623951 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 691BB400E8 for ; Mon, 22 Oct 2012 06:53:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932854Ab2JVGxH (ORCPT ); Mon, 22 Oct 2012 02:53:07 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:37779 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932176Ab2JVGxG (ORCPT ); Mon, 22 Oct 2012 02:53:06 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so2600629vbb.19 for ; Sun, 21 Oct 2012 23:53:06 -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=5MuGMTCsiQwlkFxS01FbgoLu6iKzllcq4FLWg1QF6q8=; b=bNkeh1PH6dAHD1jvgFs+UiYZ7fkbW0Vap0x/W+lqMqCGFMTIu/zPYHS6/WtcQ2B2gq m8vzAd5EsNl0W5IhbyaPq9gMEaaHUDZmrpuC4yvUvEXPDWHHTKJmNkGFPDeq+7I5Osg1 hlP38HY2IRGiXk5IDP4asJESrhCrqgKTIcstaDNyLs9aPwD5czJsdGpHpCzfnueHKg3Y CFh1MZhH2TiEjedSRd1kalIliemDyc61630iiK3IA43jxtvTenWZ+RVW5caJSEmaAKmQ rzuk0tEue+0kmA+CUMCKKVZ4x/ybFWK+/rFFsVnYKae402m8+QH9nzsXEBrwI9zW1hoM XPyQ== Received: by 10.220.205.198 with SMTP id fr6mr13371484vcb.63.1350888786347; Sun, 21 Oct 2012 23:53:06 -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 r17sm9495343vdj.12.2012.10.21.23.53.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Oct 2012 23:53:06 -0700 (PDT) Subject: [PATCH v3 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, 22 Oct 2012 02:53:15 -0400 Message-ID: <20121022065315.18883.10095.stgit@ubuntu> In-Reply-To: <20121022065301.18883.35308.stgit@ubuntu> References: <20121022065301.18883.35308.stgit@ubuntu> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnLijy3zHMtprp3E3Rvh81jQnx83R8BoCyv6XDAMlNNvdUy6tQDkv0yFABfiwCD4x7pRFPA 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] ||