Commit 372b7c1b authored by Mark Rutland's avatar Mark Rutland Committed by Christoffer Dall

ARM: KVM: arch_timer: use symbolic constants

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: default avatarMark Rutland <mark.rutland@arm.com>
Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <cdall@cs.columbia.edu>
Signed-off-by: default avatarChristoffer Dall <cdall@cs.columbia.edu>
parent 210552c1
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/kvm_host.h> #include <linux/kvm_host.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <clocksource/arm_arch_timer.h>
#include <asm/arch_timer.h> #include <asm/arch_timer.h>
#include <asm/kvm_vgic.h> #include <asm/kvm_vgic.h>
...@@ -64,7 +65,7 @@ static void kvm_timer_inject_irq(struct kvm_vcpu *vcpu) ...@@ -64,7 +65,7 @@ static void kvm_timer_inject_irq(struct kvm_vcpu *vcpu)
{ {
struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; 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, kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id,
vcpu->arch.timer_cpu.irq->irq, vcpu->arch.timer_cpu.irq->irq,
vcpu->arch.timer_cpu.irq->level); vcpu->arch.timer_cpu.irq->level);
...@@ -133,8 +134,8 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) ...@@ -133,8 +134,8 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu)
cycle_t cval, now; cycle_t cval, now;
u64 ns; u64 ns;
/* Check if the timer is enabled and unmasked first */ if ((timer->cntv_ctl & ARCH_TIMER_CTRL_IT_MASK) ||
if ((timer->cntv_ctl & 3) != 1) !(timer->cntv_ctl & ARCH_TIMER_CTRL_ENABLE))
return; return;
cval = timer->cntv_cval; cval = timer->cntv_cval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment