[PATCH 12/24] accel/tcg: Have tlb_vaddr_to_host() use vaddr type

Philippe Mathieu-Daudé posted 24 patches 1 week, 2 days ago
[PATCH 12/24] accel/tcg: Have tlb_vaddr_to_host() use vaddr type
Posted by Philippe Mathieu-Daudé 1 week, 2 days ago
abi_ptr is expected to be used in user emulation.
tlb_vaddr_to_host() uses it, but can be used in
system emulation. Replace the type by 'vaddr' which
is equivalent on user emulation but also works on
system.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/cpu_ldst.h | 3 ++-
 accel/tcg/cputlb.c      | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index a26ab49b0b..769e9fc440 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -67,6 +67,7 @@
 #endif
 
 #include "exec/memopidx.h"
+#include "exec/vaddr.h"
 #include "exec/abi_ptr.h"
 #include "exec/mmu-access-type.h"
 #include "qemu/int128.h"
@@ -330,7 +331,7 @@ static inline void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
     return g2h(env_cpu(env), addr);
 }
 #else
-void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
+void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr,
                         MMUAccessType access_type, int mmu_idx);
 #endif
 
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index b76a4eac4e..080cbcb34d 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1504,7 +1504,7 @@ void *probe_access(CPUArchState *env, vaddr addr, int size,
     return host;
 }
 
-void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
+void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr,
                         MMUAccessType access_type, int mmu_idx)
 {
     CPUTLBEntryFull *full;
-- 
2.45.2


Re: [PATCH 12/24] accel/tcg: Have tlb_vaddr_to_host() use vaddr type
Posted by Richard Henderson 1 week, 1 day ago
On 11/13/24 17:12, Philippe Mathieu-Daudé wrote:
> abi_ptr is expected to be used in user emulation.
> tlb_vaddr_to_host() uses it, but can be used in
> system emulation. Replace the type by 'vaddr' which
> is equivalent on user emulation but also works on
> system.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/cpu_ldst.h | 3 ++-
>   accel/tcg/cputlb.c      | 2 +-
>   2 files changed, 3 insertions(+), 2 deletions(-)

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


r~

Re: [PATCH 12/24] accel/tcg: Have tlb_vaddr_to_host() use vaddr type
Posted by Pierrick Bouvier 1 week, 2 days ago
On 11/13/24 17:12, Philippe Mathieu-Daudé wrote:
> abi_ptr is expected to be used in user emulation.
> tlb_vaddr_to_host() uses it, but can be used in
> system emulation. Replace the type by 'vaddr' which
> is equivalent on user emulation but also works on
> system.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/cpu_ldst.h | 3 ++-
>   accel/tcg/cputlb.c      | 2 +-
>   2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
> index a26ab49b0b..769e9fc440 100644
> --- a/include/exec/cpu_ldst.h
> +++ b/include/exec/cpu_ldst.h
> @@ -67,6 +67,7 @@
>   #endif
>   
>   #include "exec/memopidx.h"
> +#include "exec/vaddr.h"
>   #include "exec/abi_ptr.h"
>   #include "exec/mmu-access-type.h"
>   #include "qemu/int128.h"
> @@ -330,7 +331,7 @@ static inline void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
>       return g2h(env_cpu(env), addr);
>   }
>   #else
> -void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
> +void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr,
>                           MMUAccessType access_type, int mmu_idx);
>   #endif
>   
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index b76a4eac4e..080cbcb34d 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1504,7 +1504,7 @@ void *probe_access(CPUArchState *env, vaddr addr, int size,
>       return host;
>   }
>   
> -void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
> +void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr,
>                           MMUAccessType access_type, int mmu_idx)
>   {
>       CPUTLBEntryFull *full;

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>