Put peripheral registers in a separate sub-struct to lazy registers.

They are not handled by the same code in exceptions.S as the other
system registers, so separating them makes this clearer.

Change-Id: I09000c6eaaebde6356b9c161db82e8c1bb5764d8
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 9402fe5..9957a28 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -76,8 +76,8 @@
  */
 void complete_saving_state(struct vcpu *vcpu)
 {
-	vcpu->regs.lazy.cntv_cval_el0 = read_msr(cntv_cval_el0);
-	vcpu->regs.lazy.cntv_ctl_el0 = read_msr(cntv_ctl_el0);
+	vcpu->regs.peripherals.cntv_cval_el0 = read_msr(cntv_cval_el0);
+	vcpu->regs.peripherals.cntv_ctl_el0 = read_msr(cntv_ctl_el0);
 
 	api_regs_state_saved(vcpu);
 
@@ -111,8 +111,8 @@
 	 * is configured as edge-triggered, as it would then be latched in.
 	 */
 	write_msr(cntv_ctl_el0, 0);
-	write_msr(cntv_cval_el0, vcpu->regs.lazy.cntv_cval_el0);
-	write_msr(cntv_ctl_el0, vcpu->regs.lazy.cntv_ctl_el0);
+	write_msr(cntv_cval_el0, vcpu->regs.peripherals.cntv_cval_el0);
+	write_msr(cntv_ctl_el0, vcpu->regs.peripherals.cntv_ctl_el0);
 
 	/*
 	 * If we are switching (back) to the primary, disable the EL2 physical
diff --git a/src/arch/aarch64/inc/hf/arch/types.h b/src/arch/aarch64/inc/hf/arch/types.h
index 71e91e0..e6f1b9d 100644
--- a/src/arch/aarch64/inc/hf/arch/types.h
+++ b/src/arch/aarch64/inc/hf/arch/types.h
@@ -56,6 +56,7 @@
 	uintreg_t r[31];
 	uintreg_t pc;
 	uintreg_t spsr;
+	/* System registers. */
 	struct {
 		uintreg_t vmpidr_el2;
 		uintreg_t csselr_el1;
@@ -86,9 +87,14 @@
 		uintreg_t cptr_el2;
 		uintreg_t cnthctl_el2;
 		uintreg_t vttbr_el2;
+	} lazy;
+	/*
+	 * Peripheral registers, handled separately from other system registers.
+	 */
+	struct {
 		uintreg_t cntv_cval_el0;
 		uintreg_t cntv_ctl_el0;
-	} lazy;
+	} peripherals;
 	/* Floating point registers. */
 	struct float_reg fp[32];
 	uintreg_t fpsr;
diff --git a/src/arch/aarch64/timer.c b/src/arch/aarch64/timer.c
index f9c4506..12f4132 100644
--- a/src/arch/aarch64/timer.c
+++ b/src/arch/aarch64/timer.c
@@ -37,7 +37,7 @@
  */
 void arch_timer_mask(struct arch_regs *regs)
 {
-	regs->lazy.cntv_ctl_el0 |= CNTV_CTL_EL0_IMASK;
+	regs->peripherals.cntv_ctl_el0 |= CNTV_CTL_EL0_IMASK;
 }
 
 /**
@@ -45,7 +45,7 @@
  */
 bool arch_timer_enabled(struct arch_regs *regs)
 {
-	uintreg_t cntv_ctl_el0 = regs->lazy.cntv_ctl_el0;
+	uintreg_t cntv_ctl_el0 = regs->peripherals.cntv_ctl_el0;
 
 	return (cntv_ctl_el0 & CNTV_CTL_EL0_ENABLE) &&
 	       !(cntv_ctl_el0 & CNTV_CTL_EL0_IMASK);
@@ -70,7 +70,7 @@
 	 * Calculate the value from the saved CompareValue (cntv_cval_el0) and
 	 * the virtual count value.
 	 */
-	uintreg_t cntv_cval_el0 = regs->lazy.cntv_cval_el0;
+	uintreg_t cntv_cval_el0 = regs->peripherals.cntv_cval_el0;
 	uintreg_t cntvct_el0 = read_msr(cntvct_el0);
 
 	if (cntv_cval_el0 >= cntvct_el0) {
@@ -100,7 +100,7 @@
 		return false;
 	}
 
-	if (regs->lazy.cntv_ctl_el0 & CNTV_CTL_EL0_ISTATUS) {
+	if (regs->peripherals.cntv_ctl_el0 & CNTV_CTL_EL0_ISTATUS) {
 		return true;
 	}