|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v10 03/10] tools: Add vmware_hwver support
This is used to set xen_arch_domainconfig vmware_hw. It is set to
the emulated VMware virtual hardware version.
Currently 0, 3-4, 6-11 are good values. However the code only
checks for == 0, != 0, or < 7.
If non-zero then
default VGA to VMware's VGA.
Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
v10:
LIBXL_HAVE_LIBXL_VGA_INTERFACE_TYPE_VMWARE &
LIBXL_HAVE_BUILDINFO_HVM_VMWARE_HWVER are arriving together
a single umbrella could be used.
Since I split the LIBXL_VGA_INTERFACE_TYPE_VMWARE into
it's own patch, this is not longer true.
But I did use 1 for the 2 c_info changes.
Please use GCSPRINTF.
Remove vga=vmware from here.
v9:
I assumed that s/vmware_hw/vmware_hwver/ is not a big enough
change to drop the Reviewed-by. Did a minor edit to the
commit message to add 7 to the list of values checked.
v7:
Default handling of hvm.vga.kind bad.
Fixed.
Default of vmware_port should be based on vmware_hw.
Done.
v5:
Anything looking for Xen according to the Xen cpuid instructions...
Adjusted doc to new wording.
docs/man/xl.cfg.pod.5 | 25 ++++++++++++++++++++++++-
tools/libxc/xc_domain.c | 2 +-
tools/libxl/libxl.c | 4 +++-
tools/libxl/libxl.h | 1 +
tools/libxl/libxl_create.c | 18 +++++++++++++-----
tools/libxl/libxl_dm.c | 2 +-
tools/libxl/libxl_dom.c | 7 ++++---
tools/libxl/libxl_internal.h | 3 ++-
tools/libxl/libxl_types.idl | 1 +
tools/libxl/libxl_x86.c | 3 +--
tools/libxl/xl_cmdimpl.c | 9 ++++++---
11 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index ba78374..f62d9f2 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -1333,6 +1333,25 @@ The viridian option can be specified as a boolean. A
value of true (1)
is equivalent to the list [ "defaults" ], and a value of false (0) is
equivalent to an empty list.
+=item B<vmware_hwver=NUMBER>
+
+Turns on or off the exposure of VMware cpuid. The number is
+VMware's hardware version number, where 0 is off. A number >= 7
+is needed to enable exposure of VMware cpuid.
+
+If not zero it changes the default VGA to VMware's VGA.
+
+The hardware version number (vmware_hwver) come from VMware config files.
+
+=over 4
+
+In a .vmx it is virtualHW.version
+
+In a .ovf it is part of the value of vssd:VirtualSystemType.
+For vssd:VirtualSystemType == vmx-07, vmware_hwver = 7.
+
+=back
+
=back
=head3 Emulated VGA Graphics Device
@@ -1372,10 +1391,14 @@ later (e.g. Windows XP onwards) then you should enable
this.
stdvga supports more video ram and bigger resolutions than Cirrus.
This option is deprecated, use vga="stdvga" instead.
+The deprecated B<stdvga=0> prevents the usage of vmware by default
+if B<vmware_hwver> is non-zero.
+
=item B<vga="STRING">
Selects the emulated video card (none|stdvga|cirrus|qxl|vmware).
-The default is cirrus.
+The default is cirrus unless B<vmware_hwver> is non-zero in which case it
+is vmware.
In general, QXL should work with the Spice remote display protocol
for acceleration, and QXL driver is necessary in guest in this case.
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index a7079a1..40ff6ba 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -64,7 +64,7 @@ int xc_domain_create(xc_interface *xch,
memset(&config, 0, sizeof(config));
#if defined (__i386) || defined(__x86_64__)
- /* No arch-specific configuration for now */
+ /* No arch-specific default configuration for now */
#elif defined (__arm__) || defined(__aarch64__)
config.gic_version = XEN_DOMCTL_CONFIG_GIC_DEFAULT;
config.nr_spis = 0;
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index a6eb2df..c154246 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4930,12 +4930,14 @@ int libxl_get_memory_target(libxl_ctx *ctx, uint32_t
domid,
}
int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
+ libxl_domain_create_info *c_info,
uint32_t *need_memkb)
{
GC_INIT(ctx);
int rc;
- rc = libxl__domain_build_info_setdefault(gc, b_info);
+ rc = libxl__domain_build_info_setdefault(gc, b_info,
+ c_info->vmware_hwver != 0);
if (rc) goto out;
*need_memkb = b_info->target_memkb;
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 007a211..61d89be 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -1099,6 +1099,7 @@ int libxl_get_memory_target(libxl_ctx *ctx, uint32_t
domid, uint32_t *out_target
*/
/* how much free memory in the system a domain needs to be built */
int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info,
+ libxl_domain_create_info *c_info,
uint32_t *need_memkb);
/* how much free memory is available in the system */
int libxl_get_free_memory(libxl_ctx *ctx, uint32_t *memkb);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index f0da7dc..b7818bc 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -101,7 +101,8 @@ static int sched_params_valid(libxl__gc *gc,
}
int libxl__domain_build_info_setdefault(libxl__gc *gc,
- libxl_domain_build_info *b_info)
+ libxl_domain_build_info *b_info,
+ bool vmware_vga_default)
{
int i;
@@ -238,8 +239,12 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
if (b_info->u.hvm.mmio_hole_memkb == LIBXL_MEMKB_DEFAULT)
b_info->u.hvm.mmio_hole_memkb = 0;
- if (!b_info->u.hvm.vga.kind)
- b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS;
+ if (!b_info->u.hvm.vga.kind) {
+ if (vmware_vga_default)
+ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_VMWARE;
+ else
+ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_CIRRUS;
+ }
switch (b_info->device_model_version) {
case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
@@ -455,7 +460,7 @@ int libxl__domain_build(libxl__gc *gc,
vments[4] = "start_time";
vments[5] = libxl__sprintf(gc, "%lu.%02d",
start_time.tv_sec,(int)start_time.tv_usec/10000);
- localents = libxl__calloc(gc, 9, sizeof(char *));
+ localents = libxl__calloc(gc, 11, sizeof(char *));
i = 0;
localents[i++] = "platform/acpi";
localents[i++] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
@@ -463,6 +468,8 @@ int libxl__domain_build(libxl__gc *gc,
localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
localents[i++] = "platform/acpi_s4";
localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
+ localents[i++] = "platform/vmware_hwver";
+ localents[i++] = GCSPRINTF("%"PRId64, d_config->c_info.vmware_hwver);
if (info->u.hvm.mmio_hole_memkb) {
uint64_t max_ram_below_4g =
(1ULL << 32) - (info->u.hvm.mmio_hole_memkb << 10);
@@ -901,7 +908,8 @@ static void initiate_domain_create(libxl__egc *egc,
dcs->guest_domid = domid;
dcs->dmss.dm.guest_domid = 0; /* means we haven't spawned */
- ret = libxl__domain_build_info_setdefault(gc, &d_config->b_info);
+ ret = libxl__domain_build_info_setdefault(gc, &d_config->b_info,
+ d_config->c_info.vmware_hwver != 0);
if (ret) goto error_out;
if (!sched_params_valid(gc, domid, &d_config->b_info.sched_params)) {
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 9a06f9b..c04fa0d 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1099,7 +1099,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc,
libxl__stub_dm_spawn_state *sdss)
ret = libxl__domain_create_info_setdefault(gc, &dm_config->c_info);
if (ret) goto out;
- ret = libxl__domain_build_info_setdefault(gc, &dm_config->b_info);
+ ret = libxl__domain_build_info_setdefault(gc, &dm_config->b_info, false);
if (ret) goto out;
GCNEW(vfb);
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index a0c9850..f7add33 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -131,7 +131,8 @@ static int numa_cmpf(const libxl__numa_candidate *c1,
/* The actual automatic NUMA placement routine */
static int numa_place_domain(libxl__gc *gc, uint32_t domid,
- libxl_domain_build_info *info)
+ libxl_domain_build_info *info,
+ libxl_domain_create_info *c_info)
{
int found;
libxl__numa_candidate candidate;
@@ -155,7 +156,7 @@ static int numa_place_domain(libxl__gc *gc, uint32_t domid,
if (rc)
return rc;
- rc = libxl_domain_need_memory(CTX, info, &memkb);
+ rc = libxl_domain_need_memory(CTX, info, c_info, &memkb);
if (rc)
goto out;
if (libxl_node_bitmap_alloc(CTX, &cpupool_nodemap, 0)) {
@@ -353,7 +354,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
if (rc)
return rc;
- rc = numa_place_domain(gc, domid, info);
+ rc = numa_place_domain(gc, domid, info, &d_config->c_info);
if (rc) {
libxl_bitmap_dispose(&cpumap_soft);
return rc;
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 057fd0f..eff6bc0 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1099,7 +1099,8 @@ _hidden int libxl__init_console_from_channel(libxl__gc
*gc,
_hidden int libxl__domain_create_info_setdefault(libxl__gc *gc,
libxl_domain_create_info *c_info);
_hidden int libxl__domain_build_info_setdefault(libxl__gc *gc,
- libxl_domain_build_info *b_info);
+ libxl_domain_build_info *b_info,
+ bool vmware_vga_default);
_hidden int libxl__device_disk_setdefault(libxl__gc *gc,
libxl_device_disk *disk);
_hidden int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 9d6ca45..501bb48 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -343,6 +343,7 @@ libxl_domain_create_info = Struct("domain_create_info",[
("run_hotplug_scripts",libxl_defbool),
("pvh", libxl_defbool),
("driver_domain",libxl_defbool),
+ ("vmware_hwver", uint64),
], dir=DIR_IN)
libxl_domain_restore_params = Struct("domain_restore_params", [
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index ed2bd38..fd7dafa 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -5,8 +5,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
libxl_domain_config *d_config,
xc_domain_configuration_t *xc_config)
{
- /* No specific configuration right now */
-
+ xc_config->vmware_hwver = d_config->c_info.vmware_hwver;
return 0;
}
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 0e44b12..18ba70f 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1382,6 +1382,8 @@ static void parse_config_data(const char *config_source,
b_info->cmdline = parse_cmdline(config);
xlu_cfg_get_defbool(config, "driver_domain", &c_info->driver_domain, 0);
+ if (!xlu_cfg_get_long(config, "vmware_hwver", &l, 1))
+ c_info->vmware_hwver = l;
switch(b_info->type) {
case LIBXL_DOMAIN_TYPE_HVM:
@@ -2395,7 +2397,8 @@ static int preserve_domain(uint32_t *r_domid, libxl_event
*event,
return rc == 0 ? 1 : 0;
}
-static int freemem(uint32_t domid, libxl_domain_build_info *b_info)
+static int freemem(uint32_t domid, libxl_domain_build_info *b_info,
+ libxl_domain_create_info *c_info)
{
int rc, retries = 3;
uint32_t need_memkb, free_memkb;
@@ -2403,7 +2406,7 @@ static int freemem(uint32_t domid,
libxl_domain_build_info *b_info)
if (!autoballoon)
return 0;
- rc = libxl_domain_need_memory(ctx, b_info, &need_memkb);
+ rc = libxl_domain_need_memory(ctx, b_info, c_info, &need_memkb);
if (rc < 0)
return rc;
@@ -2683,7 +2686,7 @@ start:
if (rc < 0)
goto error_out;
- ret = freemem(domid, &d_config.b_info);
+ ret = freemem(domid, &d_config.b_info, &d_config.c_info);
if (ret < 0) {
fprintf(stderr, "failed to free memory for the domain\n");
ret = ERROR_FAIL;
--
1.8.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |