]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM: SVM: Add MSR-based feature support for serializing LFENCE
authorTom Lendacky <thomas.lendacky@amd.com>
Wed, 10 Apr 2019 10:10:00 +0000 (12:10 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 24 Apr 2019 07:52:36 +0000 (09:52 +0200)
commit09c0663d3e9b18a3efb5165c2ed7f03008c04529
treefaa3cdf6bf7cc2ed21c86045bdb1bbdcc9e41a18
parentf80e341a0e3d26f88bc297fb3697ee19c45a8e3b
KVM: SVM: Add MSR-based feature support for serializing LFENCE

BugLink: https://bugs.launchpad.net/bugs/1822760
In order to determine if LFENCE is a serializing instruction on AMD
processors, MSR 0xc0011029 (MSR_F10H_DECFG) must be read and the state
of bit 1 checked.  This patch will add support to allow a guest to
properly make this determination.

Add the MSR feature callback operation to svm.c and add MSR 0xc0011029
to the list of MSR-based features.  If LFENCE is serializing, then the
feature is supported, allowing the hypervisor to set the value of the
MSR that guest will see.  Support is also added to write (hypervisor only)
and read the MSR value for the guest.  A write by the guest will result in
a #GP.  A read by the guest will return the value as set by the host.  In
this way, the support to expose the feature to the guest is controlled by
the hypervisor.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
(backported from commit d1d93fa90f1afa926cb060b7f78ab01a65705b4d)
[juergh: Adjusted context.]
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kvm/svm.c
arch/x86/kvm/x86.c