HEX
Server: LiteSpeed
System: Linux cp4.porkbun.com 5.14.0-611.20.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jan 14 06:35:04 EST 2026 x86_64
User: vxblllubpkafjsjw (1110)
PHP: 8.4.19
Disabled: NONE
Upload Files
File: //usr/lib/python3.9/site-packages/sos/report/plugins/__pycache__/spyre.cpython-39.opt-1.pyc
a

�>�h��@s&ddlmZmZGdd�dee�ZdS)�)�Plugin�IndependentPluginc@s0eZdZdZdZdZdZedd��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)zppc.*c	Cs�g}|sdS|��D]�}|��s"qz*|jdd�\}}}}|���d�\}}WntybYqYn0|dkr|dvr|�d�dkr�d|}z"|�d�\}	}
}|�d	�\}}
Wnty�YqYn0|�|	|
||
f�q|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)Z06a7Z06a8�z0000:�.)�
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.9/site-packages/sos/report/plugins/spyre.py�get_ibm_spyre_devicess*

zSpyre.get_ibm_spyre_devicesc	Cs�|�d�}|ddkrdS|�|d�}|s0dS|D]L\}}}}|�d|�d|�d|��}d|�d|�d|�d	�}|j|d
d�q4|�gd��dS)
Nzlspci -n�statusr�outputrr	z/sys/devices/pci�/z	/vfio-devT)Ztree)z/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)
�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZ
architectures�staticmethodrrrrrrrs
-rN)Zsos.report.pluginsrrrrrrr�<module>s