diff mbox series

[v3,07/18] KVM: arm64: nVHE: Don't consume host SErrors with ESB

Message ID 20200903135307.251331-8-ascull@google.com (mailing list archive)
State New, archived
Headers show
Series Introduce separate nVHE hyp context | expand

Commit Message

Andrew Scull Sept. 3, 2020, 1:52 p.m. UTC
The ESB at the start of the host vector may cause SErrors to be consumed
to DISR_EL1. However, this is not checked for the host so the SError
could go unhandled.

Remove the ESB so that SErrors are not consumed but are instead left
pending for the host to consume. __guest_enter already defers entry into
a guest if there are any SErrors pending.

Fixes: 0e5b9c085dce ("KVM: arm64: Consume pending SError as early as possible")
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Andrew Scull <ascull@google.com>
---
 arch/arm64/kvm/hyp/nvhe/host.S | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Marc Zyngier Sept. 7, 2020, 11:46 a.m. UTC | #1
On Thu, 03 Sep 2020 14:52:56 +0100,
Andrew Scull <ascull@google.com> wrote:
> 
> The ESB at the start of the host vector may cause SErrors to be consumed
> to DISR_EL1. However, this is not checked for the host so the SError
> could go unhandled.
> 
> Remove the ESB so that SErrors are not consumed but are instead left
> pending for the host to consume. __guest_enter already defers entry into
> a guest if there are any SErrors pending.
> 
> Fixes: 0e5b9c085dce ("KVM: arm64: Consume pending SError as early as possible")

I'd drop the Fixes: tag here. The KVM RAS support was never designed
to use nVHE the first place, and this patch is impossible to backport
without dragging tons of other patches, turning it into a nightmare.

The patch itself is fine.

Thanks,

	M.
diff mbox series

Patch

diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
index 9c96b9a3b71d..5a7380c342c8 100644
--- a/arch/arm64/kvm/hyp/nvhe/host.S
+++ b/arch/arm64/kvm/hyp/nvhe/host.S
@@ -24,7 +24,6 @@  SYM_FUNC_END(__hyp_do_panic)
 
 .macro valid_host_el1_sync_vect
 	.align 7
-	esb
 	stp	x0, x1, [sp, #-16]!
 
 	mrs	x0, esr_el2
@@ -77,6 +76,11 @@  SYM_FUNC_END(__hyp_do_panic)
 .endm
 
 /*
+ * The host vector does not use an ESB instruction in order to avoid consuming
+ * SErrors that should only be consumed by the host. Guest entry is deferred by
+ * __guest_enter if there are any pending asynchronous exceptions so hyp will
+ * always return to the host without having consumerd host SErrors.
+ *
  * CONFIG_KVM_INDIRECT_VECTORS is not applied to the host vector because the
  * host already knows the address of hyp by virtue of loading it there.
  */