On 3/31/25 20:15, Huacai Chen wrote:
# define TARGET_VIRT_ADDR_SPACE_BITS 32
#endif
#endif
-#ifdef CONFIG_USER_ONLY
#define TARGET_PAGE_BITS 12
-#else
-#define TARGET_PAGE_BITS_VARY
-#define TARGET_PAGE_BITS_MIN 12
-#endif
I'm a bit confused about TARGET_PAGE_BITS and other macros.
In my opinion, if we define TARGET_PAGE_BITS as 12, that means we only
support 4K pages. And if we define TARGET_PAGE_BITS_VARY and
TARGET_PAGE_BITS_MIN as 12, that means we support the minimum page as
4K, but we also support larger pages.
Am I wrong?
Yes.
TARGET_PAGE_BITS is a minimum value that is used by the memory subsystem for managing ram
and i/o. If variable, via TARGET_PAGE_BITS_VARY, this is set very early in qemu startup
and cannot be changed.
The page size for the mips cpu, like many others, may be changed at runtime. The page
size used at that point is reported to softmmu during tlb_fill.
The value of TARGET_PAGE_BITS must be the minimum supported by the cpu.
For Arm, the minimum for armv6 was 1k, then armv7 dropped support for tiny pages so the
minimum is 4k. At runtime, armv8 supports page sizes of 4k, 16k, and 64k.
For MIPS, ignoring those cpus which support 1k pages, the minimum is 4k.
r~