HEX
Server: LiteSpeed
System: Linux node612.namehero.net 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: dfwparty (1186)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/sos/report/plugins/__pycache__/spyre.cpython-36.pyc
3

ܓ�i��@s&ddlmZmZGdd�dee�ZdS)�)�Plugin�IndependentPluginc@s0eZdZdZdZdZd
Zedd��Zdd�Z	d	S)�Spyreu�Spyre chip is IBM’s AI accelerator, designed to handle AI inferencing
    and workloads.

    The Spyre plugin collects data about the Spyre card’s VFIO device node
    tree, configuration files, and more.
    z!IBM Spyre Accelerator InformationZspyre�ppc.*cCs�g}|sdSx�|j�D]�}|j�s$qy*|jdd�\}}}}|j�jd�\}}Wntk
rdwYnX|dkr|dkr|jd�dkr�d	|}y"|jd�\}	}
}|jd
�\}}
Wntk
r�wYnX|j|	|
||
f�qW|S)a�Extract PCI domain, bus, device, function for devices that match:
        - Vendor ID = 0x1014 (IBM)
        - Device ID = 0x06a7 or 0x06a8

        Parameters
        ----------
        lspci_out : str
        The output string from `lspci -n`.

        Returns
        -------
        list of tuples
        A list of (domain, bus, device, function) tuples for each matching
        card.
        N�)�maxsplit�:Z1014�06a7�06a8�z0000:�.)r	r
)�
splitlines�strip�split�lower�
ValueError�count�append)Zlspci_output�spyre_cards�line�pci_addrZ_classZidsZ_restZvendor�device�domain�busZdev_funcZ
pci_device�function�r�/usr/lib/python3.6/spyre.py�get_ibm_spyre_devicess*zSpyre.get_ibm_spyre_devicesc	Cs�|jd�}|ddkrdS|j|d�}|s0dSxT|D]L\}}}}|�d|�d|�d|��}d|�d|�d|�d	�}|j|d
d�q6W|jdd
dg�dS)Nzlspci -nZstatusr�outputrrz/sys/devices/pci�/z	/vfio-devT)Ztreez/etc/modprobe.d/vfio-pci.confz!/etc/udev/rules.d/95-vfio-3.rulesz#/etc/security/limits.d/memlock.conf)Zexec_cmdrZadd_dir_listingZ
add_copy_spec)	�selfZlspcirrrrrrZpci_vfiorrr�setupHs
zSpyre.setupN)r)
�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZ
architectures�staticmethodrr!rrrrrs.rN)Zsos.report.pluginsrrrrrrr�<module>s