From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76A6CC87FCA for ; Thu, 31 Jul 2025 05:32:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uhLr5-0000xB-G0; Thu, 31 Jul 2025 01:29:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uhLpn-0007PN-FH for qemu-devel@nongnu.org; Thu, 31 Jul 2025 01:28:07 -0400 Received: from p-east3-cluster7-host9-snip4-1.eps.apple.com ([57.103.84.212] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uhLpl-0005kh-AR for qemu-devel@nongnu.org; Thu, 31 Jul 2025 01:28:07 -0400 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-20-percent-1 (Postfix) with ESMTPS id 424B5180010F; Thu, 31 Jul 2025 05:27:59 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; bh=pwja+ZpN/2feJPEJZL5LWngWJ+S9c3/1c73FYPVP0IQ=; h=From:To:Subject:Date:Message-Id:MIME-Version:x-icloud-hme; b=ExZOPRvace2Ee1vtCumTF6zo0KTDjqGABgQNm2QeNbyFdJDRG8bO5w/46RdQ9khjUxFs7IdnLv6KKQ6eWG4Jtqd5PyWqHo26Z7fIHug4KPrSFeoH8ZgpdgA0pxtIyzE+ofqcIS6A3xYUE50cQlO/OPN2trTHQqTAzHG+wo97odGN8tc1TbQsLv9fEBzNlvcu8HrYU/ssDY5UGj1yJ8pZLeh1RjTdLNULEHgNKFZhIVaIcbeiiZJI1QCsbIwqRrr9qJ9ScqEGaH+Q3mn1iQWfkasXpVAcacgCPKJreG77ZA+BLfVQoNIbJBw5BrDWCNWo9LBAZB87LCwwVxrwOikavg== X-Client-IP: 46.189.47.18 Received: from localhost.localdomain (qs-asmtp-me-k8s.p00.prod.me.com [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-20-percent-1 (Postfix) with ESMTPSA id 2ED141800131; Thu, 31 Jul 2025 05:27:57 +0000 (UTC) From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , Sunil Muthuswamy , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , qemu-arm@nongnu.org, Mohamed Mediouni Subject: [RFC 1/9] whpx: Move around files before introducing AArch64 support Date: Thu, 31 Jul 2025 07:27:45 +0200 Message-Id: <20250731052753.93255-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250731052753.93255-1-mohamed@unpredictable.fr> References: <20250731052753.93255-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzMxMDAzNSBTYWx0ZWRfX/Gz2RU0tEMD1 pnHFeLSy+K1QBX1Ww3C1NXZFHaMUeuIjYwl2O0Skkz0aMBOn459QzWe31W+5XNWOdHz/61Acy6p s6sH1kDBe6xliINOBQQ2uYp7TGD/QDwbl0pVLpnafqeLAwfKmh6l5hBy8o/qajLdcrrmrBAdePo LVJ8D8p6X7Jq0RhLtqLeA9ASxplIO0jiz1V5J0Yfit39LKRjFR9PvQXGbd6jhWLc8nC+0o2Nip5 4QIkaKXB1CkfTAx9TUc7sLhtMVRSd0LO33qGXOcpzl05zKtFzTpEQihg4J2F/4tYJo4uD6xtU= X-Proofpoint-ORIG-GUID: bnQJHQ4VWV27sdcR_qxph6lggf3yL5Db X-Proofpoint-GUID: bnQJHQ4VWV27sdcR_qxph6lggf3yL5Db X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-07-31_01,2025-07-31_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 clxscore=1030 bulkscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2506270000 definitions=main-2507310035 Received-SPF: pass client-ip=57.103.84.212; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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 #include +#ifdef __x86_64__ #include - +#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 -#include "whpx-internal.h" -#include "whpx-accel-ops.h" +#include "system/whpx-internal.h" +#include "system/whpx-accel-ops.h" #include #include -- 2.39.5 (Apple Git-154)