refactor: add helper function to check if VM is primary

The call `vm_is_primary(current->vm)` makes the intention more clear to
readers than `current->vm->id == HF_PRIMARY_VM_ID`.

Change-Id: I5cbf7293b8184da420ad6911cb810666ae9a45dc
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 0977819..c30d52a 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -102,7 +102,7 @@
 	 * This is used to emulate the virtual timer for the primary in case it
 	 * should fire while the secondary is running.
 	 */
-	if (vcpu->vm->id == HF_PRIMARY_VM_ID) {
+	if (vm_is_primary(vcpu->vm)) {
 		/*
 		 * Clear timer control register before copying compare value, to
 		 * avoid a spurious timer interrupt. This could be a problem if
@@ -148,7 +148,7 @@
 	 * timer which was being used to emulate the EL0 virtual timer, as the
 	 * virtual timer is now running for the primary again.
 	 */
-	if (vcpu->vm->id == HF_PRIMARY_VM_ID) {
+	if (vm_is_primary(vcpu->vm)) {
 		write_msr(cnthp_ctl_el2, 0);
 		write_msr(cnthp_cval_el2, 0);
 	}