DISCLAIMER: KVM in this context is not to be confused with PowerKVM or any of IBM's other virtualization products which require licensing!
Introducion
Hosting KVM guests is by and large the same as you'd see it done on x86_64, however there are a few prerequisites as well as quirks you'll have to manuallly apply depending on your particular system.
Below short guides have been written with running ArchPOWER on a dual socket (POWER8E / SMT8) IBM S822L, linux-6.12
, qemu-9.2.0
as well as libvirt-10.9.0
in mind. Your mileage may vary with different combinations of the above.
Run Opal not PowerKVM firmware
Should you run PowerKVM, switch to Opal first. This will disbale the built-in hypervisor which you cannot run regular KVM on. However, you can now also not run any LPAR anymore.
Disable SMT & define CPU topology
qemu-system-ppc64{,le}
will refuse to function with -enable-kvm
should you leave SMT enabled. It can be switched off like so:
ppc64_cpu --smt=off
This of course is a shame but you can utilize SMT inside a VM again, by defining the CPU topology explicity like so in XML:
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>POWER8</model>
<topology sockets='1' dies='1' clusters='1' cores='1' threads='8'/>
</cpu>
<vcpu placement='static'>8</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='0'/>
<vcpupin vcpu='1' cpuset='0'/>
<vcpupin vcpu='2' cpuset='0'/>
<vcpupin vcpu='3' cpuset='0'/>
<vcpupin vcpu='4' cpuset='0'/>
<vcpupin vcpu='5' cpuset='0'/>
<vcpupin vcpu='6' cpuset='0'/>
<vcpupin vcpu='7' cpuset='0'/>
</cputune>
It is vital that you pin all vCPU
to the respective core of your host's CPU. In this example we use core 0
. After disabling SMT you can identify the usable cores by looking at the remaining On-line CPU(s) list
in the output of lscpu
:
[user@archpower ~]$ lscpu | grep 'On-line CPU'
On-line CPU(s) list: 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152
Varying page sizes
It is recommended to run a 64K page-size kernel on the host, which will give you the freedom to run either 4K or 64K guests. However, if you want to run a 4K guest you may still want the following in your XML:
<os>
<type arch='ppc64' machine='pseries'>hvm</type>
</os>
<features>
<hpt>
<maxpagesize unit='KiB'>4</maxpagesize>
</hpt>
<ccf-assist state='off'/>
</features>