]> xenbits.xensource.com Git - xen.git/commit
x86/amd: Avoid cpu_has_hypervisor evaluating true on native hardware
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 11 Feb 2020 15:02:31 +0000 (15:02 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 14 Feb 2020 18:01:52 +0000 (18:01 +0000)
commite2d1254f5af2a6ff24d009523639b80ccba2c089
tree0a51a8876291e9f2ceb5a2d9f01641c306a4811e
parentd0bc4cd3ae6b9f48e7fc782cdf0cc1073cf8cec1
x86/amd: Avoid cpu_has_hypervisor evaluating true on native hardware

Currently when booting native on AMD hardware, cpuidmask_defaults._1cd gets
configured with the HYPERVISOR bit before native CPUID is scanned for feature
bits.

This results in cpu_has_hypervisor becoming set as part of identify_cpu(), and
ends up appearing in the raw and host CPU policies.

A combination of this bug, and c/s bb502a8ca59 "x86: check feature flags after
resume" which checks that feature bits don't go missing, results in broken S3
on AMD hardware.

Alter amd_init_levelling() to exclude the HYPERVISOR bit from
cpumask_defaults, and update domain_cpu_policy_changed() to allow it to be
explicitly forwarded.

This also fixes a bug on kexec, where the hypervisor bit is left enabled for
the new kernel to find.

These changes highlight a further but - dom0 construction is asymetric with
domU construction, by not having any calls to domain_cpu_policy_changed().
Extend arch_domain_create() to always call domain_cpu_policy_changed().

Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/amd.c
xen/arch/x86/domain.c
xen/arch/x86/domctl.c
xen/include/asm-x86/domain.h