ia64/xen-unstable

changeset 19282:ec671455fb05

tool: make management of PCI D-states by guest optional

D3hot state in some PCI devices causes the failure of domain
creation/destruction.

The default is "pci_power_mgmt=3D0" which disables the guest OS from
managing D-states because it would be better to avoid the trouble than
advantage of low power consumption.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Mar 06 18:58:41 2009 +0000 (2009-03-06)
parents 6c7ae9c859f5
children 73c4e6dbbb60
files tools/examples/xmexample.hvm tools/python/xen/xend/XendConfig.py tools/python/xen/xend/server/pciif.py tools/python/xen/xm/create.py tools/python/xen/xm/xenapi_create.py
line diff
     1.1 --- a/tools/examples/xmexample.hvm	Fri Mar 06 18:56:28 2009 +0000
     1.2 +++ b/tools/examples/xmexample.hvm	Fri Mar 06 18:58:41 2009 +0000
     1.3 @@ -308,6 +308,8 @@ serial='pty'
     1.4  #                   available options are:
     1.5  #                   - msitranslate=0|1
     1.6  #                      per-device overriden of pci_msitranslate, see below
     1.7 +#                   - power_mgmt=0|1
     1.8 +#                      per-device overriden of pci_power_mgmt, see below
     1.9  #
    1.10  #pci=[ '07:00.0', '07:00.1' ]
    1.11  
    1.12 @@ -322,6 +324,13 @@ serial='pty'
    1.13  # 
    1.14  #pci_msitranslate=1
    1.15  
    1.16 +#   PCI Power Management:
    1.17 +#
    1.18 +#   If it's set, the guest OS will be able to program D0-D3hot states of the
    1.19 +# PCI device for the purpose of low power consumption.
    1.20 +# 
    1.21 +#pci_power_mgmt=0
    1.22 +
    1.23  #-----------------------------------------------------------------------------
    1.24  #   Configure PVSCSI devices:
    1.25  #
     2.1 --- a/tools/python/xen/xend/XendConfig.py	Fri Mar 06 18:56:28 2009 +0000
     2.2 +++ b/tools/python/xen/xend/XendConfig.py	Fri Mar 06 18:58:41 2009 +0000
     2.3 @@ -169,6 +169,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     2.4      'hap': int,
     2.5      'xen_extended_power_mgmt': int,
     2.6      'pci_msitranslate': int,
     2.7 +    'pci_power_mgmt': int,
     2.8  }
     2.9  
    2.10  # Xen API console 'other_config' keys.
     3.1 --- a/tools/python/xen/xend/server/pciif.py	Fri Mar 06 18:56:28 2009 +0000
     3.2 +++ b/tools/python/xen/xend/server/pciif.py	Fri Mar 06 18:58:41 2009 +0000
     3.3 @@ -97,6 +97,8 @@ class PciController(DevController):
     3.4          back['uuid'] = config.get('uuid','')
     3.5          if 'pci_msitranslate' in self.vm.info['platform']:
     3.6              back['msitranslate']=str(self.vm.info['platform']['pci_msitranslate'])
     3.7 +        if 'pci_power_mgmt' in self.vm.info['platform']:
     3.8 +            back['power_mgmt']=str(self.vm.info['platform']['pci_power_mgmt'])
     3.9  
    3.10          return (0, back, {})
    3.11  
     4.1 --- a/tools/python/xen/xm/create.py	Fri Mar 06 18:56:28 2009 +0000
     4.2 +++ b/tools/python/xen/xm/create.py	Fri Mar 06 18:58:41 2009 +0000
     4.3 @@ -322,14 +322,16 @@ gopts.var('disk', val='phy:DEV,VDEV,MODE
     4.4            backend driver domain to use for the disk.
     4.5            The option may be repeated to add more than one disk.""")
     4.6  
     4.7 -gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=0|1]',
     4.8 +gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=0|1][,power_mgmt=0|1]',
     4.9            fn=append_value, default=[],
    4.10            use="""Add a PCI device to a domain, using given params (in hex).
    4.11            For example 'pci=c0:02.1'.
    4.12            If msitranslate is set, MSI-INTx translation is enabled if possible.
    4.13            Guest that doesn't support MSI will get IO-APIC type IRQs
    4.14            translated from physical MSI, HVM only. Default is 1.
    4.15 -          The option may be repeated to add more than one pci device.""")
    4.16 +          The option may be repeated to add more than one pci device.
    4.17 +          If power_mgmt is set, the guest OS will be able to program the power
    4.18 +          states D0-D3hot of the device, HVM only. Default=0.""")
    4.19  
    4.20  gopts.var('vscsi', val='PDEV,VDEV[,DOM]',
    4.21            fn=append_value, default=[],
    4.22 @@ -605,6 +607,10 @@ gopts.var('pci_msitranslate', val='TRANS
    4.23            use="""Global PCI MSI-INTx translation flag (0=disable;
    4.24            1=enable.""")
    4.25  
    4.26 +gopts.var('pci_power_mgmt', val='POWERMGMT',
    4.27 +          fn=set_int, default=0,
    4.28 +          use="""Global PCI Power Management flag (0=disable;1=enable).""")
    4.29 +
    4.30  def err(msg):
    4.31      """Print an error to stderr and exit.
    4.32      """
    4.33 @@ -691,7 +697,7 @@ def configure_pci(config_devs, vals):
    4.34          d = comma_sep_kv_to_dict(opts)
    4.35  
    4.36          def f(k):
    4.37 -            if k not in ['msitranslate']:
    4.38 +            if k not in ['msitranslate', 'power_mgmt']:
    4.39                  err('Invalid pci option: ' + k)
    4.40  
    4.41              config_pci_opts.append([k, d[k]])
    4.42 @@ -913,7 +919,7 @@ def configure_hvm(config_image, vals):
    4.43               'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
    4.44               'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
    4.45               'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate',
    4.46 -             'vpt_align' ]
    4.47 +             'vpt_align', 'pci_power_mgmt' ]
    4.48  
    4.49      for a in args:
    4.50          if a in vals.__dict__ and vals.__dict__[a] is not None:
     5.1 --- a/tools/python/xen/xm/xenapi_create.py	Fri Mar 06 18:56:28 2009 +0000
     5.2 +++ b/tools/python/xen/xm/xenapi_create.py	Fri Mar 06 18:58:41 2009 +0000
     5.3 @@ -1047,6 +1047,7 @@ class sxp2xml:
     5.4              'guest_os_type',
     5.5              'hap',
     5.6              'pci_msitranslate',
     5.7 +            'pci_power_mgmt',
     5.8          ]
     5.9  
    5.10          platform_configs = []