]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
libxl: Call libxl__virtio_devtype.set_default() early enough
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 13 Jun 2023 09:12:24 +0000 (11:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 13 Jun 2023 09:12:24 +0000 (11:12 +0200)
The _setdefault() function for virtio devices is getting called after
libxl__prepare_dtb(), which is late as libxl__prepare_dtb() expects the
defaults to be already set by this time.

Call libxl__virtio_devtype.set_default() from
libxl__domain_config_setdefault(), in a similar way as other devices
like disk, etc.

Suggested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
tools/libs/light/libxl_create.c

index ec8eab02c20782d1bfc34086ef21380c8ea13e3c..36770af6d4ff79cfa635f6c3a3e36866e274cbe7 100644 (file)
@@ -1068,7 +1068,7 @@ int libxl__domain_config_setdefault(libxl__gc *gc,
                                     uint32_t domid /* for logging, only */)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret;
+    int ret, i;
     bool pod_enabled = false;
     libxl_domain_create_info *c_info = &d_config->c_info;
 
@@ -1266,6 +1266,15 @@ int libxl__domain_config_setdefault(libxl__gc *gc,
         goto error_out;
     }
 
+    for (i = 0; i < d_config->num_virtios; i++) {
+        ret = libxl__virtio_devtype.set_default(gc, domid,
+                                                &d_config->virtios[i], false);
+        if (ret) {
+            LOGD(ERROR, domid, "Unable to set virtio defaults for device %d", i);
+            goto error_out;
+        }
+    }
+
     ret = 0;
  error_out:
     return ret;