x86/cpuid: prevent decreasing of hypervisor max leaf on migration
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 27 Oct 2021 14:00:50 +0000 (16:00 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Oct 2021 16:42:03 +0000 (17:42 +0100)
commit6f1d6682de832d12b728f856331e700a89737a1e
tree6938a2c536c27579b69f379e59964f09543aa0d9
parentc91c967f329f866b1826b04e73e32aea936930cd
x86/cpuid: prevent decreasing of hypervisor max leaf on migration

In order to be compatible with previous Xen versions, and not change
max hypervisor leaf as a result of a migration, keep the clamping of
the maximum leaf value provided to XEN_CPUID_MAX_NUM_LEAVES, instead
of doing it based on the domain type. Also set the default maximum
leaf without taking the domain type into account. The maximum
hypervisor leaf is not migrated, so we need the default to not regress
beyond what might already be reported to a guest by existing Xen
versions.

This is a partial revert of 540d911c28 and restores the previous
behaviour and assures that HVM guests won't see it's maximum
hypervisor leaf reduced from 5 to 4 as a result of a migration.

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