diff options
| author | Sean Christopherson <seanjc@google.com> | 2024-12-19 17:26:17 -0800 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2025-01-08 12:57:03 -0800 |
| commit | 983820cb53c0e796777caf85bfc2810ad0c8fb22 (patch) | |
| tree | 9b0f6400e8ecaa5a1de056a6c91dc450630dd1ce /tools/testing/selftests/kvm/x86/hyperv_ipi.c | |
| parent | 7803339fa929387bbc66479532afbaf8cbebb41b (diff) | |
KVM: selftests: Add helpers for locally (un)blocking IRQs on x86
Copy KVM-Unit-Tests' x86 helpers for emitting STI and CLI, comments and
all, and use them throughout x86 selftests. The safe_halt() and sti_nop()
logic in particular benefits from centralized comments, as the behavior
isn't obvious unless the reader is already aware of the STI shadow.
Cc: Manali Shukla <Manali.Shukla@amd.com>
Link: https://lore.kernel.org/r/20241220012617.3513898-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/x86/hyperv_ipi.c')
| -rw-r--r-- | tools/testing/selftests/kvm/x86/hyperv_ipi.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/x86/hyperv_ipi.c b/tools/testing/selftests/kvm/x86/hyperv_ipi.c index 22c0c124582f..2b5b4bc6ef7e 100644 --- a/tools/testing/selftests/kvm/x86/hyperv_ipi.c +++ b/tools/testing/selftests/kvm/x86/hyperv_ipi.c @@ -63,8 +63,10 @@ static void receiver_code(void *hcall_page, vm_vaddr_t pgs_gpa) /* Signal sender vCPU we're ready */ ipis_rcvd[vcpu_id] = (u64)-1; - for (;;) - asm volatile("sti; hlt; cli"); + for (;;) { + safe_halt(); + cli(); + } } static void guest_ipi_handler(struct ex_regs *regs) |