As you know, starting with version 2.0, PCI Express supports compound atomic operations:
FetchAdd,Swap,CAS: https://pcisig.com/sites/default/files/specification_documents/ECN_Atomic_Ops_080417.pdfAlso known, that x86_64 CPU has assembler compound atomic operations:
lock add,[lock] xchg,lock cmpxchg: https://godbolt.org/g/MmqMRw
That can be produced by C-compiler used volatile atomic_int-operations:
int expceted_cas = 0;
volatile atomic_int a;
atomic_fetch_add( &a, 1 );
atomic_exchange( &a, 1 );
atomic_compare_exchange_weak( &a, &expceted_cas, 1 );
I want to access to the buffer memory on device (Ethernet, GPU, ...) that connected by PCI Express to PC-x86_64, by using compound atomic operations. I.e. we already know how works hardware bus (PCIe supports atomics FetchAdd/Swap/CAS), but we want to know what assembler source code required to use this PCIe features.
Can we use x86_64 CPU compound atomic operations: lock add, [lock] xchg, lock cmpxchg to generate on PCI Express the compound atomic operations: FetchAdd, Swap, CAS?
Or what asm-code should we use on x86_64 CPU to perform atomic operations FetchAdd, Swap, CAS on PCI Express 2.0/3.0?