The "dtb" option sets the filename for the device tree.
If without this option support, "-dtb file" will be converted into
<qemu:commandline> in domain XML file.
For example, '-dtb /media/ram/test.dtb' will be converted into
<qemu:commandline>
<qemu:arg value='-dtb'/>
<qemu:arg value='/media/ram/test.dtb'/>
</qemu:commandline>
This is not very friendly.
This patchset add special <dtb> tag like <kernel> and <initrd>
which is easier for user to write domain XML file.
<os>
<type arch='ppc' machine='ppce500v2'>hvm</type>
<kernel>/media/ram/uImage</kernel>
<initrd>/media/ram/ramdisk</initrd>
<dtb>/media/ram/test.dtb</dtb>
<cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
</os>
Signed-off-by: Eric Blake <eblake@redhat.com>
"rng-random", /* 130 */
"rng-egd",
- "virtio-ccw"
+ "virtio-ccw",
+ "dtb",
);
struct _virQEMUCaps {
if (strstr(help, "dump-guest-core=on|off"))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE);
+ if (strstr(help, "-dtb"))
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
+
/*
* Handling of -incoming arg with varying features
* -incoming tcp (kvm >= 79, qemu >= 0.10.0)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
}
virtio rng */
QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
QEMU_CAPS_VIRTIO_CCW = 132, /* -device virtio-*-ccw */
+ QEMU_CAPS_DTB = 133, /* -dtb file */
QEMU_CAPS_LAST, /* this must always be the last item */
};
virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
if (def->os.cmdline)
virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
+ if (def->os.dtb) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB)) {
+ virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("dtb is not supported with this QEMU binary"));
+ goto error;
+ }
+ }
} else {
virCommandAddArgList(cmd, "-bootloader", def->os.bootloader, NULL);
}
WANT_VALUE();
if (!(def->os.cmdline = strdup(val)))
goto no_memory;
+ } else if (STREQ(arg, "-dtb")) {
+ WANT_VALUE();
+ if (!(def->os.dtb = strdup(val)))
+ goto no_memory;
} else if (STREQ(arg, "-boot")) {
const char *token = NULL;
WANT_VALUE();
QEMU_CAPS_DEVICE_CIRRUS_VGA,
QEMU_CAPS_DEVICE_VMWARE_SVGA,
QEMU_CAPS_DEVICE_USB_SERIAL,
- QEMU_CAPS_DEVICE_USB_NET);
+ QEMU_CAPS_DEVICE_USB_NET,
+ QEMU_CAPS_DTB);
DO_TEST("qemu-1.2.0", 1002000, 0, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DEVICE_VMWARE_SVGA,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_USB_SERIAL,
- QEMU_CAPS_DEVICE_USB_NET);
+ QEMU_CAPS_DEVICE_USB_NET,
+ QEMU_CAPS_DTB);
DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
QEMU_CAPS_DEVICE_VMWARE_SVGA,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_USB_SERIAL,
- QEMU_CAPS_DEVICE_USB_NET);
+ QEMU_CAPS_DEVICE_USB_NET,
+ QEMU_CAPS_DTB);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--- /dev/null
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
+/usr/bin/qemu-system-ppc -S -M ppce500v2 -m 256 -smp 1 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-kernel /media/ram/uImage -initrd /media/ram/ramdisk \
+-append 'root=/dev/ram rw console=ttyS0,115200' -dtb /media/ram/test.dtb \
+-usb -net none -serial pty -parallel none
--- /dev/null
+<domain type='kvm'>
+ <name>QEMUGuest1</name>
+ <uuid>49545eb3-75e1-2d0a-acdd-f0294406c99e</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc' machine='ppce500v2'>hvm</type>
+ <kernel>/media/ram/uImage</kernel>
+ <initrd>/media/ram/ramdisk</initrd>
+ <cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
+ <dtb>/media/ram/test.dtb</dtb>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc</emulator>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
QEMU_CAPS_VIRTIO_S390, QEMU_CAPS_DEVICE_VIRTIO_RNG,
QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("ppc-dtb", QEMU_CAPS_KVM, QEMU_CAPS_DTB);
+
virObjectUnref(driver.config);
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlconf);
return -1;
}
+static int testQemuAddPPCGuest(virCapsPtr caps)
+{
+ static const char *machine[] = { "g3beige",
+ "mac99",
+ "prep",
+ "ppce500v2" };
+ virCapsGuestMachinePtr *machines = NULL;
+ virCapsGuestPtr guest;
+
+ machines = virCapabilitiesAllocMachines(machine, 1);
+ if (!machines)
+ goto error;
+
+ guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_PPC,
+ "/usr/bin/qemu-system-ppc", NULL,
+ 1, machines);
+ if (!guest)
+ goto error;
+
+ if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
+ goto error;
+
+ return 0;
+
+error:
+ /* No way to free a guest? */
+ virCapabilitiesFreeMachines(machines, 1);
+ return -1;
+}
+
static int testQemuAddS390Guest(virCapsPtr caps)
{
static const char *s390_machines[] = { "s390-virtio",
if (testQemuAddPPC64Guest(caps))
goto cleanup;
+ if (testQemuAddPPCGuest(caps))
+ goto cleanup;
+
if (testQemuAddS390Guest(caps))
goto cleanup;