diff options
author | Roland Dreier <roland@purestorage.com> | 2011-05-24 20:13:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:44 -0400 |
commit | dbee8a0affd5e6eaa5d7c816c4bc233f6f110f50 (patch) | |
tree | 485bba5ec4436e9e8c84aacf25590ca8f8a6332b /drivers/scsi | |
parent | 818b667ba57f68bf1e7240fa441dda0b11e6b944 (diff) |
x86: remove 32-bit versions of readq()/writeq()
The presense of a writeq() implementation on 32-bit x86 that splits the
64-bit write into two 32-bit writes turns out to break the mpt2sas driver
(and in general is risky for drivers as was discussed in
<http://lkml.kernel.org/r/adaab6c1h7c.fsf@cisco.com>). To fix this,
revert 2c5643b1c5c7 ("x86: provide readq()/writeq() on 32-bit too") and
follow-on cleanups.
This unfortunately leads to pushing non-atomic definitions of readq() and
write() to various x86-only drivers that in the meantime started using the
definitions in the x86 version of <asm/io.h>. However as discussed
exhaustively, this is actually the right thing to do, because the right
way to split a 64-bit transaction is hardware dependent and therefore
belongs in the hardware driver (eg mpt2sas needs a spinlock to make sure
no other accesses occur in between the two halves of the access).
Build tested on 32- and 64-bit x86 allmodconfig.
Link: http://lkml.kernel.org/r/x86-32-writeq-is-broken@mdm.bga.com
Acked-by: Hitoshi Mitake <h.mitake@gmail.com>
Cc: Kashyap Desai <Kashyap.Desai@lsi.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Ravi Anand <ravi.anand@qlogic.com>
Cc: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Jason Uhlenkott <juhlenko@akamai.com>
Acked-by: James Bottomley <James.Bottomley@parallels.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_nx.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c index 35381cb0936e..03e522b2fe0b 100644 --- a/drivers/scsi/qla4xxx/ql4_nx.c +++ b/drivers/scsi/qla4xxx/ql4_nx.c | |||
@@ -655,6 +655,27 @@ static int qla4_8xxx_pci_is_same_window(struct scsi_qla_host *ha, | |||
655 | return 0; | 655 | return 0; |
656 | } | 656 | } |
657 | 657 | ||
658 | #ifndef readq | ||
659 | static inline __u64 readq(const volatile void __iomem *addr) | ||
660 | { | ||
661 | const volatile u32 __iomem *p = addr; | ||
662 | u32 low, high; | ||
663 | |||
664 | low = readl(p); | ||
665 | high = readl(p + 1); | ||
666 | |||
667 | return low + ((u64)high << 32); | ||
668 | } | ||
669 | #endif | ||
670 | |||
671 | #ifndef writeq | ||
672 | static inline void writeq(__u64 val, volatile void __iomem *addr) | ||
673 | { | ||
674 | writel(val, addr); | ||
675 | writel(val >> 32, addr+4); | ||
676 | } | ||
677 | #endif | ||
678 | |||
658 | static int qla4_8xxx_pci_mem_read_direct(struct scsi_qla_host *ha, | 679 | static int qla4_8xxx_pci_mem_read_direct(struct scsi_qla_host *ha, |
659 | u64 off, void *data, int size) | 680 | u64 off, void *data, int size) |
660 | { | 681 | { |