Caner Altinbasak
Caner Altinbasak

Reputation: 113

How to record(reverse-engineer) PCI transactions on Linux

I want to record all read/write PCI transactions of a device driver. Is there a way to do it by a linux command or on software?

Upvotes: 5

Views: 2557

Answers (2)

alex.forencich
alex.forencich

Reputation: 1435

PCI/PCIe is implemented entirely in hardware at a very low level, software generally does not have any visibility over the actual operations taking place on the bus, unlike something like Ethernet or USB where a large portion of the stack is handled in software. So, things like DMA are not going to be possible to directly monitor from software as they are handled completely in hardware. Operations initiated by the CPU (MMIO) are simply load and store operations on IO-mapped memory, so in principle it should be possible to monitor those the same way you would monitor any other memory accesses from software.

If you really need visibility into what is going on on a PCI or PCIe bus, then you need a piece of hardware called a protocol analyzer. This will capture and decode all of the bus transfers and display them in a manner similar to wireshark.

Upvotes: 0

ephemient
ephemient

Reputation: 204956

Memory-mapped I/O Trace is now in the mainline kernel, see /usr/src/linux/Documentation/trace/mmiotrace.txt for documentation.

Upvotes: 4

Related Questions