ia64/xen-unstable

changeset 8948:991c4d62d392

Add PAE option to HVM config file.
This option is disabled by default, only if we have "pae=1" in config
file, cpuid will return PAE available to VMX guest, and Linux PAE VMX
guest need this. Once the PAE VMX guest support is stable, we will
enable it by default.

Signed-off-by: Xin Li <xin.b.li@intel.com>
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Feb 21 18:15:49 2006 +0100 (2006-02-21)
parents 2401f414d1ad
children e8d044119316
files tools/examples/xmexample.hvm tools/libxc/xc_hvm_build.c tools/libxc/xc_ia64_stubs.c tools/libxc/xenguest.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/image.py tools/python/xen/xm/create.py xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/domain.h xen/include/public/hvm/hvm_info_table.h
line diff
     1.1 --- a/tools/examples/xmexample.hvm	Tue Feb 21 17:13:30 2006 +0000
     1.2 +++ b/tools/examples/xmexample.hvm	Tue Feb 21 18:15:49 2006 +0100
     1.3 @@ -30,6 +30,9 @@ name = "ExampleHVMDomain"
     1.4  # the number of cpus guest platform has, default=1
     1.5  #vcpus=1
     1.6  
     1.7 +# enable/disable HVM guest PAE, default=0 (disabled)
     1.8 +#pae=0
     1.9 +
    1.10  # enable/disable HVM guest ACPI, default=0 (disabled)
    1.11  #acpi=0
    1.12  
     2.1 --- a/tools/libxc/xc_hvm_build.c	Tue Feb 21 17:13:30 2006 +0000
     2.2 +++ b/tools/libxc/xc_hvm_build.c	Tue Feb 21 18:15:49 2006 +0100
     2.3 @@ -137,7 +137,7 @@ set_hvm_info_checksum(struct hvm_info_ta
     2.4   */
     2.5  static int set_hvm_info(int xc_handle, uint32_t dom,
     2.6                          unsigned long *pfn_list, unsigned int vcpus,
     2.7 -                        unsigned int acpi, unsigned int apic)
     2.8 +                        unsigned int pae, unsigned int acpi, unsigned int apic)
     2.9  {
    2.10      char *va_map;
    2.11      struct hvm_info_table *va_hvm;
    2.12 @@ -159,6 +159,7 @@ static int set_hvm_info(int xc_handle, u
    2.13      va_hvm->length       = sizeof(struct hvm_info_table);
    2.14      va_hvm->acpi_enabled = acpi;
    2.15      va_hvm->apic_enabled = apic;
    2.16 +    va_hvm->pae_enabled  = pae;
    2.17      va_hvm->nr_vcpus     = vcpus;
    2.18  
    2.19      set_hvm_info_checksum(va_hvm);
    2.20 @@ -176,7 +177,8 @@ static int setup_guest(int xc_handle,
    2.21                         unsigned long shared_info_frame,
    2.22                         unsigned int control_evtchn,
    2.23                         unsigned int vcpus,
    2.24 -		       unsigned int acpi,
    2.25 +                       unsigned int pae,
    2.26 +                       unsigned int acpi,
    2.27                         unsigned int apic,
    2.28                         unsigned int store_evtchn,
    2.29                         unsigned long *store_mfn)
    2.30 @@ -265,7 +267,7 @@ static int setup_guest(int xc_handle,
    2.31              goto error_out;
    2.32      }
    2.33  
    2.34 -    if ( set_hvm_info(xc_handle, dom, page_array, vcpus, acpi, apic) ) {
    2.35 +    if ( set_hvm_info(xc_handle, dom, page_array, vcpus, pae, acpi, apic) ) {
    2.36          fprintf(stderr, "Couldn't set hvm info for HVM guest.\n");
    2.37          goto error_out;
    2.38      }
    2.39 @@ -345,7 +347,8 @@ int xc_hvm_build(int xc_handle,
    2.40                   const char *image_name,
    2.41                   unsigned int control_evtchn,
    2.42                   unsigned int vcpus,
    2.43 -		 unsigned int acpi,
    2.44 +                 unsigned int pae,
    2.45 +                 unsigned int acpi,
    2.46                   unsigned int apic,
    2.47                   unsigned int store_evtchn,
    2.48                   unsigned long *store_mfn)
    2.49 @@ -400,7 +403,7 @@ int xc_hvm_build(int xc_handle,
    2.50      ctxt->flags = VGCF_HVM_GUEST;
    2.51      if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages,
    2.52                       ctxt, op.u.getdomaininfo.shared_info_frame, control_evtchn,
    2.53 -                     vcpus, acpi, apic, store_evtchn, store_mfn) < 0)
    2.54 +                     vcpus, pae, acpi, apic, store_evtchn, store_mfn) < 0)
    2.55      {
    2.56          ERROR("Error constructing guest OS");
    2.57          goto error_out;
     3.1 --- a/tools/libxc/xc_ia64_stubs.c	Tue Feb 21 17:13:30 2006 +0000
     3.2 +++ b/tools/libxc/xc_ia64_stubs.c	Tue Feb 21 18:15:49 2006 +0100
     3.3 @@ -626,9 +626,10 @@ int xc_hvm_build(int xc_handle,
     3.4                   int memsize,
     3.5                   const char *image_name,
     3.6                   unsigned int control_evtchn,
     3.7 -                 unsigned int lapic,
     3.8                   unsigned int vcpus,
     3.9 +                 unsigned int pae,
    3.10                   unsigned int acpi,
    3.11 +                 unsigned int apic,
    3.12                   unsigned int store_evtchn,
    3.13                   unsigned long *store_mfn)
    3.14  {
     4.1 --- a/tools/libxc/xenguest.h	Tue Feb 21 17:13:30 2006 +0000
     4.2 +++ b/tools/libxc/xenguest.h	Tue Feb 21 18:15:49 2006 +0100
     4.3 @@ -40,7 +40,7 @@ int xc_linux_save(int xc_handle, int io_
     4.4  int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, 
     4.5                       unsigned long nr_pfns, unsigned int store_evtchn, 
     4.6                       unsigned long *store_mfn, unsigned int console_evtchn,
     4.7 -		     unsigned long *console_mfn);
     4.8 +                     unsigned long *console_mfn);
     4.9  
    4.10  int xc_linux_build(int xc_handle,
    4.11                     uint32_t domid,
    4.12 @@ -59,6 +59,7 @@ int xc_hvm_build(int xc_handle,
    4.13                   const char *image_name,
    4.14                   unsigned int control_evtchn,
    4.15                   unsigned int vcpus,
    4.16 +                 unsigned int pae,
    4.17                   unsigned int acpi,
    4.18                   unsigned int apic,
    4.19                   unsigned int store_evtchn,
     5.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Tue Feb 21 17:13:30 2006 +0000
     5.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue Feb 21 18:15:49 2006 +0100
     5.3 @@ -366,20 +366,21 @@ static PyObject *pyxc_hvm_build(XcObject
     5.4      int control_evtchn, store_evtchn;
     5.5      int memsize;
     5.6      int vcpus = 1;
     5.7 +    int pae  = 0;
     5.8      int acpi = 0;
     5.9      int apic = 0;
    5.10      unsigned long store_mfn = 0;
    5.11  
    5.12      static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn",
    5.13 -				"memsize", "image", "vcpus", "acpi", "apic",
    5.14 +				"memsize", "image", "vcpus", "pae", "acpi", "apic",
    5.15  				NULL };
    5.16 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiisiii", kwd_list,
    5.17 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiisiiii", kwd_list,
    5.18                                        &dom, &control_evtchn, &store_evtchn,
    5.19 -				      &memsize, &image, &vcpus, &acpi, &apic) )
    5.20 +				      &memsize, &image, &vcpus, &pae, &acpi, &apic) )
    5.21          return NULL;
    5.22  
    5.23      if ( xc_hvm_build(self->xc_handle, dom, memsize, image, control_evtchn,
    5.24 -		      vcpus, acpi, apic, store_evtchn, &store_mfn) != 0 )
    5.25 +		      vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
    5.26          return PyErr_SetFromErrno(xc_error);
    5.27  
    5.28      return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
     6.1 --- a/tools/python/xen/xend/image.py	Tue Feb 21 17:13:30 2006 +0000
     6.2 +++ b/tools/python/xen/xend/image.py	Tue Feb 21 18:15:49 2006 +0100
     6.3 @@ -191,8 +191,8 @@ class HVMImageHandler(ImageHandler):
     6.4          ImageHandler.configure(self, imageConfig, deviceConfig)
     6.5  
     6.6          info = xc.xeninfo()
     6.7 -	if not 'hvm' in info['xen_caps']:
     6.8 -	    raise VmError("Not an HVM capable platform, we stop creating!")
     6.9 +        if not 'hvm' in info['xen_caps']:
    6.10 +            raise VmError("Not an HVM capable platform, we stop creating!")
    6.11  
    6.12          self.dmargs = self.parseDeviceModelArgs(imageConfig, deviceConfig)
    6.13          self.device_model = sxp.child_value(imageConfig, 'device_model')
    6.14 @@ -210,6 +210,8 @@ class HVMImageHandler(ImageHandler):
    6.15  
    6.16          self.dmargs += self.configVNC(imageConfig)
    6.17  
    6.18 +        self.pae  = int(sxp.child_value(imageConfig, 'pae', 0))
    6.19 +
    6.20          self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0))
    6.21          self.apic = int(sxp.child_value(imageConfig, 'apic', 0))
    6.22  
    6.23 @@ -227,6 +229,7 @@ class HVMImageHandler(ImageHandler):
    6.24          log.debug("store_evtchn   = %d", store_evtchn)
    6.25          log.debug("memsize        = %d", self.vm.getMemoryTarget() / 1024)
    6.26          log.debug("vcpus          = %d", self.vm.getVCpuCount())
    6.27 +        log.debug("pae            = %d", self.pae)
    6.28          log.debug("acpi           = %d", self.acpi)
    6.29          log.debug("apic           = %d", self.apic)
    6.30  
    6.31 @@ -238,6 +241,7 @@ class HVMImageHandler(ImageHandler):
    6.32                              store_evtchn   = store_evtchn,
    6.33                              memsize        = self.vm.getMemoryTarget() / 1024,
    6.34                              vcpus          = self.vm.getVCpuCount(),
    6.35 +                            pae            = self.pae,
    6.36                              acpi           = self.acpi,
    6.37                              apic           = self.apic)
    6.38  
     7.1 --- a/tools/python/xen/xm/create.py	Tue Feb 21 17:13:30 2006 +0000
     7.2 +++ b/tools/python/xen/xm/create.py	Tue Feb 21 18:15:49 2006 +0100
     7.3 @@ -161,6 +161,10 @@ gopts.var('cpus', val='CPUS',
     7.4            fn=set_int, default=None,
     7.5            use="CPUS to run the domain on.")
     7.6  
     7.7 +gopts.var('pae', val='PAE',
     7.8 +          fn=set_int, default=0,
     7.9 +          use="Disable or enable PAE of HVM domain.")
    7.10 +
    7.11  gopts.var('acpi', val='ACPI',
    7.12            fn=set_int, default=0,
    7.13            use="Disable or enable ACPI of HVM domain.")
    7.14 @@ -545,7 +549,7 @@ def configure_vifs(config_devs, vals):
    7.15  def configure_hvm(config_image, vals):
    7.16      """Create the config for HVM devices.
    7.17      """
    7.18 -    args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
    7.19 +    args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
    7.20               'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
    7.21               'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'acpi', 'apic',
    7.22               'xauthority' ]
     8.1 --- a/xen/arch/x86/hvm/hvm.c	Tue Feb 21 17:13:30 2006 +0000
     8.2 +++ b/xen/arch/x86/hvm/hvm.c	Tue Feb 21 18:15:49 2006 +0100
     8.3 @@ -175,10 +175,12 @@ static void hvm_get_info(struct domain *
     8.4      if ( validate_hvm_info(t) ) {
     8.5          d->arch.hvm_domain.nr_vcpus = t->nr_vcpus;
     8.6          d->arch.hvm_domain.apic_enabled = t->apic_enabled;
     8.7 +        d->arch.hvm_domain.pae_enabled = t->pae_enabled;
     8.8      } else {
     8.9          printk("Bad hvm info table\n");
    8.10          d->arch.hvm_domain.nr_vcpus = 1;
    8.11          d->arch.hvm_domain.apic_enabled = 0;
    8.12 +        d->arch.hvm_domain.pae_enabled = 0;
    8.13      }
    8.14  
    8.15      unmap_domain_page(p);
     9.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Feb 21 17:13:30 2006 +0000
     9.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Feb 21 18:15:49 2006 +0100
     9.3 @@ -662,19 +662,21 @@ static void vmx_vmexit_do_cpuid(unsigned
     9.4  
     9.5      cpuid(input, &eax, &ebx, &ecx, &edx);
     9.6  
     9.7 -    if (input == 1)
     9.8 +    if ( input == 1 )
     9.9      {
    9.10          if ( hvm_apic_support(v->domain) &&
    9.11                  !vlapic_global_enabled((VLAPIC(v))) )
    9.12              clear_bit(X86_FEATURE_APIC, &edx);
    9.13  
    9.14  #if CONFIG_PAGING_LEVELS < 3
    9.15 +        clear_bit(X86_FEATURE_PAE, &edx);
    9.16          clear_bit(X86_FEATURE_PSE, &edx);
    9.17 -        clear_bit(X86_FEATURE_PAE, &edx);
    9.18          clear_bit(X86_FEATURE_PSE36, &edx);
    9.19  #else
    9.20          if ( v->domain->arch.ops->guest_paging_levels == PAGING_L2 )
    9.21          {
    9.22 +            if ( !v->domain->arch.hvm_domain.pae_enabled )
    9.23 +                clear_bit(X86_FEATURE_PAE, &edx);
    9.24              clear_bit(X86_FEATURE_PSE, &edx);
    9.25              clear_bit(X86_FEATURE_PSE36, &edx);
    9.26          }
    10.1 --- a/xen/include/asm-x86/hvm/domain.h	Tue Feb 21 17:13:30 2006 +0000
    10.2 +++ b/xen/include/asm-x86/hvm/domain.h	Tue Feb 21 18:15:49 2006 +0100
    10.3 @@ -34,6 +34,7 @@ struct hvm_domain {
    10.4      unsigned long          shared_page_va;
    10.5      unsigned int           nr_vcpus;
    10.6      unsigned int           apic_enabled;
    10.7 +    unsigned int           pae_enabled;
    10.8  
    10.9      struct hvm_virpit      vpit;
   10.10      struct hvm_virpic      vpic;
    11.1 --- a/xen/include/public/hvm/hvm_info_table.h	Tue Feb 21 17:13:30 2006 +0000
    11.2 +++ b/xen/include/public/hvm/hvm_info_table.h	Tue Feb 21 18:15:49 2006 +0100
    11.3 @@ -17,7 +17,7 @@ struct hvm_info_table {
    11.4      uint8_t     checksum;
    11.5      uint8_t     acpi_enabled;
    11.6      uint8_t     apic_enabled;
    11.7 -    uint8_t     pad[1];
    11.8 +    uint8_t     pae_enabled;
    11.9      uint32_t    nr_vcpus;
   11.10  };
   11.11