From e819c126a8d9629f57deef31689f3a7fc476fa45 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Tue, 30 Jun 2026 15:56:04 +0800 Subject: [PATCH] target/loongarch: Enable TARGET_PAGE_BITS_VARY for loongarch64 user-only Hard coding PAGE_SIZE to 4K will prevent user-only emulation from working on hosts with 16K page size. Fixes: 1d832c19db1e ("target/loongarch: Support 4K page size") Fixes: qemu-project/qemu#3651 Signed-off-by: Miao Wang Reviewed-by: Song Gao Message-ID: <20260630-loong64-vary-page-sz-v1-1-1d1a894674be@gmail.com> Signed-off-by: Song Gao --- target/loongarch/cpu-param.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/loongarch/cpu-param.h b/target/loongarch/cpu-param.h index 3bcf77b375..6abe72ff5c 100644 --- a/target/loongarch/cpu-param.h +++ b/target/loongarch/cpu-param.h @@ -10,6 +10,11 @@ #define TARGET_VIRT_ADDR_SPACE_BITS 48 -#define TARGET_PAGE_BITS 12 +#ifdef CONFIG_USER_ONLY +/* Allow user-only to vary page size from 4k */ +# define TARGET_PAGE_BITS_VARY +#else +# define TARGET_PAGE_BITS 12 +#endif #endif