ia64/xen-unstable

changeset 10251:279628dc2d6f

[IA64] pass vcpu nr to guest firmware

This patch pass the vcpus number to VT-i domain guest firmware,
so that guest firmware can set SMP info accordingly, mostly in
ACPI MADT table.

This patch is required by VT-i SMP support.

Signed-off-by: Yu Ke <ke.yu@intel.com>
author awilliam@xenbuild.aw
date Mon Jun 05 14:23:57 2006 -0600 (2006-06-05)
parents e32ddb4a90e6
children f662f98d594b
files tools/libxc/xc_ia64_stubs.c
line diff
     1.1 --- a/tools/libxc/xc_ia64_stubs.c	Mon Jun 05 14:21:37 2006 -0600
     1.2 +++ b/tools/libxc/xc_ia64_stubs.c	Mon Jun 05 14:23:57 2006 -0600
     1.3 @@ -207,18 +207,21 @@ typedef enum {
     1.4      HOB_TYPE_PAL_VM_SUMMARY,
     1.5      HOB_TYPE_PAL_VM_INFO,
     1.6      HOB_TYPE_PAL_VM_PAGE_SIZE,
     1.7 +    HOB_TYPE_NR_VCPU,
     1.8      HOB_TYPE_MAX
     1.9  }hob_type_t;
    1.10  
    1.11  static int hob_init( void  *buffer ,unsigned long buf_size);
    1.12  static int add_pal_hob(void* hob_buf);
    1.13  static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size);
    1.14 +static int add_vcpus_hob(void* hob_buf, unsigned long nr_vcpu);
    1.15  static int build_hob (void* hob_buf, unsigned long hob_buf_size,
    1.16 -                  unsigned long dom_mem_size);
    1.17 +                  unsigned long dom_mem_size, unsigned long vcpus);
    1.18  static int load_hob(int xc_handle,uint32_t dom, void *hob_buf,
    1.19  		unsigned long dom_mem_size);
    1.20  
    1.21 -int xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize){
    1.22 +int xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize, 
    1.23 +                      unsigned long vcpus){
    1.24  
    1.25      char   *hob_buf;
    1.26  
    1.27 @@ -228,7 +231,7 @@ int xc_ia64_build_hob(int xc_handle, uin
    1.28          return -1;
    1.29      }
    1.30  
    1.31 -    if ( build_hob( hob_buf, GFW_HOB_SIZE, memsize) < 0){
    1.32 +    if ( build_hob( hob_buf, GFW_HOB_SIZE, memsize, vcpus) < 0){
    1.33          free (hob_buf);
    1.34          PERROR("Could not build hob");
    1.35          return -1;
    1.36 @@ -329,7 +332,7 @@ int get_hob_size(void* hob_buf){
    1.37  }
    1.38  
    1.39  int build_hob (void* hob_buf, unsigned long hob_buf_size,
    1.40 -                  unsigned long dom_mem_size)
    1.41 +                  unsigned long dom_mem_size, unsigned long vcpus)
    1.42  {
    1.43      //Init HOB List
    1.44      if (hob_init (hob_buf, hob_buf_size)<0){
    1.45 @@ -342,6 +345,11 @@ int build_hob (void* hob_buf, unsigned l
    1.46          goto err_out;
    1.47      }
    1.48  
    1.49 +    if ( add_vcpus_hob(hob_buf, vcpus)<0){
    1.50 +        PERROR("Add NR_VCPU hob failed, buffer too small");
    1.51 +        goto err_out;
    1.52 +    }
    1.53 +
    1.54      if ( add_pal_hob( hob_buf ) < 0 ){
    1.55          PERROR("Add PAL hob failed, buffer too small");
    1.56          goto err_out;
    1.57 @@ -400,6 +408,12 @@ add_mem_hob(void* hob_buf, unsigned long
    1.58      return 0;
    1.59  }
    1.60  
    1.61 +static int 
    1.62 +add_vcpus_hob(void* hob_buf, unsigned long vcpus)
    1.63 +{
    1.64 +    return hob_add(hob_buf, HOB_TYPE_NR_VCPU, &vcpus, sizeof(vcpus));
    1.65 +}
    1.66 +
    1.67  unsigned char config_pal_bus_get_features_data[24] = {
    1.68      0, 0, 0, 32, 0, 0, 240, 189, 0, 0, 0, 0, 0, 0,
    1.69      0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    1.70 @@ -630,7 +644,7 @@ static int setup_guest(  int xc_handle,
    1.71      }
    1.72  
    1.73      /* Hand-off state passed to guest firmware */
    1.74 -    if (xc_ia64_build_hob(xc_handle, dom, dom_memsize) < 0){
    1.75 +    if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, (unsigned long)vcpus) < 0){
    1.76          PERROR("Could not build hob\n");
    1.77         goto error_out;
    1.78      }