MSI-X中断消息产生流程比MSI更复杂一些,它大致有以下步骤。相比于发送MSI时,EP HW可以直接使用配置空间中指明的MSI基地址,MSI-X需要先去查询MSI-X table才能够获取到中断对应的address和data信息。 RC driver映射MSI-X 和pending bit table到其地址空间。 RC driver向MSI-X table中填入它所支持的中断向量配置表。
*entries, int minvec, int maxvec)*/首先,调用pci_enable_msix_range使能msix中断,这个函数里面会根据处理器体系结构初始化MSI-X Capability寄存器,并且分配中断号保存在entries->vector; 然后,使用request_irq函数注册中断处理函数即可;
desc->mask_base是MSI-X table entry 0对应的虚拟地址,desc->msi_attrib.entry_nr是MSI-X table entry编号。desc->mask_base和desc->msi_attrib.entry_nr都是在msix_setup_entries赋值的(pci_enable_msix_range->__pci_enable_msix_range-> __pci_enable_msix->msix_capability_init->msix_setup_entries)...
MSIX Table存储所有PCIE设备的中断向量号,位于BAR3的起始地址处,这里是设备内部的寄存器空间。每个中断向量对应一条Entry,包含中断向量号和用于处理中断的Local APIC编号。每条Entry占用4个DWORD,访问第N个Entry的地址计算公式为:n_entry_address = base address[BAR] +16 * n。中断向量的申请过程发生...
PCIE MSIX: 工作原理:MSIX解决了MSI的设计缺陷,引入了更大规模的中断表和更灵活的中断管理。它支持更多的中断向量,使得设备能够更有效地处理中断。 关键结构: MSIX Capability Structure:包含Table Size、Function Mask和MSIX Enable Bit,用于支持MSIX中断的初始化和管理。 MSIX Table和Pending ...
pci_match_one_device函数中,第一个参数是设备驱动注册时硬编码的ID结构体,第二个参数是pci设备,当PCI驱动指定的ID为PCI_ANY_ID时,表示可以匹配任何的ID,查看virtio_pci_driver注册时设置的virtio_pci_id_table,如下,可以看到,驱动只设置了vendor id,所有只要vendor id为0x1af4,都可以match成功。在系统枚举PCI设...
msi domain初始化流程涉及irq_domain结构体的配置,系统在pci_arch_init()中调用x86_create_pci_msi_domain完成初始化。接着,pci_alloc_irq_vectors函数用于MSI/MSIX capability初始化、中断号分配,最终实现中断管理。MSI-X中断软件注册流程与MSI类似,通过pci_alloc_irq_vector函数完成,主要区别在于为...
pcie_msix module MSI-X support module. Implements MSI-X table and pending bit array with AXI lite register interface, accepts interrupt requests on a streaming interface, and generates corresponding write request TLPs. pcie_ptile_cfg module Configuration shim for Intel Stratix 10 DX/Agilex series...
u8 msix_cap; /* MSI-X capability offset */ u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ u8 rom_base_reg; /* which config register controls the ROM */ u8 pin; /* which interrupt pin this device uses */ u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ ...
其中nvme_driver中的id_table 取值如下: static conststructpci_device_id nvme_id_table[] = {undefined { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, { 0, } }; 其中PCI_DEVICE_CLASS宏用于创建一个struct pci_device_id类型的实例,这个实例只需要匹配指定的pci class,这个指定的匹配PCI...