How can I tell the compiler not to optimize and not to add any other instructions in between, and force the CPU to execute them back to back?
For example I'd like the kernel module to execute write (or read or mixed) commands as fast as possible
writel(0, addr);
writel(1, addr);
writel(0, addr);
or
writel(0, addr1);
writel(1, addr2);
writel(0, addr3);
Edit:
I replaced
iowrite32
withwritel
that has a definition withvolatile void __iomem *addr
addr*
can be allocated withdma_alloc_coherent()
or simplyioremap()
.My question isn't about order of execution (that is solved with memory barrier or
volatile
) but delay between them.Might be possible by combining my commands in a single assembly
asm volatile()
but I'd rather use something safer.