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 753E8E83830 for ; Mon, 16 Feb 2026 20:45:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vs5TL-0007Mj-Qu; Mon, 16 Feb 2026 15:45:35 -0500 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 1vs5TL-0007MR-6E for qemu-arm@nongnu.org; Mon, 16 Feb 2026 15:45:35 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vs5TJ-0007BL-EN for qemu-arm@nongnu.org; Mon, 16 Feb 2026 15:45:34 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-48329eb96a7so19011625e9.3 for ; Mon, 16 Feb 2026 12:45:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771274730; x=1771879530; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=NA154KD38aNvhHzLvJhS6XIR9Dy0bugG6Y4r1fssa4Y=; b=EdkLBqc3TC9Zt1cWNTTxguXe6C3MPs6Ae+Aj5uoq7JluroZBuRepzKe5kn0CdC/QrO tcnrXZluXPquJ0q3htn/9ahMyimmz1RCQ8eL61S7PU8nLqeFZcNcyhwKvDWeJSIrgXTR KWUwXGOXb8Aim8KeCc5Idlyb3GFCFXyAM0OqMyUwAVh3HQS1qFJKVYNiYojmSUGy+00Q V4VWS/CmduK8PQi+/IZBftDCWjw2UcEidExiGFVS1+mSZPSp0sgecUI7VB01gYelOqlO iN+zYadVebcrNGE/Izf+YMbUd8YQppFeQjYVs6qKpJFwPYjGVYDHAXBBSCIatENk+xqc P5Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771274730; x=1771879530; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NA154KD38aNvhHzLvJhS6XIR9Dy0bugG6Y4r1fssa4Y=; b=o6tbdAzMjAS+v1b4Ko9AgfbCz9fpl88Q1o3tNBjzGwncyl9rHhHKzJ9S77MPDZ5a9s Tca/xPZZhFYKIP21H0s4P84GGe8O9X2Y80+EQcO0zVMTHDXrObtz51zIuAo6xegOnz6b X2diBQOCHYbNWQYLj/hHZmChAaK7fx6Ujr6jHxOt8Zqe11kJQ+zA+YCu86jXAXzEh4TI vuBCVDj52Ajnv+DJAMaV+Wb7X+StaexzLuD8ex1RFZ4f6ylUXlUNRX7YTJd6yfNTLcBA 2yznc8sGFhFhiStB4H0LW4So8pthbK9OHWNpr7cyq1XQp00YC7vKb8gWk4aFMLKkfF1J HJdg== X-Forwarded-Encrypted: i=1; AJvYcCX7RMmXJX6kGY9YuOScalOtogZcxsacWXtldgrEosUlnhKf3ZZfGvE+WEPEfYTV2HW04P6ki3J0vQ==@nongnu.org X-Gm-Message-State: AOJu0YymIOTfrY8fYGz78cd1j74FNVop5wOoZ2KKkmXe1PadS2JQGe1a yOCjaXfzSRrqI5WVzVRYmMRSnn3nlyqjBvEdlyBAayMyyJd/ZZDu4TnW X-Gm-Gg: AZuq6aIR3pggFHgqo4RpDmAEpMmSK72QAx5rKchbm6o4EJW0uRzR3Q/P5GIhf3d6HWb eKVtfYnAGIcSm+LJkhjdH1bwPLwkSPnxF9p/u3qCUrgbHeTtHNcskORoW3lmwxn/p3Uawi8/IRm w+vDAw6C5khyF5eCgPpIgaD7OR4sCO4uZie9L415UtYuo9B/YbEMpiHVXHdJ+NjXT9tK32tajuL 1nMZylN5DwCyzBcfPJU6NNIuB5xwy9//kSPNkG1FyKUXPnJUXgWgucd8vO/CifRjhrYaV6+AaqD BPJPme+Wj8YlQpTwW1S7F6bQuFhVkoJq0q5Q+WRnVEB367vqoxoXlyA/r2zPw6VgHCvA3732M19 lqbHi4yYhtwGIXjOGcW9zL+mrKlzMX5HlyDt7HqufX5ll7fvxjz8Xe+pQ56nGcbc/0FcRbkJEre rqAqTeeXMR1ueGDiKgKVXljeKLQu0PNpeS7z8g3ijBTL+6p2CxotDxefwhvHOc0I08cO2B5Pj3E Qafy1WqC6eVdPbR2X42TJW4BBUpGno8ZMbXZIEHsJrl+A== X-Received: by 2002:a05:600c:198e:b0:477:df7:b020 with SMTP id 5b1f17b1804b1-48373a38293mr213499215e9.18.1771274730251; Mon, 16 Feb 2026 12:45:30 -0800 (PST) Received: from ehlo.thunderbird.net (dynamic-2a02-3100-2363-0f00-f009-a6c9-39e7-d8fe.310.pool.telefonica.de. [2a02:3100:2363:f00:f009:a6c9:39e7:d8fe]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d82a4c4sm755558265e9.10.2026.02.16.12.45.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Feb 2026 12:45:29 -0800 (PST) Date: Mon, 16 Feb 2026 18:45:45 +0000 From: Bernhard Beschow To: Mohamed Mediouni , qemu-devel@nongnu.org CC: Phil Dennis-Jordan , Cameron Esfahani , Magnus Kulke , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Paolo Bonzini , Pedro Barbuda , =?ISO-8859-1?Q?Daniel_P=2E_Berrang=E9?= , =?ISO-8859-1?Q?Marc-Andr=E9_Lureau?= , Magnus Kulke , =?ISO-8859-1?Q?Philippe_Mathieu-Daud=E9?= , Wei Liu , Zhao Liu Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_v3_08/14=5D_whpx=3A_move_whpx?= =?US-ASCII?Q?=5Fget=5Freg/whpx=5Fset=5Freg_to_generic_code?= In-Reply-To: <20260215052225.22513-9-mohamed@unpredictable.fr> References: <20260215052225.22513-1-mohamed@unpredictable.fr> <20260215052225.22513-9-mohamed@unpredictable.fr> Message-ID: <8423E1CF-83F9-478E-99C6-DF38C689F43F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=shentey@gmail.com; helo=mail-wm1-x335.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Am 15=2E Februar 2026 05:22:19 UTC schrieb Mohamed Mediouni : >These will be used in the next commit on the x86_64 backend too=2E >Also move flush_cpu_state as it's used by get_reg/set_reg and the arm64 c= ode=2E > >Signed-off-by: Mohamed Mediouni >--- > accel/whpx/whpx-common=2Ec | 35 +++++++++++++++++++++++++++++++++++ > include/system/whpx-common=2Eh | 3 +++ > target/arm/whpx/whpx-all=2Ec | 35 ----------------------------------- > 3 files changed, 38 insertions(+), 35 deletions(-) > >diff --git a/accel/whpx/whpx-common=2Ec b/accel/whpx/whpx-common=2Ec >index c57a0d3f0f=2E=2Ec2263c2496 100644 >--- a/accel/whpx/whpx-common=2Ec >+++ b/accel/whpx/whpx-common=2Ec >@@ -46,6 +46,41 @@ static HMODULE hWinHvEmulation; > struct whpx_state whpx_global; > struct WHPDispatch whp_dispatch; >=20 >+void flush_cpu_state(CPUState *cpu) >+{ >+ if (cpu->vcpu_dirty) { >+ whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); >+ cpu->vcpu_dirty =3D false; >+ } >+} >+ >+void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VAL= UE* val) >+{ >+ struct whpx_state *whpx =3D &whpx_global; >+ HRESULT hr; >+ >+ flush_cpu_state(cpu); >+ >+ hr =3D whp_dispatch=2EWHvGetVirtualProcessorRegisters(whpx->partitio= n, cpu->cpu_index, >+ ®, 1, val); >+ >+ if (FAILED(hr)) { >+ error_report("WHPX: Failed to get register %08x, hr=3D%08lx", re= g, hr); >+ } >+} >+ >+void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VAL= UE val) >+{ >+ struct whpx_state *whpx =3D &whpx_global; >+ HRESULT hr; >+ hr =3D whp_dispatch=2EWHvSetVirtualProcessorRegisters(whpx->partitio= n, cpu->cpu_index, >+ ®, 1, &val); >+ >+ if (FAILED(hr)) { >+ error_report("WHPX: Failed to set register %08x, hr=3D%08lx", re= g, hr); >+ } >+} >+ > /* Tries to find a breakpoint at the specified address=2E */ > struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address) > { >diff --git a/include/system/whpx-common=2Eh b/include/system/whpx-common= =2Eh >index b86fe9db6e=2E=2E5bce33e336 100644 >--- a/include/system/whpx-common=2Eh >+++ b/include/system/whpx-common=2Eh >@@ -20,6 +20,9 @@ int whpx_first_vcpu_starting(CPUState *cpu); > int whpx_last_vcpu_stopping(CPUState *cpu); > void whpx_memory_init(void); > struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address)= ; >+void flush_cpu_state(CPUState *cpu); Now that flush_cpu_state() is exported we should better prefix it with "wh= px_" to avoid name clashes=2E With this fixed: Reviewed-by: Bernhard Beschow >+void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VAL= UE* val); >+void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTER_VAL= UE val); >=20 > /* On x64: same as WHvX64ExceptionTypeDebugTrapOrFault */ > #define WHPX_INTERCEPT_DEBUG_TRAPS 1 >diff --git a/target/arm/whpx/whpx-all=2Ec b/target/arm/whpx/whpx-all=2Ec >index d52580a082=2E=2Ec8d71a252e 100644 >--- a/target/arm/whpx/whpx-all=2Ec >+++ b/target/arm/whpx/whpx-all=2Ec >@@ -274,14 +274,6 @@ static struct whpx_sreg_match whpx_sreg_match[] =3D = { > { WHvArm64RegisterSpEl1, ENCODE_AA64_CP_REG(4, 1, 3, 4, 0) }, > }; >=20 >-static void flush_cpu_state(CPUState *cpu) >-{ >- if (cpu->vcpu_dirty) { >- whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); >- cpu->vcpu_dirty =3D false; >- } >-} >- > HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions) > { > if (exceptions !=3D 0) { >@@ -314,33 +306,6 @@ void whpx_arch_destroy_vcpu(CPUState *cpu) > /* currently empty on Arm */ > } >=20 >-static void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGIS= TER_VALUE* val) >-{ >- struct whpx_state *whpx =3D &whpx_global; >- HRESULT hr; >- >- flush_cpu_state(cpu); >- >- hr =3D whp_dispatch=2EWHvGetVirtualProcessorRegisters(whpx->partitio= n, cpu->cpu_index, >- ®, 1, val); >- >- if (FAILED(hr)) { >- error_report("WHPX: Failed to get register %08x, hr=3D%08lx", re= g, hr); >- } >-} >- >-static void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGIS= TER_VALUE val) >-{ >- struct whpx_state *whpx =3D &whpx_global; >- HRESULT hr; >- hr =3D whp_dispatch=2EWHvSetVirtualProcessorRegisters(whpx->partitio= n, cpu->cpu_index, >- ®, 1, &val); >- >- if (FAILED(hr)) { >- error_report("WHPX: Failed to set register %08x, hr=3D%08lx", re= g, hr); >- } >-} >- > static void whpx_get_global_reg(WHV_REGISTER_NAME reg, WHV_REGISTER_VALU= E *val) > { > struct whpx_state *whpx =3D &whpx_global;