Commit 48f8e8e9 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 58c3f14f d2332f88
...@@ -238,10 +238,6 @@ static void mmc_mq_exit_request(struct blk_mq_tag_set *set, struct request *req, ...@@ -238,10 +238,6 @@ static void mmc_mq_exit_request(struct blk_mq_tag_set *set, struct request *req,
mmc_exit_request(mq->queue, req); mmc_exit_request(mq->queue, req);
} }
/*
* We use BLK_MQ_F_BLOCKING and have only 1 hardware queue, which means requests
* will not be dispatched in parallel.
*/
static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx, static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
const struct blk_mq_queue_data *bd) const struct blk_mq_queue_data *bd)
{ {
...@@ -264,7 +260,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -264,7 +260,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
spin_lock_irq(q->queue_lock); spin_lock_irq(q->queue_lock);
if (mq->recovery_needed) { if (mq->recovery_needed || mq->busy) {
spin_unlock_irq(q->queue_lock); spin_unlock_irq(q->queue_lock);
return BLK_STS_RESOURCE; return BLK_STS_RESOURCE;
} }
...@@ -291,6 +287,9 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -291,6 +287,9 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
break; break;
} }
/* Parallel dispatch of requests is not supported at the moment */
mq->busy = true;
mq->in_flight[issue_type] += 1; mq->in_flight[issue_type] += 1;
get_card = (mmc_tot_in_flight(mq) == 1); get_card = (mmc_tot_in_flight(mq) == 1);
cqe_retune_ok = (mmc_cqe_qcnt(mq) == 1); 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, ...@@ -333,9 +332,12 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
mq->in_flight[issue_type] -= 1; mq->in_flight[issue_type] -= 1;
if (mmc_tot_in_flight(mq) == 0) if (mmc_tot_in_flight(mq) == 0)
put_card = true; put_card = true;
mq->busy = false;
spin_unlock_irq(q->queue_lock); spin_unlock_irq(q->queue_lock);
if (put_card) if (put_card)
mmc_put_card(card, &mq->ctx); mmc_put_card(card, &mq->ctx);
} else {
WRITE_ONCE(mq->busy, false);
} }
return ret; return ret;
......
...@@ -81,6 +81,7 @@ struct mmc_queue { ...@@ -81,6 +81,7 @@ struct mmc_queue {
unsigned int cqe_busy; unsigned int cqe_busy;
#define MMC_CQE_DCMD_BUSY BIT(0) #define MMC_CQE_DCMD_BUSY BIT(0)
#define MMC_CQE_QUEUE_FULL BIT(1) #define MMC_CQE_QUEUE_FULL BIT(1)
bool busy;
bool use_cqe; bool use_cqe;
bool recovery_needed; bool recovery_needed;
bool in_recovery; bool in_recovery;
......
...@@ -217,7 +217,7 @@ static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host, ...@@ -217,7 +217,7 @@ static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host,
* We don't really have DMA, so we need * We don't really have DMA, so we need
* to copy from our platform driver buffer * to copy from our platform driver buffer
*/ */
sg_copy_to_buffer(data->sg, 1, host->virt_base, sg_copy_from_buffer(data->sg, 1, host->virt_base,
data->sg->length); data->sg->length);
} }
host->data->bytes_xfered += data->sg->length; host->data->bytes_xfered += data->sg->length;
...@@ -393,7 +393,7 @@ static void goldfish_mmc_prepare_data(struct goldfish_mmc_host *host, ...@@ -393,7 +393,7 @@ static void goldfish_mmc_prepare_data(struct goldfish_mmc_host *host,
* We don't really have DMA, so we need to copy to our * We don't really have DMA, so we need to copy to our
* platform driver buffer * platform driver buffer
*/ */
sg_copy_from_buffer(data->sg, 1, host->virt_base, sg_copy_to_buffer(data->sg, 1, host->virt_base,
data->sg->length); data->sg->length);
} }
} }
......
...@@ -1976,7 +1976,7 @@ static void atmci_read_data_pio(struct atmel_mci *host) ...@@ -1976,7 +1976,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
do { do {
value = atmci_readl(host, ATMCI_RDR); value = atmci_readl(host, ATMCI_RDR);
if (likely(offset + 4 <= sg->length)) { if (likely(offset + 4 <= sg->length)) {
sg_pcopy_to_buffer(sg, 1, &value, sizeof(u32), offset); sg_pcopy_from_buffer(sg, 1, &value, sizeof(u32), offset);
offset += 4; offset += 4;
nbytes += 4; nbytes += 4;
...@@ -1993,7 +1993,7 @@ static void atmci_read_data_pio(struct atmel_mci *host) ...@@ -1993,7 +1993,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
} else { } else {
unsigned int remaining = sg->length - offset; unsigned int remaining = sg->length - offset;
sg_pcopy_to_buffer(sg, 1, &value, remaining, offset); sg_pcopy_from_buffer(sg, 1, &value, remaining, offset);
nbytes += remaining; nbytes += remaining;
flush_dcache_page(sg_page(sg)); flush_dcache_page(sg_page(sg));
...@@ -2003,7 +2003,7 @@ static void atmci_read_data_pio(struct atmel_mci *host) ...@@ -2003,7 +2003,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
goto done; goto done;
offset = 4 - remaining; offset = 4 - remaining;
sg_pcopy_to_buffer(sg, 1, (u8 *)&value + remaining, sg_pcopy_from_buffer(sg, 1, (u8 *)&value + remaining,
offset, 0); offset, 0);
nbytes += offset; nbytes += offset;
} }
...@@ -2042,7 +2042,7 @@ static void atmci_write_data_pio(struct atmel_mci *host) ...@@ -2042,7 +2042,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
do { do {
if (likely(offset + 4 <= sg->length)) { if (likely(offset + 4 <= sg->length)) {
sg_pcopy_from_buffer(sg, 1, &value, sizeof(u32), offset); sg_pcopy_to_buffer(sg, 1, &value, sizeof(u32), offset);
atmci_writel(host, ATMCI_TDR, value); atmci_writel(host, ATMCI_TDR, value);
offset += 4; offset += 4;
...@@ -2059,7 +2059,7 @@ static void atmci_write_data_pio(struct atmel_mci *host) ...@@ -2059,7 +2059,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
unsigned int remaining = sg->length - offset; unsigned int remaining = sg->length - offset;
value = 0; value = 0;
sg_pcopy_from_buffer(sg, 1, &value, remaining, offset); sg_pcopy_to_buffer(sg, 1, &value, remaining, offset);
nbytes += remaining; nbytes += remaining;
host->sg = sg = sg_next(sg); host->sg = sg = sg_next(sg);
...@@ -2070,7 +2070,7 @@ static void atmci_write_data_pio(struct atmel_mci *host) ...@@ -2070,7 +2070,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
} }
offset = 4 - remaining; offset = 4 - remaining;
sg_pcopy_from_buffer(sg, 1, (u8 *)&value + remaining, sg_pcopy_to_buffer(sg, 1, (u8 *)&value + remaining,
offset, 0); offset, 0);
atmci_writel(host, ATMCI_TDR, value); atmci_writel(host, ATMCI_TDR, value);
nbytes += offset; nbytes += offset;
......
...@@ -45,14 +45,16 @@ ...@@ -45,14 +45,16 @@
/* DM_CM_RST */ /* DM_CM_RST */
#define RST_DTRANRST1 BIT(9) #define RST_DTRANRST1 BIT(9)
#define RST_DTRANRST0 BIT(8) #define RST_DTRANRST0 BIT(8)
#define RST_RESERVED_BITS GENMASK_ULL(32, 0) #define RST_RESERVED_BITS GENMASK_ULL(31, 0)
/* DM_CM_INFO1 and DM_CM_INFO1_MASK */ /* DM_CM_INFO1 and DM_CM_INFO1_MASK */
#define INFO1_CLEAR 0 #define INFO1_CLEAR 0
#define INFO1_MASK_CLEAR GENMASK_ULL(31, 0)
#define INFO1_DTRANEND1 BIT(17) #define INFO1_DTRANEND1 BIT(17)
#define INFO1_DTRANEND0 BIT(16) #define INFO1_DTRANEND0 BIT(16)
/* DM_CM_INFO2 and DM_CM_INFO2_MASK */ /* DM_CM_INFO2 and DM_CM_INFO2_MASK */
#define INFO2_MASK_CLEAR GENMASK_ULL(31, 0)
#define INFO2_DTRANERR1 BIT(17) #define INFO2_DTRANERR1 BIT(17)
#define INFO2_DTRANERR0 BIT(16) #define INFO2_DTRANERR0 BIT(16)
...@@ -252,6 +254,12 @@ renesas_sdhi_internal_dmac_request_dma(struct tmio_mmc_host *host, ...@@ -252,6 +254,12 @@ renesas_sdhi_internal_dmac_request_dma(struct tmio_mmc_host *host,
{ {
struct renesas_sdhi *priv = host_to_priv(host); struct renesas_sdhi *priv = host_to_priv(host);
/* Disable DMAC interrupts, we don't use them */
renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO1_MASK,
INFO1_MASK_CLEAR);
renesas_sdhi_internal_dmac_dm_write(host, DM_CM_INFO2_MASK,
INFO2_MASK_CLEAR);
/* Each value is set to non-zero to assume "enabling" each DMA */ /* Each value is set to non-zero to assume "enabling" each DMA */
host->chan_rx = host->chan_tx = (void *)0xdeadbeaf; host->chan_rx = host->chan_tx = (void *)0xdeadbeaf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment