Commit 2115713c authored by Vishal Annapurve's avatar Vishal Annapurve Committed by Sean Christopherson

KVM: selftests: Add arch specific post vm creation hook

Add arch specific API kvm_arch_vm_post_create to perform any required setup
after VM creation.
Suggested-by: default avatarSean Christopherson <seanjc@google.com>
Reviewed-by: default avatarAndrew Jones <andrew.jones@linux.dev>
Reviewed-by: default avatarPeter Gonda <pgonda@google.com>
Signed-off-by: default avatarVishal Annapurve <vannapurve@google.com>
Link: https://lore.kernel.org/r/20221115213845.3348210-4-vannapurve@google.com
[sean: place x86's implementation by vm_arch_vcpu_add()]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent e1ab3124
......@@ -864,4 +864,6 @@ static inline int __vm_disable_nx_huge_pages(struct kvm_vm *vm)
*/
void kvm_selftest_arch_init(void);
void kvm_arch_vm_post_create(struct kvm_vm *vm);
#endif /* SELFTEST_KVM_UTIL_BASE_H */
......@@ -351,9 +351,7 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint32_t nr_runnable_vcpus,
slot0 = memslot2region(vm, 0);
ucall_init(vm, slot0->region.guest_phys_addr + slot0->region.memory_size);
#ifdef __x86_64__
vm_create_irqchip(vm);
#endif
kvm_arch_vm_post_create(vm);
return vm;
}
......@@ -2087,6 +2085,10 @@ void __vm_get_stat(struct kvm_vm *vm, const char *stat_name, uint64_t *data,
}
}
__weak void kvm_arch_vm_post_create(struct kvm_vm *vm)
{
}
__weak void kvm_selftest_arch_init(void)
{
}
......
......@@ -586,6 +586,11 @@ void __vm_xsave_require_permission(int bit, const char *name)
bitmask);
}
void kvm_arch_vm_post_create(struct kvm_vm *vm)
{
vm_create_irqchip(vm);
}
struct kvm_vcpu *vm_arch_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id,
void *guest_code)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment