From: David Woodhouse Date: Fri, 11 Mar 2022 20:01:51 +0000 (+0000) Subject: KVM: x86/xen: Implement HVMOP_flush_tlbs X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6cdca779dcc521ccb0e0ec1397fd5dbd2bc55c40;p=users%2Fdwmw2%2Flinux.git KVM: x86/xen: Implement HVMOP_flush_tlbs AFAICT there isn't a way for the VMM to do this from userspace. Signed-off-by: David Woodhouse --- diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 7e7c8a5bff52a..e031a29ed0a9b 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -1212,6 +1212,12 @@ static bool kvm_xen_hcall_set_timer_op(struct kvm_vcpu *vcpu, uint64_t timeout, return true; } +static bool kvm_xen_hcall_hvm_flush_tlbs(struct kvm_vcpu *vcpu) +{ + kvm_flush_remote_tlbs(vcpu->kvm); + return true; +} + int kvm_xen_hypercall(struct kvm_vcpu *vcpu) { bool longmode; @@ -1266,6 +1272,10 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu) handled = kvm_xen_hcall_vcpu_op(vcpu, longmode, params[0], params[1], params[2], &r); break; + case __HYPERVISOR_hvm_op: + if (params[0] == HVMOP_flush_tlbs) + handled = kvm_xen_hcall_hvm_flush_tlbs(vcpu); + break; case __HYPERVISOR_set_timer_op: { u64 timeout = params[0]; /* In 32-bit mode, the 64-bit timeout is in two 32-bit params. */ diff --git a/arch/x86/kvm/xen.h b/arch/x86/kvm/xen.h index ee5c4ae0755cd..414133c329038 100644 --- a/arch/x86/kvm/xen.h +++ b/arch/x86/kvm/xen.h @@ -205,4 +205,8 @@ struct compat_vcpu_runstate_info { uint64_t time[4]; } __attribute__((packed)); +#ifndef HVMOP_flush_tlbs +#define HVMOP_flush_tlbs 5 +#endif + #endif /* __ARCH_X86_KVM_XEN_H__ */