Allow entry to a vcpu that can handle interrupts if there is an
interrupts pending. Entry will still be aborted if the vcpu cannot
handle interrupts.

This allows use of __guest_enter to enter into the host.

Signed-off-by: Andrew Scull <[email protected]>
---
 arch/arm64/kvm/hyp/entry.S | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index ee32a7743389..6a641fcff4f7 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -73,13 +73,17 @@ SYM_FUNC_START(__guest_enter)
        save_sp_el0     x1, x2
 
        // Now the host state is stored if we have a pending RAS SError it must
-       // affect the host. If any asynchronous exception is pending we defer
-       // the guest entry. The DSB isn't necessary before v8.2 as any SError
-       // would be fatal.
+       // affect the host. If physical IRQ interrupts are going to be trapped
+       // and there are already asynchronous exceptions pending then we defer
+       // the entry. The DSB isn't necessary before v8.2 as any SError would
+       // be fatal.
 alternative_if ARM64_HAS_RAS_EXTN
        dsb     nshst
        isb
 alternative_else_nop_endif
+       mrs     x1, hcr_el2
+       and     x1, x1, #HCR_IMO
+       cbz     x1, 1f
        mrs     x1, isr_el1
        cbz     x1,  1f
        mov     x0, #ARM_EXCEPTION_IRQ
-- 
2.27.0.389.gc38d7665816-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to