]> xenbits.xensource.com Git - xen.git/commit
x86/cpuid: Split dom0 handling out of init_domain_cpuid_policy()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 15 Dec 2021 15:36:59 +0000 (15:36 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 3 Aug 2023 18:14:19 +0000 (19:14 +0100)
commitceea0ecc3ec6fecdf834bcec5bf32acb55a7831e
treee32e9a6422960a42586b96fff0823fae3b5c28be
parent1814dd3df7f9b93bfd840d5192477596774f85fb
x86/cpuid: Split dom0 handling out of init_domain_cpuid_policy()

To implement dom0-cpuid= support, the special cases would need extending.
However there is already a problem with late hwdom where the special cases
override toolstack settings, which is unintended and poor behaviour.

Introduce a new init_dom0_cpuid_policy() for the purpose, moving the ITSC and
ARCH_CAPS logic.  The is_hardware_domain() can be dropped, and for now there
is no need to rerun recalculate_cpuid_policy(); this is a relatively expensive
operation, and will become more-so over time.

Rearrange the logic in create_dom0() to make room for a call to
init_dom0_cpuid_policy().  The AMX plans for having variable sized XSAVE
states require that modifications to the policy happen before vCPUs are
created.

Additionally, factor out domid into a variable so we can be slightly more
correct in the case of a failure, and also print the error from
domain_create().  This will at least help distinguish -EINVAL from -ENOMEM.

No practical change in behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
(cherry picked from commit c17072fc164a72583fda8e2b836c71d2e3f8e84d)
xen/arch/x86/cpuid.c
xen/arch/x86/setup.c
xen/include/asm-x86/cpuid.h