x86/cpuid: prevent shrinking migrated policies max leaves
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 10 Nov 2021 17:40:59 +0000 (18:40 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 12 Nov 2021 13:57:04 +0000 (13:57 +0000)
commit81da2b544cbb003a5447c9b14d275746ad22ab37
treec3b2894c62074c832ac016368adfaf6f0432e068
parentc06e3d81031424a8a0f725198c16ad81007be89c
x86/cpuid: prevent shrinking migrated policies max leaves

CPUID policies from guest being migrated shouldn't have the maximum
leaves shrink, as that would be a guest visible change. The hypervisor
has no knowledge on whether a guest has been migrated or is build from
scratch, and hence it must not blindly shrink the CPUID policy in
recalculate_cpuid_policy. Remove the
x86_cpuid_policy_shrink_max_leaves call from recalculate_cpuid_policy.
Removing such call could be seen as a partial revert of 540d911c28.

Instead let the toolstack shrink the policies for newly created
guests, while keeping the previous values for guests that are migrated
in. Note that guests migrated in without a CPUID policy won't get any
kind of shrinking applied.

Fixes: 540d911c28 ('x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/libs/guest/xg_cpuid_x86.c
xen/arch/x86/cpuid.c