[PATCH v3 02/14] whpx: Move around files before introducing AArch64 support

Mohamed Mediouni posted 14 patches 3 months, 2 weeks ago
Maintainers: Sunil Muthuswamy <sunilmut@microsoft.com>, Mohamed Mediouni <mohamed@unpredictable.fr>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Shannon Zhao <shannon.zhaosl@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Zhao Liu <zhao1.liu@intel.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>
There is a newer version of this series
[PATCH v3 02/14] whpx: Move around files before introducing AArch64 support
Posted by Mohamed Mediouni 3 months, 2 weeks ago
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>

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 MAINTAINERS                                           | 2 ++
 accel/meson.build                                     | 1 +
 accel/whpx/meson.build                                | 6 ++++++
 {target/i386 => accel}/whpx/whpx-accel-ops.c          | 4 ++--
 {target/i386/whpx => include/system}/whpx-accel-ops.h | 0
 target/i386/whpx/meson.build                          | 1 -
 target/i386/whpx/whpx-all.c                           | 4 ++--
 target/i386/whpx/whpx-internal.h                      | 1 +
 8 files changed, 14 insertions(+), 5 deletions(-)
 create mode 100644 accel/whpx/meson.build
 rename {target/i386 => accel}/whpx/whpx-accel-ops.c (97%)
 rename {target/i386/whpx => include/system}/whpx-accel-ops.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 28cea34271..238065e1c9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -542,9 +542,11 @@ F: include/system/hvf_int.h
 WHPX CPUs
 M: Sunil Muthuswamy <sunilmut@microsoft.com>
 S: Supported
+F: accel/whpx/
 F: target/i386/whpx/
 F: accel/stubs/whpx-stub.c
 F: include/system/whpx.h
+F: include/system/whpx-accel-ops.h
 
 X86 Instruction Emulator
 M: Cameron Esfahani <dirty@apple.com>
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..7b3d6f1c1c
--- /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)
diff --git a/target/i386/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c
similarity index 97%
rename from target/i386/whpx/whpx-accel-ops.c
rename to accel/whpx/whpx-accel-ops.c
index da58805b1a..18488421bc 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)
 {
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/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>
diff --git a/target/i386/whpx/whpx-internal.h b/target/i386/whpx/whpx-internal.h
index 6633e9c4ca..435e0c5046 100644
--- a/target/i386/whpx/whpx-internal.h
+++ b/target/i386/whpx/whpx-internal.h
@@ -117,3 +117,4 @@ typedef enum WHPFunctionList {
 } WHPFunctionList;
 
 #endif /* TARGET_I386_WHPX_INTERNAL_H */
+
-- 
2.39.5 (Apple Git-154)


Re: [PATCH v3 02/14] whpx: Move around files before introducing AArch64 support
Posted by Mohamed Mediouni 3 months, 2 weeks ago
Note: I _also_ screwed up this rebase a bit unfortunately but this one should be clean: https://github.com/mediouni-m/qemu/commit/66f052d80b6b51a60374074cec876f9bfc8a756c 

To not cause too much spam on the ML will most likely batch this when I have more changes...

> On 2. Aug 2025, at 10:17, Mohamed Mediouni <mohamed@unpredictable.fr> wrote:
> 
> 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>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> MAINTAINERS                                           | 2 ++
> accel/meson.build                                     | 1 +
> accel/whpx/meson.build                                | 6 ++++++
> {target/i386 => accel}/whpx/whpx-accel-ops.c          | 4 ++--
> {target/i386/whpx => include/system}/whpx-accel-ops.h | 0
> target/i386/whpx/meson.build                          | 1 -
> target/i386/whpx/whpx-all.c                           | 4 ++--
> target/i386/whpx/whpx-internal.h                      | 1 +
> 8 files changed, 14 insertions(+), 5 deletions(-)
> create mode 100644 accel/whpx/meson.build
> rename {target/i386 => accel}/whpx/whpx-accel-ops.c (97%)
> rename {target/i386/whpx => include/system}/whpx-accel-ops.h (100%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 28cea34271..238065e1c9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -542,9 +542,11 @@ F: include/system/hvf_int.h
> WHPX CPUs
> M: Sunil Muthuswamy <sunilmut@microsoft.com>
> S: Supported
> +F: accel/whpx/
> F: target/i386/whpx/
> F: accel/stubs/whpx-stub.c
> F: include/system/whpx.h
> +F: include/system/whpx-accel-ops.h
> 
> X86 Instruction Emulator
> M: Cameron Esfahani <dirty@apple.com>
> 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..7b3d6f1c1c
> --- /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)
> diff --git a/target/i386/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c
> similarity index 97%
> rename from target/i386/whpx/whpx-accel-ops.c
> rename to accel/whpx/whpx-accel-ops.c
> index da58805b1a..18488421bc 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)
> {
> 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/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>
> diff --git a/target/i386/whpx/whpx-internal.h b/target/i386/whpx/whpx-internal.h
> index 6633e9c4ca..435e0c5046 100644
> --- a/target/i386/whpx/whpx-internal.h
> +++ b/target/i386/whpx/whpx-internal.h
> @@ -117,3 +117,4 @@ typedef enum WHPFunctionList {
> } WHPFunctionList;
> 
> #endif /* TARGET_I386_WHPX_INTERNAL_H */
> +
> -- 
> 2.39.5 (Apple Git-154)
> 

Re: [PATCH v3 02/14] whpx: Move around files before introducing AArch64 support
Posted by Richard Henderson 3 months, 2 weeks ago
On 8/2/25 18:17, Mohamed Mediouni wrote:
> 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>
> 
> Reviewed-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   MAINTAINERS                                           | 2 ++
>   accel/meson.build                                     | 1 +
>   accel/whpx/meson.build                                | 6 ++++++
>   {target/i386 => accel}/whpx/whpx-accel-ops.c          | 4 ++--
>   {target/i386/whpx => include/system}/whpx-accel-ops.h | 0
>   target/i386/whpx/meson.build                          | 1 -
>   target/i386/whpx/whpx-all.c                           | 4 ++--
>   target/i386/whpx/whpx-internal.h                      | 1 +
>   8 files changed, 14 insertions(+), 5 deletions(-)
>   create mode 100644 accel/whpx/meson.build
>   rename {target/i386 => accel}/whpx/whpx-accel-ops.c (97%)
>   rename {target/i386/whpx => include/system}/whpx-accel-ops.h (100%)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~