[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 1/2] QEMU: add -dtb option support



Signed-off-by: Olivia Yin <hong-hua yin freescale com>
---
 src/conf/domain_conf.c       |    4 ++++
 src/conf/domain_conf.h       |    1 +
 src/qemu/qemu_capabilities.c |    3 +++
 src/qemu/qemu_capabilities.h |    1 +
 src/qemu/qemu_command.c      |    6 ++++++
 5 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c75838..07ad6b9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1771,6 +1771,7 @@ void virDomainDefFree(virDomainDefPtr def)
     VIR_FREE(def->os.kernel);
     VIR_FREE(def->os.initrd);
     VIR_FREE(def->os.cmdline);
+    VIR_FREE(def->os.dtb);
     VIR_FREE(def->os.root);
     VIR_FREE(def->os.loader);
     VIR_FREE(def->os.bootloader);
@@ -9993,6 +9994,7 @@ virDomainDefParseXML(virCapsPtr caps,
         def->os.kernel = virXPathString("string(./os/kernel[1])", ctxt);
         def->os.initrd = virXPathString("string(./os/initrd[1])", ctxt);
         def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
+        def->os.dtb = virXPathString("string(./os/dtb[1])", ctxt);
         def->os.root = virXPathString("string(./os/root[1])", ctxt);
         def->os.loader = virXPathString("string(./os/loader[1])", ctxt);
     }
@@ -14506,6 +14508,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                           def->os.initrd);
     virBufferEscapeString(buf, "    <cmdline>%s</cmdline>\n",
                           def->os.cmdline);
+    virBufferEscapeString(buf, "    <dtb>%s</dtb>\n",
+                          def->os.dtb);
     virBufferEscapeString(buf, "    <root>%s</root>\n",
                           def->os.root);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4ffa4aa..892640f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1545,6 +1545,7 @@ struct _virDomainOSDef {
     char *kernel;
     char *initrd;
     char *cmdline;
+    char *dtb;
     char *root;
     char *loader;
     char *bootloader;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 35a714d..7f226b6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -206,6 +206,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "usb-net",
               "add-fd",
               "nbd-server",
+              "dtb",
     );
 
 struct _virQEMUCaps {
@@ -940,6 +941,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
     }
     if (strstr(help, "-uuid"))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID);
+    if (strstr(help, "-dtb"))
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
     if (strstr(help, "-xen-domid"))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_XEN_DOMID);
     else if (strstr(help, "-domid"))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 7c55dc8..1f1bfa3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -167,6 +167,7 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_DEVICE_USB_NET     = 126, /* -device usb-net */
     QEMU_CAPS_ADD_FD             = 127, /* -add-fd */
     QEMU_CAPS_NBD_SERVER         = 128, /* nbd-server-start QMP command */
+    QEMU_CAPS_DTB                = 129, /* -dtb available */
 
     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 dee493f..e979e09 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5628,6 +5628,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);
     }
@@ -8794,6 +8796,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();
-- 
1.6.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]