Re: [RFC PATCH V3 03/16] x86/hyperv: Set Virtual Trust Level in vmbus init message

From: Tianyu Lan
Date: Thu Feb 02 2023 - 22:33:14 EST


On 2/1/2023 1:55 AM, Michael Kelley (LINUX) wrote:
index db2202d985bd..6dcbb21aac2b 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -36,6 +36,10 @@
#define HYPERV_CPUID_MIN 0x40000005
#define HYPERV_CPUID_MAX 0x4000ffff

+/* Support for HVCALL_GET_VP_REGISTERS hvcall */
The above comment isn't really right, in that these definitions
aren't for the hypercall. They are for the specific synthetic register.

+#define HV_X64_REGISTER_VSM_VP_STATUS 0x000D0003
+#define HV_X64_VTL_MASK GENMASK(3, 0)
Hyper-V synthetic registers have two different numbering schemes.
For registers that have synthetic MSR equivalents, there's a full list
starting with HV_X64_MSR_GUEST_OS_ID, which defines the MSR
address. But these registers also have register numbers that are
not the same as the MSR address. These register numbers
aren't defined anywhere in x86 Linux code because we don't access
them using the register number. (The register numbers*are*
defined in ARM64 code since ARM64 doesn't have MSRs.) But this
register is an exception on x86. There's no MSR equivalent so we
must use a hypercall to fetch the value.

I'd suggest starting a separate list after the definition of
HV_X64_MSR_REFERENCE_TSC and make clear in a comment
about the list that this is a list of register numbers, not MSR addresses.


Agree. Will update in the next version.