From patchwork Tue Apr 30 14:49:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2505221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 2C7FC3FD85 for ; Tue, 30 Apr 2013 14:51:08 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBtO-0001mz-F0; Tue, 30 Apr 2013 14:50:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBtI-00036b-Ei; Tue, 30 Apr 2013 14:50:48 +0000 Received: from mail-da0-x229.google.com ([2607:f8b0:400e:c00::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXBss-0002z1-J8 for linux-arm-kernel@lists.infradead.org; Tue, 30 Apr 2013 14:50:23 +0000 Received: by mail-da0-f41.google.com with SMTP id p8so281905dan.14 for ; Tue, 30 Apr 2013 07:50:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=5WKxh6gY167NF+lnsrMpMWWYOO+eE+3+72T/IHIp9X8=; b=CbHfrh0YQuF/zhwhTHJGTXl7YRScqwintGhp7uSNzh87pDVWmpUEy8U4DUGgaWlFTL Nxg9ypzhwIFtGzFt+azPzrqMWw+G84A/ZpFVevk15czgH13QbwZVUvSm2tTMu1/OAuII RufAwccjKgnRjjAyatON0MSXJ2JK/gq+zo1us+h1Oj0u1UwTG2Tp49iHtfTgVVCMRGrL ow0EYJSVTFhYGjO8c6yKQYIzPCQzNaJ+W3X5YMZAY37MTpT8SalpdDp8+8G6lJeYDb2f AK58nT3f1RcgQfgUsaajPrN8mtDDdPUjNp/0QRX9NGR25mdnd3QweIk37Rn58/Os870p 5ndQ== X-Received: by 10.68.130.132 with SMTP id oe4mr56891263pbb.116.1367333400045; Tue, 30 Apr 2013 07:50:00 -0700 (PDT) Received: from localhost.localdomain (c-67-169-183-77.hsd1.ca.comcast.net. [67.169.183.77]) by mx.google.com with ESMTPSA id cq1sm28799244pbc.13.2013.04.30.07.49.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Apr 2013 07:49:59 -0700 (PDT) From: Christoffer Dall To: kvm@vger.kernel.org Subject: [PATCH 02/15] ARM: KVM: arch_timer: use symbolic constants Date: Tue, 30 Apr 2013 07:49:23 -0700 Message-Id: <1367333376-30983-3-git-send-email-cdall@cs.columbia.edu> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1367333376-30983-1-git-send-email-cdall@cs.columbia.edu> References: <1367333376-30983-1-git-send-email-cdall@cs.columbia.edu> X-Gm-Message-State: ALoCoQlH8Szn6SEFaAjMv4+/J3OIm1mkzxPa2EiYrsb6jtlPTFZlFfaXVAcnULDJfe52/eTc1zd+ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130430_105022_749438_4418DC64 X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Mark Rutland , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mark Rutland In clocksource/arm_arch_timer.h we define useful symbolic constants. Let's use them to make the KVM arch_timer code clearer. Signed-off-by: Mark Rutland Acked-by: Marc Zyngier Cc: Christoffer Dall Signed-off-by: Christoffer Dall --- arch/arm/kvm/arch_timer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/kvm/arch_timer.c b/arch/arm/kvm/arch_timer.c index 6ac938d..c55b608 100644 --- a/arch/arm/kvm/arch_timer.c +++ b/arch/arm/kvm/arch_timer.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ static void kvm_timer_inject_irq(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; - timer->cntv_ctl |= 1 << 1; /* Mask the interrupt in the guest */ + timer->cntv_ctl |= ARCH_TIMER_CTRL_IT_MASK; kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id, vcpu->arch.timer_cpu.irq->irq, vcpu->arch.timer_cpu.irq->level); @@ -133,8 +134,8 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) cycle_t cval, now; u64 ns; - /* Check if the timer is enabled and unmasked first */ - if ((timer->cntv_ctl & 3) != 1) + if ((timer->cntv_ctl & ARCH_TIMER_CTRL_IT_MASK) || + !(timer->cntv_ctl & ARCH_TIMER_CTRL_ENABLE)) return; cval = timer->cntv_cval;