Skip to content

Commit 48f8e8e

Browse files
committed
Merge tag 'mmc-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fix unsupported parallel dispatch of requests MMC host: - atmel-mci/android-goldfish: Fixup logic of sg_copy_{from,to}_buffer - renesas_sdhi_internal_dmac: Prevent IRQ-storm due of DMAC IRQs - renesas_sdhi_internal_dmac: Fixup bad register offset" * tag 'mmc-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: renesas_sdhi_internal_dmac: mask DMAC interrupts mmc: renesas_sdhi_internal_dmac: fix #define RST_RESERVED_BITS mmc: block: Fix unsupported parallel dispatch of requests mmc: android-goldfish: fix bad logic of sg_copy_{from,to}_buffer conversion mmc: atmel-mci: fix bad logic of sg_copy_{from,to}_buffer conversion
2 parents 58c3f14 + d2332f8 commit 48f8e8e

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

drivers/mmc/core/queue.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ static void mmc_mq_exit_request(struct blk_mq_tag_set *set, struct request *req,
238238
mmc_exit_request(mq->queue, req);
239239
}
240240

241-
/*
242-
* We use BLK_MQ_F_BLOCKING and have only 1 hardware queue, which means requests
243-
* will not be dispatched in parallel.
244-
*/
245241
static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
246242
const struct blk_mq_queue_data *bd)
247243
{
@@ -264,7 +260,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
264260

265261
spin_lock_irq(q->queue_lock);
266262

267-
if (mq->recovery_needed) {
263+
if (mq->recovery_needed || mq->busy) {
268264
spin_unlock_irq(q->queue_lock);
269265
return BLK_STS_RESOURCE;
270266
}
@@ -291,6 +287,9 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
291287
break;
292288
}
293289

290+
/* Parallel dispatch of requests is not supported at the moment */
291+
mq->busy = true;
292+
294293
mq->in_flight[issue_type] += 1;
295294
get_card = (mmc_tot_in_flight(mq) == 1);
296295
cqe_retune_ok = (mmc_cqe_qcnt(mq) == 1);
@@ -333,9 +332,12 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
333332
mq->in_flight[issue_type] -= 1;
334333
if (mmc_tot_in_flight(mq) == 0)
335334
put_card = true;
335+
mq->busy = false;
336336
spin_unlock_irq(q->queue_lock);
337337
if (put_card)
338338
mmc_put_card(card, &mq->ctx);
339+
} else {
340+
WRITE_ONCE(mq->busy, false);
339341
}
340342

341343
return ret;

drivers/mmc/core/queue.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct mmc_queue {
8181
unsigned int cqe_busy;
8282
#define MMC_CQE_DCMD_BUSY BIT(0)
8383
#define MMC_CQE_QUEUE_FULL BIT(1)
84+
bool busy;
8485
bool use_cqe;
8586
bool recovery_needed;
8687
bool in_recovery;

drivers/mmc/host/android-goldfish.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host,
217217
* We don't really have DMA, so we need
218218
* to copy from our platform driver buffer
219219
*/
220-
sg_copy_to_buffer(data->sg, 1, host->virt_base,
220+
sg_copy_from_buffer(data->sg, 1, host->virt_base,
221221
data->sg->length);
222222
}
223223
host->data->bytes_xfered += data->sg->length;
@@ -393,7 +393,7 @@ static void goldfish_mmc_prepare_data(struct goldfish_mmc_host *host,
393393
* We don't really have DMA, so we need to copy to our
394394
* platform driver buffer
395395
*/
396-
sg_copy_from_buffer(data->sg, 1, host->virt_base,
396+
sg_copy_to_buffer(data->sg, 1, host->virt_base,
397397
data->sg->length);
398398
}
399399
}

drivers/mmc/host/atmel-mci.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
19761976
do {
19771977
value = atmci_readl(host, ATMCI_RDR);
19781978
if (likely(offset + 4 <= sg->length)) {
1979-
sg_pcopy_to_buffer(sg, 1, &value, sizeof(u32), offset);
1979+
sg_pcopy_from_buffer(sg, 1, &value, sizeof(u32), offset);
19801980

19811981
offset += 4;
19821982
nbytes += 4;
@@ -1993,7 +1993,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
19931993
} else {
19941994
unsigned int remaining = sg->length - offset;
19951995

1996-
sg_pcopy_to_buffer(sg, 1, &value, remaining, offset);
1996+
sg_pcopy_from_buffer(sg, 1, &value, remaining, offset);
19971997
nbytes += remaining;
19981998

19991999
flush_dcache_page(sg_page(sg));
@@ -2003,7 +2003,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
20032003
goto done;
20042004

20052005
offset = 4 - remaining;
2006-
sg_pcopy_to_buffer(sg, 1, (u8 *)&value + remaining,
2006+
sg_pcopy_from_buffer(sg, 1, (u8 *)&value + remaining,
20072007
offset, 0);
20082008
nbytes += offset;
20092009
}
@@ -2042,7 +2042,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
20422042

20432043
do {
20442044
if (likely(offset + 4 <= sg->length)) {
2045-
sg_pcopy_from_buffer(sg, 1, &value, sizeof(u32), offset);
2045+
sg_pcopy_to_buffer(sg, 1, &value, sizeof(u32), offset);
20462046
atmci_writel(host, ATMCI_TDR, value);
20472047

20482048
offset += 4;
@@ -2059,7 +2059,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
20592059
unsigned int remaining = sg->length - offset;
20602060

20612061
value = 0;
2062-
sg_pcopy_from_buffer(sg, 1, &value, remaining, offset);
2062+
sg_pcopy_to_buffer(sg, 1, &value, remaining, offset);
20632063
nbytes += remaining;
20642064

20652065
host->sg = sg = sg_next(sg);
@@ -2070,7 +2070,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
20702070
}
20712071

20722072
offset = 4 - remaining;
2073-
sg_pcopy_from_buffer(sg, 1, (u8 *)&value + remaining,
2073+
sg_pcopy_to_buffer(sg, 1, (u8 *)&value + remaining,
20742074
offset, 0);
20752075
atmci_writel(host, ATMCI_TDR, value);
20762076
nbytes += offset;

drivers/mmc/host/renesas_sdhi_internal_dmac.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@
4545
/* DM_CM_RST */
4646
#define RST_DTRANRST1 BIT(9)
4747
#define RST_DTRANRST0 BIT(8)
48-
#define RST_RESERVED_BITS GENMASK_ULL(32, 0)
48+
#define RST_RESERVED_BITS GENMASK_ULL(31, 0)
4949

5050
/* DM_CM_INFO1 and DM_CM_INFO1_MASK */
5151
#define INFO1_CLEAR 0
52+
#define INFO1_MASK_CLEAR GENMASK_ULL(31, 0)
5253
#define INFO1_DTRANEND1 BIT(17)
5354
#define INFO1_DTRANEND0 BIT(16)
5455

5556
/* DM_CM_INFO2 and DM_CM_INFO2_MASK */
57+
#define INFO2_MASK_CLEAR GENMASK_ULL(31, 0)
5658
#define INFO2_DTRANERR1 BIT(17)
5759
#define INFO2_DTRANERR0 BIT(16)
5860

@@ -252,6 +254,12 @@ renesas_sdhi_internal_dmac_request_dma(struct tmio_mmc_host *host,
252254
{
253255
struct renesas_sdhi *priv = host_to_priv(host);
254256

257+
/* Disable DMAC interrupts, we don't use them */
258+
renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO1_MASK,
259+
INFO1_MASK_CLEAR);
260+
renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO2_MASK,
261+
INFO2_MASK_CLEAR);
262+
255263
/* Each value is set to non-zero to assume "enabling" each DMA */
256264
host->chan_rx = host->chan_tx = (void *)0xdeadbeaf;
257265

0 commit comments

Comments
 (0)