]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
aa116b0df91757a27f251b2509e19d3a3478d4de
[thirdparty/kernel/stable-queue.git] /
1 From 7321f47eada53a395fb3086d49297eebb19e8e58 Mon Sep 17 00:00:00 2001
2 From: Vitaly Kuznetsov <vkuznets@redhat.com>
3 Date: Tue, 22 Feb 2022 16:46:41 +0100
4 Subject: KVM: x86: hyper-v: Fix the maximum number of sparse banks for XMM fast TLB flush hypercalls
5
6 From: Vitaly Kuznetsov <vkuznets@redhat.com>
7
8 commit 7321f47eada53a395fb3086d49297eebb19e8e58 upstream.
9
10 When TLB flush hypercalls (HVCALL_FLUSH_VIRTUAL_ADDRESS_{LIST,SPACE}_EX are
11 issued in 'XMM fast' mode, the maximum number of allowed sparse_banks is
12 not 'HV_HYPERCALL_MAX_XMM_REGISTERS - 1' (5) but twice as many (10) as each
13 XMM register is 128 bit long and can hold two 64 bit long banks.
14
15 Cc: stable@vger.kernel.org # 5.14.x
16 Fixes: 5974565bc26d ("KVM: x86: kvm_hv_flush_tlb use inputs from XMM registers")
17 Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
18 Message-Id: <20220222154642.684285-4-vkuznets@redhat.com>
19 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 ---
22 arch/x86/kvm/hyperv.c | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25 --- a/arch/x86/kvm/hyperv.c
26 +++ b/arch/x86/kvm/hyperv.c
27 @@ -1820,7 +1820,8 @@ static u64 kvm_hv_flush_tlb(struct kvm_v
28
29 if (!all_cpus) {
30 if (hc->fast) {
31 - if (sparse_banks_len > HV_HYPERCALL_MAX_XMM_REGISTERS - 1)
32 + /* XMM0 is already consumed, each XMM holds two sparse banks. */
33 + if (sparse_banks_len > 2 * (HV_HYPERCALL_MAX_XMM_REGISTERS - 1))
34 return HV_STATUS_INVALID_HYPERCALL_INPUT;
35 for (i = 0; i < sparse_banks_len; i += 2) {
36 sparse_banks[i] = sse128_lo(hc->xmm[i / 2 + 1]);