diff mbox series

[v3,30/48] exec-all: Widen tb_page_addr_t for user-only

Message ID 20230531040330.8950-31-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg: Build once for system, once for user | expand

Commit Message

Richard Henderson May 31, 2023, 4:03 a.m. UTC
This is a step toward making TranslationBlock agnostic
to the address size of the guest.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/exec/exec-all.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé June 2, 2023, 10:02 a.m. UTC | #1
On 31/5/23 06:03, Richard Henderson wrote:
> This is a step toward making TranslationBlock agnostic
> to the address size of the guest.

My understanding is tb_page_addr_t is QEMU internal, not exposed
to the guest, thus abi_ulong isn't required. It was a tiny memory
optimization we could do when abi_ulong is 32-bit. Therefore we
can widen the type, unifying/simplifying TB management on the host.
Is that correct? The patch is fine/safe but I'd like to correctly
understand :) Meanwhile:

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

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/exec/exec-all.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index 4d2b151986..0d00541aca 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -31,8 +31,8 @@
>      addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
>      type.  */
>   #if defined(CONFIG_USER_ONLY)
> -typedef abi_ulong tb_page_addr_t;
> -#define TB_PAGE_ADDR_FMT TARGET_ABI_FMT_lx
> +typedef vaddr tb_page_addr_t;
> +#define TB_PAGE_ADDR_FMT "%" VADDR_PRIx
>   #else
>   typedef ram_addr_t tb_page_addr_t;
>   #define TB_PAGE_ADDR_FMT RAM_ADDR_FMT
Richard Henderson June 3, 2023, 4:14 a.m. UTC | #2
On 6/2/23 03:02, Philippe Mathieu-Daudé wrote:
> On 31/5/23 06:03, Richard Henderson wrote:
>> This is a step toward making TranslationBlock agnostic
>> to the address size of the guest.
> 
> My understanding is tb_page_addr_t is QEMU internal, not exposed
> to the guest, thus abi_ulong isn't required. It was a tiny memory
> optimization we could do when abi_ulong is 32-bit. Therefore we
> can widen the type, unifying/simplifying TB management on the host.
> Is that correct?

Yes, exactly.


r~
diff mbox series

Patch

diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 4d2b151986..0d00541aca 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -31,8 +31,8 @@ 
    addresses in userspace mode.  Define tb_page_addr_t to be an appropriate
    type.  */
 #if defined(CONFIG_USER_ONLY)
-typedef abi_ulong tb_page_addr_t;
-#define TB_PAGE_ADDR_FMT TARGET_ABI_FMT_lx
+typedef vaddr tb_page_addr_t;
+#define TB_PAGE_ADDR_FMT "%" VADDR_PRIx
 #else
 typedef ram_addr_t tb_page_addr_t;
 #define TB_PAGE_ADDR_FMT RAM_ADDR_FMT