linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NVMe: Fix compilation on architecturs without readq/writeq
@ 2012-01-20  1:01 Matthew Wilcox
  2012-01-20  1:21 ` Linus Torvalds
  0 siblings, 1 reply; 27+ messages in thread
From: Matthew Wilcox @ 2012-01-20  1:01 UTC (permalink / raw)
  To: torvalds, linux-kernel, linux-nvme, hpa; +Cc: Matthew Wilcox

The only places that uses readq/writeq are in the initialisation
path.  Since they're not performance critical, always use readl/writel.

Reported-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
---
 drivers/block/nvme.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index c1dc4d8..f27deec 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -972,6 +972,20 @@ static __devinit struct nvme_queue *nvme_create_queue(struct nvme_dev *dev,
 	return ERR_PTR(result);
 }
 
+static inline unsigned long long nvme_readq(const volatile void __iomem *addr)
+{
+	unsigned long long result = readl(addr);
+	result |= (unsigned long long)readl(addr + 4) << 32;
+	return result;
+}
+
+static inline void
+nvme_writeq(unsigned long long val, volatile void __iomem *addr)
+{
+	writel(val, addr);
+	writel(val >> 32, addr + 4);
+}
+
 static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev)
 {
 	int result;
@@ -996,11 +1010,11 @@ static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev)
 
 	writel(0, &dev->bar->cc);
 	writel(aqa, &dev->bar->aqa);
-	writeq(nvmeq->sq_dma_addr, &dev->bar->asq);
-	writeq(nvmeq->cq_dma_addr, &dev->bar->acq);
+	nvme_writeq(nvmeq->sq_dma_addr, &dev->bar->asq);
+	nvme_writeq(nvmeq->cq_dma_addr, &dev->bar->acq);
 	writel(dev->ctrl_config, &dev->bar->cc);
 
-	cap = readq(&dev->bar->cap);
+	cap = nvme_readq(&dev->bar->cap);
 	timeout = ((NVME_CAP_TIMEOUT(cap) + 1) * HZ / 2) + jiffies;
 	dev->db_stride = NVME_CAP_STRIDE(cap);
 
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2012-02-07  2:48 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20  1:01 [PATCH] NVMe: Fix compilation on architecturs without readq/writeq Matthew Wilcox
2012-01-20  1:21 ` Linus Torvalds
2012-01-20 17:43   ` Wilcox, Matthew R
2012-01-21  8:28   ` Ingo Molnar
2012-01-21 15:54     ` Hitoshi Mitake
2012-01-21 16:58       ` Ingo Molnar
2012-01-23 16:05         ` Hitoshi Mitake
2012-01-23 16:57           ` Linus Torvalds
2012-01-23 23:04             ` H. Peter Anvin
2012-01-29  8:02             ` Hitoshi Mitake
2012-01-31  3:03               ` Linus Torvalds
2012-01-31  3:05                 ` Linus Torvalds
2012-02-04 15:25                   ` Hitoshi Mitake
2012-01-31 11:58                 ` Alan Cox
2012-01-31 12:09                   ` Ingo Molnar
2012-01-31 12:18                     ` Alan Cox
2012-01-31 12:23                       ` Ingo Molnar
2012-02-01 23:35                         ` Linus Torvalds
2012-02-02  1:05                           ` James Bottomley
2012-02-02  1:15                             ` Linus Torvalds
2012-02-02 15:05                             ` H. Peter Anvin
2012-02-04 15:39                               ` Hitoshi Mitake
2012-02-05  6:53                                 ` Geert Uytterhoeven
2012-02-05  7:01                                   ` Hitoshi Mitake
2012-02-04 15:34                             ` Hitoshi Mitake
2012-02-07  2:48                               ` Hitoshi Mitake
2012-02-04 15:24                 ` Hitoshi Mitake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).