Skip to contentSkip to conversation

: xl, allow setting of timer_mode, hpet and vpt_align parameters

PATCH In review Gianni Tedesco 3 participants 3 messages Jul 5, 2010 – Jul 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : xl, allow setting of timer_mode, hpet and vpt_align parameters

Implement parsing for timer_mode, hpet and vpt_align parameters.

These are all HVM only parameters and hpet/vpt_align are boolean so change types and place in hvm union accordingly. Also HPET is x86 only on principle so make this compile-time conditional on arch as-is viridian.

 libxl.h      |    6 +++---
 libxl_dom.c  |    7 -------
 xenguest.c   |    3 +++
 xl_cmdimpl.c |   18 ++++++++++++------
 4 files changed, 18 insertions(+), 16 deletions(-)
tools/libxl/libxl.h +3 -3
diff -r 6e70c88167bb tools/libxl/libxl.h
@@ -90,9 +90,6 @@
 } libxl_domain_create_info;
 
 typedef struct {
-    int timer_mode;
-    int hpet;
-    int vpt_align;
     int max_vcpus;
     int cur_vcpus;
     int tsc_mode;
@@ -110,6 +107,9 @@
             bool nx;
             bool viridian;
             char *timeoffset;
+            bool hpet;
+            bool vpt_align;
+            int timer_mode;
         } hvm;
         struct {
             uint32_t   slack_memkb;
tools/libxl/libxl_dom.c +0 -7
diff -r 6e70c88167bb tools/libxl/libxl_dom.c
@@ -62,13 +62,6 @@
 int build_pre(struct libxl_ctx *ctx, uint32_t domid,
               libxl_domain_build_info *info, libxl_domain_build_state *state)
 {
-    if (info->timer_mode != -1)
-        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_TIMER_MODE,
-                (unsigned long) info->timer_mode);
-    if (info->hpet != -1)
-        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) info->hpet);
-    if (info->vpt_align != -1)
-        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->vpt_align);
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
     xc_domain_set_memmap_limit(ctx->xch, domid, 
tools/libxl/xenguest.c +3 -0
diff -r 6e70c88167bb tools/libxl/xenguest.c
@@ -49,7 +49,10 @@
     xc_set_hvm_param(handle, domid, HVM_PARAM_PAE_ENABLED, info->u.hvm.pae);
 #if defined(__i386__) || defined(__x86_64__)
     xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info->u.hvm.viridian);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned long) info->u.hvm.hpet);
 #endif
+    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned long) info->u.hvm.timer_mode);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned long) info->u.hvm.vpt_align);
     xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn);
     return 0;
 }
tools/libxl/xl_cmdimpl.c +12 -6
diff -r 6e70c88167bb tools/libxl/xl_cmdimpl.c
@@ -189,9 +189,6 @@
 static void init_build_info(libxl_domain_build_info *b_info, libxl_domain_create_info *c_info)
 {
     memset(b_info, '\0', sizeof(*b_info));
-    b_info->timer_mode = -1;
-    b_info->hpet = 1;
-    b_info->vpt_align = -1;
     b_info->max_vcpus = 1;
     b_info->max_memkb = 32 * 1024;
     b_info->target_memkb = b_info->max_memkb;
@@ -205,6 +202,9 @@
         b_info->u.hvm.acpi = 1;
         b_info->u.hvm.nx = 1;
         b_info->u.hvm.viridian = 0;
+        b_info->u.hvm.hpet = 1;
+        b_info->u.hvm.vpt_align = 1;
+        b_info->u.hvm.timer_mode = 0;
     } else {
         b_info->u.pv.slack_memkb = 8 * 1024;
     }
@@ -356,9 +356,6 @@
 
 
     printf("\t(domain_build_info)\n");
-    printf("\t(timer_mode %d)\n", b_info->timer_mode);
-    printf("\t(hpet %d)\n", b_info->hpet);
-    printf("\t(vpt_align %d)\n", b_info->vpt_align);
     printf("\t(max_vcpus %d)\n", b_info->max_vcpus);
     printf("\t(tsc_mode %d)\n", b_info->tsc_mode);
     printf("\t(max_memkb %d)\n", b_info->max_memkb);
@@ -375,6 +372,9 @@
         printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
         printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
         printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
+        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
+        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
+        printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model);
         printf("\t\t\t(videoram %d)\n", dm_info->videoram);
@@ -571,6 +571,12 @@
             b_info->u.hvm.nx = l;
         if (!xlu_cfg_get_long (config, "viridian", &l))
             b_info->u.hvm.viridian = l;
+        if (!xlu_cfg_get_long (config, "hpet", &l))
+            b_info->u.hvm.hpet = l;
+        if (!xlu_cfg_get_long (config, "vpt_align", &l))
+            b_info->u.hvm.vpt_align = l;
+        if (!xlu_cfg_get_long (config, "timer_mode", &l))
+            b_info->u.hvm.timer_mode = l;
     } else {
         char *cmdline = NULL;
         const char *root = NULL, *extra = "";
#1 lore raw

Hi Gianni --

If you have a chance, could you look at porting disable_migrate support also from xend to xl? It is needed for full TSC support and also for Dulloor's NUMA work.

Thanks,
Dan

Quoted 151 lines

-----Original Message-----
From: Gianni Tedesco [mailto:[email protected]]
Sent: Monday, July 05, 2010 9:03 AM
To: Xen-devel
Cc: Stefano Stabellini
Subject: [Xen-devel] [PATCH]: xl, allow setting of timer_mode, hpet and vpt_align parameters

Implement parsing for timer_mode, hpet and vpt_align parameters.

These are all HVM only parameters and hpet/vpt_align are boolean so change types and place in hvm union accordingly. Also HPET is x86 only on principle so make this compile-time conditional on arch as-is viridian.

 libxl.h      |    6 +++---
 libxl_dom.c  |    7 -------
 xenguest.c   |    3 +++
 xl_cmdimpl.c |   18 ++++++++++++------
 4 files changed, 18 insertions(+), 16 deletions(-)

diff -r 6e70c88167bb tools/libxl/libxl.h

tools/libxl/libxl.h +3 -3
@@ -90,9 +90,6 @@
 } libxl_domain_create_info;
 
 typedef struct {
-    int timer_mode;
-    int hpet;
-    int vpt_align;
     int max_vcpus;
     int cur_vcpus;
     int tsc_mode;
@@ -110,6 +107,9 @@
             bool nx;
             bool viridian;
             char *timeoffset;
+            bool hpet;
+            bool vpt_align;
+            int timer_mode;
         } hvm;
         struct {
             uint32_t   slack_memkb;

diff -r 6e70c88167bb tools/libxl/libxl_dom.c

tools/libxl/libxl_dom.c +0 -7
@@ -62,13 +62,6 @@
 int build_pre(struct libxl_ctx *ctx, uint32_t domid,
               libxl_domain_build_info *info, libxl_domain_build_state
 *state)
 {
-    if (info->timer_mode != -1)
-        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_TIMER_MODE,
-                (unsigned long) info->timer_mode);
-    if (info->hpet != -1)
-        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_HPET_ENABLED,
 (unsigned long) info->hpet);
-    if (info->vpt_align != -1)
-        xc_set_hvm_param(ctx->xch, domid, HVM_PARAM_VPT_ALIGN,
 (unsigned long) info->vpt_align);
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb +
LIBXL_MAXMEM_CONSTANT);
     xc_domain_set_memmap_limit(ctx->xch, domid,

diff -r 6e70c88167bb tools/libxl/xenguest.c

tools/libxl/xenguest.c +2 -0
@@ -49,7 +49,10 @@
     xc_set_hvm_param(handle, domid, HVM_PARAM_PAE_ENABLED, info-
 >u.hvm.pae);
 #if defined(__i386__) || defined(__x86_64__)
     xc_set_hvm_param(handle, domid, HVM_PARAM_VIRIDIAN, info-
 >u.hvm.viridian);
+    xc_set_hvm_param(handle, domid, HVM_PARAM_HPET_ENABLED, (unsigned
 long) info->u.hvm.hpet);
 #endif
+    xc_set_hvm_param(handle, domid, HVM_PARAM_TIMER_MODE, (unsigned

long) info->u.hvm.timer_mode);
+ xc_set_hvm_param(handle, domid, HVM_PARAM_VPT_ALIGN, (unsigned
long) info->u.hvm.vpt_align);
xc_set_hvm_param(handle, domid, HVM_PARAM_STORE_EVTCHN,

store_evtchn);
     return 0;

}
diff -r 6e70c88167bb tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c +0 -3
@@ -189,9 +189,6 @@
 static void init_build_info(libxl_domain_build_info *b_info,
 libxl_domain_create_info *c_info)
 {
     memset(b_info, '\0', sizeof(*b_info));
-    b_info->timer_mode = -1;
-    b_info->hpet = 1;
-    b_info->vpt_align = -1;
     b_info->max_vcpus = 1;
     b_info->max_memkb = 32 * 1024;
     b_info->target_memkb = b_info->max_memkb;
tools/libxl/xl_cmdimpl.c +12 -3
@@ -205,6 +202,9 @@
         b_info->u.hvm.acpi = 1;
         b_info->u.hvm.nx = 1;
         b_info->u.hvm.viridian = 0;
+        b_info->u.hvm.hpet = 1;
+        b_info->u.hvm.vpt_align = 1;
+        b_info->u.hvm.timer_mode = 0;
     } else {
         b_info->u.pv.slack_memkb = 8 * 1024;
     }
@@ -356,9 +356,6 @@
 
 
     printf("\t(domain_build_info)\n");
-    printf("\t(timer_mode %d)\n", b_info->timer_mode);
-    printf("\t(hpet %d)\n", b_info->hpet);
-    printf("\t(vpt_align %d)\n", b_info->vpt_align);
     printf("\t(max_vcpus %d)\n", b_info->max_vcpus);
     printf("\t(tsc_mode %d)\n", b_info->tsc_mode);
     printf("\t(max_memkb %d)\n", b_info->max_memkb);
@@ -375,6 +372,9 @@
         printf("\t\t\t(acpi %d)\n", b_info->u.hvm.acpi);
         printf("\t\t\t(nx %d)\n", b_info->u.hvm.nx);
         printf("\t\t\t(viridian %d)\n", b_info->u.hvm.viridian);
+        printf("\t\t\t(hpet %d)\n", b_info->u.hvm.hpet);
+        printf("\t\t\t(vpt_align %d)\n", b_info->u.hvm.vpt_align);
+        printf("\t\t\t(timer_mode %d)\n", b_info->u.hvm.timer_mode);
 
         printf("\t\t\t(device_model %s)\n", dm_info->device_model);
         printf("\t\t\t(videoram %d)\n", dm_info->videoram);
@@ -571,6 +571,12 @@
             b_info->u.hvm.nx = l;
         if (!xlu_cfg_get_long (config, "viridian", &l))
             b_info->u.hvm.viridian = l;
+        if (!xlu_cfg_get_long (config, "hpet", &l))
+            b_info->u.hvm.hpet = l;
+        if (!xlu_cfg_get_long (config, "vpt_align", &l))
+            b_info->u.hvm.vpt_align = l;
+        if (!xlu_cfg_get_long (config, "timer_mode", &l))
+            b_info->u.hvm.timer_mode = l;
     } else {
         char *cmdline = NULL;
         const char *root = NULL, *extra = "";

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Acked-by on v1 1/1
#2 lore raw
In reply to Gianni Tedesco
Quoted 7 lines · On Mon, 5 Jul 2010, Gianni Tedesco (3P) wrote:

Implement parsing for timer_mode, hpet and vpt_align parameters.

These are all HVM only parameters and hpet/vpt_align are boolean so change types and place in hvm union accordingly. Also HPET is x86 only on principle so make this compile-time conditional on arch as-is viridian.

Quoted 8 lines
 libxl.h      |    6 +++---
 libxl_dom.c  |    7 -------
 xenguest.c   |    3 +++
 xl_cmdimpl.c |   18 ++++++++++++------
 4 files changed, 18 insertions(+), 16 deletions(-)