]> xenbits.xensource.com Git - xen.git/commit
x86/msr: Fix handling of MSR_AMD_PATCHLEVEL/MSR_IA32_UCODE_REV
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 1 Apr 2019 10:08:28 +0000 (11:08 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Apr 2019 10:09:08 +0000 (11:09 +0100)
commit013896cb8b2f070dc452bd1b91fc5b842a538367
treeb26bea94fdc8a246006c394c9697dc250375d5f0
parent0cd074144cbb32de53e98eaad7d0ecd9259f219b
x86/msr: Fix handling of MSR_AMD_PATCHLEVEL/MSR_IA32_UCODE_REV

There are a number of bugs.  There are no read/write hooks on the HVM side, so
guest accesses fall into the "read/write-discard" defaults, which bypass the
correct faulting behaviour and the Intel special case.

For the PV side, writes are discarded (again, bypassing proper faulting),
except for a pinned dom0, which is permitted to actually write the values
other than 0.  This is pointless with read hook implementing the Intel special
case.

However, implementing the Intel special case is itself pointless.  First of
all, OS software can't guarentee to read back 0 in the first place, because a)
this behaviour isn't guarenteed in the SDM, and b) there are SMM handlers
which use the CPUID instruction.  Secondly, when a guest executes CPUID, this
doesn't typically result in Xen executing a CPUID instruction in practice.

With the dom0 special case removed, there are now no writes to this MSR other
than Xen's microcode loading facilities, which means that the value held in
the MSR will be properly up-to-date.  Forward it directly, without jumping
through any hoops.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/msr.c
xen/arch/x86/pv/emul-priv-op.c