How to run 16K page kernel with qemu
Hi all:
I am trying to run ARM64 16K kernel on qemu, but failed.
I run a narmal 4K kernel on qemu at first with following steps:
1. cloning latest linux code
2. using default config and build kernel
(wd: path where I cloned the linux code)
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j 16
3. run the built kernel with following command:
qemu-system-aarch64 -cpu cortex-a72 -m 4G -nographic \
-machine virt,usb=off,dump-guest-core=off,gic-version=2 \
-kernel arch/arm64/boot/ImageThe kernel can be booted successfully with above steps, but halt when trying to mount a rootfs, it does not matter to me.
Then I enabled CONFIG_ARM64_16K_PAGES then build the kernel again:
1. change the config and build again
sed -i 's/default ARM64_4K_PAGES/default ARM64_16K_PAGES/' arch/arm64/Kconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j 16
2. run the built kernel with following command:
qemu-system-aarch64 -cpu cortex-a72 -m 4G -nographic \
-machine virt,usb=off,dump-guest-core=off,gic-version=2 \
-kernel arch/arm64/boot/ImageBut I failed to boot the 16K kernel, no log printed.
Following is some related config:
CONFIG_ARM64=yCONFIG_ARM64_PAGE_SHIFT=14CONFIG_ARM64_CONT_PTE_SHIFT=7CONFIG_ARM64_CONT_PMD_SHIFT=5CONFIG_ARM64_VA_BITS_48=yCONFIG_ARM64_VA_BITS=48CONFIG_PGTABLE_LEVELS=4
Is anyone help to point out how to run ARM64 16K pages kernel? Or is there any doc about it? Did I miss any critical changes?
Thanks.
Quoted 2 lines · Wenchao Hao
Is anyone help to point out how to run ARM64 16K pages kernel? Or is there any doc about it? Did I miss any critical changes?
Your command lines indicate you want a Cortex A72. Cortex A72 supports 4K, 64K and 1M page sizes. It doesn't support 16K page sizes.
Therefore, a 16K page sized kernel will not boot on Cortex A72.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Quoted 9 lines · Russell King (Oracle)
Quoted 2 lines · Wenchao Hao
Is anyone help to point out how to run ARM64 16K pages kernel? Or is there any doc about it? Did I miss any critical changes?
Your command lines indicate you want a Cortex A72. Cortex A72 supports 4K, 64K and 1M page sizes. It doesn't support 16K page sizes.
Therefore, a 16K page sized kernel will not boot on Cortex A72.
Thanks a lot for your reply, which ARM core support 16K page size? Where can I find these support info?
Quoted 5 lines · Wenchao Hao
Quoted 4 lines · Russell King (Oracle)
Quoted 2 lines · Wenchao Hao
Is anyone help to point out how to run ARM64 16K pages kernel? Or is there any doc about it? Did I miss any critical changes?
Quoted 8 lines
Quoted 5 lines
Your command lines indicate you want a Cortex A72. Cortex A72 supports 4K, 64K and 1M page sizes. It doesn't support 16K page sizes.
Therefore, a 16K page sized kernel will not boot on Cortex A72.
Thanks a lot for your reply, which ARM core support 16K page size? Where can I find these support info?
Per ARM DDI 0487K.a, ID_AA64MMFR0_EL1.TGran16 (bits [23:20]) indicates support for 16KB memory translation granule size. You can find the specific value of TGran16 filed in Cortex A72's TRM [*].
Since you are using QEMU's tcg accelerator, you can have a look at the aarch64_cpus[] array in target/arm/tcg/cpu64.c to understand how QEMU exposes these feature ID registers to guests.
And if your HW supports 16KB granule size, you can *alternatively* expose it for guests by putting '-cpu host -accel kvm' parameter in your QEMU command line (if you're running things on a KVM host).
[*] https://developer.arm.com/documentation/100095/latest/
Thanks,
Zenghui