[PATCH 1/2] include: Don't include guest-host.h in cpu-ldst.h

Peter Maydell posted 2 patches 2 days, 13 hours ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Laurent Vivier <laurent@vivier.eu>, Pierrick Bouvier <pierrick.bouvier@linaro.org>
[PATCH 1/2] include: Don't include guest-host.h in cpu-ldst.h
Posted by Peter Maydell 2 days, 13 hours ago
We currently include user/guest-host.h from accel/tcg/cpu-ldst.h.
However that file doesn't need anything from guest-host.h, since we
removed the uses of g2h() in commit 9b74d403b30e ("accel/tcg: Move
user-only tlb_vaddr_to_host out of line").

Move the include of guest-host.h to where it's actually needed.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This isn't needed for the following bugfix patch, but it made
it a bit easier for me to understand where we're actually using
the functions.
---
 bsd-user/qemu.h              | 1 +
 include/accel/tcg/cpu-ldst.h | 4 ----
 linux-user/qemu.h            | 1 +
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 2c586e546f..b0b2c249fb 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -27,6 +27,7 @@
 #include "user/abitypes.h"
 #include "user/cpu_loop.h"
 #include "user/page-protection.h"
+#include "user/guest-host.h"
 
 extern char **environ;
 
diff --git a/include/accel/tcg/cpu-ldst.h b/include/accel/tcg/cpu-ldst.h
index a5711bc15a..ea2cbf40fe 100644
--- a/include/accel/tcg/cpu-ldst.h
+++ b/include/accel/tcg/cpu-ldst.h
@@ -71,10 +71,6 @@
 #include "accel/tcg/cpu-mmu-index.h"
 #include "exec/abi_ptr.h"
 
-#if defined(CONFIG_USER_ONLY)
-#include "user/guest-host.h"
-#endif /* CONFIG_USER_ONLY */
-
 static inline uint32_t
 cpu_ldub_mmuidx_ra(CPUArchState *env, abi_ptr addr, int mmu_idx, uintptr_t ra)
 {
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 85e68eff7b..cfe5f45fc4 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -10,6 +10,7 @@
 #include "syscall_defs.h"
 #include "target_syscall.h"
 #include "accel/tcg/vcpu-state.h"
+#include "user/guest-host.h"
 
 /*
  * This is the size of the host kernel's sigset_t, needed where we make
-- 
2.43.0
Re: [PATCH 1/2] include: Don't include guest-host.h in cpu-ldst.h
Posted by Philippe Mathieu-Daudé 1 day, 10 hours ago
On 30/3/26 16:31, Peter Maydell wrote:
> We currently include user/guest-host.h from accel/tcg/cpu-ldst.h.
> However that file doesn't need anything from guest-host.h, since we
> removed the uses of g2h() in commit 9b74d403b30e ("accel/tcg: Move
> user-only tlb_vaddr_to_host out of line").
> 
> Move the include of guest-host.h to where it's actually needed.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This isn't needed for the following bugfix patch, but it made
> it a bit easier for me to understand where we're actually using
> the functions.
> ---
>   bsd-user/qemu.h              | 1 +
>   include/accel/tcg/cpu-ldst.h | 4 ----
>   linux-user/qemu.h            | 1 +
>   3 files changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Re: [PATCH 1/2] include: Don't include guest-host.h in cpu-ldst.h
Posted by Richard Henderson 1 day, 21 hours ago
On 3/31/26 00:31, Peter Maydell wrote:
> We currently include user/guest-host.h from accel/tcg/cpu-ldst.h.
> However that file doesn't need anything from guest-host.h, since we
> removed the uses of g2h() in commit 9b74d403b30e ("accel/tcg: Move
> user-only tlb_vaddr_to_host out of line").
> 
> Move the include of guest-host.h to where it's actually needed.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
> This isn't needed for the following bugfix patch, but it made
> it a bit easier for me to understand where we're actually using
> the functions.
> ---
>   bsd-user/qemu.h              | 1 +
>   include/accel/tcg/cpu-ldst.h | 4 ----
>   linux-user/qemu.h            | 1 +
>   3 files changed, 2 insertions(+), 4 deletions(-)

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

r~
Re: [PATCH 1/2] include: Don't include guest-host.h in cpu-ldst.h
Posted by Laurent Vivier 2 days, 13 hours ago
Le 30/03/2026 à 16:31, Peter Maydell a écrit :
> We currently include user/guest-host.h from accel/tcg/cpu-ldst.h.
> However that file doesn't need anything from guest-host.h, since we
> removed the uses of g2h() in commit 9b74d403b30e ("accel/tcg: Move
> user-only tlb_vaddr_to_host out of line").
> 
> Move the include of guest-host.h to where it's actually needed.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This isn't needed for the following bugfix patch, but it made
> it a bit easier for me to understand where we're actually using
> the functions.
> ---
>   bsd-user/qemu.h              | 1 +
>   include/accel/tcg/cpu-ldst.h | 4 ----
>   linux-user/qemu.h            | 1 +
>   3 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> index 2c586e546f..b0b2c249fb 100644
> --- a/bsd-user/qemu.h
> +++ b/bsd-user/qemu.h
> @@ -27,6 +27,7 @@
>   #include "user/abitypes.h"
>   #include "user/cpu_loop.h"
>   #include "user/page-protection.h"
> +#include "user/guest-host.h"
>   
>   extern char **environ;
>   
> diff --git a/include/accel/tcg/cpu-ldst.h b/include/accel/tcg/cpu-ldst.h
> index a5711bc15a..ea2cbf40fe 100644
> --- a/include/accel/tcg/cpu-ldst.h
> +++ b/include/accel/tcg/cpu-ldst.h
> @@ -71,10 +71,6 @@
>   #include "accel/tcg/cpu-mmu-index.h"
>   #include "exec/abi_ptr.h"
>   
> -#if defined(CONFIG_USER_ONLY)
> -#include "user/guest-host.h"
> -#endif /* CONFIG_USER_ONLY */
> -
>   static inline uint32_t
>   cpu_ldub_mmuidx_ra(CPUArchState *env, abi_ptr addr, int mmu_idx, uintptr_t ra)
>   {
> diff --git a/linux-user/qemu.h b/linux-user/qemu.h
> index 85e68eff7b..cfe5f45fc4 100644
> --- a/linux-user/qemu.h
> +++ b/linux-user/qemu.h
> @@ -10,6 +10,7 @@
>   #include "syscall_defs.h"
>   #include "target_syscall.h"
>   #include "accel/tcg/vcpu-state.h"
> +#include "user/guest-host.h"
>   
>   /*
>    * This is the size of the host kernel's sigset_t, needed where we make

Reviewed-by: Laurent Vivier <laurent@vivier.eu>