lkml.org 
[lkml]   [2012]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] NVMe: Fix compilation on architecturs without readq/writeq
Date
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


\
 
 \ /
  Last update: 2012-01-20 02:13    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site