[PATCH 0/2] x86/hyperv: Bug fix and what I hope is an enhancement

From: Sean Christopherson
Date: Thu Oct 28 2021 - 18:22:00 EST


Patch 01 is a fix for a NULL pointer deref that I ran into with a bad VMM
configuration.

Patch 02 effectively makes the required MSRs mandatory for recognizing
Hyper-V at all. I'm not confident this is truly desirable, e.g. there
might be some features that are still kinda sorta usable, but on the other
hand there's a large pile of features that end up being a waste of cycles
to worm their way back to the native ops.

QEMU 5.1 (and other versions) makes it all too easy to advertise Hyper-V
and a slew of features without advertising the Hyper-V HYPERCALL MSR, e.g.
forcing QEMU features +hv-ipi,+hv-tlbflush,+hv-vpindex,+hv-reenlightenment
advertises a bunch of things, but not the HYPERCALL MSR.

That results in the guest identifying Hyper-V and setting a variety of PV
ops that then get ignored because hyperv_init() silently disables Hyper-V
for all intents and purposes. The VMM (or its controller) is obviously
off in the weeds, but ideally the guest kernel would acknowledge the bad
setup in some way.

Sean Christopherson (2):
x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup
fails
x86/hyperv: Move required MSRs check to initial platform probing

arch/x86/hyperv/hv_init.c | 16 +++++++---------
arch/x86/kernel/cpu/mshyperv.c | 20 +++++++++++++++-----
2 files changed, 22 insertions(+), 14 deletions(-)

--
2.33.0.1079.g6e70778dc9-goog