Skip to contentSkip to conversation

configs/qemu: Add a ppc64le-powernv configuration

PATCH Applied Cédric Le Goater 2 participants 10 messages Nov 12, 2021 – Dec 29, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 configs/qemu: Add a ppc64le-powernv configuration

PowerNV (as Non-Virtualized) is the "baremetal" platform using the OPAL [1] firmware. It runs Linux on IBM and OpenPOWER systems and can be used as an hypervisor OS, running KVM guests, or simply as a host OS. OPAL includes a Linux kernel and a buildroot rootfs which acts as a bootloader [2] for the various systems installed on disks.

Since QEMU provides PowerNV machines for POWER8-10 processors [3], add a new qemu_ppc64le_powernv board to buildroot.

[1] https://github.com/open-power/skiboot/blob/master/doc/overview.rst
[2] https://github.com/open-power/petitboot/
[3] https://qemu.readthedocs.io/en/latest/system/ppc/powernv.html

---
 board/qemu/ppc64le-powernv/readme.txt  |  5 +++++
 configs/qemu_ppc64le_powernv_defconfig | 29 ++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 board/qemu/ppc64le-powernv/readme.txt
 create mode 100644 configs/qemu_ppc64le_powernv_defconfig
board/qemu/ppc64le-powernv/readme.txt new file +5 -0
new file mode 100644
index 000000000000..ee102a3d6846
@@ -0,0 +1,5 @@
+Run the emulation with:
+
+qemu-system-ppc64 -M powernv9 -kernel vmlinux -append "console=hvc0 rootwait root=/dev/nvme0n1" -device nvme,bus=pcie.3,addr=0x0,drive=drive0,serial=1234 -drive file=./rootfs.ext2,if=none,id=drive0,format=raw,cache=none -device e1000e,netdev=net0,mac=C0:FF:EE:00:01:03,bus=pcie.1,addr=0x0  -netdev user,id=net0 -serial mon:stdio -nographic # qemu_ppc64le_powernv_defconfig
+
+The login prompt will appear in the terminal window.
configs/qemu_ppc64le_powernv_defconfig new file +29 -0
new file mode 100644
index 000000000000..d8ea6655fce0
@@ -0,0 +1,29 @@
+# Architecture
+BR2_powerpc64le=y
+BR2_powerpc_power8=y
+
+# System
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_SYSTEM_DHCP="eth0"
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
+# Linux headers same as kernel
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15"
+BR2_LINUX_KERNEL_DEFCONFIG="powernv"
+BR2_LINUX_KERNEL_VMLINUX=y
+
+# host-qemu for gitlab testing
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/3 configs/qemu_ppc64_e5500: Enable dhcp on network interface

Add a virtio-net-pci device with a user mode host network backend

---
 board/qemu/ppc64-e5500/readme.txt  | 2 +-
 configs/qemu_ppc64_e5500_defconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
board/qemu/ppc64-e5500/readme.txt +1 -1
index 61d51f7f4dd0..7c8c80af4458 100644
@@ -1,5 +1,5 @@
 Run the emulation with:
 
- qemu-system-ppc64 -M ppce500 -cpu e5500 -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic # qemu_ppc64_e5500_defconfig
+ qemu-system-ppc64 -M ppce500 -cpu e5500 -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -net nic,model=virtio-net-pci -net user -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic # qemu_ppc64_e5500_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
configs/qemu_ppc64_e5500_defconfig +2 -1
index 286d79a26b6d..09aac502522b 100644
@@ -2,7 +2,8 @@
 BR2_powerpc64=y
 BR2_powerpc_e5500=y
 
-# Serial port config
+# System
+BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 
 # Image
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/3] configs/qemu_ppc64_e5500: Enable dhcp on network interface

Quoted 7 lines · On Fri, 12 Nov 2021 17:04:12 +0100 Cédric Le Goater <[email protected]> wrote:

Add a virtio-net-pci device with a user mode host network backend

---
 board/qemu/ppc64-e5500/readme.txt  | 2 +-
 configs/qemu_ppc64_e5500_defconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH 3/3 configs/qemu_ppc_e500mc: Enable dhcp on network interface

In reply to Cédric Le Goater

Add a virtio-net-pci device with a user mode host network backend

---
 board/qemu/ppc-e500mc/readme.txt  | 2 +-
 configs/qemu_ppc_e500mc_defconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
board/qemu/ppc-e500mc/readme.txt +1 -1
index 77a864ed2bf3..76bad015d2d5 100644
@@ -1,5 +1,5 @@
 Run the emulation with:
 
- qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic # qemu_ppc_e500mc_defconfig
+ qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -net nic,model=virtio-net-pci -net user -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic # qemu_ppc_e500mc_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
configs/qemu_ppc_e500mc_defconfig +2 -1
index 1a5b1e3c2c83..232bc1f70c69 100644
@@ -2,7 +2,8 @@
 BR2_powerpc=y
 BR2_powerpc_e500mc=y
 
-# Serial port config
+# System
+BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 
 # Image
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 3/3] configs/qemu_ppc_e500mc: Enable dhcp on network interface

Quoted 8 lines · On Fri, 12 Nov 2021 17:04:13 +0100 Cédric Le Goater <[email protected]> wrote:

Add a virtio-net-pci device with a user mode host network backend

---
 board/qemu/ppc-e500mc/readme.txt  | 2 +-
 configs/qemu_ppc_e500mc_defconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Cédric Le Goater

Hello Cédric,

Quoted 5 lines · On Fri, 12 Nov 2021 17:04:11 +0100 Cédric Le Goater <[email protected]> wrote:

PowerNV (as Non-Virtualized) is the "baremetal" platform using the OPAL [1] firmware. It runs Linux on IBM and OpenPOWER systems and can be used as an hypervisor OS, running KVM guests, or simply as a host OS. OPAL includes a Linux kernel and a buildroot rootfs which acts as a bootloader [2] for the various systems installed on disks.

For the person not familiar with all this OpenPOWER stuff, it's very complex to understand all these firmware, virtualized stuff, hypervisor, etc.

board/qemu/ppc64le-powernv/readme.txt line 3

Quoted 9 lines
board/qemu/ppc64le-powernv/readme.txt new file +3 -0
new file mode 100644
index 000000000000..ee102a3d6846
@@ -0,0 +1,5 @@
+Run the emulation with:
+
+qemu-system-ppc64 -M powernv9 -kernel vmlinux -append "console=hvc0 rootwait root=/dev/nvme0n1" -device nvme,bus=pcie.3,addr=0x0,drive=drive0,serial=1234 -drive file=./rootfs.ext2,if=none,id=drive0,format=raw,cache=none -device e1000e,netdev=net0,mac=C0:FF:EE:00:01:03,bus=pcie.1,addr=0x0  -netdev user,id=net0 -serial mon:stdio -nographic # qemu_ppc64le_powernv_defconfig

You're emulating a powernv9, so we assume based on the Power9 processor.

board/qemu/ppc64le-powernv/readme.txt line 3

Quoted 4 lines
board/qemu/ppc64le-powernv/readme.txt new file +3 -0
@@ -0,0 +1,29 @@
+# Architecture
+BR2_powerpc64le=y
+BR2_powerpc_power8=y

But you're targeting Power8.

Could you clarify?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Hello Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello Cédric,

Quoted 5 lines · On Fri, 12 Nov 2021 17:04:11 +0100 Cédric Le Goater <[email protected]> wrote:

PowerNV (as Non-Virtualized) is the "baremetal" platform using the OPAL [1] firmware. It runs Linux on IBM and OpenPOWER systems and can be used as an hypervisor OS, running KVM guests, or simply as a host OS. OPAL includes a Linux kernel and a buildroot rootfs which acts as a bootloader [2] for the various systems installed on disks.

Quoted 3 lines

For the person not familiar with all this OpenPOWER stuff, it's very complex to understand all these firmware, virtualized stuff, hypervisor, etc.

Let's try differently,

On these systems, the FW is comparable to U-Boot as it loads kernel and initramfs images from flash. The initramfs is a buildroot environment which includes the petitboot [*] boot loader. This second boot loader does the device discovery and kexecs a new Linux image from disk or network.

What we care about here is only the first level which uses the buildroot image. petitboot is another topic.

As for QEMU, it implements 3 machines POWER8, POWER9 and Power10 processors that we use for dev and tests. I have chosen in the QEMU script to boot directly from a nvme disk because it is simple enough but using a ramfs would be closer to reality.

The hypervisor part is simply a feature of this Linux PPC platform, that is called PowerNV.

[*] https://github.com/open-power/petitboot/

Quoted 12 lines

board/qemu/ppc64le-powernv/readme.txt line 3

Quoted 9 lines
board/qemu/ppc64le-powernv/readme.txt new file +3 -0
new file mode 100644
index 000000000000..ee102a3d6846
@@ -0,0 +1,5 @@
+Run the emulation with:
+
+qemu-system-ppc64 -M powernv9 -kernel vmlinux -append "console=hvc0 rootwait root=/dev/nvme0n1" -device nvme,bus=pcie.3,addr=0x0,drive=drive0,serial=1234 -drive file=./rootfs.ext2,if=none,id=drive0,format=raw,cache=none -device e1000e,netdev=net0,mac=C0:FF:EE:00:01:03,bus=pcie.1,addr=0x0  -netdev user,id=net0 -serial mon:stdio -nographic # qemu_ppc64le_powernv_defconfig

You're emulating a powernv9, so we assume based on the Power9 processor.

Quoted 6 lines

board/qemu/ppc64le-powernv/readme.txt line 3

Quoted 4 lines
board/qemu/ppc64le-powernv/readme.txt new file +3 -0
@@ -0,0 +1,29 @@
+# Architecture
+BR2_powerpc64le=y
+BR2_powerpc_power8=y

But you're targeting Power8.

yes

Quoted 1 line

Could you clarify?

because the same image can be used for the QEMU machine implementing the POWER8 processor, which also works for POWER9 and Power10. Thanks,

C.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

Hello Cédric,

Quoted 16 lines · On Tue, 28 Dec 2021 23:50:29 +0100 Cédric Le Goater <[email protected]> wrote:

Let's try differently,

On these systems, the FW is comparable to U-Boot as it loads kernel and initramfs images from flash. The initramfs is a buildroot environment which includes the petitboot [*] boot loader. This second boot loader does the device discovery and kexecs a new Linux image from disk or network.

What we care about here is only the first level which uses the buildroot image. petitboot is another topic.

As for QEMU, it implements 3 machines POWER8, POWER9 and Power10 processors that we use for dev and tests. I have chosen in the QEMU script to boot directly from a nvme disk because it is simple enough but using a ramfs would be closer to reality.

Quoted 4 lines

The hypervisor part is simply a feature of this Linux PPC platform, that is called PowerNV.

[*] https://github.com/open-power/petitboot/

Thanks for the additional explanations!

Quoted 4 lines
Quoted 1 line

Could you clarify?

because the same image can be used for the QEMU machine implementing the POWER8 processor, which also works for POWER9 and Power10.

So why don't we test it with -M powernv8 ?

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Hello Thomas,

Quoted 4 lines
Quoted 2 lines

because the same image can be used for the QEMU machine implementing the POWER8 processor, which also works for POWER9 and Power10.

So why don't we test it with -M powernv8 ?

Sure. Would you rather have a ppc64le-powernv8 and a ppc64le-powernv9 config instead ?

I have a few other patches adding similar boards for 44x CPUs. I can resend a v2 for the whole.

What's the process to bump the QEMU version ?

Thanks,

C.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw

Hello Cédric,

Quoted 7 lines · On Wed, 29 Dec 2021 15:01:30 +0100 Cédric Le Goater <[email protected]> wrote:
Quoted 4 lines
Quoted 2 lines

because the same image can be used for the QEMU machine implementing the POWER8 processor, which also works for POWER9 and Power10.

So why don't we test it with -M powernv8 ?

Sure. Would you rather have a ppc64le-powernv8 and a ppc64le-powernv9 config instead ?

In the interest of not growing too much the number of defconfigs, I would perhaps suggest to have just a powernv8 configuration, and in its readme.txt file, indicate that it can be similarly used on powerpcnv9.

Quoted 2 lines

I have a few other patches adding similar boards for 44x CPUs. I can resend a v2 for the whole.

Sounds useful.

Quoted 1 line

What's the process to bump the QEMU version ?

Send a patch against the package/qemu/ package, it's as simple as that. Ideally, when you do that, make sure to retest all the Qemu defconfigs, to ensure they continue to boot well under the new Qemu version. You can use Gitlab CI to automate this testing.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot