Skip to contentSkip to conversation

mmc: mmci: Fixup error handling for dma

PATCH New Ulf Hansson 3 participants 5 messages Nov 29, 2011 – Dec 5, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: mmci: Fixup error handling for dma

When getting a cmd irq during an ongoing data transfer with dma, the dma job were never terminated. This is now corrected.

---
 drivers/mmc/host/mmci.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/mmc/host/mmci.c +5 -1
index e900f51..62ad649 100644
@@ -761,8 +761,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
 	}
 
 	if (!cmd->data || cmd->error) {
-		if (host->data)
+		if (host->data) {
+			/* Terminate the DMA transfer */
+			if (dma_inprogress(host))
+				mmci_dma_data_error(host);
 			mmci_stop_data(host);
+		}
 		mmci_request_end(host, cmd->mrq);
 	} else if (!(cmd->data->flags & MMC_DATA_READ)) {
 		mmci_start_data(host, cmd->data);
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 1/1 mmc: mmci: Fixup error handling for dma

In reply to Ulf Hansson

drivers/mmc/host/mmci.c mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, · line 767

Quoted 13 lines · Ulf Hansson
drivers/mmc/host/mmci.c +4 -1
index e900f51..62ad649 100644
@@ -761,8 +761,12 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd,
 	}
 
 	if (!cmd->data || cmd->error) {
-		if (host->data)
+		if (host->data) {
+			/* Terminate the DMA transfer */
+			if (dma_inprogress(host))
+				mmci_dma_data_error(host);

Doesn't this leave the DMA buffers mapped?

#3 lore raw

PATCH 1/1 mmc: mmci: Fixup error handling for dma

Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines

? ? ? if (!cmd->data || cmd->error) {
- ? ? ? ? ? ? if (host->data)
+ ? ? ? ? ? ? if (host->data) {
+ ? ? ? ? ? ? ? ? ? ? /* Terminate the DMA transfer */
+ ? ? ? ? ? ? ? ? ? ? if (dma_inprogress(host))
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? mmci_dma_data_error(host);

Doesn't this leave the DMA buffers mapped?

Yep it needs an mmci_dma_unmap() call too AFAICT,
Ulf will you update?

Yours,
Linus Walleij

#4 lore raw

PATCH 1/1 mmc: mmci: Fixup error handling for dma

Quoted 10 lines · Linus Walleij
Quoted 7 lines · Russell King - ARM Linux

drivers/mmc/host/mmci.c mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, · line 767

Quoted 6 lines
      if (!cmd->data || cmd->error) {
drivers/mmc/host/mmci.c +4 -1
-             if (host->data)
+             if (host->data) {
+                     /* Terminate the DMA transfer */
+                     if (dma_inprogress(host))
+                             mmci_dma_data_error(host);

Doesn't this leave the DMA buffers mapped?

Correct, but it will be handled in post_request function.

Quoted 3 lines

Yep it needs an mmci_dma_unmap() call too AFAICT,
Ulf will you update?

Actually it's needs only dma_unmap_sg, but as stated this should be handled in mmci_post_request.

By, the way - I spoke to Per F?rlin who implemented the pre_request and post_request functions; we will soon push some clean-up patches for improved error handling and how to manage the cookie better. Right now it is kind of hard to follow the error path, I think. We hope this shall be improved then.

Although it should have nothing to do with this patch directly, since this is a bugfix only.

BR
Ulf Hansson