On Sun, Feb 25, 2018 at 11:02 AM, Johannes Thumshirn <jthumshirn@xxxxxxx> wrote: > Arnd Bergmann <arnd@xxxxxxxx> writes: >> 32-bit architectures generally cannot use writeq(), so we now get a build >> failure for the lpfc driver: >> >> drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_sli4_wq_put': >> drivers/scsi/lpfc/lpfc_sli.c:145:4: error: implicit declaration of function 'writeq'; did you mean 'writeb'? [-Werror=implicit-function-declaration] > Hi Arnd, > why can't we use the writeq() from 'io-64-nonatomic-lo-hi.h'? I always > thought these are compat versions for 32 Bit archs and even asked James > to do so, what's why he did the change in the first place. That could work as well, if someone can figure out what the correct incantation is that works on big-endian 32-bit architectures. I think the simplest version that works everywhere would be lo_hi_writeq(__le32_to_cpup(__le32 __force *)p) | (u64)__le32_to_cpup(__le32 __force *)p +1) << 32)); but this is ugly as hell and makes my head spin. I definitely would't want that applied without being tested properly first on a variety of architectures. There are three variants that I'd prefer over that: - use memcpy_toio() and change the x86 implementation to guarantee aligned word aligned accesses on the output if at all possible (which seems to be a good idea anyway) - use a loop around __raw_writeq()/__raw_writel() depending on CONFIG_64BIT - add generic memcpy_toio_32() and memcpy_toio_64() helpers in linux/io.h and use those. Arnd