From: Roman Kisel <romank@linux.microsoft.com>
To: arnd@arndb.de, bp@alien8.de, corbet@lwn.net,
dave.hansen@linux.intel.com, decui@microsoft.com,
haiyangz@microsoft.com, hpa@zytor.com, kys@microsoft.com,
mikelley@microsoft.com, mingo@redhat.com, tglx@linutronix.de,
Tianyu.Lan@microsoft.com, wei.liu@kernel.org, x86@kernel.org,
linux-hyperv@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Cc: benhill@microsoft.com, bperkins@microsoft.com,
sunilmut@microsoft.com, romank@linux.microsoft.com
Subject: [PATCH hyperv-next v6 03/17] arch/x86: mshyperv: Discover Confidential VMBus availability
Date: Fri, 3 Oct 2025 15:26:56 -0700 [thread overview]
Message-ID: <20251003222710.6257-4-romank@linux.microsoft.com> (raw)
In-Reply-To: <20251003222710.6257-1-romank@linux.microsoft.com>
Confidential VMBus requires enabling paravisor SynIC, and
the x86_64 guest has to inspect the Virtualization Stack (VS)
CPUID leaf to see if Confidential VMBus is available. If it is,
the guest shall enable the paravisor SynIC.
Read the relevant data from the VS CPUID leaf. Refactor the
code to avoid repeating CPUID and add flags to the struct
ms_hyperv_info. For ARM64, the flag for Confidential VMBus
is not set which provides the desired behaviour for now as
it is not available on ARM64 just yet. Once ARM64 CCA guests
are supported, this flag will be set unconditionally when
running such a guest.
Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
---
arch/x86/kernel/cpu/mshyperv.c | 28 +++++++++++++++-------------
include/asm-generic/mshyperv.h | 2 ++
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 25773af116bc..57163c7a000f 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -434,7 +434,7 @@ EXPORT_SYMBOL_GPL(hv_get_hypervisor_version);
static void __init ms_hyperv_init_platform(void)
{
- int hv_max_functions_eax;
+ int hv_max_functions_eax, eax;
#ifdef CONFIG_PARAVIRT
pv_info.name = "Hyper-V";
@@ -469,6 +469,19 @@ static void __init ms_hyperv_init_platform(void)
pr_info("Hyper-V: running on a nested hypervisor\n");
}
+ /*
+ * There is no check against the max function for HYPERV_CPUID_VIRT_STACK_* CPUID
+ * leaves as the hypervisor doesn't handle them. Even a nested root partition (L2
+ * root) will not get them because the nested (L1) hypervisor filters them out.
+ * These are handled through intercept processing by the Windows Hyper-V stack
+ * or the paravisor.
+ */
+ eax = cpuid_eax(HYPERV_CPUID_VIRT_STACK_PROPERTIES);
+ ms_hyperv.confidential_vmbus_available =
+ eax & HYPERV_VS_PROPERTIES_EAX_CONFIDENTIAL_VMBUS_AVAILABLE;
+ ms_hyperv.msi_ext_dest_id =
+ eax & HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE;
+
if (ms_hyperv.features & HV_ACCESS_FREQUENCY_MSRS &&
ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {
x86_platform.calibrate_tsc = hv_get_tsc_khz;
@@ -668,21 +681,10 @@ static bool __init ms_hyperv_x2apic_available(void)
* pci-hyperv host bridge.
*
* Note: for a Hyper-V root partition, this will always return false.
- * The hypervisor doesn't expose these HYPERV_CPUID_VIRT_STACK_* cpuids by
- * default, they are implemented as intercepts by the Windows Hyper-V stack.
- * Even a nested root partition (L2 root) will not get them because the
- * nested (L1) hypervisor filters them out.
*/
static bool __init ms_hyperv_msi_ext_dest_id(void)
{
- u32 eax;
-
- eax = cpuid_eax(HYPERV_CPUID_VIRT_STACK_INTERFACE);
- if (eax != HYPERV_VS_INTERFACE_EAX_SIGNATURE)
- return false;
-
- eax = cpuid_eax(HYPERV_CPUID_VIRT_STACK_PROPERTIES);
- return eax & HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE;
+ return ms_hyperv.msi_ext_dest_id;
}
#ifdef CONFIG_AMD_MEM_ENCRYPT
diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index 64ba6bc807d9..9049a9617324 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -62,6 +62,8 @@ struct ms_hyperv_info {
};
};
u64 shared_gpa_boundary;
+ bool msi_ext_dest_id;
+ bool confidential_vmbus_available;
};
extern struct ms_hyperv_info ms_hyperv;
extern bool hv_nested;
--
2.43.0
next prev parent reply other threads:[~2025-10-03 22:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 22:26 [PATCH hyperv-next v6 00/17] Confidential VMBus Roman Kisel
2025-10-03 22:26 ` [PATCH hyperv-next v6 01/17] Documentation: hyperv: " Roman Kisel
2025-10-06 16:55 ` Michael Kelley
2025-10-07 2:23 ` Bagas Sanjaya
2025-10-07 20:38 ` Roman Kisel
2025-10-07 23:56 ` Bagas Sanjaya
2025-10-08 22:11 ` Roman Kisel
2025-10-08 23:20 ` Bagas Sanjaya
2025-10-03 22:26 ` [PATCH hyperv-next v6 02/17] Drivers: hv: VMBus protocol version 6.0 Roman Kisel
2025-10-03 22:26 ` Roman Kisel [this message]
2025-10-03 22:26 ` [PATCH hyperv-next v6 04/17] arch: hyperv: Get/set SynIC synth.registers via paravisor Roman Kisel
2025-10-03 22:26 ` [PATCH hyperv-next v6 05/17] arch/x86: mshyperv: Trap on access for some synthetic MSRs Roman Kisel
2025-10-04 8:09 ` kernel test robot
2025-10-06 16:55 ` Michael Kelley
2025-10-06 18:30 ` Roman Kisel
2025-10-03 22:26 ` [PATCH hyperv-next v6 06/17] Drivers: hv: Rename fields for SynIC message and event pages Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 07/17] Drivers: hv: Allocate the paravisor SynIC pages when required Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 08/17] Drivers: hv: Post messages through the confidential VMBus if available Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 09/17] Drivers: hv: remove stale comment Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 10/17] Drivers: hv: Check message and event pages for non-NULL before iounmap() Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 11/17] Drivers: hv: Rename the SynIC enable and disable routines Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 12/17] Drivers: hv: Functions for setting up and tearing down the paravisor SynIC Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 13/17] Drivers: hv: Allocate encrypted buffers when requested Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 14/17] Drivers: hv: Free msginfo when the buffer fails to decrypt Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 15/17] Drivers: hv: Support confidential VMBus channels Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 16/17] Drivers: hv: Set the default VMBus version to 6.0 Roman Kisel
2025-10-03 22:27 ` [PATCH hyperv-next v6 17/17] Drivers: hv: Support establishing the confidential VMBus connection Roman Kisel
2025-10-06 16:55 ` [PATCH hyperv-next v6 00/17] Confidential VMBus Michael Kelley
2025-10-06 18:58 ` Roman Kisel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251003222710.6257-4-romank@linux.microsoft.com \
--to=romank@linux.microsoft.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=arnd@arndb.de \
--cc=benhill@microsoft.com \
--cc=bp@alien8.de \
--cc=bperkins@microsoft.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kys@microsoft.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=sunilmut@microsoft.com \
--cc=tglx@linutronix.de \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).