Skip to content

Commit 1ae7efb

Browse files
committed
Merge tag 'mmc-v5.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fix a couple of quite severe issues for the CQE request path MMC host: - alcor: Fix a resource leak in the error path for ->probe() - sdhci-acpi: Fix the DMA support for the AMD eMMC v5.0 variant - sdhci-pci-gli: Fix system resume support for GL975x - sdhci-pci-gli: Fix reboot error for GL9750" * tag 'mmc-v5.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-acpi: Add SDHCI_QUIRK2_BROKEN_64_BIT_DMA for AMDI0040 mmc: block: Fix request completion in the CQE timeout path mmc: core: Fix recursive locking issue in CQE recovery path mmc: core: Check request type before completing the request mmc: sdhci-pci-gli: Fix can not access GL9750 after reboot from Windows 10 mmc: alcor: Fix a resource leak in the error path for ->probe() mmc: sdhci-pci-gli: Fix no irq handler from suspend
2 parents decd616 + 45a3fe3 commit 1ae7efb

File tree

5 files changed

+41
-17
lines changed

5 files changed

+41
-17
lines changed

drivers/mmc/core/block.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
13701370
struct mmc_request *mrq = &mqrq->brq.mrq;
13711371
struct request_queue *q = req->q;
13721372
struct mmc_host *host = mq->card->host;
1373+
enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
13731374
unsigned long flags;
13741375
bool put_card;
13751376
int err;
@@ -1399,7 +1400,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
13991400

14001401
spin_lock_irqsave(&mq->lock, flags);
14011402

1402-
mq->in_flight[mmc_issue_type(mq, req)] -= 1;
1403+
mq->in_flight[issue_type] -= 1;
14031404

14041405
put_card = (mmc_tot_in_flight(mq) == 0);
14051406

drivers/mmc/core/queue.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,10 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
107107
case MMC_ISSUE_DCMD:
108108
if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
109109
if (recovery_needed)
110-
__mmc_cqe_recovery_notifier(mq);
110+
mmc_cqe_recovery_notifier(mrq);
111111
return BLK_EH_RESET_TIMER;
112112
}
113-
/* No timeout (XXX: huh? comment doesn't make much sense) */
114-
blk_mq_complete_request(req);
113+
/* The request has gone already */
115114
return BLK_EH_DONE;
116115
default:
117116
/* Timeout is handled by mmc core */
@@ -127,18 +126,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,
127126
struct mmc_card *card = mq->card;
128127
struct mmc_host *host = card->host;
129128
unsigned long flags;
130-
int ret;
129+
bool ignore_tout;
131130

132131
spin_lock_irqsave(&mq->lock, flags);
133-
134-
if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)
135-
ret = BLK_EH_RESET_TIMER;
136-
else
137-
ret = mmc_cqe_timed_out(req);
138-
132+
ignore_tout = mq->recovery_needed || !mq->use_cqe || host->hsq_enabled;
139133
spin_unlock_irqrestore(&mq->lock, flags);
140134

141-
return ret;
135+
return ignore_tout ? BLK_EH_RESET_TIMER : mmc_cqe_timed_out(req);
142136
}
143137

144138
static void mmc_mq_recovery_handler(struct work_struct *work)

drivers/mmc/host/alcor.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
11041104

11051105
if (ret) {
11061106
dev_err(&pdev->dev, "Failed to get irq for data line\n");
1107-
return ret;
1107+
goto free_host;
11081108
}
11091109

11101110
mutex_init(&host->cmd_mutex);
@@ -1116,6 +1116,10 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
11161116
dev_set_drvdata(&pdev->dev, host);
11171117
mmc_add_host(mmc);
11181118
return 0;
1119+
1120+
free_host:
1121+
mmc_free_host(mmc);
1122+
return ret;
11191123
}
11201124

11211125
static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)

drivers/mmc/host/sdhci-acpi.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,12 @@ static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev,
605605
}
606606

607607
static const struct sdhci_acpi_slot sdhci_acpi_slot_amd_emmc = {
608-
.chip = &sdhci_acpi_chip_amd,
609-
.caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
610-
.quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE |
611-
SDHCI_QUIRK_32BIT_ADMA_SIZE,
608+
.chip = &sdhci_acpi_chip_amd,
609+
.caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
610+
.quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
611+
SDHCI_QUIRK_32BIT_DMA_SIZE |
612+
SDHCI_QUIRK_32BIT_ADMA_SIZE,
613+
.quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA,
612614
.probe_slot = sdhci_acpi_emmc_amd_probe_slot,
613615
};
614616

drivers/mmc/host/sdhci-pci-gli.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#define SDHCI_GLI_9750_DRIVING_2 GENMASK(27, 26)
2727
#define GLI_9750_DRIVING_1_VALUE 0xFFF
2828
#define GLI_9750_DRIVING_2_VALUE 0x3
29+
#define SDHCI_GLI_9750_SEL_1 BIT(29)
30+
#define SDHCI_GLI_9750_SEL_2 BIT(31)
31+
#define SDHCI_GLI_9750_ALL_RST (BIT(24)|BIT(25)|BIT(28)|BIT(30))
2932

3033
#define SDHCI_GLI_9750_PLL 0x864
3134
#define SDHCI_GLI_9750_PLL_TX2_INV BIT(23)
@@ -122,6 +125,8 @@ static void gli_set_9750(struct sdhci_host *host)
122125
GLI_9750_DRIVING_1_VALUE);
123126
driving_value |= FIELD_PREP(SDHCI_GLI_9750_DRIVING_2,
124127
GLI_9750_DRIVING_2_VALUE);
128+
driving_value &= ~(SDHCI_GLI_9750_SEL_1|SDHCI_GLI_9750_SEL_2|SDHCI_GLI_9750_ALL_RST);
129+
driving_value |= SDHCI_GLI_9750_SEL_2;
125130
sdhci_writel(host, driving_value, SDHCI_GLI_9750_DRIVING);
126131

127132
sw_ctrl_value &= ~SDHCI_GLI_9750_SW_CTRL_4;
@@ -334,6 +339,18 @@ static u32 sdhci_gl9750_readl(struct sdhci_host *host, int reg)
334339
return value;
335340
}
336341

342+
#ifdef CONFIG_PM_SLEEP
343+
static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip)
344+
{
345+
struct sdhci_pci_slot *slot = chip->slots[0];
346+
347+
pci_free_irq_vectors(slot->chip->pdev);
348+
gli_pcie_enable_msi(slot);
349+
350+
return sdhci_pci_resume_host(chip);
351+
}
352+
#endif
353+
337354
static const struct sdhci_ops sdhci_gl9755_ops = {
338355
.set_clock = sdhci_set_clock,
339356
.enable_dma = sdhci_pci_enable_dma,
@@ -348,6 +365,9 @@ const struct sdhci_pci_fixes sdhci_gl9755 = {
348365
.quirks2 = SDHCI_QUIRK2_BROKEN_DDR50,
349366
.probe_slot = gli_probe_slot_gl9755,
350367
.ops = &sdhci_gl9755_ops,
368+
#ifdef CONFIG_PM_SLEEP
369+
.resume = sdhci_pci_gli_resume,
370+
#endif
351371
};
352372

353373
static const struct sdhci_ops sdhci_gl9750_ops = {
@@ -366,4 +386,7 @@ const struct sdhci_pci_fixes sdhci_gl9750 = {
366386
.quirks2 = SDHCI_QUIRK2_BROKEN_DDR50,
367387
.probe_slot = gli_probe_slot_gl9750,
368388
.ops = &sdhci_gl9750_ops,
389+
#ifdef CONFIG_PM_SLEEP
390+
.resume = sdhci_pci_gli_resume,
391+
#endif
369392
};

0 commit comments

Comments
 (0)