【63-27】{【26-19】(【18-14】【13-11】)}【10-0】
【63-27】:dev->bus->domain_nr
【26-19】:dev->bus->number
(【18-14】【13-11】):dev->devfn;【18-14】==slot(即device?);【13-11】==func
【10-0】:一般是msi中断的序列号,例如第一个就是0,这里可以看出每个function,即每个配置空间对应最多2^11==2048个中断
**
* pci_msi_domain_calc_hwirq - Generate a unique ID for an MSI source
* @dev: Pointer to the PCI device
* @desc: Pointer to the msi descriptor
*
* The ID number is only used within the irqdomain.
*/
irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
struct msi_desc *desc)
{
return (irq_hw_number_t)desc->msi_attrib.entry_nr |
PCI_DEVID(dev->bus->number, dev->devfn) << 11 |
(pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27;
}
============
如下示例bus是0,slot是1, function是0,则中断号中第14位置1,得到中断号是16384
/ # lspci -v
00:00.0 Host bridge: Red Hat, Inc. Device 0008
Subsystem: Red Hat, Inc Device 1100
Flags: fast devsel
lspci: Unable to load libkmod resources: error -12
00:01.0 Ethernet controller: Red Hat, Inc Virtio network device
Subsystem: Red Hat, Inc Device 0001
Flags: bus master, fast devsel, latency 0, IRQ 41
I/O ports at 1000 [size=32]
Memory at 10040000 (32-bit, non-prefetchable) [size=4K]
Memory at 8000000000 (64-bit, prefetchable) [size=16K]
[virtual] Expansion ROM at 10000000 [disabled] [size=256K]
Capabilities: [98] MSI-X: Enable+ Count=3 Masked-
Capabilities: [84] Vendor Specific Information: VirtIO:
Capabilities: [70] Vendor Specific Information: VirtIO: Notify
Capabilities: [60] Vendor Specific Information: VirtIO: DeviceCfg
Capabilities: [50] Vendor Specific Information: VirtIO: ISR
Capabilities: [40] Vendor Specific Information: VirtIO: CommonCfg
Kernel driver in use: virtio-pci
/ # lspci -t
-[0000:00]-+-00.0
\-01.0
/ # cat /proc/interrupts | grep MSI
42: 0 0 0 0 MSI 16384 Edge virtio0-config
43: 327 0 0 0 MSI 16385 Edge virtio0-input.0
44: 1 0 0 0 MSI 16386 Edge virtio0-output.0
/ #
其他:bus==03, slot==00, function=0
03:00.0 Class 0200: Device 8086:15c2 (rev 11)
阅读(2122) | 评论(0) | 转发(0) |