fix(pauth): emit isb after pauth key update

Following e7d7f326e1a262289ed:
Hypervisor/SPMC pointer authentication key restoration misses an ISB
after key update causing function instrumentation (PACIASP/AUTIASP) to
possibly use stale key value of before the PAuth key MSR update.

Change-Id: I52fe4fb76f23bbd79096962cc17d395ef5aa19cf
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/src/arch/aarch64/exception_macros.S b/src/arch/aarch64/exception_macros.S
index 8ed785a..e7edb26 100644
--- a/src/arch/aarch64/exception_macros.S
+++ b/src/arch/aarch64/exception_macros.S
@@ -225,6 +225,8 @@
 
 /**
  * Restore Hypervisor pointer authentication APIA key.
+ * Emit isb to ensure the pointer authentication key change takes
+ * effect before any pauth instruction is executed.
  */
 .macro pauth_restore_hypervisor_key reg1 reg2
 	adrp	\reg1, pauth_apia_key
@@ -232,4 +234,5 @@
 	ldp	\reg1, \reg2, [\reg1]
 	msr     APIAKEYLO_EL1, \reg1
 	msr     APIAKEYHI_EL1, \reg2
+	isb
 .endm
diff --git a/src/arch/aarch64/hypervisor/exceptions.S b/src/arch/aarch64/hypervisor/exceptions.S
index 7de43a8..41dd600 100644
--- a/src/arch/aarch64/hypervisor/exceptions.S
+++ b/src/arch/aarch64/hypervisor/exceptions.S
@@ -492,6 +492,7 @@
 	msr APDBKEYHI_EL1, xzr
 	msr APGAKEYLO_EL1, xzr
 	msr APGAKEYHI_EL1, xzr
+	/* Omit ISB as SMC following is a context synchronizing event. */
 #endif
 
 	smc #0
@@ -784,6 +785,7 @@
 	/* Restore vCPU APIA key. */
 	msr     APIAKEYLO_EL1, x1
 	msr     APIAKEYHI_EL1, x2
+	/* Omit ISB as ERET following is a context synchronizing event. */
 #endif
 
 	ldp x4, x5, [x0, #VCPU_REGS + 8 * 4]
diff --git a/src/arch/aarch64/hypervisor/hypervisor_entry.S b/src/arch/aarch64/hypervisor/hypervisor_entry.S
index da90bec..a6b89a4 100644
--- a/src/arch/aarch64/hypervisor/hypervisor_entry.S
+++ b/src/arch/aarch64/hypervisor/hypervisor_entry.S
@@ -224,6 +224,12 @@
 	ldp	x1, x2, [x1]
 	msr     APIAKEYLO_EL1, x1
 	msr     APIAKEYHI_EL1, x2
+
+	/*
+	 * Emit ISB to ensure the pointer authentication key change takes
+	 * effect before any pauth instruction is executed.
+	 */
+	isb
 #endif
 
 	/*