Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Mark Lord <kernel@teksavvy.com>
To: Barry J Sturgeon <barry.sturgeon@perpetual-data.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: sata_mv query
Date: Tue, 07 Aug 2012 14:20:48 -0400	[thread overview]
Message-ID: <50215C80.8080601@teksavvy.com> (raw)
In-Reply-To: <50215BC9.2020709@teksavvy.com>

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

On 12-08-07 02:17 PM, Mark Lord wrote:
..
> Say, here's a thought:  We could get rid of (or relocate to upper layers)
> the busy-wait by having something similar get called from ata_qc_defer().
> 
> If you are feeling adventurous, here is a 100% untested patch to do just that.
> It looks correct to me, it compiles, but that's all I can say.

Whoops.. return codes were reversed.
Here's the corrected patch.

The attached copy is the better one to use -- my mailer mangles inline patches.

--- linux-3.4.4/drivers/ata/sata_mv.c	2012-06-22 14:37:50.000000000 -0400
+++ linux/drivers/ata/sata_mv.c	2012-08-07 14:14:43.554503157 -0400
@@ -1388,6 +1388,17 @@
 	}
 }

+static int mv_check_for_edma_empty_idle(struct ata_port *ap)
+{
+	void __iomem *port_mmio = mv_ap_base(ap);
+	const u32 empty_idle = (EDMA_STATUS_CACHE_EMPTY | EDMA_STATUS_IDLE);
+
+	u32 edma_stat = readl(port_mmio + EDMA_STATUS);
+	if ((edma_stat & empty_idle) == empty_idle)
+		return 0;
+	return ATA_DEFER_PORT;
+}
+
 static int mv_qc_defer(struct ata_queued_cmd *qc)
 {
 	struct ata_link *link = qc->dev->link;
@@ -1423,7 +1434,7 @@
 	 * If the port is completely idle, then allow the new qc.
 	 */
 	if (ap->nr_active_links == 0)
-		return 0;
+		return mv_check_for_edma_empty_idle(ap);

 	/*
 	 * The port is operating in host queuing mode (EDMA) with NCQ

[-- Attachment #2: xx_sata_mv_move_busywait.patch --]
[-- Type: text/x-patch, Size: 838 bytes --]

--- linux-3.4.4/drivers/ata/sata_mv.c	2012-06-22 14:37:50.000000000 -0400
+++ linux/drivers/ata/sata_mv.c	2012-08-07 14:14:43.554503157 -0400
@@ -1388,6 +1388,17 @@
 	}
 }
 
+static int mv_check_for_edma_empty_idle(struct ata_port *ap)
+{
+	void __iomem *port_mmio = mv_ap_base(ap);
+	const u32 empty_idle = (EDMA_STATUS_CACHE_EMPTY | EDMA_STATUS_IDLE);
+
+	u32 edma_stat = readl(port_mmio + EDMA_STATUS);
+	if ((edma_stat & empty_idle) == empty_idle)
+		return 0;
+	return ATA_DEFER_PORT;
+}
+
 static int mv_qc_defer(struct ata_queued_cmd *qc)
 {
 	struct ata_link *link = qc->dev->link;
@@ -1423,7 +1434,7 @@
 	 * If the port is completely idle, then allow the new qc.
 	 */
 	if (ap->nr_active_links == 0)
-		return 0;
+		return mv_check_for_edma_empty_idle(ap);
 
 	/*
 	 * The port is operating in host queuing mode (EDMA) with NCQ

      reply	other threads:[~2012-08-07 18:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <006c01cd74ac$a06edf30$e14c9d90$@sturgeon@perpetual-data.com>
2012-08-07 17:16 ` sata_mv query Mark Lord
2012-08-07 18:17   ` Mark Lord
2012-08-07 18:20     ` Mark Lord [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50215C80.8080601@teksavvy.com \
    --to=kernel@teksavvy.com \
    --cc=barry.sturgeon@perpetual-data.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox