Skip to content

Commit

Permalink
xen/libxl: simplify vkb/vfb separation
Browse files Browse the repository at this point in the history
vfb=[0|1] and vkb=[0|1] only really create the base object for each
structure in order to get xl to create the base xenstore nodes.

This is redundant with vkb=[ "VKB_SPEC_STRING", "VKB_SPEC_STRING", ...]
and vfb=[ "VFB_SPEC_STRING", "VFB_SPEC_STRING", ...] which should be
used instead.

Note: vfb is constantly set to 0 in xenmgr with vglass, should '1' be useful
somehow it would need to be handled via a new VFB_SPEC_STRING entry to
have the base vfb structure initialized correctly.

Signed-off-by: Eric Chanudet <[email protected]>
  • Loading branch information
Eric Chanudet committed Jan 26, 2021
1 parent e45bb76 commit 9d6cb70
Showing 1 changed file with 6 additions and 139 deletions.
145 changes: 6 additions & 139 deletions recipes-extended/xen/files/libxl-xenmgr-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LONG DESCRIPTION:
################################################################################
This patch contains several changes that couldn't be grouped elsewhere. These
changes support running xl on OpenXT with xenmgr as the toplevel toolstack
component. Some of the changes include tweaking qemu options, reworking the
vfb/vkb initialization, and writing OpenXT specific xenstore nodes. Refer
to the patch below for a comprehensive list of changes.
component. Some of the changes include tweaking qemu options, and writing
OpenXT specific xenstore nodes. Refer to the patch below for a comprehensive
list of changes.

################################################################################
CHANGELOG
Expand Down Expand Up @@ -46,33 +46,7 @@ PATCHES
int libxl_domain_sleep(libxl_ctx *ctx, uint32_t domid);
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1435,17 +1435,12 @@ static void domcreate_launch_dm(libxl__e
{
libxl__device_console console;
libxl__device device;
- libxl_device_vkb vkb;

init_console_info(gc, &console, 0);
console.backend_domid = state->console_domid;
libxl__device_console_add(gc, domid, &console, state, &device);
libxl__device_console_dispose(&console);

- libxl_device_vkb_init(&vkb);
- libxl__device_add(gc, domid, &libxl__vkb_devtype, &vkb);
- libxl_device_vkb_dispose(&vkb);
-
dcs->sdss.dm.guest_domid = domid;
if (libxl_defbool_val(d_config->b_info.device_model_stubdomain))
libxl__spawn_stub_dm(egc, &dcs->sdss);
@@ -1485,23 +1480,17 @@ static void domcreate_launch_dm(libxl__e
libxl__device_console_dispose(&vuart);
}

+ /* Disable QEMU for PV guests. */
+ ret = 0;
+
init_console_info(gc, &console, 0);
console.backend_domid = state->console_domid;
@@ -1490,18 +1490,11 @@ static void domcreate_launch_dm(libxl__e
libxl__device_console_add(gc, domid, &console, state, &device);
libxl__device_console_dispose(&console);

Expand All @@ -88,6 +62,8 @@ PATCHES
- domcreate_devmodel_started(egc, &dcs->sdss.dm, 0);
- return;
- }
+ /* Disable QEMU for PV guests. */
+
+ assert(!dcs->sdss.dm.guest_domid);
+ domcreate_devmodel_started(egc, &dcs->sdss.dm, 0);
+ return;
Expand Down Expand Up @@ -189,115 +165,6 @@ PATCHES

return 0;
}
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1229,8 +1229,9 @@ void parse_config_data(const char *confi
{
const char *buf;
long l, vcpus = 0;
+ long vkb_flag, vfb_flag;
XLU_Config *config;
- XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
+ XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cpuids, *vtpms,
*usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
*mca_caps;
@@ -2222,64 +2223,38 @@ skip_nic:
fprintf(stderr, "WARNING: vif2: netchannel2 is deprecated and not supported by xl\n");
}

- d_config->num_vfbs = 0;
- d_config->num_vkbs = 0;
- d_config->vfbs = NULL;
- d_config->vkbs = NULL;
-
- if (!xlu_cfg_get_list (config, "vfb", &cvfbs, 0, 0)) {
- while ((buf = xlu_cfg_get_listitem (cvfbs, d_config->num_vfbs)) != NULL) {
- libxl_device_vfb *vfb;
- libxl_device_vkb *vkb;
-
- char *buf2 = strdup(buf);
- char *p, *p2;
-
- vfb = ARRAY_EXTEND_INIT(d_config->vfbs, d_config->num_vfbs,
- libxl_device_vfb_init);
-
- vkb = ARRAY_EXTEND_INIT(d_config->vkbs, d_config->num_vkbs,
- libxl_device_vkb_init);
-
- p = strtok(buf2, ",");
- if (!p)
- goto skip_vfb;
- do {
- while (*p == ' ')
- p++;
- if ((p2 = strchr(p, '=')) == NULL)
- break;
- *p2 = '\0';
- if (!strcmp(p, "vnc")) {
- libxl_defbool_set(&vfb->vnc.enable, atoi(p2 + 1));
- } else if (!strcmp(p, "vnclisten")) {
- free(vfb->vnc.listen);
- vfb->vnc.listen = strdup(p2 + 1);
- } else if (!strcmp(p, "vncpasswd")) {
- free(vfb->vnc.passwd);
- vfb->vnc.passwd = strdup(p2 + 1);
- } else if (!strcmp(p, "vncdisplay")) {
- vfb->vnc.display = atoi(p2 + 1);
- } else if (!strcmp(p, "vncunused")) {
- libxl_defbool_set(&vfb->vnc.findunused, atoi(p2 + 1));
- } else if (!strcmp(p, "keymap")) {
- free(vfb->keymap);
- vfb->keymap = strdup(p2 + 1);
- } else if (!strcmp(p, "sdl")) {
- libxl_defbool_set(&vfb->sdl.enable, atoi(p2 + 1));
- } else if (!strcmp(p, "opengl")) {
- libxl_defbool_set(&vfb->sdl.opengl, atoi(p2 + 1));
- } else if (!strcmp(p, "display")) {
- free(vfb->sdl.display);
- vfb->sdl.display = strdup(p2 + 1);
- } else if (!strcmp(p, "xauthority")) {
- free(vfb->sdl.xauthority);
- vfb->sdl.xauthority = strdup(p2 + 1);
- }
- } while ((p = strtok(NULL, ",")) != NULL);
+ //Support adding vkbs by themselves
+ if (!xlu_cfg_get_long (config, "vkb", &vkb_flag, 0)){
+ d_config->num_vkbs = 0;
+ d_config->vkbs = NULL;
+
+ if (vkb_flag == 1) {
+ for(i = 0; i < 2; i++) {
+ libxl_device_vkb *vkb;
+ fprintf(stderr, "WARNING: init vkb device\n");
+ d_config->vkbs = (libxl_device_vkb *) realloc(d_config->vkbs, sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1));
+ vkb = d_config->vkbs + d_config->num_vkbs;
+ libxl_device_vkb_init(vkb);
+ vkb->devid = d_config->num_vkbs;
+ fprintf(stderr, "WARNING: vkb device of devid %d created.\n", vkb->devid);
+ d_config->num_vkbs++;
+ }
+ }
+ }

-skip_vfb:
- free(buf2);
+ if (!xlu_cfg_get_long (config, "vfb", &vfb_flag, 0)) {
+ d_config->num_vfbs = 0;
+ d_config->vfbs = NULL;
+
+ if (vfb_flag == 1) {
+ libxl_device_vfb * vfb;
+ fprintf(stderr, "WARNING: init vfb device\n");
+ d_config->vfbs = (libxl_device_vfb *) realloc(d_config->vfbs, sizeof(libxl_device_vfb) * (d_config->num_vfbs + 1));
+ vfb = d_config->vfbs + d_config->num_vfbs;
+ libxl_device_vfb_init(vfb);
+ vfb->devid = d_config->num_vfbs;
+ fprintf(stderr, "WARNING: vfb device of devid %d created.\n", vfb->devid);
+ d_config->num_vfbs++;
}
}

--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -109,7 +109,7 @@ int main_destroy(int argc, char **argv)
Expand Down

0 comments on commit 9d6cb70

Please sign in to comment.