Skip to content

Commit

Permalink
Implementation of getting the iommu pci devices address
Browse files Browse the repository at this point in the history
Add the function of getting the pci devices addresses
sharing the same iommuGroup.

Signed-off-by: Lily Zhu <[email protected]>
  • Loading branch information
iccaszhulili committed Oct 19, 2017
1 parent bf5087b commit ae940bc
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions virttest/libvirt_xml/nodedev_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,42 @@ class for capability whose type is pci.
"""

# Example:
#<capability type='pci'>
# <domain>0</domain>
# <bus>7</bus>
# <slot>0</slot>
# <function>0</function>
# <product id='0x1521'>I350 Gigabit Network Connection</product>
# <vendor id='0x8086'>Intel Corporation</vendor>
# <capability type='virt_functions'>
# <address domain='0x0000' bus='0x08' slot='0x10' function='0x0'/>
# <address domain='0x0000' bus='0x08' slot='0x10' function='0x4'/>
# </capability>
# <numa node='0'/>
#</capability>
# <capability type='pci'>
# <domain>0</domain>
# <bus>7</bus>
# <slot>0</slot>
# <function>0</function>
# <product id='0x1521'>I350 Gigabit Network Connection</product>
# <vendor id='0x8086'>Intel Corporation</vendor>
# <capability type='virt_functions'>
# <address domain='0x0000' bus='0x08' slot='0x10' function='0x0'/>
# <address domain='0x0000' bus='0x08' slot='0x10' function='0x4'/>
# </capability>
# <numa node='0'/>
# </capability>

# or the Example of iommu:
# <capability type="pci">
# <domain>0</domain>
# <bus>4</bus>
# <slot>0</slot>
# <function>1</function>
# <product id="0x1639">NetXtreme II BCM5709 Gigabit Ethernet</product>
# <vendor id="0x14e4">Broadcom Limited</vendor>
# <iommuGroup number="15">
# <address bus="0x04" domain="0x0000" function="0x0" slot="0x00" />
# <address bus="0x04" domain="0x0000" function="0x1" slot="0x00" />
# </iommuGroup>
# <numa node="0" />
# <pci-express>
# <link port="0" speed="5" validity="cap" width="4" />
# <link speed="5" validity="sta" width="4" />
# </pci-express>
# </capability>

__slots__ = ('domain', 'bus', 'slot', 'function', 'product_id',
'vendor_id', 'virt_functions', 'numa_node')
'vendor_id', 'virt_functions', 'numa_node',
'iommuGroup_number', 'iommuGroup_address')

def __init__(self, virsh_instance=base.virsh):
accessors.XMLElementInt('domain', self, parent_xpath='/',
Expand All @@ -158,6 +178,12 @@ def __init__(self, virsh_instance=base.virsh):
tag_name='vendor', attribute='id')
accessors.XMLAttribute('numa_node', self, parent_xpath='/',
tag_name='numa', attribute='node')
accessors.XMLAttribute('iommuGroup_number', self, parent_xpath='/',
tag_name='iommuGroup', attribute='number')
accessors.XMLElementList('iommuGroup_address', self,
parent_xpath='/iommuGroup',
marshal_from=self.marshal_from_address,
marshal_to=self.marshal_to_address)
accessors.XMLElementList('virt_functions', self,
parent_xpath='/capability',
marshal_from=self.marshal_from_address,
Expand Down

0 comments on commit ae940bc

Please sign in to comment.