VM Management with Libvirt and Virsh
Qualcomm platforms use Libvirt and Virsh for guest VM lifecycle management. Domain XML files define the VM configuration and are passed tovirsh to create, start, and manage VMs.
Setup Steps
1. Enable libvirt daemons
2. Switch firewall backend to nftables
Theip_tables module is incompatible with PREEMPT_RT (its dependency NETFILTER_XTABLES_LEGACY requires !PREEMPT_RT). Use nftables instead:
3. Ensure build includes iproute2 and act_csum.ko
- Add
iproute2to the image recipe (provides thetcutility required by nftables) - Enable
CONFIG_NET_ACT_CSUM=min the kernel config (providesact_csum.ko)
4. Enable vhost-net in QEMU build
Addvhost to the QEMU PACKAGECONFIG in meta-qcom-distro/conf/distro/include/qcom-base.inc:
5. Start default network and define VMs
Known Issues and Resolutions
Issue 1 — Failed to connect to hypervisor (virsh net-start default)
Issue 1 — Failed to connect to hypervisor (virsh net-start default)
Cause:
virtqemud and virtnetworkd daemons and sockets are not running.Resolution:Issue 2 — ip_tables module not found (PREEMPT_RT incompatibility)
Issue 2 — ip_tables module not found (PREEMPT_RT incompatibility)
Cause:
NETFILTER_XTABLES_LEGACY depends on !PREEMPT_RT, so ip_tables.ko cannot be built on the RT kernel.Resolution: Set the libvirt network firewall backend to nftables in /etc/libvirt/network.conf:Issue 3 — 'tc' not found after switching to nftables
Issue 3 — 'tc' not found after switching to nftables
Cause:
iproute2 (which provides tc) and act_csum.ko are not included in the build.Resolution: Add iproute2 to the image recipe and enable CONFIG_NET_ACT_CSUM=m in the kernel config.Issue 4 — vhost-net support is not compiled in (virsh start fails)
Issue 4 — vhost-net support is not compiled in (virsh start fails)
Cause: The
vhost PACKAGECONFIG option is not enabled for QEMU.Resolution: Add vhost to PACKAGECONFIG:append:pn-qemu in qcom-base.inc (see Setup Step 4 above).Sample Domain XML Files
Two reference domain XML files are provided — one for the real-time guest VM and one for the non-RT housekeeping guest VM.rt-vm.xml — Key Configuration
View full rt-vm.xml
View full rt-vm.xml
hk-vm.xml — Key Configuration
View full hk-vm.xml
View full hk-vm.xml
NIC & SR-IOV
Intel X550 kernel config and IOMMU-map setup
RT with KVM
Back to overview

