From: willy@linux.intel.com (Matthew Wilcox)
Subject: [PATCH] NVMe: Mismatched host/device page size support
Date: Sat, 21 Jun 2014 12:19:08 -0400 [thread overview]
Message-ID: <20140621161908.GQ12025@linux.intel.com> (raw)
In-Reply-To: <1403299663-31721-1-git-send-email-keith.busch@intel.com>
On Fri, Jun 20, 2014@03:27:43PM -0600, Keith Busch wrote:
> Adds support for devices with max page size smaller than the host's.
> In the case we encounter such a host/device combination, the driver will
> split a page into as many PRP entries as necessary for the device's page
> size capabilities.
That was a considerably smaller patch than I was expecting for this
functionality! Nicely done.
> @@ -1450,6 +1451,15 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev)
> u32 aqa;
> u64 cap = readq(&dev->bar->cap);
> struct nvme_queue *nvmeq;
> + unsigned page_shift = PAGE_SHIFT;
> + unsigned dev_page_shift = NVME_CAP_MPSMAX(cap) + 12;
> +
> + if (page_shift > dev_page_shift) {
> + dev_warn(&dev->pci_dev->dev,
> + "host/device page size mismatch %u/%u\n",
> + 1 << page_shift, 1 << dev_page_shift);
> + page_shift = dev_page_shift;
> + }
Let's take on another possibility here:
+ unsigned page_shift = PAGE_SHIFT;
+ unsigned dev_page_min = NVME_CAP_MPSMIN(cap) + 12;
+ unsigned dev_page_max = NVME_CAP_MPSMAX(cap) + 12;
+
+ if (page_shift < dev_page_min) {
+ dev_err(&dev->pci_dev->dev,
+ "Minimum device page size (%u) too large for "
+ "host (%u)\n", 1 << dev_page_min,
+ 1 << page_shift);
+ return -ENODEV;
+ }
+
+ if (page_shift > dev_page_max) {
+ dev_info(&dev->pci_dev->dev,
+ "Device maximum page size (%u) smaller than "
+ "host (%u); enabling work-around\n",
+ 1 << dev_page_max, 1 << page_shift);
+ page_shift = dev_page_max;
+ }
prev parent reply other threads:[~2014-06-21 16:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 21:27 [PATCH] NVMe: Mismatched host/device page size support Keith Busch
2014-06-21 16:19 ` Matthew Wilcox [this message]
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=20140621161908.GQ12025@linux.intel.com \
--to=willy@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.