All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH #upstream-fixes] ahci: redo stopping DMA engines on empty ports
@ 2010-06-07 13:15 Tejun Heo
  2010-06-07 20:08 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2010-06-07 13:15 UTC (permalink / raw)
  To: Jeff Garzik, linux-ide; +Cc: Matthew Garrett, Marc Dionne, Robert Hancock

Commit 96d60303fd (ahci: Turn off DMA engines when there's no device)
implemented stopping DMA engines on empty ports but it used single
sampling of status registers to determine device presence which led to
disabling of DMA engines on occupied ports.  Do it after all EH
actions are complete using device presence state determined by EH.
This avoids spurious disabling of DMA engines and simplifies the code.

Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Robert Hancock <hancockrwd@gmail.com>
---
 drivers/ata/libahci.c |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 1984a6e..261f86d 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -541,29 +541,11 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 	return -EINVAL;
 }

-static int ahci_is_device_present(void __iomem *port_mmio)
-{
-	u8 status = readl(port_mmio + PORT_TFDATA) & 0xff;
-
-	/* Make sure PxTFD.STS.BSY and PxTFD.STS.DRQ are 0 */
-	if (status & (ATA_BUSY | ATA_DRQ))
-		return 0;
-
-	/* Make sure PxSSTS.DET is 3h */
-	status = readl(port_mmio + PORT_SCR_STAT) & 0xf;
-	if (status != 3)
-		return 0;
-	return 1;
-}
-
 void ahci_start_engine(struct ata_port *ap)
 {
 	void __iomem *port_mmio = ahci_port_base(ap);
 	u32 tmp;

-	if (!ahci_is_device_present(port_mmio))
-		return;
-
 	/* start DMA */
 	tmp = readl(port_mmio + PORT_CMD);
 	tmp |= PORT_CMD_START;
@@ -1892,6 +1874,9 @@ static void ahci_error_handler(struct ata_port *ap)
 	}

 	sata_pmp_error_handler(ap);
+
+	if (!ata_dev_enabled(ap->link.device))
+		ahci_stop_engine(ap);
 }

 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH #upstream-fixes] ahci: redo stopping DMA engines on empty ports
  2010-06-07 13:15 [PATCH #upstream-fixes] ahci: redo stopping DMA engines on empty ports Tejun Heo
@ 2010-06-07 20:08 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2010-06-07 20:08 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, Matthew Garrett, Marc Dionne, Robert Hancock

On 06/07/2010 09:15 AM, Tejun Heo wrote:
> Commit 96d60303fd (ahci: Turn off DMA engines when there's no device)
> implemented stopping DMA engines on empty ports but it used single
> sampling of status registers to determine device presence which led to
> disabling of DMA engines on occupied ports.  Do it after all EH
> actions are complete using device presence state determined by EH.
> This avoids spurious disabling of DMA engines and simplifies the code.
>
> Signed-off-by: Tejun Heo<tj@kernel.org>
> Tested-by: Marc Dionne<marc.c.dionne@gmail.com>
> Cc: Matthew Garrett<mjg@redhat.com>
> Cc: Robert Hancock<hancockrwd@gmail.com>
> ---
>   drivers/ata/libahci.c |   21 +++------------------
>   1 file changed, 3 insertions(+), 18 deletions(-)

applied



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-07 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-07 13:15 [PATCH #upstream-fixes] ahci: redo stopping DMA engines on empty ports Tejun Heo
2010-06-07 20:08 ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.