WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/2] tool: make management of PCI D-states by guest o

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/2] tool: make management of PCI D-states by guest optional
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Fri, 6 Mar 2009 14:26:18 +0900
Cc: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Thu, 05 Mar 2009 21:27:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <7kfxhrfcmv.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
D3hot state in some PCI devices causes the failure of domain
creation/destruction.

The default is "pci_power_mgmt=0" 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@xxxxxxxxxxxxxx>

diff -r cff29d694a89 tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/examples/xmexample.hvm      Fri Mar 06 13:25:54 2009 +0900
@@ -308,6 +308,8 @@ serial='pty'
 #                   available options are:
 #                   - msitranslate=0|1
 #                      per-device overriden of pci_msitranslate, see below
+#                   - power_mgmt=0|1
+#                      per-device overriden of pci_power_mgmt, see below
 #
 #pci=[ '07:00.0', '07:00.1' ]
 
@@ -321,6 +323,13 @@ serial='pty'
 # turned off.
 # 
 #pci_msitranslate=1
+
+#   PCI Power Management:
+#
+#   If it's set, the guest OS will be able to program D0-D3hot states of the
+# PCI device for the purpose of low power consumption.
+# 
+#pci_power_mgmt=0
 
 #-----------------------------------------------------------------------------
 #   Configure PVSCSI devices:
diff -r cff29d694a89 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Fri Mar 06 13:25:54 2009 +0900
@@ -169,6 +169,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'hap': int,
     'xen_extended_power_mgmt': int,
     'pci_msitranslate': int,
+    'pci_power_mgmt': int,
 }
 
 # Xen API console 'other_config' keys.
diff -r cff29d694a89 tools/python/xen/xend/server/pciif.py
--- a/tools/python/xen/xend/server/pciif.py     Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/python/xen/xend/server/pciif.py     Fri Mar 06 13:25:54 2009 +0900
@@ -97,6 +97,8 @@ class PciController(DevController):
         back['uuid'] = config.get('uuid','')
         if 'pci_msitranslate' in self.vm.info['platform']:
             
back['msitranslate']=str(self.vm.info['platform']['pci_msitranslate'])
+        if 'pci_power_mgmt' in self.vm.info['platform']:
+            back['power_mgmt']=str(self.vm.info['platform']['pci_power_mgmt'])
 
         return (0, back, {})
 
diff -r cff29d694a89 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/python/xen/xm/create.py     Fri Mar 06 13:25:54 2009 +0900
@@ -322,14 +322,16 @@ gopts.var('disk', val='phy:DEV,VDEV,MODE
           backend driver domain to use for the disk.
           The option may be repeated to add more than one disk.""")
 
-gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=0|1]',
+gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=0|1][,power_mgmt=0|1]',
           fn=append_value, default=[],
           use="""Add a PCI device to a domain, using given params (in hex).
           For example 'pci=c0:02.1'.
           If msitranslate is set, MSI-INTx translation is enabled if possible.
           Guest that doesn't support MSI will get IO-APIC type IRQs
           translated from physical MSI, HVM only. Default is 1.
-          The option may be repeated to add more than one pci device.""")
+          The option may be repeated to add more than one pci device.
+          If power_mgmt is set, the guest OS will be able to program the power
+          states D0-D3hot of the device, HVM only. Default=0.""")
 
 gopts.var('vscsi', val='PDEV,VDEV[,DOM]',
           fn=append_value, default=[],
@@ -605,6 +607,10 @@ gopts.var('pci_msitranslate', val='TRANS
           use="""Global PCI MSI-INTx translation flag (0=disable;
           1=enable.""")
 
+gopts.var('pci_power_mgmt', val='POWERMGMT',
+          fn=set_int, default=0,
+          use="""Global PCI Power Management flag (0=disable;1=enable).""")
+
 def err(msg):
     """Print an error to stderr and exit.
     """
@@ -691,7 +697,7 @@ def configure_pci(config_devs, vals):
         d = comma_sep_kv_to_dict(opts)
 
         def f(k):
-            if k not in ['msitranslate']:
+            if k not in ['msitranslate', 'power_mgmt']:
                 err('Invalid pci option: ' + k)
 
             config_pci_opts.append([k, d[k]])
@@ -913,7 +919,7 @@ def configure_hvm(config_image, vals):
              'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
              'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
              'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate',
-             'vpt_align' ]
+             'vpt_align', 'pci_power_mgmt' ]
 
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
diff -r cff29d694a89 tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Thu Mar 05 17:50:05 2009 +0000
+++ b/tools/python/xen/xm/xenapi_create.py      Fri Mar 06 13:25:54 2009 +0900
@@ -1047,6 +1047,7 @@ class sxp2xml:
             'guest_os_type',
             'hap',
             'pci_msitranslate',
+            'pci_power_mgmt',
         ]
 
         platform_configs = []
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel