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: 2505071 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 BB1ABE0172 for ; Tue, 30 Apr 2013 14:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932424Ab3D3OuF (ORCPT ); Tue, 30 Apr 2013 10:50:05 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:50329 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932249Ab3D3OuB (ORCPT ); Tue, 30 Apr 2013 10:50:01 -0400 Received: by mail-pd0-f169.google.com with SMTP id 10so349550pdc.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=KQVmZXYQxZdflm0RrIAUoEa6VDoRh5a27zLsg5sMgCAkncgOFoxbJyjludwENFLrt4 qi80ARI2xoBABhqXcHpzN7WXQtcOoe+wWS2BYYELyerQp/W45Bz5Pd+V1LDd5HP81Ga+ hqb2cgwYYy/du16XZhzmRBYfamy5wxn01PH8nh4Hu0WXqwdbl/ih6c4zB0kNZ2ugffnT 3e3X+SFJ65wMFCDSuK7nbiqjEIceQQwsjhsakl+Iq2GdMLkAu/tpB61SYr0KqpmZc1lK ZX404MUZNkLzjf8gpD9JLIXwKCB+fEMs3jnmlPQvidThEjA9HrxzJTf27osTF8TzI+Ed 9fAQ== 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 Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Mark Rutland , Christoffer Dall 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: ALoCoQlHc6dHrXICkEJqk9xgE8be3lSpUGqcefn3rapvvLibgDnWzeWpoAndBvlAECmEv7weHLfd Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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;