* Comments - using the qc_defer hook for serializing controllers ?
@ 2007-12-05 15:26 Alan Cox
2007-12-10 8:46 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Alan Cox @ 2007-12-05 15:26 UTC (permalink / raw
To: linux-ide
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc3-mm2/drivers/ata/pata_sl82c105.c linux-2.6.24-rc3-mm2/drivers/ata/pata_sl82c105.c
--- linux.vanilla-2.6.24-rc3-mm2/drivers/ata/pata_sl82c105.c 2007-11-30 17:43:24.000000000 +0000
+++ linux-2.6.24-rc3-mm2/drivers/ata/pata_sl82c105.c 2007-12-05 15:14:42.437347728 +0000
@@ -26,7 +26,7 @@
#include <linux/libata.h>
#define DRV_NAME "pata_sl82c105"
-#define DRV_VERSION "0.3.2"
+#define DRV_VERSION "0.3.3"
enum {
/*
@@ -206,6 +206,37 @@
sl82c105_set_piomode(ap, qc->dev);
}
+/**
+ * sl82c105_qc_defer - implement serialization
+ * @qc: command
+ *
+ * We must issue one command per host not per channel because
+ * of the reset bug.
+ *
+ * Q: is the scsi host lock sufficient ?
+ */
+
+static int sl82c105_qc_defer(struct ata_queued_cmd *qc)
+{
+ struct ata_host *host = qc->ap->host;
+ int rc;
+
+ /* First apply the usual rules */
+ rc = ata_std_qc_defer(qc);
+ if (rc != 0)
+ return rc;
+
+ /* Now apply serialization rules. Only allow a command if the
+ other channel state machine is idle */
+ if (host->port[0] != qc->ap &&
+ host->port[0]->hsm_task_state != HSM_ST_IDLE)
+ return ATA_DEFER_PORT;
+ if (host->port[1] != qc->ap &&
+ host->port[1]->hsm_task_state != HSM_ST_IDLE)
+ return ATA_DEFER_PORT;
+ return 0;
+}
+
static struct scsi_host_template sl82c105_sht = {
.module = THIS_MODULE,
.name = DRV_NAME,
@@ -245,6 +276,7 @@
.bmdma_stop = sl82c105_bmdma_stop,
.bmdma_status = ata_bmdma_status,
+ .qc_defer = sl82c105_qc_defer,
.qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot,
@@ -312,7 +344,7 @@
};
/* for now use only the first port */
const struct ata_port_info *ppi[] = { &info_early,
- &ata_dummy_port_info };
+ NULL };
u32 val;
int rev;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Comments - using the qc_defer hook for serializing controllers ?
2007-12-05 15:26 Comments - using the qc_defer hook for serializing controllers ? Alan Cox
@ 2007-12-10 8:46 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2007-12-10 8:46 UTC (permalink / raw
To: Alan Cox; +Cc: linux-ide
Alan Cox wrote:
> +/**
> + * sl82c105_qc_defer - implement serialization
> + * @qc: command
> + *
> + * We must issue one command per host not per channel because
> + * of the reset bug.
> + *
> + * Q: is the scsi host lock sufficient ?
> + */
> +
> +static int sl82c105_qc_defer(struct ata_queued_cmd *qc)
> +{
> + struct ata_host *host = qc->ap->host;
> + int rc;
> +
> + /* First apply the usual rules */
> + rc = ata_std_qc_defer(qc);
> + if (rc != 0)
> + return rc;
> +
> + /* Now apply serialization rules. Only allow a command if the
> + other channel state machine is idle */
> + if (host->port[0] != qc->ap &&
> + host->port[0]->hsm_task_state != HSM_ST_IDLE)
> + return ATA_DEFER_PORT;
> + if (host->port[1] != qc->ap &&
> + host->port[1]->hsm_task_state != HSM_ST_IDLE)
> + return ATA_DEFER_PORT;
> + return 0;
> +}
hsm_task_state is not necessarily protected by host lock. I think
testing ap->qc_active would be better.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-10 8:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 15:26 Comments - using the qc_defer hook for serializing controllers ? Alan Cox
2007-12-10 8:46 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).