@@ -1376,6 +1376,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
for (i = 0; i < d_config->num_vfbs; i++) {
libxl__device_add(gc, domid, &libxl__vfb_devtype,
&d_config->vfbs[i]);
+ }
+
+ for (i = 0; i < d_config->num_vkbs; i++) {
libxl__device_add(gc, domid, &libxl__vkb_devtype,
&d_config->vkbs[i]);
}
@@ -1728,6 +1728,7 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc,
vkb->backend_domid = 0;
vkb->devid = 0;
+
return 0;
}
@@ -240,6 +240,12 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [
(2, "COLO"),
])
+libxl_vkb_backend = Enumeration("vkb_backend", [
+ (0, "UNKNOWN"),
+ (1, "QEMU"),
+ (2, "LINUX")
+ ])
+
#
# Complex libxl types
#
@@ -603,6 +609,8 @@ libxl_device_vkb = Struct("device_vkb", [
("backend_domid", libxl_domid),
("backend_domname", string),
("devid", libxl_devid),
+ ("backend_type", libxl_vkb_backend),
+ ("id", string)
])
libxl_device_disk = Struct("device_disk", [
@@ -17,6 +17,10 @@
static int libxl__device_vkb_setdefault(libxl__gc *gc, uint32_t domid,
libxl_device_vkb *vkb, bool hotplug)
{
+ if (vkb->backend_type == LIBXL_VKB_BACKEND_UNKNOWN) {
+ vkb->backend_type = LIBXL_VKB_BACKEND_QEMU;
+ }
+
return libxl__resolve_domid(gc, vkb->backend_domname, &vkb->backend_domid);
}
@@ -34,6 +38,30 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
return 0;
}
+static int libxl__device_vkb_dm_needed(libxl_device_vkb *vkb, uint32_t domid)
+{
+ if (vkb->backend_type == LIBXL_VKB_BACKEND_QEMU) {
+ return 1;
+ }
+
+ return 0;
+}
+
+static int libxl__set_xenstore_vkb(libxl__gc *gc, uint32_t domid,
+ libxl_device_vkb *vkb,
+ flexarray_t *back, flexarray_t *front,
+ flexarray_t *ro_front)
+{
+ if (vkb->id) {
+ flexarray_append_pair(front, "id", vkb->id);
+ }
+
+ flexarray_append_pair(back, "backend-type",
+ (char *)libxl_vkb_backend_to_string(vkb->backend_type));
+
+ return 0;
+}
+
int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
const libxl_asyncop_how *ao_how)
{
@@ -60,7 +88,10 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkbd")
LIBXL_DEFINE_DEVICE_REMOVE(vkb)
DEFINE_DEVICE_TYPE_STRUCT_X(vkb, vkb, vkbd
- .skip_attach = 1
+ .skip_attach = 1,
+ .dm_needed = (device_dm_needed_fn_t)libxl__device_vkb_dm_needed,
+ .set_xenstore_config = (device_set_xenstore_config_fn_t)
+ libxl__set_xenstore_vkb
);
/*