pci: add config options for MSI-INTx translation in HVM
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 8 Jan 2009 11:26:58 +0000 (11:26 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 8 Jan 2009 11:26:58 +0000 (11:26 +0000)
Add a config file option 'pci_msitranslate' to enable MSI-INTx
translation in HVM, and also a per-device option 'msitranslate' to
allow device base to be overridden

Signed-off-by: Qing He <qing.he@intel.com>
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

index 9b436ae6476eeb10b68f9d6d7ea4cb1812bb5d78..086ed99e128058ab6bbfeafbdc04edb0b01bc91e 100644 (file)
@@ -166,6 +166,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'guest_os_type': str,
     'hap': int,
     'xen_extended_power_mgmt': int,
+    'pci_msitranslate': int,
 }
 
 # Xen API console 'other_config' keys.
index 0695ae419fcfb834a4bd25659570177e15eef893..f76e4a8c4980038d44135d8e206a463c82aca7c2 100644 (file)
@@ -95,6 +95,9 @@ class PciController(DevController):
 
         back['num_devs']=str(pcidevid)
         back['uuid'] = config.get('uuid','')
+        if 'pci_msitranslate' in self.vm.info['platform']:
+            back['msitranslate']=str(self.vm.info['platform']['pci_msitranslate'])
+
         return (0, back, {})
 
 
index 48c8807425df536574a86506985263cbfc5fc9d7..d9c0a9f84f6e0b15a1874fc336ac6391cb6523ba 100644 (file)
@@ -318,11 +318,14 @@ gopts.var('disk', val='phy:DEV,VDEV,MODE[,DOM]',
           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',
+gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=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'.
-         The option may be repeated to add more than one pci device.""")
+          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.""")
 
 gopts.var('vscsi', val='PDEV,VDEV[,DOM]',
           fn=append_value, default=[],
@@ -588,6 +591,11 @@ gopts.var('suppress_spurious_page_faults', val='yes|no',
           fn=set_bool, default=None,
           use="""Do not inject spurious page faults into this guest""")
 
+gopts.var('pci_msitranslate', val='TRANSLATE',
+          fn=set_int, default=1,
+          use="""Global PCI MSI-INTx translation flag (0=disable;
+          1=enable.""")
+
 def err(msg):
     """Print an error to stderr and exit.
     """
@@ -672,6 +680,9 @@ def configure_pci(config_devs, vals):
         d = comma_sep_kv_to_dict(opts)
 
         def f(k):
+            if k not in ['msitranslate']:
+                err('Invalid pci option: ' + k)
+
             config_pci_opts.append([k, d[k]])
 
         config_pci_bdf = ['dev', ['domain', domain], ['bus', bus], \
@@ -878,7 +889,7 @@ def configure_hvm(config_image, vals):
              'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
              'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
              'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
-             'viridian', 'xen_extended_power_mgmt' ]
+             'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate' ]
 
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
index c1cc66ec5244ec290babd1d6f8bf5dc13d92d7c2..39489e497f20d162b57de16cbd2c56239f1c3d59 100644 (file)
@@ -1041,6 +1041,7 @@ class sxp2xml:
             'vhpt',
             'guest_os_type',
             'hap',
+            'pci_msitranslate',
         ]
 
         platform_configs = []