selftests: kvm: switch to using KVM_X86_*_VM
This removes the concept of "subtypes", instead letting the tests use proper VM types that were recently added. While the sev_init_vm() and sev_es_init_vm() are still able to operate with the legacy KVM_SEV_INIT and KVM_SEV_ES_INIT ioctls, this is limited to VMs that are created manually with vm_create_barebones(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-ID: <20240404121327.3107131-16-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -93,7 +93,6 @@ enum kvm_mem_region_type {
|
||||
struct kvm_vm {
|
||||
int mode;
|
||||
unsigned long type;
|
||||
uint8_t subtype;
|
||||
int kvm_fd;
|
||||
int fd;
|
||||
unsigned int pgtable_levels;
|
||||
@@ -200,8 +199,8 @@ enum vm_guest_mode {
|
||||
struct vm_shape {
|
||||
uint32_t type;
|
||||
uint8_t mode;
|
||||
uint8_t subtype;
|
||||
uint16_t padding;
|
||||
uint8_t pad0;
|
||||
uint16_t pad1;
|
||||
};
|
||||
|
||||
kvm_static_assert(sizeof(struct vm_shape) == sizeof(uint64_t));
|
||||
|
||||
@@ -23,12 +23,6 @@
|
||||
extern bool host_cpu_is_intel;
|
||||
extern bool host_cpu_is_amd;
|
||||
|
||||
enum vm_guest_x86_subtype {
|
||||
VM_SUBTYPE_NONE = 0,
|
||||
VM_SUBTYPE_SEV,
|
||||
VM_SUBTYPE_SEV_ES,
|
||||
};
|
||||
|
||||
/* Forced emulation prefix, used to invoke the emulator unconditionally. */
|
||||
#define KVM_FEP "ud2; .byte 'k', 'v', 'm';"
|
||||
|
||||
|
||||
@@ -67,20 +67,8 @@ kvm_static_assert(SEV_RET_SUCCESS == 0);
|
||||
__TEST_ASSERT_VM_VCPU_IOCTL(!ret, #cmd, ret, vm); \
|
||||
})
|
||||
|
||||
static inline void sev_vm_init(struct kvm_vm *vm)
|
||||
{
|
||||
vm->arch.sev_fd = open_sev_dev_path_or_exit();
|
||||
|
||||
vm_sev_ioctl(vm, KVM_SEV_INIT, NULL);
|
||||
}
|
||||
|
||||
|
||||
static inline void sev_es_vm_init(struct kvm_vm *vm)
|
||||
{
|
||||
vm->arch.sev_fd = open_sev_dev_path_or_exit();
|
||||
|
||||
vm_sev_ioctl(vm, KVM_SEV_ES_INIT, NULL);
|
||||
}
|
||||
void sev_vm_init(struct kvm_vm *vm);
|
||||
void sev_es_vm_init(struct kvm_vm *vm);
|
||||
|
||||
static inline void sev_register_encrypted_memory(struct kvm_vm *vm,
|
||||
struct userspace_mem_region *region)
|
||||
|
||||
Reference in New Issue
Block a user