ia64/xen-unstable

changeset 19008:3a92e1a446d9

pci: add config options for MSI-INTx translation in HVM

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>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 08 11:26:58 2009 +0000 (2009-01-08)
parents 989bd3f2fd72
children 97f8d6453fda
files 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/python/xen/xend/XendConfig.py	Thu Jan 08 11:26:16 2009 +0000
     1.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Jan 08 11:26:58 2009 +0000
     1.3 @@ -166,6 +166,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     1.4      'guest_os_type': str,
     1.5      'hap': int,
     1.6      'xen_extended_power_mgmt': int,
     1.7 +    'pci_msitranslate': int,
     1.8  }
     1.9  
    1.10  # Xen API console 'other_config' keys.
     2.1 --- a/tools/python/xen/xend/server/pciif.py	Thu Jan 08 11:26:16 2009 +0000
     2.2 +++ b/tools/python/xen/xend/server/pciif.py	Thu Jan 08 11:26:58 2009 +0000
     2.3 @@ -95,6 +95,9 @@ class PciController(DevController):
     2.4  
     2.5          back['num_devs']=str(pcidevid)
     2.6          back['uuid'] = config.get('uuid','')
     2.7 +        if 'pci_msitranslate' in self.vm.info['platform']:
     2.8 +            back['msitranslate']=str(self.vm.info['platform']['pci_msitranslate'])
     2.9 +
    2.10          return (0, back, {})
    2.11  
    2.12  
     3.1 --- a/tools/python/xen/xm/create.py	Thu Jan 08 11:26:16 2009 +0000
     3.2 +++ b/tools/python/xen/xm/create.py	Thu Jan 08 11:26:58 2009 +0000
     3.3 @@ -318,11 +318,14 @@ gopts.var('disk', val='phy:DEV,VDEV,MODE
     3.4            backend driver domain to use for the disk.
     3.5            The option may be repeated to add more than one disk.""")
     3.6  
     3.7 -gopts.var('pci', val='BUS:DEV.FUNC',
     3.8 +gopts.var('pci', val='BUS:DEV.FUNC[,msitranslate=0|1]',
     3.9            fn=append_value, default=[],
    3.10            use="""Add a PCI device to a domain, using given params (in hex).
    3.11 -         For example 'pci=c0:02.1'.
    3.12 -         The option may be repeated to add more than one pci device.""")
    3.13 +          For example 'pci=c0:02.1'.
    3.14 +          If msitranslate is set, MSI-INTx translation is enabled if possible.
    3.15 +          Guest that doesn't support MSI will get IO-APIC type IRQs
    3.16 +          translated from physical MSI, HVM only. Default is 1.
    3.17 +          The option may be repeated to add more than one pci device.""")
    3.18  
    3.19  gopts.var('vscsi', val='PDEV,VDEV[,DOM]',
    3.20            fn=append_value, default=[],
    3.21 @@ -588,6 +591,11 @@ gopts.var('suppress_spurious_page_faults
    3.22            fn=set_bool, default=None,
    3.23            use="""Do not inject spurious page faults into this guest""")
    3.24  
    3.25 +gopts.var('pci_msitranslate', val='TRANSLATE',
    3.26 +          fn=set_int, default=1,
    3.27 +          use="""Global PCI MSI-INTx translation flag (0=disable;
    3.28 +          1=enable.""")
    3.29 +
    3.30  def err(msg):
    3.31      """Print an error to stderr and exit.
    3.32      """
    3.33 @@ -672,6 +680,9 @@ def configure_pci(config_devs, vals):
    3.34          d = comma_sep_kv_to_dict(opts)
    3.35  
    3.36          def f(k):
    3.37 +            if k not in ['msitranslate']:
    3.38 +                err('Invalid pci option: ' + k)
    3.39 +
    3.40              config_pci_opts.append([k, d[k]])
    3.41  
    3.42          config_pci_bdf = ['dev', ['domain', domain], ['bus', bus], \
    3.43 @@ -878,7 +889,7 @@ def configure_hvm(config_image, vals):
    3.44               'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
    3.45               'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
    3.46               'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
    3.47 -             'viridian', 'xen_extended_power_mgmt' ]
    3.48 +             'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate' ]
    3.49  
    3.50      for a in args:
    3.51          if a in vals.__dict__ and vals.__dict__[a] is not None:
     4.1 --- a/tools/python/xen/xm/xenapi_create.py	Thu Jan 08 11:26:16 2009 +0000
     4.2 +++ b/tools/python/xen/xm/xenapi_create.py	Thu Jan 08 11:26:58 2009 +0000
     4.3 @@ -1041,6 +1041,7 @@ class sxp2xml:
     4.4              'vhpt',
     4.5              'guest_os_type',
     4.6              'hap',
     4.7 +            'pci_msitranslate',
     4.8          ]
     4.9  
    4.10          platform_configs = []