debuggers.hg

changeset 22701:6874a9d26fd9

libxl: Specify the target ram size to Qemu (new) when calling it

This patch adds target_ram in device_model_info structure, to be used in
libxl_build_device_model_args_new. Qemu upstream needs to know about it.

It introduces also libxl__sizekb_to_mb to convert size from KB to MB by
rounding up the result.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Anthony PERARD <anthony.perard@citrix.com>
date Thu Jan 06 14:27:33 2011 +0000 (2011-01-06)
parents 63fd6f886f49
children 93236edbc269 5d78193d67d1
files tools/libxl/libxl.c tools/libxl/libxl.idl tools/libxl/libxl_utils.h tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Thu Jan 06 14:25:10 2011 +0000
     1.2 +++ b/tools/libxl/libxl.c	Thu Jan 06 14:27:33 2011 +0000
     1.3 @@ -1390,6 +1390,10 @@ static char ** libxl_build_device_model_
     1.4      else
     1.5          flexarray_set(dm_args, num++, "xenfv");
     1.6  
     1.7 +    /* RAM Size */
     1.8 +    flexarray_set(dm_args, num++, "-m");
     1.9 +    flexarray_set(dm_args, num++, libxl__sprintf(gc, "%d", info->target_ram));
    1.10 +
    1.11      if (info->type == XENFV) {
    1.12          disks = libxl_device_disk_list(libxl__gc_owner(gc), info->domid, &nb);
    1.13          for (i; i < nb; i++) {
     2.1 --- a/tools/libxl/libxl.idl	Thu Jan 06 14:25:10 2011 +0000
     2.2 +++ b/tools/libxl/libxl.idl	Thu Jan 06 14:27:33 2011 +0000
     2.3 @@ -140,6 +140,7 @@ libxl_device_model_info = Struct("device
     2.4      ("device_model",     string),
     2.5      ("saved_state",      string),
     2.6      ("type",             libxl_qemu_machine_type),
     2.7 +    ("target_ram",       uint32),
     2.8      ("videoram",         integer,           False, "size of the videoram in MB"),
     2.9      ("stdvga",           bool,              False, "stdvga enabled or disabled"),
    2.10      ("vnc",              bool,              False, "vnc enabled or disabled"),
     3.1 --- a/tools/libxl/libxl_utils.h	Thu Jan 06 14:25:10 2011 +0000
     3.2 +++ b/tools/libxl/libxl_utils.h	Thu Jan 06 14:27:33 2011 +0000
     3.3 @@ -85,5 +85,9 @@ void libxl_cpumap_reset(libxl_cpumap *cp
     3.4  
     3.5  int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
     3.6  
     3.7 +static inline uint32_t libxl__sizekb_to_mb(uint32_t s) {
     3.8 +    return (s + 1023) / 1024;
     3.9 +}
    3.10 +
    3.11  #endif
    3.12  
     4.1 --- a/tools/libxl/xl_cmdimpl.c	Thu Jan 06 14:25:10 2011 +0000
     4.2 +++ b/tools/libxl/xl_cmdimpl.c	Thu Jan 06 14:27:33 2011 +0000
     4.3 @@ -359,7 +359,8 @@ static void init_dm_info(libxl_device_mo
     4.4  
     4.5      dm_info->dom_name = strdup(c_info->name);
     4.6      dm_info->device_model = strdup("qemu-dm");
     4.7 -    dm_info->videoram = b_info->video_memkb / 1024;
     4.8 +    dm_info->target_ram = libxl__sizekb_to_mb(b_info->target_memkb);
     4.9 +    dm_info->videoram = libxl__sizekb_to_mb(b_info->video_memkb);
    4.10      dm_info->apic = b_info->u.hvm.apic;
    4.11      dm_info->vcpus = b_info->max_vcpus;
    4.12      dm_info->vcpu_avail = b_info->cur_vcpus;