Re: [PATCH] NVMe: Fix compilation on architecturs withoutreadq/writeq

From: Ingo Molnar
Date: Tue Jan 31 2012 - 07:09:44 EST



* Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:

> > u64 val;
> > val = readl(addr);
> > val |= readl(addr+4) << 32;
> >
> > is well-defined and must read the low word first - both at the C level
> > *and* at the CPU level. Anything else would be a bug in the
> > architecture "readl()" implementation or the hardware.
>
> That doesn't make the access atomic to hardware however as a true 64bit
> readq/writeq would be ?
>
> It seems to me the two are not quite the same semantically

Correct, and that's what the:

#include <asm/io-inatomic.h>

line in the driver would express.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/