[PATCH] target/sparc: Enable variable page size for user-only

Richard Henderson posted 1 patch 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260912102250.597582-1-richard.henderson@linaro.org
Maintainers: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
There is a newer version of this series
target/sparc/cpu-param.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH] target/sparc: Enable variable page size for user-only
Posted by Richard Henderson 2 weeks ago
Sparc v8 has 4k pages, while Sparc v9 has 8k pages.  Because of this,
userland does not assumed a fixed page size (at least true for glibc
and musl).  Allowing the guest to follow the host page size avoids
a variety of emulation problems.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/sparc/cpu-param.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/sparc/cpu-param.h b/target/sparc/cpu-param.h
index 7ec4ac84dbb..72aa89bf66a 100644
--- a/target/sparc/cpu-param.h
+++ b/target/sparc/cpu-param.h
@@ -8,7 +8,11 @@
 #define SPARC_CPU_PARAM_H
 
 #ifdef TARGET_SPARC64
-# define TARGET_PAGE_BITS 13 /* 8k */
+# ifdef CONFIG_USER_ONLY
+#  define TARGET_PAGE_BITS_VARY
+# else
+#  define TARGET_PAGE_BITS 13 /* 8k */
+# endif
 # ifdef TARGET_ABI32
 #  define TARGET_VIRT_ADDR_SPACE_BITS 32
 # else
-- 
2.53.0
Re: [PATCH] target/sparc: Enable variable page size for user-only
Posted by Richard Henderson 2 weeks ago
On 9/12/26 00:22, Richard Henderson wrote:
> Sparc v8 has 4k pages, while Sparc v9 has 8k pages.  Because of this,
> userland does not assumed a fixed page size (at least true for glibc
> and musl).  Allowing the guest to follow the host page size avoids
> a variety of emulation problems.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/sparc/cpu-param.h | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/target/sparc/cpu-param.h b/target/sparc/cpu-param.h
> index 7ec4ac84dbb..72aa89bf66a 100644
> --- a/target/sparc/cpu-param.h
> +++ b/target/sparc/cpu-param.h
> @@ -8,7 +8,11 @@
>   #define SPARC_CPU_PARAM_H
>   
>   #ifdef TARGET_SPARC64
> -# define TARGET_PAGE_BITS 13 /* 8k */
> +# ifdef CONFIG_USER_ONLY
> +#  define TARGET_PAGE_BITS_VARY
> +# else
> +#  define TARGET_PAGE_BITS 13 /* 8k */
> +# endif
>   # ifdef TARGET_ABI32
>   #  define TARGET_VIRT_ADDR_SPACE_BITS 32
>   # else

Even better to reorg this so that it applies to sparc32 as well as 
sparc64; v2 tomorrow....

r~
Re: [PATCH] target/sparc: Enable variable page size for user-only
Posted by Helge Deller 2 weeks ago
On 9/12/26 12:22, Richard Henderson wrote:
> Sparc v8 has 4k pages, while Sparc v9 has 8k pages.  Because of this,
> userland does not assumed a fixed page size (at least true for glibc
> and musl).  Allowing the guest to follow the host page size avoids
> a variety of emulation problems.

True!

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

Reviewed-by: Helge Deller <deller@gmx.de>