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

Richard Henderson posted 48 patches 2 years, 8 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Brian Cain <bcain@quicinc.com>, Alessandro Di Federico <ale@rev.ng>, Anton Johansson <anjo@rev.ng>, Eduardo Habkost <eduardo@habkost.net>, Song Gao <gaosong@loongson.cn>, Xiaojuan Yang <yangxiaojuan@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Stafford Horne <shorne@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liweiwei@iscas.ac.cn>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>, WANG Xuerui <git@xen0n.name>, Huacai Chen <chenhuacai@kernel.org>, Stefan Weil <sw@weilnetz.de>
[PATCH v3 30/48] exec-all: Widen tb_page_addr_t for user-only
Posted by Richard Henderson 2 years, 8 months ago
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(-)

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
-- 
2.34.1
Re: [PATCH v3 30/48] exec-all: Widen tb_page_addr_t for user-only
Posted by Philippe Mathieu-Daudé 2 years, 8 months ago
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


Re: [PATCH v3 30/48] exec-all: Widen tb_page_addr_t for user-only
Posted by Richard Henderson 2 years, 8 months ago
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~