From: BOUGH CHEN <haibo.chen@nxp.com>
To: "ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>
Cc: "shawnguo@kernel.org" <shawnguo@kernel.org>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
dl-linux-imx <linux-imx@nxp.com>, BOUGH CHEN <haibo.chen@nxp.com>,
"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: [PATCH v2 14/14] mmc: queue: create dev->dma_parms before call dma_set_max_seg_size()
Date: Tue, 3 Dec 2019 12:54:55 +0000 [thread overview]
Message-ID: <20191203130120.11511-15-haibo.chen@nxp.com> (raw)
In-Reply-To: <20191203130120.11511-1-haibo.chen@nxp.com>
To make dma_set_max_seg_size() work, need to create dev->dma_parms.
Find this issue on i.MX8QM mek board, this platform config the
max_segment_size to 65535, but this dma_set_max_seg_size do not
actuall work, find sometimes the segment size is 65536, exceed
the hardware max segment limitation, trigger ADMA error.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/core/queue.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 9edc08685e86..f74c28c58482 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -359,6 +359,7 @@ static const struct blk_mq_ops mmc_mq_ops = {
static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
{
struct mmc_host *host = card->host;
+ struct device *dev = mmc_dev(host);
unsigned block_size = 512;
blk_queue_flag_set(QUEUE_FLAG_NONROT, mq->queue);
@@ -366,13 +367,12 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
if (mmc_can_erase(card))
mmc_queue_setup_discard(mq->queue, card);
- if (!mmc_dev(host)->dma_mask || !*mmc_dev(host)->dma_mask)
+ if (!dev->dma_mask || !*dev->dma_mask)
blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_HIGH);
blk_queue_max_hw_sectors(mq->queue,
min(host->max_blk_count, host->max_req_size / 512));
if (host->can_dma_map_merge)
- WARN(!blk_queue_can_use_dma_map_merging(mq->queue,
- mmc_dev(host)),
+ WARN(!blk_queue_can_use_dma_map_merging(mq->queue, dev),
"merging was advertised but not possible");
blk_queue_max_segments(mq->queue, mmc_get_max_segments(host));
@@ -389,7 +389,8 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
blk_queue_max_segment_size(mq->queue,
round_down(host->max_seg_size, block_size));
- dma_set_max_seg_size(mmc_dev(host), queue_max_segment_size(mq->queue));
+ dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), GFP_KERNEL);
+ dma_set_max_seg_size(dev, queue_max_segment_size(mq->queue));
INIT_WORK(&mq->recovery_work, mmc_mq_recovery_handler);
INIT_WORK(&mq->complete_work, mmc_blk_mq_complete_work);
--
2.17.1
prev parent reply other threads:[~2019-12-03 12:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-03 12:54 [PATCH v2 00/14] few fix for sdhci-esdhc-imx BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 01/14] mmc: sdhci: do not enable card detect interrupt for gpio cd type BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 02/14] mmc: sdhci-esdhc-imx: no fail when no pinctrl available BOUGH CHEN
2019-12-10 23:25 ` Linus Walleij
2019-12-03 12:54 ` [PATCH v2 03/14] mmc: sdhci-esdhci-imx: retune needed for Mega/Mix enabled SoCs BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 04/14] mmc: sdhci-esdhc-imx: restore the per_clk rate in PM_RUNTIME BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 05/14] doc: dt: fsl-imx-esdhc: add strobe-dll-delay-target binding BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 06/14] mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 07/14] mmc: sdhci-esdhc-imx: optimize the clock setting BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 08/14] mmc: sdhci-esdhc-imx: optimize the strobe dll setting BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 09/14] doc: dt: fsl-imx-esdhc: add auto-cmd23-broken binding BOUGH CHEN
2019-12-10 23:32 ` Linus Walleij
2019-12-10 23:39 ` Linus Walleij
2020-02-10 3:08 ` BOUGH CHEN
2020-02-10 13:30 ` Linus Walleij
2019-12-03 12:54 ` [PATCH v2 10/14] mmc: sdhci-esdhc-imx: handle 'sdhci,auto-cmd23-broken' from devicetree BOUGH CHEN
2019-12-10 23:38 ` Linus Walleij
2019-12-03 12:54 ` [PATCH v2 11/14] mmc: sdhci-esdhc-imx: clear pending interrupt and halt cqhci BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 12/14] mmc: sdhci-esdhc-imx: restore pin state when resume back BOUGH CHEN
2019-12-03 12:54 ` [PATCH v2 13/14] mmc: sdhci-esdhc-imx: clear DMA_SEL when disable DMA mode BOUGH CHEN
2019-12-03 12:54 ` BOUGH CHEN [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=20191203130120.11511-15-haibo.chen@nxp.com \
--to=haibo.chen@nxp.com \
--cc=adrian.hunter@intel.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-imx@nxp.com \
--cc=linux-mmc@vger.kernel.org \
--cc=shawnguo@kernel.org \
--cc=ulf.hansson@linaro.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).