]> xenbits.xensource.com Git - xen.git/commit
viridian: fix the HvFlushVirtualAddress/List hypercall implementation
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 26 Feb 2019 15:55:06 +0000 (16:55 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Feb 2019 15:55:06 +0000 (16:55 +0100)
commitce98ee3050a824994ce4957faa8f53ecb8c7da9d
tree01f380f2134a5a3f0b133b4f46b4b420ce2d0425
parent1c858928009c51178a9c6cac9e42343ee81dfe37
viridian: fix the HvFlushVirtualAddress/List hypercall implementation

The current code uses hvm_asid_flush_vcpu() but this is insufficient for
a guest running in shadow mode, which results in guest crashes early in
boot if the 'hcall_remote_tlb_flush' is enabled.

This patch, instead of open coding a new flush algorithm, adapts the one
already used by the HVMOP_flush_tlbs Xen hypercall. The implementation is
modified to allow TLB flushing a subset of a domain's vCPUs. A callback
function determines whether or not a vCPU requires flushing. This mechanism
was chosen because, while it is the case that the currently implemented
viridian hypercalls specify a vCPU mask, there are newer variants which
specify a sparse HV_VP_SET and thus use of a callback will avoid needing to
expose details of this outside of the viridian subsystem if and when those
newer variants are implemented.

NOTE: Use of the common flush function requires that the hypercalls are
      restartable and so, with this patch applied, viridian_hypercall()
      can now return HVM_HCALL_preempted. This is safe as no modification
      to struct cpu_user_regs is done before the return.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/viridian/viridian.c
xen/include/asm-x86/hvm/hvm.h