]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: nVMX: Handling of CR0 and CR4 modifying instructions
authorNadav Har'El <nyh@il.ibm.com>
Wed, 25 May 2011 20:14:38 +0000 (23:14 +0300)
committerAvi Kivity <avi@redhat.com>
Tue, 12 Jul 2011 08:45:18 +0000 (11:45 +0300)
commit3af74aa38f9cd276f825c14d1557ae95033344de
treebdf4b3bdb4fdcd5672990e51a211b8dc15e04ae1
parent8b0aa3d65db75a65034189b145fc1a06edc48ee1
KVM: nVMX: Handling of CR0 and CR4 modifying instructions

When L2 tries to modify CR0 or CR4 (with mov or clts), and modifies a bit
which L1 asked to shadow (via CR[04]_GUEST_HOST_MASK), we already do the right
thing: we let L1 handle the trap (see nested_vmx_exit_handled_cr() in a
previous patch).
When L2 modifies bits that L1 doesn't care about, we let it think (via
CR[04]_READ_SHADOW) that it did these modifications, while only changing
(in GUEST_CR[04]) the bits that L0 doesn't shadow.

This is needed for corect handling of CR0.TS for lazy FPU loading: L0 may
want to leave TS on, while pretending to allow the guest to change it.

Signed-off-by: Nadav Har'El <nyh@il.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/vmx.c