linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [QUESTION] How to run 16K page kernel with qemu
@ 2024-09-21 10:31 Wenchao Hao
  2024-09-21 10:48 ` Russell King (Oracle)
  0 siblings, 1 reply; 4+ messages in thread
From: Wenchao Hao @ 2024-09-21 10:31 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, linux-arm-kernel; +Cc: haowenchao22

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/Image
The 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/Image
But I failed to boot the 16K kernel, no log printed.

Following is some related config:

CONFIG_ARM64=y
CONFIG_ARM64_PAGE_SHIFT=14
CONFIG_ARM64_CONT_PTE_SHIFT=7
CONFIG_ARM64_CONT_PMD_SHIFT=5
CONFIG_ARM64_VA_BITS_48=y
CONFIG_ARM64_VA_BITS=48
CONFIG_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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] How to run 16K page kernel with qemu
  2024-09-21 10:31 [QUESTION] How to run 16K page kernel with qemu Wenchao Hao
@ 2024-09-21 10:48 ` Russell King (Oracle)
  2024-09-21 10:55   ` Wenchao Hao
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King (Oracle) @ 2024-09-21 10:48 UTC (permalink / raw)
  To: Wenchao Hao; +Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, haowenchao22

On Sat, Sep 21, 2024 at 06:31:49PM +0800, Wenchao Hao wrote:
> 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.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] How to run 16K page kernel with qemu
  2024-09-21 10:48 ` Russell King (Oracle)
@ 2024-09-21 10:55   ` Wenchao Hao
  2024-09-28 10:12     ` Zenghui Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Wenchao Hao @ 2024-09-21 10:55 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, haowenchao22

On 2024/9/21 18:48, Russell King (Oracle) wrote:
> On Sat, Sep 21, 2024 at 06:31:49PM +0800, Wenchao Hao wrote:
>> 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?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [QUESTION] How to run 16K page kernel with qemu
  2024-09-21 10:55   ` Wenchao Hao
@ 2024-09-28 10:12     ` Zenghui Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Zenghui Yu @ 2024-09-28 10:12 UTC (permalink / raw)
  To: Wenchao Hao
  Cc: Russell King (Oracle), Catalin Marinas, Will Deacon,
	linux-arm-kernel, haowenchao22

On 2024/9/21 18:55, Wenchao Hao wrote:
> On 2024/9/21 18:48, Russell King (Oracle) wrote:
> > On Sat, Sep 21, 2024 at 06:31:49PM +0800, Wenchao Hao wrote:
> > > 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?

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-28 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-21 10:31 [QUESTION] How to run 16K page kernel with qemu Wenchao Hao
2024-09-21 10:48 ` Russell King (Oracle)
2024-09-21 10:55   ` Wenchao Hao
2024-09-28 10:12     ` Zenghui Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).