[PATCH 12/15] ARM: KVM: timer: simplify access to cntvoff and cntv_cval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of using a union between 32 and 64bit quantities for cntvoff
and cntv_cval, just use the 64bit one.

Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
---
 arch/arm/include/asm/kvm_arch_timer.h | 21 +++------------------
 arch/arm/kernel/asm-offsets.c         |  6 ++----
 arch/arm/kvm/interrupts_head.S        | 12 ++++++------
 3 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/arch/arm/include/asm/kvm_arch_timer.h
index bd5e501..aed1c42 100644
--- a/arch/arm/include/asm/kvm_arch_timer.h
+++ b/arch/arm/include/asm/kvm_arch_timer.h
@@ -28,17 +28,8 @@ struct arch_timer_kvm {
 	/* Is the timer enabled */
 	bool			enabled;
 
-	/*
-	 * Virtual offset (kernel access it through cntvoff, HYP code
-	 * access it as two 32bit values).
-	 */
-	union {
-		cycle_t		cntvoff;
-		struct {
-			u32	low; 	/* Restored only */
-			u32	high;  	/* Restored only */
-		} cntvoff32;
-	};
+	/* Virtual offset */
+	cycle_t			cntvoff;
 #endif
 };
 
@@ -46,13 +37,7 @@ struct arch_timer_cpu {
 #ifdef CONFIG_KVM_ARM_TIMER
 	/* Registers: control register, timer value */
 	u32				cntv_ctl;	/* Saved/restored */
-	union {
-		cycle_t			cntv_cval;
-		struct {
-			u32		low;		/* Saved/restored */
-			u32		high;		/* Saved/restored */
-		} cntv_cval32;
-	};
+	cycle_t				cntv_cval;	/* Saved/restored */
 
 	/*
 	 * Anything that is not used directly from assembly code goes
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 5baf604..5ce738b 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -181,10 +181,8 @@ int main(void)
   DEFINE(VGIC_CPU_NR_LR,	offsetof(struct vgic_cpu, nr_lr));
 #ifdef CONFIG_KVM_ARM_TIMER
   DEFINE(VCPU_TIMER_CNTV_CTL,	offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl));
-  DEFINE(VCPU_TIMER_CNTV_CVALH,	offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_cval32.high));
-  DEFINE(VCPU_TIMER_CNTV_CVALL,	offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_cval32.low));
-  DEFINE(KVM_TIMER_CNTVOFF_H,	offsetof(struct kvm, arch.timer.cntvoff32.high));
-  DEFINE(KVM_TIMER_CNTVOFF_L,	offsetof(struct kvm, arch.timer.cntvoff32.low));
+  DEFINE(VCPU_TIMER_CNTV_CVAL,	offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_cval));
+  DEFINE(KVM_TIMER_CNTVOFF,	offsetof(struct kvm, arch.timer.cntvoff));
   DEFINE(KVM_TIMER_ENABLED,	offsetof(struct kvm, arch.timer.enabled));
 #endif
   DEFINE(KVM_VGIC_VCTRL,	offsetof(struct kvm, arch.vgic.vctrl_base));
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index ece84d1..c906fac 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -436,8 +436,8 @@
 	isb
 
 	mrrc	p15, 3, r2, r3, c14	@ CNTV_CVAL
-	str	r3, [\vcpup, #VCPU_TIMER_CNTV_CVALH]
-	str	r2, [\vcpup, #VCPU_TIMER_CNTV_CVALL]
+	str	r2, [\vcpup, #VCPU_TIMER_CNTV_CVAL]
+	str	r3, [\vcpup, #(VCPU_TIMER_CNTV_CVAL + 4)]
 
 1:
 #endif
@@ -461,13 +461,13 @@
 	cmp	r2, #0
 	beq	1f
 
-	ldr	r3, [r4, #KVM_TIMER_CNTVOFF_H]
-	ldr	r2, [r4, #KVM_TIMER_CNTVOFF_L]
+	ldr	r2, [r4, #KVM_TIMER_CNTVOFF]
+	ldr	r3, [r4, #(KVM_TIMER_CNTVOFF + 4)]
 	mcrr	p15, 4, r2, r3, c14	@ CNTVOFF
 	isb
 
-	ldr	r3, [\vcpup, #VCPU_TIMER_CNTV_CVALH]
-	ldr	r2, [\vcpup, #VCPU_TIMER_CNTV_CVALL]
+	ldr	r2, [\vcpup, #VCPU_TIMER_CNTV_CVAL]
+	ldr	r3, [\vcpup, #(VCPU_TIMER_CNTV_CVAL + 4)]
 	mcrr	p15, 3, r2, r3, c14	@ CNTV_CVAL
 
 	ldr	r2, [\vcpup, #VCPU_TIMER_CNTV_CTL]
-- 
1.8.0.1



_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux