aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2011-05-24 20:13:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 11:39:44 -0400
commitdbee8a0affd5e6eaa5d7c816c4bc233f6f110f50 (patch)
tree485bba5ec4436e9e8c84aacf25590ca8f8a6332b /drivers/acpi
parent818b667ba57f68bf1e7240fa441dda0b11e6b944 (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/acpi')
-rw-r--r--drivers/acpi/apei/einj.c8
-rw-r--r--drivers/acpi/atomicio.c4
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 096aebfe7f3..f74b2ea11f2 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -101,6 +101,14 @@ static DEFINE_MUTEX(einj_mutex);
101 101
102static struct einj_parameter *einj_param; 102static struct einj_parameter *einj_param;
103 103
104#ifndef writeq
105static inline void writeq(__u64 val, volatile void __iomem *addr)
106{
107 writel(val, addr);
108 writel(val >> 32, addr+4);
109}
110#endif
111
104static void einj_exec_ctx_init(struct apei_exec_context *ctx) 112static void einj_exec_ctx_init(struct apei_exec_context *ctx)
105{ 113{
106 apei_exec_ctx_init(ctx, einj_ins_type, ARRAY_SIZE(einj_ins_type), 114 apei_exec_ctx_init(ctx, einj_ins_type, ARRAY_SIZE(einj_ins_type),
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 542e5390389..7489b89c300 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -280,9 +280,11 @@ static int acpi_atomic_read_mem(u64 paddr, u64 *val, u32 width)
280 case 32: 280 case 32:
281 *val = readl(addr); 281 *val = readl(addr);
282 break; 282 break;
283#ifdef readq
283 case 64: 284 case 64:
284 *val = readq(addr); 285 *val = readq(addr);
285 break; 286 break;
287#endif
286 default: 288 default:
287 return -EINVAL; 289 return -EINVAL;
288 } 290 }
@@ -307,9 +309,11 @@ static int acpi_atomic_write_mem(u64 paddr, u64 val, u32 width)
307 case 32: 309 case 32:
308 writel(val, addr); 310 writel(val, addr);
309 break; 311 break;
312#ifdef writeq
310 case 64: 313 case 64:
311 writeq(val, addr); 314 writeq(val, addr);
312 break; 315 break;
316#endif
313 default: 317 default:
314 return -EINVAL; 318 return -EINVAL;
315 } 319 }