Skip to content

Commit 3244867

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86: Ignore sparse banks size for an "all CPUs", non-sparse IPI req
Do not bail early if there are no bits set in the sparse banks for a non-sparse, a.k.a. "all CPUs", IPI request. Per the Hyper-V spec, it is legal to have a variable length of '0', e.g. VP_SET's BankContents in this case, if the request can be serviced without the extra info. It is possible that for a given invocation of a hypercall that does accept variable sized input headers that all the header input fits entirely within the fixed size header. In such cases the variable sized input header is zero-sized and the corresponding bits in the hypercall input should be set to zero. Bailing early results in KVM failing to send IPIs to all CPUs as expected by the guest. Fixes: 214ff83 ("KVM: x86: hyperv: implement PV IPI send hypercalls") Cc: [email protected] Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Vitaly Kuznetsov <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 1ebfaa1 commit 3244867

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/x86/kvm/hyperv.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,18 +1922,21 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc, bool
19221922

19231923
all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL;
19241924

1925+
if (all_cpus)
1926+
goto check_and_send_ipi;
1927+
19251928
if (!sparse_banks_len)
19261929
goto ret_success;
19271930

1928-
if (!all_cpus &&
1929-
kvm_read_guest(kvm,
1931+
if (kvm_read_guest(kvm,
19301932
hc->ingpa + offsetof(struct hv_send_ipi_ex,
19311933
vp_set.bank_contents),
19321934
sparse_banks,
19331935
sparse_banks_len))
19341936
return HV_STATUS_INVALID_HYPERCALL_INPUT;
19351937
}
19361938

1939+
check_and_send_ipi:
19371940
if ((vector < HV_IPI_LOW_VECTOR) || (vector > HV_IPI_HIGH_VECTOR))
19381941
return HV_STATUS_INVALID_HYPERCALL_INPUT;
19391942

0 commit comments

Comments
 (0)