From: Thierry Reding <thierry.reding@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
Ulf Hansson <ulf.hansson@linaro.org>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Christoph Hellwig <hch@lst.de>,
Simon Horman <horms+renesas@verge.net.au>,
Jon Hunter <jonathanh@nvidia.com>,
linux-block@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: [PATCH 1/3] block: Respect the device's maximum segment size
Date: Mon, 9 Sep 2019 14:56:56 +0200 [thread overview]
Message-ID: <20190909125658.30559-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20190909125658.30559-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
When enabling the DMA map merging capability for a queue, ensure that
the maximum segment size does not exceed the device's limit.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
block/blk-settings.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 70b39f14e974..9fb1288fbc12 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -738,12 +738,8 @@ void blk_queue_segment_boundary(struct request_queue *q, unsigned long mask)
}
EXPORT_SYMBOL(blk_queue_segment_boundary);
-/**
- * blk_queue_virt_boundary - set boundary rules for bio merging
- * @q: the request queue for the device
- * @mask: the memory boundary mask
- **/
-void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask)
+void __blk_queue_virt_boundary(struct request_queue *q, unsigned long mask,
+ unsigned int max_segment_size)
{
q->limits.virt_boundary_mask = mask;
@@ -754,7 +750,17 @@ void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask)
* of that they are not limited by our notion of "segment size".
*/
if (mask)
- q->limits.max_segment_size = UINT_MAX;
+ q->limits.max_segment_size = max_segment_size;
+}
+
+/**
+ * blk_queue_virt_boundary - set boundary rules for bio merging
+ * @q: the request queue for the device
+ * @mask: the memory boundary mask
+ **/
+void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask)
+{
+ __blk_queue_virt_boundary(q, mask, UINT_MAX);
}
EXPORT_SYMBOL(blk_queue_virt_boundary);
@@ -843,13 +849,13 @@ EXPORT_SYMBOL_GPL(blk_queue_write_cache);
bool blk_queue_can_use_dma_map_merging(struct request_queue *q,
struct device *dev)
{
+ unsigned int max_segment_size = dma_get_max_seg_size(dev);
unsigned long boundary = dma_get_merge_boundary(dev);
if (!boundary)
return false;
- /* No need to update max_segment_size. see blk_queue_virt_boundary() */
- blk_queue_virt_boundary(q, boundary);
+ __blk_queue_virt_boundary(q, boundary, max_segment_size);
return true;
}
--
2.23.0
next prev parent reply other threads:[~2019-09-09 12:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 12:56 [PATCH 0/3] mmc: Fix scatter/gather on SDHCI Thierry Reding
2019-09-09 12:56 ` Thierry Reding [this message]
2019-09-09 16:13 ` [PATCH 1/3] block: Respect the device's maximum segment size Christoph Hellwig
2019-09-09 19:19 ` Thierry Reding
2019-09-10 2:03 ` Yoshihiro Shimoda
2019-09-10 6:13 ` Christoph Hellwig
2019-09-10 7:37 ` Thierry Reding
2019-09-11 10:36 ` Christoph Hellwig
2019-09-10 7:30 ` Thierry Reding
2019-09-11 7:23 ` Yoshihiro Shimoda
2019-09-11 10:37 ` Christoph Hellwig
2019-09-12 0:57 ` Ming Lei
2019-09-12 8:19 ` Christoph Hellwig
2019-09-09 12:56 ` [PATCH 2/3] mmc: core: Respect MMC host's " Thierry Reding
2019-09-09 12:56 ` [PATCH 3/3] mmc: sdhci: Set DMA maximum segment size to 64 KiB Thierry Reding
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=20190909125658.30559-2-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=horms+renesas@verge.net.au \
--cc=jonathanh@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=yoshihiro.shimoda.uh@renesas.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 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).