Re: [libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-19 Thread Eric Blake
On 03/19/2013 07:41 PM, Yin Olivia-R63875 wrote:
> Hi Eric,
> 
> You're so kind to help squash. Thank you very much.

No problem.  You can return the favor by helping review other
outstanding patches.

> 
> Exactly there's one more thing need fix is that 'ppce500v2' 
> should be changed as 'ppce500' to align with qemu-1.4.0.
> 
> What should I do next step? Should I post a new revision of patchset?

At this point, your original patches are already part of libvirt.git, so
you will need to post the fix as a new patch.  Starting a new thread
will give it better visibility.

Also, we tend to avoid top-posting on technical lists.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-19 Thread Yin Olivia-R63875
Hi Eric,

You're so kind to help squash. Thank you very much.

Exactly there's one more thing need fix is that 'ppce500v2' 
should be changed as 'ppce500' to align with qemu-1.4.0.

What should I do next step? Should I post a new revision of patchset?

Best Regards,
Olivia

> -Original Message-
> From: Eric Blake [mailto:ebl...@redhat.com]
> Sent: Wednesday, March 20, 2013 5:24 AM
> To: Yin Olivia-R63875
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] [PATCH v5 2/3] qemu: add dtb option supprt
> 
> On 03/13/2013 10:49 PM, Olivia Yin wrote:
> > The "dtb" option sets the filename for the device tree.
> > If without this option support, "-dtb file" will be converted into
> >  in domain XML file.
> > For example, '-dtb /media/ram/test.dtb' will be converted into
> >   
> > 
> > 
> >   
> >
> 
> > +++ b/src/qemu/qemu_command.c
> > @@ -5984,6 +5984,8 @@ qemuBuildCommandLine(virConnectPtr conn,
> >  virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
> >  if (def->os.cmdline)
> >  virCommandAddArgList(cmd, "-append", def->os.cmdline,
> > NULL);
> > +if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB) && def->os.dtb)
> > +virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
> 
> This silently ignores def->os.dtb if set but qemu is too old.  Instead, we
> should error out on the unsupported combination.
> 
> > +++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> > @@ -0,0 +1 @@
> > +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
> 
> Sheesh, this line is long.  Backslash-newline is your friend.
> 
> In addition to what I'm squashing after Dan's comments, I'm adding this:
> 
> diff --git i/src/qemu/qemu_command.c w/src/qemu/qemu_command.c index
> 0b56726..8626b62 100644
> --- i/src/qemu/qemu_command.c
> +++ w/src/qemu/qemu_command.c
> @@ -6152,8 +6152,15 @@ qemuBuildCommandLine(virConnectPtr conn,
>  virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
>  if (def->os.cmdline)
>  virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
> -if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB) && def->os.dtb)
> -virCommandAddArgList(cmd, "-dtb", def->os.dtb, 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);
>  }
> diff --git i/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> w/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> index a66ac51..93e8f9c 100644
> --- i/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> +++ w/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> @@ -1 +1,6 @@
> -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
> +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
> 
> 
> --
> Eric Blake   eblake redhat com+1-919-301-3266
> Libvirt virtualization library http://libvirt.org


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-19 Thread Eric Blake
On 03/13/2013 10:49 PM, Olivia Yin wrote:
> The "dtb" option sets the filename for the device tree.
> If without this option support, "-dtb file" will be converted into
>  in domain XML file.
> For example, '-dtb /media/ram/test.dtb' will be converted into
>   
> 
> 
>   
> 

> +++ b/src/qemu/qemu_command.c
> @@ -5984,6 +5984,8 @@ qemuBuildCommandLine(virConnectPtr conn,
>  virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
>  if (def->os.cmdline)
>  virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
> +if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB) && def->os.dtb)
> +virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);

This silently ignores def->os.dtb if set but qemu is too old.  Instead,
we should error out on the unsupported combination.

> +++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> @@ -0,0 +1 @@
> +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

Sheesh, this line is long.  Backslash-newline is your friend.

In addition to what I'm squashing after Dan's comments, I'm adding this:

diff --git i/src/qemu/qemu_command.c w/src/qemu/qemu_command.c
index 0b56726..8626b62 100644
--- i/src/qemu/qemu_command.c
+++ w/src/qemu/qemu_command.c
@@ -6152,8 +6152,15 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
 if (def->os.cmdline)
 virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
-if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB) && def->os.dtb)
-virCommandAddArgList(cmd, "-dtb", def->os.dtb, 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);
 }
diff --git i/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
w/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
index a66ac51..93e8f9c 100644
--- i/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
+++ w/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -1 +1,6 @@
-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
+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


-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-19 Thread Eric Blake
On 03/19/2013 06:24 AM, Daniel P. Berrange wrote:
> On Thu, Mar 14, 2013 at 12:49:43PM +0800, Olivia Yin wrote:

s/supprt/support/ in the subject

>> The "dtb" option sets the filename for the device tree.
>> If without this option support, "-dtb file" will be converted into
>>  in domain XML file.
>> For example, '-dtb /media/ram/test.dtb' will be converted into
>>   
>> 
>> 
>>   
>>

> ACK

I will push these soon.

>> -  "virtio-ccw"
>> +  "virtio-ccw",
>> +  "dtb",

Oops - we let the previous person to touch this enum forget to use a
trailing comma.  Oh well, not your fault.

>>  
>> -if (version >= 11000)
>> +if (version >= 11000) {
>>  virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
>> +virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
>> +}
> 
> Doesn't  '-dtb' show up in the -help output ?  If it does, then it
> is preferrable to check for that, instead of using a version number
> based check

It does; in fact, it showed up in 1.1 (and NOT in 0.11).  Here's what I
will squash in:

diff --git i/src/qemu/qemu_capabilities.c w/src/qemu/qemu_capabilities.c
index 48fd971..50f8084 100644
--- i/src/qemu/qemu_capabilities.c
+++ w/src/qemu/qemu_capabilities.c
@@ -1087,6 +1087,9 @@ virQEMUCapsComputeCmdFlags(const char *help,
 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)
@@ -1174,10 +1177,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
 if (version >= 12000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);

-if (version >= 11000) {
+if (version >= 11000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
-virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
-}

 if (version >= 1002000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
diff --git i/tests/qemuhelptest.c w/tests/qemuhelptest.c
index 1cceffa..059fa86 100644
--- i/tests/qemuhelptest.c
+++ w/tests/qemuhelptest.c
@@ -339,8 +339,7 @@ mymain(void)
 QEMU_CAPS_NO_ACPI,
 QEMU_CAPS_VIRTIO_BLK_SG_IO,
 QEMU_CAPS_CPU_HOST,
-QEMU_CAPS_VNC,
-QEMU_CAPS_DTB);
+QEMU_CAPS_VNC);
 DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -398,8 +397,7 @@ mymain(void)
 QEMU_CAPS_DEVICE_CIRRUS_VGA,
 QEMU_CAPS_DEVICE_VMWARE_SVGA,
 QEMU_CAPS_DEVICE_USB_SERIAL,
-QEMU_CAPS_DEVICE_USB_NET,
-QEMU_CAPS_DTB);
+QEMU_CAPS_DEVICE_USB_NET);
 DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -442,8 +440,7 @@ mymain(void)
 QEMU_CAPS_NO_ACPI,
 QEMU_CAPS_VIRTIO_BLK_SG_IO,
 QEMU_CAPS_CPU_HOST,
-QEMU_CAPS_VNC,
-QEMU_CAPS_DTB);
+QEMU_CAPS_VNC);
 DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -509,8 +506,7 @@ mymain(void)
 QEMU_CAPS_DEVICE_CIRRUS_VGA,
 QEMU_CAPS_DEVICE_VMWARE_SVGA,
 QEMU_CAPS_DEVICE_USB_SERIAL,
-QEMU_CAPS_DEVICE_USB_NET,
-QEMU_CAPS_DTB);
+QEMU_CAPS_DEVICE_USB_NET);
 DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -575,8 +571,7 @@ mymain(void)
 QEMU_CAPS_DEVICE_CIRRUS_VGA,
 QEMU_CAPS_DEVICE_VMWARE_SVGA,
 QEMU_CAPS_DEVICE_USB_SERIAL,
-QEMU_CAPS_DEVICE_USB_NET,
-QEMU_CAPS_DTB);
+QEMU_CAPS_DEVICE_USB_NET);
 DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -648,8 +643,7 @@ mymain(void)
 QEMU_CAPS_VNC,
 QEMU_CAPS_DEVICE_QXL,
 QEMU_CAPS_DEVICE_VGA,
-QEMU_CAPS_DEVICE_CIRRUS_VGA,
-QEMU_CAPS_DTB);
+QEMU_CAPS_DEVICE_CIRRUS_VGA);
 DO_TEST("qemu-1.0", 100, 0, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -729,8 +723,7 @@ mymain(void)
 QEMU_CAPS_DEVICE_CIRRUS_VGA,
 QEMU_CAPS_DEVICE_VMWARE_SVGA,
 QEMU_CAPS_DEVICE_USB_SERIAL,
-QEMU_CAPS_DEVICE_USB_NET,
-QEMU_CAPS_DTB);
+QEMU_CAPS_DEVICE_USB_NET);
 DO_TEST("qemu-1.1.0", 1001000, 0, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,


-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mail

Re: [libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-19 Thread Daniel P. Berrange
On Thu, Mar 14, 2013 at 12:49:43PM +0800, Olivia Yin wrote:
> The "dtb" option sets the filename for the device tree.
> If without this option support, "-dtb file" will be converted into
>  in domain XML file.
> For example, '-dtb /media/ram/test.dtb' will be converted into
>   
> 
> 
>   
> 
> This is not very friendly.
> This patchset add special  tag like  and 
> which is easier for user to write domain XML file.
>   
> hvm
> /media/ram/uImage
> /media/ram/ramdisk
> /media/ram/test.dtb
> root=/dev/ram rw console=ttyS0,115200
>   
> ---
>  src/qemu/qemu_capabilities.c |8 -
>  src/qemu/qemu_capabilities.h |1 +
>  src/qemu/qemu_command.c  |6 
>  tests/qemuhelptest.c |   30 +--
>  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
>  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
>  tests/qemuxml2argvtest.c |2 +
>  tests/testutilsqemu.c|   33 
> ++
>  8 files changed, 97 insertions(+), 12 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

ACK


> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 79cfdb3..636608a 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>  
>"rng-random", /* 130 */
>"rng-egd",
> -  "virtio-ccw"
> +  "virtio-ccw",
> +  "dtb",
>  );
>  
>  struct _virQEMUCaps {
> @@ -1173,8 +1174,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
>  if (version >= 12000)
>  virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
>  
> -if (version >= 11000)
> +if (version >= 11000) {
>  virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
> +virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
> +}

Doesn't  '-dtb' show up in the -help output ?  If it does, then it
is preferrable to check for that, instead of using a version number
based check

> @@ -2299,6 +2302,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
>  virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
>  virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
>  virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
> +virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);

This bit is fine for QMP.


Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-13 Thread Olivia Yin
The "dtb" option sets the filename for the device tree.
If without this option support, "-dtb file" will be converted into
 in domain XML file.
For example, '-dtb /media/ram/test.dtb' will be converted into
  


  

This is not very friendly.
This patchset add special  tag like  and 
which is easier for user to write domain XML file.
  
hvm
/media/ram/uImage
/media/ram/ramdisk
/media/ram/test.dtb
root=/dev/ram rw console=ttyS0,115200
  
---
 src/qemu/qemu_capabilities.c |8 -
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 
 tests/qemuhelptest.c |   30 +--
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 tests/testutilsqemu.c|   33 ++
 8 files changed, 97 insertions(+), 12 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 79cfdb3..636608a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
   "rng-random", /* 130 */
   "rng-egd",
-  "virtio-ccw"
+  "virtio-ccw",
+  "dtb",
 );
 
 struct _virQEMUCaps {
@@ -1173,8 +1174,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
 if (version >= 12000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
 
-if (version >= 11000)
+if (version >= 11000) {
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
+}
 
 if (version >= 1002000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
@@ -2299,6 +2302,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 5c5dc5a..9f88593 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -172,6 +172,7 @@ enum virQEMUCapsFlags {
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 */
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e7f2325..a95d41c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5984,6 +5984,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
 if (def->os.cmdline)
 virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB) && def->os.dtb)
+virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, "-bootloader", def->os.bootloader, NULL);
 }
@@ -9161,6 +9163,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 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();
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 720a188..460c5fd 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -339,7 +339,8 @@ mymain(void)
 QEMU_CAPS_NO_ACPI,
 QEMU_CAPS_VIRTIO_BLK_SG_IO,
 QEMU_CAPS_CPU_HOST,
-QEMU_CAPS_VNC);
+QEMU_CAPS_VNC,
+QEMU_CAPS_DTB);
 DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -397,7 +398,8 @@ mymain(void)
 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-kvm-0.12.3", 12003, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -440,7 +442,8 @@ mymain(void)
 QEMU_CAPS_NO_ACPI,
 QEMU_CAPS_VIRTIO_BLK_SG_IO,
 QEMU_CAPS_CPU_HOST,
-QEMU_CAPS_VNC);
+