qemu-arm.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mohamed Mediouni <mohamed@unpredictable.fr>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Sunil Muthuswamy" <sunilmut@microsoft.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org,
	"Mohamed Mediouni" <mohamed@unpredictable.fr>
Subject: [RFC 1/9] whpx: Move around files before introducing AArch64 support
Date: Thu, 31 Jul 2025 07:27:45 +0200	[thread overview]
Message-ID: <20250731052753.93255-2-mohamed@unpredictable.fr> (raw)
In-Reply-To: <20250731052753.93255-1-mohamed@unpredictable.fr>

Switch to a design where we can share whpx code between x86 and AArch64 when it makes sense to do so.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
 accel/meson.build                                     | 1 +
 accel/whpx/meson.build                                | 6 ++++++
 {target/i386 => accel}/whpx/whpx-accel-ops.c          | 8 ++++++--
 {target/i386/whpx => include/system}/whpx-accel-ops.h | 0
 {target/i386/whpx => include/system}/whpx-internal.h  | 7 ++++++-
 target/i386/whpx/meson.build                          | 1 -
 target/i386/whpx/whpx-all.c                           | 4 ++--
 7 files changed, 21 insertions(+), 6 deletions(-)
 create mode 100644 accel/whpx/meson.build
 rename {target/i386 => accel}/whpx/whpx-accel-ops.c (96%)
 rename {target/i386/whpx => include/system}/whpx-accel-ops.h (100%)
 rename {target/i386/whpx => include/system}/whpx-internal.h (98%)

diff --git a/accel/meson.build b/accel/meson.build
index 25b0f100b5..de927a3b37 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -6,6 +6,7 @@ user_ss.add(files('accel-user.c'))
 subdir('tcg')
 if have_system
   subdir('hvf')
+  subdir('whpx')
   subdir('qtest')
   subdir('kvm')
   subdir('xen')
diff --git a/accel/whpx/meson.build b/accel/whpx/meson.build
new file mode 100644
index 0000000000..659efb13c9
--- /dev/null
+++ b/accel/whpx/meson.build
@@ -0,0 +1,6 @@
+whpx_ss = ss.source_set()
+whpx_ss.add(files(
+  'whpx-accel-ops.c',
+))
+
+specific_ss.add_all(when: 'CONFIG_WHPX', if_true: whpx_ss)
\ No newline at end of file
diff --git a/target/i386/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c
similarity index 96%
rename from target/i386/whpx/whpx-accel-ops.c
rename to accel/whpx/whpx-accel-ops.c
index da58805b1a..364d99b660 100644
--- a/target/i386/whpx/whpx-accel-ops.c
+++ b/accel/whpx/whpx-accel-ops.c
@@ -16,8 +16,8 @@
 #include "qemu/guest-random.h"
 
 #include "system/whpx.h"
-#include "whpx-internal.h"
-#include "whpx-accel-ops.h"
+#include "system/whpx-internal.h"
+#include "system/whpx-accel-ops.h"
 
 static void *whpx_cpu_thread_fn(void *arg)
 {
@@ -80,7 +80,11 @@ static void whpx_kick_vcpu_thread(CPUState *cpu)
 
 static bool whpx_vcpu_thread_is_idle(CPUState *cpu)
 {
+#ifndef __aarch64__
     return !whpx_apic_in_platform();
+#else
+    return 0;
+#endif
 }
 
 static void whpx_accel_ops_class_init(ObjectClass *oc, const void *data)
diff --git a/target/i386/whpx/whpx-accel-ops.h b/include/system/whpx-accel-ops.h
similarity index 100%
rename from target/i386/whpx/whpx-accel-ops.h
rename to include/system/whpx-accel-ops.h
diff --git a/target/i386/whpx/whpx-internal.h b/include/system/whpx-internal.h
similarity index 98%
rename from target/i386/whpx/whpx-internal.h
rename to include/system/whpx-internal.h
index 6633e9c4ca..af1e46a491 100644
--- a/target/i386/whpx/whpx-internal.h
+++ b/include/system/whpx-internal.h
@@ -3,8 +3,9 @@
 
 #include <windows.h>
 #include <winhvplatform.h>
+#ifdef __x86_64__
 #include <winhvemulation.h>
-
+#endif
 typedef enum WhpxBreakpointState {
     WHPX_BP_CLEARED = 0,
     WHPX_BP_SET_PENDING,
@@ -97,12 +98,16 @@ void whpx_apic_get(DeviceState *s);
 
 /* Define function typedef */
 LIST_WINHVPLATFORM_FUNCTIONS(WHP_DEFINE_TYPE)
+#ifdef __x86_64__
 LIST_WINHVEMULATION_FUNCTIONS(WHP_DEFINE_TYPE)
+#endif
 LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DEFINE_TYPE)
 
 struct WHPDispatch {
     LIST_WINHVPLATFORM_FUNCTIONS(WHP_DECLARE_MEMBER)
+#ifdef __x86_64__
     LIST_WINHVEMULATION_FUNCTIONS(WHP_DECLARE_MEMBER)
+#endif
     LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DECLARE_MEMBER)
 };
 
diff --git a/target/i386/whpx/meson.build b/target/i386/whpx/meson.build
index 9c54aaad39..c3aaaff9fd 100644
--- a/target/i386/whpx/meson.build
+++ b/target/i386/whpx/meson.build
@@ -1,5 +1,4 @@
 i386_system_ss.add(when: 'CONFIG_WHPX', if_true: files(
   'whpx-all.c',
   'whpx-apic.c',
-  'whpx-accel-ops.c',
 ))
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index b72dcff3c8..5a431fc3c7 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -31,8 +31,8 @@
 #include "accel/accel-cpu-target.h"
 #include <winerror.h>
 
-#include "whpx-internal.h"
-#include "whpx-accel-ops.h"
+#include "system/whpx-internal.h"
+#include "system/whpx-accel-ops.h"
 
 #include <winhvplatform.h>
 #include <winhvemulation.h>
-- 
2.39.5 (Apple Git-154)



  reply	other threads:[~2025-07-31  5:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31  5:27 [RFC 0/9] WHPX support for Arm Mohamed Mediouni
2025-07-31  5:27 ` Mohamed Mediouni [this message]
2025-07-31  8:27   ` [RFC 1/9] whpx: Move around files before introducing AArch64 support Philippe Mathieu-Daudé
2025-08-01  5:44   ` Richard Henderson
2025-07-31  5:27 ` [RFC 2/9] whpx: reshuffle common code Mohamed Mediouni
2025-07-31  5:27 ` [RFC 3/9] whpx: common: use whpx_cpu_instance_init on x86 only Mohamed Mediouni
2025-07-31  8:30   ` Philippe Mathieu-Daudé
2025-07-31  5:27 ` [RFC 4/9] whpx: interrupt controller support Mohamed Mediouni
2025-07-31  5:27 ` [RFC 5/9] hw/virt: make Qemu aware that WHPX has a vGICv3 Mohamed Mediouni
2025-07-31  8:35   ` Philippe Mathieu-Daudé
2025-07-31 14:47     ` Mohamed Mediouni
2025-07-31  5:27 ` [RFC 6/9] hw: intc: arm_gicv3_common: add whpx Mohamed Mediouni
2025-07-31  8:33   ` Philippe Mathieu-Daudé
2025-07-31  5:27 ` [RFC 7/9] whpx: add arm64 support Mohamed Mediouni
2025-07-31  5:27 ` [RFC 8/9] whpx: copy over memory tracking logic from hvf Mohamed Mediouni
2025-07-31  5:27 ` [RFC 9/9] target/arm: cpu: mark WHPX as supporting PSCI 1.1 Mohamed Mediouni
2025-08-01  1:15 ` [RFC 0/9] WHPX support for Arm Pierrick Bouvier
2025-08-01 12:43   ` Mohamed Mediouni
2025-08-01 17:22     ` Pierrick Bouvier
2025-08-01 18:52       ` Mohamed Mediouni
2025-08-01 19:16         ` Pierrick Bouvier
2025-08-01 19:31           ` Mohamed Mediouni
2025-08-01 19:42             ` Pierrick Bouvier
2025-08-01 19:57               ` Mohamed Mediouni
2025-08-01 20:10                 ` Pierrick Bouvier

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=20250731052753.93255-2-mohamed@unpredictable.fr \
    --to=mohamed@unpredictable.fr \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sunilmut@microsoft.com \
    /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).