summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/include/x86_64/svm_util.h
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2024-11-27 16:55:46 -0800
committerSean Christopherson <seanjc@google.com>2024-12-18 14:15:04 -0800
commit67730e6c53d70fb31618230f81c4acee9f72eaa3 (patch)
treea6017a949d82c8cd2ca73efca2cd6033860538da /tools/testing/selftests/kvm/include/x86_64/svm_util.h
parent43fbd8cd389faa9760c5152b1c58e893c812953b (diff)
KVM: selftests: Use canonical $(ARCH) paths for KVM selftests directories
Use the kernel's canonical $(ARCH) paths instead of the raw target triple for KVM selftests directories. KVM selftests are quite nearly the only place in the entire kernel that using the target triple for directories, tools/testing/selftests/drivers/s390x being the lone holdout. Using the kernel's preferred nomenclature eliminates the minor, but annoying, friction of having to translate to KVM's selftests directories, e.g. for pattern matching, opening files, running selftests, etc. Opportunsitically delete file comments that reference the full path of the file, as they are obviously prone to becoming stale, and serve no known purpose. Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Acked-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20241128005547.4077116-16-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include/x86_64/svm_util.h')
-rw-r--r--tools/testing/selftests/kvm/include/x86_64/svm_util.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/tools/testing/selftests/kvm/include/x86_64/svm_util.h b/tools/testing/selftests/kvm/include/x86_64/svm_util.h
deleted file mode 100644
index 044f0f872ba9..000000000000
--- a/tools/testing/selftests/kvm/include/x86_64/svm_util.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * tools/testing/selftests/kvm/include/x86_64/svm_utils.h
- * Header for nested SVM testing
- *
- * Copyright (C) 2020, Red Hat, Inc.
- */
-
-#ifndef SELFTEST_KVM_SVM_UTILS_H
-#define SELFTEST_KVM_SVM_UTILS_H
-
-#include <asm/svm.h>
-
-#include <stdint.h>
-#include "svm.h"
-#include "processor.h"
-
-struct svm_test_data {
- /* VMCB */
- struct vmcb *vmcb; /* gva */
- void *vmcb_hva;
- uint64_t vmcb_gpa;
-
- /* host state-save area */
- struct vmcb_save_area *save_area; /* gva */
- void *save_area_hva;
- uint64_t save_area_gpa;
-
- /* MSR-Bitmap */
- void *msr; /* gva */
- void *msr_hva;
- uint64_t msr_gpa;
-};
-
-static inline void vmmcall(void)
-{
- /*
- * Stuff RAX and RCX with "safe" values to make sure L0 doesn't handle
- * it as a valid hypercall (e.g. Hyper-V L2 TLB flush) as the intended
- * use of this function is to exit to L1 from L2. Clobber all other
- * GPRs as L1 doesn't correctly preserve them during vmexits.
- */
- __asm__ __volatile__("push %%rbp; vmmcall; pop %%rbp"
- : : "a"(0xdeadbeef), "c"(0xbeefdead)
- : "rbx", "rdx", "rsi", "rdi", "r8", "r9",
- "r10", "r11", "r12", "r13", "r14", "r15");
-}
-
-#define stgi() \
- __asm__ __volatile__( \
- "stgi\n" \
- )
-
-#define clgi() \
- __asm__ __volatile__( \
- "clgi\n" \
- )
-
-struct svm_test_data *vcpu_alloc_svm(struct kvm_vm *vm, vm_vaddr_t *p_svm_gva);
-void generic_svm_setup(struct svm_test_data *svm, void *guest_rip, void *guest_rsp);
-void run_guest(struct vmcb *vmcb, uint64_t vmcb_gpa);
-
-int open_sev_dev_path_or_exit(void);
-
-#endif /* SELFTEST_KVM_SVM_UTILS_H */