Skip to content

PowerNV

Cédric Le Goater edited this page Oct 9, 2019 · 12 revisions

Quick how to run a PowerNV QEMU guest

PowerNV (as Non-Virtualized) is the "baremetal" platform using the OPAL firmware. It runs Linux on IBM and OpenPOWER systems and it can be used as an hypervisor OS, running KVM guests, or simply as a host OS.

This QEMU machine is mostly used to develop skiboot, a component of OPAL, and is also part of a non-regression testsuite. It is used for distro development, especially when you can't access real hardware to test your code on the host.

GitHub branches

clone and compile :

https://github.com/legoater/qemu/tree/powernv-4.2	(stable branch)

Firmware images

to boot a P8, get the palmetto skiroot kernel and rootfs. You can find the images on the OpenPOWER build site at :

https://openpower.xyz/job/openpower/job/openpower-op-build/label=slave,target=palmetto/lastSuccessfulBuild/

or use these OpenPOWER palmetto v1.20 images zImage.epapr and rootfs.cpio.xz files.

For P9, grab the witherspoon images at :

https://openpower.xyz/job/openpower/job/openpower-op-build/label=slave,target=witherspoon/lastSuccessfulBuild/

Running QEMU

Getting started

Here is a simple setup with one NIC :

qemu-system-ppc64 -m 2G -machine powernv \
        -cpu POWER8 -smp 2,cores=2,threads=1 -accel tcg,thread=multi \
	-device e1000,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0 \
	-netdev user,id=net0,hostfwd=::20022-:22,hostname=pnv \
	-kernel ./zImage.epapr  \
	-initrd ./rootfs.cpio.xz \
	-nographic

BMC simulator configuration

OpenPOWER systems negotiate the shutdown and reboot with their BMC. To get that working under QEMU, you will need to add an IPMI BMC simulator using the BT interface :

  -device ipmi-bmc-sim,sdrfile=./palmetto-SDR.bin,fruareasize=256,frudatafile=./palmetto-FRU.bin,id=bmc0 \
  -device isa-ipmi-bt,bmc=bmc0,irq=10 \

The files palmetto-SDR.bin and palmetto-FRU.bin define a Sensor Data Record repository and a Field Replaceable Unit inventory for the BMC simulator used in QEMU. These are optional.

Complex configuration

Lately, the PHB (PCI Host Bridge) model got a serious refresh to fit QEMU's best practices. Three PHBs are initialized per chip but no default PCI layout is provided (This is to be compatible with libvirt). One PCI device can be added on any of the available PCIe slots using command line options such as :

  -device e1000,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0
  -netdev bridge,id=net0,helper=/usr/libexec/qemu-bridge-helper,br=virbr0,id=hostnet0

  -device megasas,id=scsi0,bus=pcie.0,addr=0x0
  -drive file=$disk,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none
  -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=2

Here is a full example with two different storage controllers on different PHBs, each with a disk, the second PHB is empty :

qemu-system-ppc64 -m 2G -machine powernv \
  -cpu POWER8 -smp 2,cores=2,threads=1 -accel tcg,thread=multi \
  -kernel ./zImage.epapr -initrd ./rootfs.cpio.xz -bios ./skiboot.lid \
  \
  -device megasas,id=scsi0,bus=pcie.0,addr=0x0 \
  -drive file=./rhel7-ppc64le.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none \
  -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=2 \
  \
  -device pcie-pci-bridge,id=pcie.3,bus=pcie.1,addr=0x0 \
  \
  -device ich9-ahci,id=sata0,bus=pcie.3,addr=0x1 \
  -drive file=./ubuntu-ppc64le.qcow2,if=none,id=drive0,format=qcow2,cache=none \
  -device ide-hd,bus=sata0.0,unit=0,drive=drive0,id=ide,bootindex=1 \
  -device e1000,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.3,addr=0x2 \
  -netdev bridge,helper=/usr/libexec/qemu-bridge-helper,br=virbr0,id=net0 \
  -device nec-usb-xhci,bus=pcie.3,addr=0x7 \
  \
  -device ipmi-bmc-sim,sdrfile=./palmetto-SDR.bin,fruareasize=256,frudatafile=./palmetto-FRU.bin,id=bmc0 \
  -device isa-ipmi-bt,bmc=bmc0,irq=10 \
  \
  -drive file=./palmetto.pnor,format=raw,if=mtd \
  \
  -serial mon:stdio -nographic -nodefaults


NVRAM

Models for the SIO and LPC2AHB device of the Aspeed SoC were recently plugged into the PowerNV machine, use a mtd drive to add a PNOR to the machine (and get a NVRAM) :

-drive file=./palmetto.pnor,format=raw,if=mtd

Contacts

Please send questions, comments, patches to the QEMU PPC devel list qemu-ppc@nongnu.org, the QEMU devel list qemu-devel@nongnu.org and Cédric Le Goater clg@kaod.org

Clone this wiki locally
You can’t perform that action at this time.