From: Mohamed Mediouni <mohamed@unpredictable.fr>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, Mohamed Mediouni <mohamed@unpredictable.fr>,
Pedro Barbuda <pbarbuda@microsoft.com>,
Peter Maydell <peter.maydell@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
Akshey Taneja <aksheynew.tanejanew@gmail.com>
Subject: [PULL 11/13] whpx: i386: do not require ProcessorFeaturesBanks on legacy Windows
Date: Sun, 8 Nov 2026 02:54:01 -0700 [thread overview]
Message-ID: <20261108095403.70813-12-mohamed@unpredictable.fr> (raw)
In-Reply-To: <20261108095403.70813-1-mohamed@unpredictable.fr>
From: Akshey Taneja <aksheynew.tanejanew@gmail.com>
WHvCapabilityCodeProcessorFeaturesBanks and the matching partition
property are implemented starting from Windows 10 version 20H1.
On earlier Windows 10 releases, the capability query returns
WHV_E_UNKNOWN_CAPABILITY (0x80370300) and whpx_accel_init()
aborts with -ENOSPC, reported to the user as "failed to initialize
whpx: No space left on device". This regressed older Windows 10
releases in 8b87283ce4 ("whpx: i386: enable all supported host features").
Fall back to the original single-bank WHvCapabilityCodeProcessorFeatures
on legacy hosts and skip the corresponding SetPartitionProperty, which
restores the pre-8b87283ce4 behaviour there.
Reported-on: Windows 10 Enterprise LTSC 17763, Intel i7-6700
Signed-off-by: Akshey Taneja <aksheynew.tanejanew@gmail.com>
[Editing patch for reflecting the availability of this API, which is
available in Windows 10 version 2004 onwards]
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
target/i386/whpx/whpx-all.c | 59 +++++++++++++++++++++++++++----------
1 file changed, 43 insertions(+), 16 deletions(-)
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 1790b1c7b6..f40409b330 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -3312,13 +3312,33 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
memset(&processor_features, 0, sizeof(WHV_PROCESSOR_FEATURES_BANKS));
processor_features.BanksCount = 2;
- hr = whp_dispatch.WHvGetCapability(
- WHvCapabilityCodeProcessorFeaturesBanks, &processor_features,
- sizeof(WHV_PROCESSOR_FEATURES_BANKS), &whpx_cap_size);
- if (FAILED(hr)) {
- error_report("WHPX: Failed to get processor features, hr=%08lx", hr);
- ret = -ENOSPC;
- goto error;
+ if (whpx_is_legacy_os()) {
+ /*
+ * WHvCapabilityCodeProcessorFeaturesBanks is implemented starting
+ * from Windows 10 version 20H2 (19041). Fall back to the single-bank
+ * capability on earlier Windows 10 releases.
+ */
+ WHV_PROCESSOR_FEATURES legacy_features = {0};
+
+ processor_features.BanksCount = 1;
+ hr = whp_dispatch.WHvGetCapability(
+ WHvCapabilityCodeProcessorFeatures, &legacy_features,
+ sizeof(legacy_features), &whpx_cap_size);
+ if (FAILED(hr)) {
+ warn_report("WHPX: Failed to get legacy processor features, "
+ "hr=%08lx", hr);
+ } else {
+ processor_features.Bank0 = legacy_features;
+ }
+ } else {
+ hr = whp_dispatch.WHvGetCapability(
+ WHvCapabilityCodeProcessorFeaturesBanks, &processor_features,
+ sizeof(WHV_PROCESSOR_FEATURES_BANKS), &whpx_cap_size);
+ if (FAILED(hr)) {
+ error_report("WHPX: Failed to get processor features, hr=%08lx", hr);
+ ret = -ENOSPC;
+ goto error;
+ }
}
whpx_rdtsc_cap = processor_features.Bank0.RdtscpSupport;
@@ -3363,15 +3383,22 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
}
}
- hr = whp_dispatch.WHvSetPartitionProperty(
- whpx->partition,
- WHvPartitionPropertyCodeProcessorFeaturesBanks,
- &processor_features,
- sizeof(WHV_PROCESSOR_FEATURES_BANKS));
- if (FAILED(hr)) {
- error_report("WHPX: Failed to set processor features, hr=%08lx", hr);
- ret = -EINVAL;
- goto error;
+ /*
+ * The matching partition property is available on Windows 10 version 20H2 (19041).
+ * and later. Rely on the whpx_is_legacy_os() check to enable this code only on Server
+ * 2022 or Windows 11.
+ */
+ if (!whpx_is_legacy_os()) {
+ hr = whp_dispatch.WHvSetPartitionProperty(
+ whpx->partition,
+ WHvPartitionPropertyCodeProcessorFeaturesBanks,
+ &processor_features,
+ sizeof(WHV_PROCESSOR_FEATURES_BANKS));
+ if (FAILED(hr)) {
+ error_report("WHPX: Failed to set processor features, hr=%08lx", hr);
+ ret = -EINVAL;
+ goto error;
+ }
}
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-08 9:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 9:53 [PULL 00/13] Whpx fix 0 patches Mohamed Mediouni
2026-11-08 9:53 ` [PULL 01/13] target/i386/whpx: fix VMX capability MSR values Mohamed Mediouni
2026-11-08 9:53 ` [PULL 02/13] target/i386/whpx: whpx_get_xsave_state error handling Mohamed Mediouni
2026-11-08 9:53 ` [PULL 03/13] whpx: i386: get APIC state before VM save Mohamed Mediouni
2026-11-08 9:53 ` [PULL 04/13] whpx: i386: fix TPR encodings for local APIC Mohamed Mediouni
2026-11-08 9:53 ` [PULL 05/13] whpx: i386: save/restore xss Mohamed Mediouni
2026-11-08 9:53 ` [PULL 06/13] whpx: i386: make nested virtualisation init failure non-fatal Mohamed Mediouni
2026-11-08 9:53 ` [PULL 07/13] whpx: i386: avoid updating hflags for vmexits Mohamed Mediouni
2026-11-08 9:53 ` [PULL 08/13] target/i386/whpx: handle processor reset Mohamed Mediouni
2026-11-08 9:53 ` [PULL 09/13] target/arm/whpx: " Mohamed Mediouni
2026-11-08 9:54 ` [PULL 10/13] whpx: i386: forward the dynamic EBX of CPUID[0xD] sub-leaves 0 and 1, not 1 and 2 Mohamed Mediouni
2026-11-08 9:54 ` Mohamed Mediouni [this message]
2026-11-08 9:54 ` [PULL 12/13] whpx: i386: fall back to xAPIC when the MSR exit bitmap is unavailable Mohamed Mediouni
2026-11-08 9:54 ` [PULL 13/13] whpx: i386: also save debug registers Mohamed Mediouni
2026-11-08 19:01 ` [PULL 00/13] Whpx fix 0 patches Alex Bennée
2026-11-09 0:41 ` Mohamed Mediouni
-- strict thread matches above, loose matches on Subject: below --
2026-11-09 0:40 [PULL 00/13] whpx: QEMU 11.2 pull request Mohamed Mediouni
2026-11-09 0:41 ` [PULL 11/13] whpx: i386: do not require ProcessorFeaturesBanks on legacy Windows Mohamed Mediouni
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=20261108095403.70813-12-mohamed@unpredictable.fr \
--to=mohamed@unpredictable.fr \
--cc=aksheynew.tanejanew@gmail.com \
--cc=pbarbuda@microsoft.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.