From: Mohamed Mediouni <mohamed@unpredictable.fr>
To: qemu-devel@nongnu.org
Cc: Roman Bolshakov <rbolshakov@ddn.com>,
Wei Liu <wei.liu@kernel.org>,
Pedro Barbuda <pbarbuda@microsoft.com>,
Mohamed Mediouni <mohamed@unpredictable.fr>,
Phil Dennis-Jordan <phil@philjordan.eu>
Subject: [PATCH v2 02/13] whpx: i386: enable exceptions VM exit only when needed
Date: Mon, 23 Mar 2026 23:34:23 +0100 [thread overview]
Message-ID: <20260323223434.81780-3-mohamed@unpredictable.fr> (raw)
In-Reply-To: <20260323223434.81780-1-mohamed@unpredictable.fr>
The exceptions VM exit was enabled with an empty bitmask
even when not used.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
target/i386/whpx/whpx-all.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 015c0f1dc9..8f1835ee95 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -903,13 +903,31 @@ static void whpx_init_emu(void)
HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions)
{
struct whpx_state *whpx = &whpx_global;
- WHV_PARTITION_PROPERTY prop = { 0, };
+ WHV_PARTITION_PROPERTY prop;
HRESULT hr;
if (exceptions == whpx->exception_exit_bitmap) {
return S_OK;
}
+ /* Register for MSR and CPUID exits */
+ memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY));
+ prop.ExtendedVmExits.X64MsrExit = 1;
+ if (exceptions != 0) {
+ prop.ExtendedVmExits.ExceptionExit = 1;
+ }
+
+ hr = whp_dispatch.WHvSetPartitionProperty(
+ whpx->partition,
+ WHvPartitionPropertyCodeExtendedVmExits,
+ &prop,
+ sizeof(WHV_PARTITION_PROPERTY));
+ if (FAILED(hr)) {
+ error_report("WHPX: Failed to enable extended VM exits, hr=%08lx", hr);
+ return hr;
+ }
+
+ memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY));
prop.ExceptionExitBitmap = exceptions;
hr = whp_dispatch.WHvSetPartitionProperty(
@@ -2167,7 +2185,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
/* Register for MSR and CPUID exits */
memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY));
prop.ExtendedVmExits.X64MsrExit = 1;
- prop.ExtendedVmExits.ExceptionExit = 1;
hr = whp_dispatch.WHvSetPartitionProperty(
whpx->partition,
@@ -2175,7 +2192,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms)
&prop,
sizeof(WHV_PARTITION_PROPERTY));
if (FAILED(hr)) {
- error_report("WHPX: Failed to enable MSR & CPUIDexit, hr=%08lx", hr);
+ error_report("WHPX: Failed to enable extended VM exits, hr=%08lx", hr);
ret = -EINVAL;
goto error;
}
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-03-23 22:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 22:34 [PATCH v2 00/13] whpx: i386: Windows 10 and performance fixes Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 01/13] whpx: i386: workaround for Windows 10 support Mohamed Mediouni
2026-03-23 22:34 ` Mohamed Mediouni [this message]
2026-03-23 22:34 ` [PATCH v2 03/13] whpx: i386: skip TSC read for MMIO exits Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 04/13] whpx: i386: skip XCRs " Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 05/13] whpx: i386: don't restore segment registers after MMIO handling Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 06/13] target/i386: emulate: add new callbacks Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 07/13] whpx: i386: add implementation of new x86_emul_ops Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 08/13] target/i386: emulate: indirect access to CRs Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 09/13] whpx: i386: " Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 10/13] target/i386: emulate: segmentation rework Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 11/13] whpx: i386: fetch segments on-demand Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 12/13] whpx: i386: workaround for segment granularity reading as 0 Mohamed Mediouni
2026-03-23 22:34 ` [PATCH v2 13/13] whpx: i386: fast runtime state reads 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=20260323223434.81780-3-mohamed@unpredictable.fr \
--to=mohamed@unpredictable.fr \
--cc=pbarbuda@microsoft.com \
--cc=phil@philjordan.eu \
--cc=qemu-devel@nongnu.org \
--cc=rbolshakov@ddn.com \
--cc=wei.liu@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