← PCIe 상세 목차DUJINLABS.COM

Hardware · PCIe detailed manual 07 · Linux v6.18.37

7. MSI/MSI-X를 Memory Write TLP부터 irqdomain까지 추적한다

MSI는 별도 물리 interrupt wire가 아니라 device가 특정 address와 data로 보내는 Memory Write입니다. DWC 내부 MSI controller를 쓰는 구성과 GIC ITS 같은 외부 MSI parent를 쓰는 구성을 먼저 구분해야 합니다.

상세 표
4
검증 행
33
절차
5 checkpoints
기준
PCIe · Linux v6.18.37

CHAPTER 07

7. MSI/MSI-X를 Memory Write TLP부터 irqdomain까지 추적한다

MSI는 별도 물리 interrupt wire가 아니라 device가 특정 address와 data로 보내는 Memory Write입니다. DWC 내부 MSI controller를 쓰는 구성과 GIC ITS 같은 외부 MSI parent를 쓰는 구성을 먼저 구분해야 합니다.

DWC 내부 MSI register group

RegisterOffset역할Linux 자료구조검증
PCIE_MSI_ADDR_LO0x820MSI target address lowpp->msi_datadevice capability에 program된 address와 일치
PCIE_MSI_ADDR_HI0x824MSI target address highpp->msi_data upper64-bit address 지원 확인
MSI_INTR0_ENABLE0x828 + block offset32-vector block enableirqdomain allocation할당 vector bit set
MSI_INTR0_MASK0x82c + block offsetmask 상태pp->irq_mask[ctrl]software shadow와 hardware 일치
MSI_INTR0_STATUS0x830 + block offsetpending/W1C statusdw_handle_msi_irqpending bit와 virq mapping
block stride12 bytes다음 32 vector groupMAX_MSI_CTRLSvector/32와 bit%32 계산
MAX_MSI_IRQS256공통 driver 상한bitmap/irq arraysIP 실제 vector 수와 min 적용

MSI write가 Linux handler까지 가는 경로

단계관찰 지점실패 시
Vector allocationhwirq/virqirqdomain, driver returnvector 부족/domain 오류
Message composeaddress_lo/hi + dataMSI capability/MSI-X table잘못된 target/data
Device Memory WriteRequester ID, address, dataprotocol analyzer/AERTLP 미발생/UR
Internal DWC matchMSI address/status bitMSI status registerstatus 0이면 route/address 문제
Parent IRQDWC MSI summary IRQGIC/PLIC/APIC counterstatus는 1인데 parent IRQ 없음
irqdomain dispatchhwirq→virqgeneric_handle_domain_irqmapping/affinity 문제
Device ISRqueue/vector/proc/interrupts/traceIRQ는 오나 wrong queue
Ack/clear/unmaskW1C status/maskregister readbackinterrupt storm 또는 1회 후 정지

내부 DWC MSI와 외부 MSI parent 비교

항목DWC 내부 MSI외부 GIC ITS/플랫폼 MSI판정 근거
DT 표시msi-parent/msi-map가 없을 수 있음msi-parent 또는 msi-maplive DT
target addressDWC가 할당한 msi_dataITS/doorbell addresscompose_msi_msg
pending statusDWC 0x830 계열ITS/외부 controller어느 bank가 증가하는가
parent IRQDWC summary IRQLPI/MSI domain/proc/interrupts와 irqdomain
maskDWC mask shadow/registerMSI core/remapperirq_chip ops
대표 설정 오류내부 block enable 누락RID/DeviceID/MSI map 오류fault/status 위치

MSI-X에서 추가로 볼 항목

항목위치의미검증
Table BIRMSI-X capabilitytable이 들어 있는 BARBAR resource와 mapping
Table offsetMSI-X capabilityBAR 내 table 시작entry stride/범위
Message addressentry +0/+4vector별 targetirq core가 쓴 값
Message dataentry +8vector datahwirq/remapper data
Vector controlentry +12per-vector maskunmask 후 bit0=0
PBABIR+offsetmasked pending bitmask 중 event 후 bit set
Function MaskMSI-X Message Control전체 vector maskprobe/runtime 전환
그림 1. 7. MSI/MSI-X를 Memory Write TLP부터 irqdomain까지 추적한다의 실행 순서왼쪽에서 오른쪽으로 실제 소유권과 관찰 지점이 이동합니다.
01 pci_alloc_irq_vectors
02 irqdomain hwirq/virq
03 MSI message compose
04 device capability/table write
05 device MSI Memory Write
06 DWC/ITS match
07 parent IRQ
08 Linux handler
09 status clear

실제 검증 절차

순서실행남길 증거판정 목적
1할당된 virq, hwirq, message address/data와 queue index를 표로 저장합니다.vector 하나가 한 queue/handler에 일관되게 연결번호 공간 혼동 제거
2device table/capability와 irqdomain이 compose한 message를 비교합니다.address/data exact matchdevice programming 누락 확인
3DMA completion memory write와 MSI TLP를 timestamp로 비교합니다.completion data가 먼저, MSI가 뒤device ordering 또는 driver visibility 문제
4DWC status, parent controller count, `/proc/interrupts`를 같은 event에서 봅니다.처음 증가하지 않는 stagerouting 경계 확정
5mask/unmask와 affinity 변경을 반복합니다.pending/재전달/target CPU 동작vector control과 remapper 검증

주의DWC 내부 MSI status가 0이라고 해서 device가 MSI를 보내지 않았다고 단정하지 않습니다. 외부 MSI parent 구성이면 해당 TLP는 DWC 내부 block을 거치지 않을 수 있습니다.

공개적으로 다시 확인할 수 있는 자료

공개되지 않은 vendor register나 integration별 offset을 추측해서 채우지 않았습니다. 아래 제조사 자료, architecture 문서와 Linux v6.18.37 원본에서 다시 확인할 수 있는 범위만 사용했습니다.