How to test PCIe bus speed and correctness
hz hanks
hankshz at gmail.com
Wed Aug 1 13:55:18 EDT 2012
Hi, all:
I'm working on an embedded system using PCIe bus. Now my task is to
test the speed and correctness of the PCIe bus.
In order to do that:
1. find the corresponding resource I want to read and write ----
/sys/bus/pci/devices/XXXX:XX:XX.X/resource0
2. in my program, use function open() to open the resource
3. remap it use mmap() like this:
long *where = (long*) mmap( NULL, getpagesize(), PROT_READ|PROT_WRITE,
MAP_SHARED, fd, 0)
4. then I can read and write through PCIe bus like this:
where[0]; //read
where[0] = 1; //write
Is this the correct and entire process to test it in Linux?
Besides, I also worry about the cache's effect. I will actually
read/write the register of PCIe switch through PCIe bus. Presumably,
they're actually IO from the perspective of Linux, and Linux should
not cache it. Is it correct?
Thanks a lot.
Best,
Hanks
More information about the Kernelnewbies
mailing list