From: Matthew Wilcox <matthew.r.wilcox@intel.com>
To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-nvme@infradead.org, hpa@linux.intel.com
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Subject: [PATCH] NVMe: Fix compilation on architecturs without readq/writeq
Date: Thu, 19 Jan 2012 20:01:05 -0500 [thread overview]
Message-ID: <1327021265-22184-1-git-send-email-matthew.r.wilcox@intel.com> (raw)
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
next reply other threads:[~2012-01-20 1:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 1:01 Matthew Wilcox [this message]
2012-01-20 1:21 ` [PATCH] NVMe: Fix compilation on architecturs without readq/writeq 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1327021265-22184-1-git-send-email-matthew.r.wilcox@intel.com \
--to=matthew.r.wilcox@intel.com \
--cc=hpa@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@infradead.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).