Commit 5f25a66f authored by Pierre Ossman's avatar Pierre Ossman Committed by Linus Torvalds

[PATCH] mmc: fix MMIO vs memory races in sdhci

Sprinkle some mmiowb() where needed (writeX() before unlock()).
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f9565129
...@@ -717,6 +717,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -717,6 +717,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
} else } else
sdhci_send_command(host, mrq->cmd); sdhci_send_command(host, mrq->cmd);
mmiowb();
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
} }
...@@ -753,6 +754,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -753,6 +754,7 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
ctrl &= ~SDHCI_CTRL_4BITBUS; ctrl &= ~SDHCI_CTRL_4BITBUS;
writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
mmiowb();
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
} }
...@@ -860,6 +862,7 @@ static void sdhci_tasklet_finish(unsigned long param) ...@@ -860,6 +862,7 @@ static void sdhci_tasklet_finish(unsigned long param)
sdhci_deactivate_led(host); sdhci_deactivate_led(host);
mmiowb();
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
mmc_request_done(host->mmc, mrq); mmc_request_done(host->mmc, mrq);
...@@ -893,6 +896,7 @@ static void sdhci_timeout_timer(unsigned long data) ...@@ -893,6 +896,7 @@ static void sdhci_timeout_timer(unsigned long data)
} }
} }
mmiowb();
spin_unlock_irqrestore(&host->lock, flags); spin_unlock_irqrestore(&host->lock, flags);
} }
...@@ -1030,6 +1034,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1030,6 +1034,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id, struct pt_regs *regs)
result = IRQ_HANDLED; result = IRQ_HANDLED;
mmiowb();
out: out:
spin_unlock(&host->lock); spin_unlock(&host->lock);
...@@ -1095,6 +1100,7 @@ static int sdhci_resume (struct pci_dev *pdev) ...@@ -1095,6 +1100,7 @@ static int sdhci_resume (struct pci_dev *pdev)
if (chip->hosts[i]->flags & SDHCI_USE_DMA) if (chip->hosts[i]->flags & SDHCI_USE_DMA)
pci_set_master(pdev); pci_set_master(pdev);
sdhci_init(chip->hosts[i]); sdhci_init(chip->hosts[i]);
mmiowb();
ret = mmc_resume_host(chip->hosts[i]->mmc); ret = mmc_resume_host(chip->hosts[i]->mmc);
if (ret) if (ret)
return ret; return ret;
...@@ -1327,6 +1333,8 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) ...@@ -1327,6 +1333,8 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
host->chip = chip; host->chip = chip;
chip->hosts[slot] = host; chip->hosts[slot] = host;
mmiowb();
mmc_add_host(mmc); mmc_add_host(mmc);
printk(KERN_INFO "%s: SDHCI at 0x%08lx irq %d %s\n", mmc_hostname(mmc), printk(KERN_INFO "%s: SDHCI at 0x%08lx irq %d %s\n", mmc_hostname(mmc),
......
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