+ # string. QEMU 2.10 added a new CPUID leaf, so this
+ # problem only triggered for older QEMU
+ if grep -q 'QEMU' "${root}/proc/cpuinfo"; then
+ echo qemu
+ fi
+ fi
+fi
+
+if ! "$skip_lkvm"; then
+ if [ "$cpuid" = "LKVMLKVMLKVM" ]; then
+ echo lkvm
+ elif [ "$arch" = "arm" ] || [ "$arch" = "aarch64" ]; then
+ if [ -d "${root}/proc/device-tree" ] &&
+ grep -q "dummy-virt" "${root}/proc/device-tree/compatible"; then
+ echo lkvm
+ fi
+ fi
+fi
+
+# Check for Docker.
+if [ -f "${root}/.dockerinit" ]; then
+ echo docker
+fi
+
+# Check ppc64 lpar, kvm or powerkvm
+
+# example /proc/cpuinfo line indicating 'not baremetal'
+# platform : pSeries
+#
+# example /proc/ppc64/lparcfg systemtype line
+# system_type=IBM pSeries (emulated by qemu)
+
+if [ "$arch" = "ppc64" ]; then
+ if have_cpuinfo && grep -q 'platform.**pSeries' "${root}/proc/cpuinfo"; then
+ if grep -q 'model.*emulated by qemu' "${root}/proc/cpuinfo"; then
+ echo ibm_power-kvm
+ else
+ # Assume LPAR, now detect shared or dedicated
+ if grep -q 'shared_processor_mode=1' "${root}/proc/ppc64/lparcfg"; then
+ echo ibm_power-lpar_shared
+ else
+ echo ibm_power-lpar_dedicated
+ fi
+ # detect powerkvm?
+ fi
+ fi
+fi
+
+# Check for OpenBSD/VMM
+if [ "$cpuid" = "OpenBSDVMM58" ]; then
+ echo vmm
+fi
+
+# Check for LDoms
+if [[ "$arch" == sparc* && -e ${root}/dev/mdesc ]]; then
+ echo ldoms
+ if [[ -d ${root}/sys/class/vlds/ctrl && \
+ -d ${root}/sys/class/vlds/sp ]]; then
+ echo ldoms-control
+ else
+ echo ldoms-guest
+ fi
+ MDPROP="${root}/usr/lib/ldoms/mdprop.py"
+ if [[ -x ${MDPROP} ]]; then
+ if [[ -n $($MDPROP -v iodevice device-type=pciex) ]]; then
+ echo ldoms-root
+ echo ldoms-io
+ elif [[ -n $($MDPROP -v iov-device vf-id=0) ]]; then
+ echo ldoms-io
+ fi