kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] SVM: move guest past HLT
@ 2020-04-23 17:06 Paolo Bonzini
  2020-04-23 19:46 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2020-04-23 17:06 UTC (permalink / raw)
  To: kvm; +Cc: wei.huang2, cavery

On AMD, the guest is not woken up from HLT by the interrupt or NMI vmexits.
Therefore we have to fix up the RIP manually.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/svm_tests.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index c2725af..1f2975c 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -1316,6 +1316,11 @@ static bool interrupt_finished(struct svm_test *test)
             return true;
         }
 
+        /* The guest is not woken up from HLT, unlike Intel.  Fix that up.  */
+        if (get_test_stage(test) == 3) {
+            vmcb->save.rip++;
+        }
+
         irq_enable();
         asm volatile ("nop");
         irq_disable();
@@ -1501,6 +1506,9 @@ static bool nmi_hlt_finished(struct svm_test *test)
             return true;
         }
 
+        /* The guest is not woken up from HLT, unlike Intel.  Fix that up.  */
+        vmcb->save.rip++;
+
         report(true, "NMI intercept while running guest");
         break;
 
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-23 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-23 17:06 [PATCH kvm-unit-tests] SVM: move guest past HLT Paolo Bonzini
2020-04-23 19:46 ` Sean Christopherson
2020-04-23 21:23   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).