public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH 0/9] isci updates for 3.1
@ 2011-07-30  0:16 Dan Williams
  2011-07-30  0:16 ` [PATCH 1/9] isci: fix sata response handling Dan Williams
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:16 UTC (permalink / raw)
  To: JBottomley; +Cc: linux-scsi

James, please pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git master

...to receive primarily a collection of fixes.  The first two are tagged
for -stable.

We still have ATAPI and SGPIO support in the works.

The SGPIO support is awaiting your response on the interface from libsas
to the driver for locally attached sgpio operation [1].  I think we can
solve the sysfs representation of these initiators at a later date.  For
now this just allows the driver to capture the smp sgpio request.

ATAPI support is not ready for prime time, but the initial
implementation is available on the 'testing' branch [2], and we are
aiming to get it finalized for 3.1.

[1]: http://marc.info/?l=linux-scsi&m=130876728404136&w=2
[2]: git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git testing

Dan Williams (5):
      isci: fix sata response handling
      isci: fix 32-bit operation when CONFIG_HIGHMEM64G=n
      isci: dynamic interrupt coalescing
      isci: fix event-get pointer increment
      isci: add version number

Dave Jiang (2):
      isci: Update MAINTAINERS entry for the isci driver
      isci: Adding documentation to API change and fixup sysfs registration

Jeff Skirvin (1):
      isci: Leave requests alone if already terminating.

Marcin Tomczak (1):
      isci: change sas phy timeouts from 54us to 59us

 Documentation/ABI/testing/sysfs-class-scsi_host |   13 ++++++
 MAINTAINERS                                     |   11 +++++
 drivers/scsi/isci/host.c                        |   13 ++++++-
 drivers/scsi/isci/host.h                        |    3 +
 drivers/scsi/isci/init.c                        |   47 +++++++++++++---------
 drivers/scsi/isci/phy.c                         |   13 ++++++
 drivers/scsi/isci/registers.h                   |   12 ++++++
 drivers/scsi/isci/request.c                     |   30 ++++++++-------
 drivers/scsi/isci/unsolicited_frame_control.c   |    2 +-
 drivers/scsi/isci/unsolicited_frame_control.h   |    2 +-
 10 files changed, 110 insertions(+), 36 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-class-scsi_host

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

* [PATCH 1/9] isci: fix sata response handling
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
@ 2011-07-30  0:16 ` Dan Williams
  2011-07-30  0:16 ` [PATCH 2/9] isci: fix 32-bit operation when CONFIG_HIGHMEM64G=n Dan Williams
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:16 UTC (permalink / raw)
  To: JBottomley; +Cc: stable, linux-scsi

A bug (likely copy/paste) that has been carried from the original
implementation.  The unsolicited frame handling structure returns the
d2h fis in the isci_request.stp.rsp buffer.

Cc: <stable@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/request.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index a46e07a..b4cf998 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -2399,22 +2399,19 @@ static void isci_task_save_for_upper_layer_completion(
 	}
 }
 
-static void isci_request_process_stp_response(struct sas_task *task,
-					      void *response_buffer)
+static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis)
 {
-	struct dev_to_host_fis *d2h_reg_fis = response_buffer;
 	struct task_status_struct *ts = &task->task_status;
 	struct ata_task_resp *resp = (void *)&ts->buf[0];
 
-	resp->frame_len = le16_to_cpu(*(__le16 *)(response_buffer + 6));
-	memcpy(&resp->ending_fis[0], response_buffer + 16, 24);
+	resp->frame_len = sizeof(*fis);
+	memcpy(resp->ending_fis, fis, sizeof(*fis));
 	ts->buf_valid_size = sizeof(*resp);
 
-	/**
-	 * If the device fault bit is set in the status register, then
+	/* If the device fault bit is set in the status register, then
 	 * set the sense data and return.
 	 */
-	if (d2h_reg_fis->status & ATA_DF)
+	if (fis->status & ATA_DF)
 		ts->stat = SAS_PROTO_RESPONSE;
 	else
 		ts->stat = SAM_STAT_GOOD;
@@ -2428,7 +2425,6 @@ static void isci_request_io_request_complete(struct isci_host *ihost,
 {
 	struct sas_task *task = isci_request_access_task(request);
 	struct ssp_response_iu *resp_iu;
-	void *resp_buf;
 	unsigned long task_flags;
 	struct isci_remote_device *idev = isci_lookup_device(task->dev);
 	enum service_response response       = SAS_TASK_UNDELIVERED;
@@ -2565,9 +2561,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost,
 				task);
 
 			if (sas_protocol_ata(task->task_proto)) {
-				resp_buf = &request->stp.rsp;
-				isci_request_process_stp_response(task,
-								  resp_buf);
+				isci_process_stp_response(task, &request->stp.rsp);
 			} else if (SAS_PROTOCOL_SSP == task->task_proto) {
 
 				/* crack the iu response buffer. */


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

* [PATCH 2/9] isci: fix 32-bit operation when CONFIG_HIGHMEM64G=n
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
  2011-07-30  0:16 ` [PATCH 1/9] isci: fix sata response handling Dan Williams
@ 2011-07-30  0:16 ` Dan Williams
  2011-07-30  0:16 ` [PATCH 3/9] isci: change sas phy timeouts from 54us to 59us Dan Williams
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:16 UTC (permalink / raw)
  To: JBottomley; +Cc: stable, linux-scsi, Jacek Danecki

The unsolicited frame control infrastructure requires a table of dma
addresses for the hardware to lookup the frame buffer location by an
index.  The hardware expects the elements of this table to be 64-bit
quantities, so we cannot reference these elements as dma_addr_t.  All
unsolicited frame protocols are affected, particularly SATA-PIO and SMP
which prevented direct-attached SATA drives and expander-attached drives
to not be discovered.

Cc: <stable@kernel.org>
Reported-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/unsolicited_frame_control.c |    2 +-
 drivers/scsi/isci/unsolicited_frame_control.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/unsolicited_frame_control.c b/drivers/scsi/isci/unsolicited_frame_control.c
index e9e1e2a..16f88ab 100644
--- a/drivers/scsi/isci/unsolicited_frame_control.c
+++ b/drivers/scsi/isci/unsolicited_frame_control.c
@@ -72,7 +72,7 @@ int sci_unsolicited_frame_control_construct(struct isci_host *ihost)
 	 */
 	buf_len = SCU_MAX_UNSOLICITED_FRAMES * SCU_UNSOLICITED_FRAME_BUFFER_SIZE;
 	header_len = SCU_MAX_UNSOLICITED_FRAMES * sizeof(struct scu_unsolicited_frame_header);
-	size = buf_len + header_len + SCU_MAX_UNSOLICITED_FRAMES * sizeof(dma_addr_t);
+	size = buf_len + header_len + SCU_MAX_UNSOLICITED_FRAMES * sizeof(uf_control->address_table.array[0]);
 
 	/*
 	 * The Unsolicited Frame buffers are set at the start of the UF
diff --git a/drivers/scsi/isci/unsolicited_frame_control.h b/drivers/scsi/isci/unsolicited_frame_control.h
index 31cb950..75d8966 100644
--- a/drivers/scsi/isci/unsolicited_frame_control.h
+++ b/drivers/scsi/isci/unsolicited_frame_control.h
@@ -214,7 +214,7 @@ struct sci_uf_address_table_array {
 	 * starting address of the UF address table.
 	 * 64-bit pointers are required by the hardware.
 	 */
-	dma_addr_t *array;
+	u64 *array;
 
 	/**
 	 * This field specifies the physical address location for the UF


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

* [PATCH 3/9] isci: change sas phy timeouts from 54us to 59us
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
  2011-07-30  0:16 ` [PATCH 1/9] isci: fix sata response handling Dan Williams
  2011-07-30  0:16 ` [PATCH 2/9] isci: fix 32-bit operation when CONFIG_HIGHMEM64G=n Dan Williams
@ 2011-07-30  0:16 ` Dan Williams
  2011-07-30  0:16 ` [PATCH 4/9] isci: Update MAINTAINERS entry for the isci driver Dan Williams
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:16 UTC (permalink / raw)
  To: JBottomley; +Cc: Marcin Tomczak, linux-scsi

From: Marcin Tomczak <marcin.tomczak@intel.com>

Need the following workaround in the driver for interoperability with
the older Intel SSD drives and any other SATA drive that may exhibit the
same behavior. This is a corner case where SCU speed is limited to
either 3G or 1.5G and the drive has a period of DC idle when it switches
speed during SATA speed negotiation. Workaround :change PHYTOV[31:24]
from 0x36 to 0x3B.

Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/phy.c       |   13 +++++++++++++
 drivers/scsi/isci/registers.h |   12 ++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index 79313a7..430fc8f 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -104,6 +104,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
 	u32 parity_count = 0;
 	u32 llctl, link_rate;
 	u32 clksm_value = 0;
+	u32 sp_timeouts = 0;
 
 	iphy->link_layer_registers = reg;
 
@@ -211,6 +212,18 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
 	llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate);
 	writel(llctl, &iphy->link_layer_registers->link_layer_control);
 
+	sp_timeouts = readl(&iphy->link_layer_registers->sas_phy_timeouts);
+
+	/* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */
+	sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF);
+
+	/* Set RATE_CHANGE timeout value to 0x3B (59us).  This ensures SCU can
+	 * lock with 3Gb drive when SCU max rate is set to 1.5Gb.
+	 */
+	sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B);
+
+	writel(sp_timeouts, &iphy->link_layer_registers->sas_phy_timeouts);
+
 	if (is_a2(ihost->pdev)) {
 		/* Program the max ARB time for the PHY to 700us so we inter-operate with
 		 * the PMC expander which shuts down PHYs if the expander PHY generates too
diff --git a/drivers/scsi/isci/registers.h b/drivers/scsi/isci/registers.h
index 9b266c7..00afc73 100644
--- a/drivers/scsi/isci/registers.h
+++ b/drivers/scsi/isci/registers.h
@@ -1299,6 +1299,18 @@ struct scu_transport_layer_registers {
 #define SCU_AFE_XCVRCR_OFFSET       0x00DC
 #define SCU_AFE_LUTCR_OFFSET        0x00E0
 
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_ALIGN_DETECTION_SHIFT          (0UL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_ALIGN_DETECTION_MASK           (0x000000FFUL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_HOT_PLUG_SHIFT                 (8UL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_HOT_PLUG_MASK                  (0x0000FF00UL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_COMSAS_DETECTION_SHIFT         (16UL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_COMSAS_DETECTION_MASK          (0x00FF0000UL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_RATE_CHANGE_SHIFT              (24UL)
+#define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_RATE_CHANGE_MASK               (0xFF000000UL)
+
+#define SCU_SAS_PHYTOV_GEN_VAL(name, value) \
+	SCU_GEN_VALUE(SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_##name, value)
+
 #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_SHIFT                  (0)
 #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_MASK                   (0x00000003)
 #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1                   (0)


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

* [PATCH 4/9] isci: Update MAINTAINERS entry for the isci driver
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
                   ` (2 preceding siblings ...)
  2011-07-30  0:16 ` [PATCH 3/9] isci: change sas phy timeouts from 54us to 59us Dan Williams
@ 2011-07-30  0:16 ` Dan Williams
  2011-07-30  0:17 ` [PATCH 5/9] isci: Adding documentation to API change and fixup sysfs registration Dan Williams
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:16 UTC (permalink / raw)
  To: JBottomley; +Cc: Dave Jiang, linux-scsi

From: Dave Jiang <dave.jiang@intel.com>

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 MAINTAINERS |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 187282d..cf3ea1f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3240,6 +3240,17 @@ F:	Documentation/input/multi-touch-protocol.txt
 F:	drivers/input/input-mt.c
 K:	\b(ABS|SYN)_MT_
 
+INTEL C600 SERIES SAS CONTROLLER DRIVER
+M:	Intel SCU Linux support <intel-linux-scu@intel.com>
+M:	Dan Williams <dan.j.williams@intel.com>
+M:	Dave Jiang <dave.jiang@intel.com>
+M:	Ed Nadolski <edmund.nadolski@intel.com>
+L:	linux-scsi@vger.kernel.org
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git
+S:	Maintained
+F:	drivers/scsi/isci/
+F:	firmware/isci/
+
 INTEL IDLE DRIVER
 M:	Len Brown <lenb@kernel.org>
 L:	linux-pm@lists.linux-foundation.org


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

* [PATCH 5/9] isci: Adding documentation to API change and fixup sysfs registration
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
                   ` (3 preceding siblings ...)
  2011-07-30  0:16 ` [PATCH 4/9] isci: Update MAINTAINERS entry for the isci driver Dan Williams
@ 2011-07-30  0:17 ` Dan Williams
  2011-07-30  0:17 ` [PATCH 6/9] isci: Leave requests alone if already terminating Dan Williams
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:17 UTC (permalink / raw)
  To: JBottomley; +Cc: Dave Jiang, linux-scsi

From: Dave Jiang <dave.jiang@intel.com>

Adding API update for adding isci_id entry scsi_host sysfs entry.
Also fixing up the sysfs registration to the scsi_host template

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/ABI/testing/sysfs-class-scsi_host |   13 ++++++++
 drivers/scsi/isci/init.c                        |   36 ++++++++++++-----------
 2 files changed, 31 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-class-scsi_host

diff --git a/Documentation/ABI/testing/sysfs-class-scsi_host b/Documentation/ABI/testing/sysfs-class-scsi_host
new file mode 100644
index 0000000..29a4f89
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-scsi_host
@@ -0,0 +1,13 @@
+What:		/sys/class/scsi_host/hostX/isci_id
+Date:		June 2011
+Contact:	Dave Jiang <dave.jiang@intel.com>
+Description:
+		This file contains the enumerated host ID for the Intel
+		SCU controller. The Intel(R) C600 Series Chipset SATA/SAS
+		Storage Control Unit embeds up to two 4-port controllers in
+		a single PCI device.  The controllers are enumerated in order
+		which usually means the lowest number scsi_host corresponds
+		with the first controller, but this association is not
+		guaranteed.  The 'isci_id' attribute unambiguously identifies
+		the controller index: '0' for the first controller,
+		'1' for the second.
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 61e0d09..e78320b 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -59,6 +59,7 @@
 #include <linux/firmware.h>
 #include <linux/efi.h>
 #include <asm/string.h>
+#include <scsi/scsi_host.h>
 #include "isci.h"
 #include "task.h"
 #include "probe_roms.h"
@@ -113,6 +114,22 @@ unsigned char max_concurr_spinup = 1;
 module_param(max_concurr_spinup, byte, 0);
 MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");
 
+static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev);
+	struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
+	struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
+}
+
+static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
+
+struct device_attribute *isci_host_attrs[] = {
+	&dev_attr_isci_id,
+	NULL
+};
+
 static struct scsi_host_template isci_sht = {
 
 	.module				= THIS_MODULE,
@@ -138,6 +155,7 @@ static struct scsi_host_template isci_sht = {
 	.slave_alloc			= sas_slave_alloc,
 	.target_destroy			= sas_target_destroy,
 	.ioctl				= sas_ioctl,
+	.shost_attrs			= isci_host_attrs,
 };
 
 static struct sas_domain_function_template isci_transport_ops  = {
@@ -232,17 +250,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host)
 	return 0;
 }
 
-static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev);
-	struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
-	struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);
-
-	return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
-}
-
-static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
-
 static void isci_unregister(struct isci_host *isci_host)
 {
 	struct Scsi_Host *shost;
@@ -251,7 +258,6 @@ static void isci_unregister(struct isci_host *isci_host)
 		return;
 
 	shost = isci_host->shost;
-	device_remove_file(&shost->shost_dev, &dev_attr_isci_id);
 
 	sas_unregister_ha(&isci_host->sas_ha);
 
@@ -415,14 +421,8 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
 	if (err)
 		goto err_shost_remove;
 
-	err = device_create_file(&shost->shost_dev, &dev_attr_isci_id);
-	if (err)
-		goto err_unregister_ha;
-
 	return isci_host;
 
- err_unregister_ha:
-	sas_unregister_ha(&(isci_host->sas_ha));
  err_shost_remove:
 	scsi_remove_host(shost);
  err_shost:


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

* [PATCH 6/9] isci: Leave requests alone if already terminating.
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
                   ` (4 preceding siblings ...)
  2011-07-30  0:17 ` [PATCH 5/9] isci: Adding documentation to API change and fixup sysfs registration Dan Williams
@ 2011-07-30  0:17 ` Dan Williams
  2011-07-30  0:17 ` [PATCH 7/9] isci: dynamic interrupt coalescing Dan Williams
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:17 UTC (permalink / raw)
  To: JBottomley; +Cc: Jeff Skirvin, linux-scsi

From: Jeff Skirvin <jeffrey.d.skirvin@intel.com>

Instead of immediately completing any request that has a second
termination call made on it, wait for the TC done/abort HW event.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/request.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index b4cf998..b5d3a8c 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -732,12 +732,20 @@ sci_io_request_terminate(struct isci_request *ireq)
 		sci_change_state(&ireq->sm, SCI_REQ_ABORTING);
 		return SCI_SUCCESS;
 	case SCI_REQ_TASK_WAIT_TC_RESP:
+		/* The task frame was already confirmed to have been
+		 * sent by the SCU HW.  Since the state machine is
+		 * now only waiting for the task response itself,
+		 * abort the request and complete it immediately
+		 * and don't wait for the task response.
+		 */
 		sci_change_state(&ireq->sm, SCI_REQ_ABORTING);
 		sci_change_state(&ireq->sm, SCI_REQ_COMPLETED);
 		return SCI_SUCCESS;
 	case SCI_REQ_ABORTING:
-		sci_change_state(&ireq->sm, SCI_REQ_COMPLETED);
-		return SCI_SUCCESS;
+		/* If a request has a termination requested twice, return
+		 * a failure indication, since HW confirmation of the first
+		 * abort is still outstanding.
+		 */
 	case SCI_REQ_COMPLETED:
 	default:
 		dev_warn(&ireq->owning_controller->pdev->dev,


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

* [PATCH 7/9] isci: dynamic interrupt coalescing
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
                   ` (5 preceding siblings ...)
  2011-07-30  0:17 ` [PATCH 6/9] isci: Leave requests alone if already terminating Dan Williams
@ 2011-07-30  0:17 ` Dan Williams
  2011-07-30  0:17 ` [PATCH 8/9] isci: fix event-get pointer increment Dan Williams
  2011-07-30  0:17 ` [PATCH 9/9] isci: add version number Dan Williams
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:17 UTC (permalink / raw)
  To: JBottomley; +Cc: Dave Jiang, linux-scsi

Hardware allows both an outstanding number commands and a timeout value
(whichever occurs first) as a gate to the next interrupt generation.  This
scheme at completion time looks at the remaining number of outstanding tasks
and sets the timeout to maximize small transaction operation.  If transactions
are large (take more than a few 10s of microseconds to complete) then
performance is not interrupt processing bound, so the small timeouts this
scheme generates are overridden by the time it takes for a completion to
arrive.

Tested-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/host.c |   10 +++++++++-
 drivers/scsi/isci/host.h |    3 +++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 26072f1..2328f98 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1091,6 +1091,7 @@ static void isci_host_completion_routine(unsigned long data)
 	struct isci_request *request;
 	struct isci_request *next_request;
 	struct sas_task     *task;
+	u16 active;
 
 	INIT_LIST_HEAD(&completed_request_list);
 	INIT_LIST_HEAD(&errored_request_list);
@@ -1181,6 +1182,13 @@ static void isci_host_completion_routine(unsigned long data)
 		}
 	}
 
+	/* the coalesence timeout doubles at each encoding step, so
+	 * update it based on the ilog2 value of the outstanding requests
+	 */
+	active = isci_tci_active(ihost);
+	writel(SMU_ICC_GEN_VAL(NUMBER, active) |
+	       SMU_ICC_GEN_VAL(TIMER, ISCI_COALESCE_BASE + ilog2(active)),
+	       &ihost->smu_registers->interrupt_coalesce_control);
 }
 
 /**
@@ -1471,7 +1479,7 @@ static void sci_controller_ready_state_enter(struct sci_base_state_machine *sm)
 	struct isci_host *ihost = container_of(sm, typeof(*ihost), sm);
 
 	/* set the default interrupt coalescence number and timeout value. */
-	sci_controller_set_interrupt_coalescence(ihost, 0x10, 250);
+	sci_controller_set_interrupt_coalescence(ihost, 0, 0);
 }
 
 static void sci_controller_ready_state_exit(struct sci_base_state_machine *sm)
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index 062101a..9f33831 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -369,6 +369,9 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev)
 #define ISCI_TAG_SEQ(tag) (((tag) >> 12) & (SCI_MAX_SEQ-1))
 #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1))
 
+/* interrupt coalescing baseline: 9 == 3 to 5us interrupt delay per command */
+#define ISCI_COALESCE_BASE 9
+
 /* expander attached sata devices require 3 rnc slots */
 static inline int sci_remote_device_node_count(struct isci_remote_device *idev)
 {


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

* [PATCH 8/9] isci: fix event-get pointer increment
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
                   ` (6 preceding siblings ...)
  2011-07-30  0:17 ` [PATCH 7/9] isci: dynamic interrupt coalescing Dan Williams
@ 2011-07-30  0:17 ` Dan Williams
  2011-07-30  0:17 ` [PATCH 9/9] isci: add version number Dan Williams
  8 siblings, 0 replies; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:17 UTC (permalink / raw)
  To: JBottomley; +Cc: Kapil Karkra, linux-scsi

Hardware only increments the put pointer on event types >= 4.  Do not
increment the get pointer for event type 3.

Reported-by: Kapil Karkra <kapil.karkra@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/host.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 2328f98..6981b77 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -531,6 +531,9 @@ static void sci_controller_process_completions(struct isci_host *ihost)
 			break;
 
 		case SCU_COMPLETION_TYPE_EVENT:
+			sci_controller_event_completion(ihost, ent);
+			break;
+
 		case SCU_COMPLETION_TYPE_NOTIFY: {
 			event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) <<
 				       (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT);


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

* [PATCH 9/9] isci: add version number
  2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
                   ` (7 preceding siblings ...)
  2011-07-30  0:17 ` [PATCH 8/9] isci: fix event-get pointer increment Dan Williams
@ 2011-07-30  0:17 ` Dan Williams
  2011-07-30 16:55   ` Stefan Richter
  8 siblings, 1 reply; 16+ messages in thread
From: Dan Williams @ 2011-07-30  0:17 UTC (permalink / raw)
  To: JBottomley; +Cc: linux-scsi

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/isci/init.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index e78320b..29aa34e 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -64,6 +64,14 @@
 #include "task.h"
 #include "probe_roms.h"
 
+#define MAJ 1
+#define MIN 0
+#define BUILD 0
+#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \
+	__stringify(BUILD)
+
+MODULE_VERSION(DRV_VERSION);
+
 static struct scsi_transport_template *isci_transport_template;
 
 static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = {
@@ -540,7 +548,8 @@ static __init int isci_init(void)
 {
 	int err;
 
-	pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);
+	pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n",
+		DRV_NAME, DRV_VERSION);
 
 	isci_transport_template = sas_domain_attach_transport(&isci_transport_ops);
 	if (!isci_transport_template)


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

* Re: [PATCH 9/9] isci: add version number
  2011-07-30  0:17 ` [PATCH 9/9] isci: add version number Dan Williams
@ 2011-07-30 16:55   ` Stefan Richter
  2011-08-01 16:24     ` Dan Williams
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Richter @ 2011-07-30 16:55 UTC (permalink / raw)
  To: Dan Williams; +Cc: JBottomley, linux-scsi

On Jul 29 Dan Williams wrote:
> @@ -540,7 +548,8 @@ static __init int isci_init(void)
>  {
>  	int err;
>  
> -	pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);
> +	pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n",
> +		DRV_NAME, DRV_VERSION);

Why?  There is already a version number.  Like 2.6.39, 3.0, 3.1.

Besides, just

-	pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);

would be the most correct thing to do here.
-- 
Stefan Richter
-=====-==-== -=== ====-
http://arcgraph.de/sr/

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

* Re: [PATCH 9/9] isci: add version number
  2011-07-30 16:55   ` Stefan Richter
@ 2011-08-01 16:24     ` Dan Williams
  2011-08-01 17:38       ` Stefan Richter
  0 siblings, 1 reply; 16+ messages in thread
From: Dan Williams @ 2011-08-01 16:24 UTC (permalink / raw)
  To: Stefan Richter; +Cc: JBottomley, linux-scsi

On Sat, Jul 30, 2011 at 9:55 AM, Stefan Richter
<stefanr@s5r6.in-berlin.de> wrote:
> On Jul 29 Dan Williams wrote:
>> @@ -540,7 +548,8 @@ static __init int isci_init(void)
>>  {
>>       int err;
>>
>> -     pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);
>> +     pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n",
>> +             DRV_NAME, DRV_VERSION);
>
> Why?  There is already a version number.  Like 2.6.39, 3.0, 3.1.

This is for tracking driver versions across distributions and driver
update packages as they sync with upstream on different cadences.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 9/9] isci: add version number
  2011-08-01 16:24     ` Dan Williams
@ 2011-08-01 17:38       ` Stefan Richter
  2011-08-01 17:54         ` James Bottomley
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Richter @ 2011-08-01 17:38 UTC (permalink / raw)
  To: Dan Williams; +Cc: JBottomley, linux-scsi

On Aug 01 Dan Williams wrote:
> On Sat, Jul 30, 2011 at 9:55 AM, Stefan Richter
> <stefanr@s5r6.in-berlin.de> wrote:
> > On Jul 29 Dan Williams wrote:
> >> @@ -540,7 +548,8 @@ static __init int isci_init(void)
> >>  {
> >>       int err;
> >>
> >> -     pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);
> >> +     pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n",
> >> +             DRV_NAME, DRV_VERSION);
> >
> > Why?  There is already a version number.  Like 2.6.39, 3.0, 3.1.
> 
> This is for tracking driver versions across distributions and driver
> update packages as they sync with upstream on different cadences.

If they "synced with upstream", they had just the kernel version number.
You mean they "backport new drivers from current upstream into their branch
with an old core".

The mainline doesn't generally carry stubs and macros that are only there
for backporting.  Well, I guess SCSI drivers are different in that regard.
-- 
Stefan Richter
-=====-==-== =--- ----=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 9/9] isci: add version number
  2011-08-01 17:38       ` Stefan Richter
@ 2011-08-01 17:54         ` James Bottomley
  2011-08-01 18:29           ` Stefan Richter
  0 siblings, 1 reply; 16+ messages in thread
From: James Bottomley @ 2011-08-01 17:54 UTC (permalink / raw)
  To: Stefan Richter; +Cc: Dan Williams, linux-scsi

On Mon, 2011-08-01 at 19:38 +0200, Stefan Richter wrote:
> On Aug 01 Dan Williams wrote:
> > On Sat, Jul 30, 2011 at 9:55 AM, Stefan Richter
> > <stefanr@s5r6.in-berlin.de> wrote:
> > > On Jul 29 Dan Williams wrote:
> > >> @@ -540,7 +548,8 @@ static __init int isci_init(void)
> > >>  {
> > >>       int err;
> > >>
> > >> -     pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME);
> > >> +     pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n",
> > >> +             DRV_NAME, DRV_VERSION);
> > >
> > > Why?  There is already a version number.  Like 2.6.39, 3.0, 3.1.
> > 
> > This is for tracking driver versions across distributions and driver
> > update packages as they sync with upstream on different cadences.
> 
> If they "synced with upstream", they had just the kernel version number.
> You mean they "backport new drivers from current upstream into their branch
> with an old core".

This isn't good enough for distros, who often pretend to be on one
kernel version yet have the driver backported from another.

> The mainline doesn't generally carry stubs and macros that are only there
> for backporting.  Well, I guess SCSI drivers are different in that regard.

This is hardly a stub for a backport.  It's a printk printing the
version.  At least 25% of drivers seem to do this (not that I entirely
approve ... it does tend to clutter the boot sequence a bit)

The whole reason for MODULE_VERSION() is to mark this correctly.

James



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

* Re: [PATCH 9/9] isci: add version number
  2011-08-01 17:54         ` James Bottomley
@ 2011-08-01 18:29           ` Stefan Richter
  2011-08-01 18:40             ` Stefan Richter
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Richter @ 2011-08-01 18:29 UTC (permalink / raw)
  To: James Bottomley, Dan Williams; +Cc: linux-scsi

On Aug 01 James Bottomley wrote:
> On Mon, 2011-08-01 at 19:38 +0200, Stefan Richter wrote:
> > The mainline doesn't generally carry stubs and macros that are only there
> > for backporting.  Well, I guess SCSI drivers are different in that regard.
> 
> This is hardly a stub for a backport.  It's a printk printing the
> version.

It is a printk printing a version that is only of interest in conjuction
with backports.  And even in that context a "major.minor.build"
naming scheme for a device driver is quite naive.  For example, a backport
of a driver which directly or indirectly uses the workqueue infrastructure
back into a kernel from before concurrency managed workqueues will behave
quite differently, regardless what its local version numbers say.

> At least 25% of drivers seem to do this (not that I entirely
> approve ... it does tend to clutter the boot sequence a bit)

25% of SCSI drivers perhaps (surely more than that if we consider only
SCSI drivers).  My random sample of 46 loaded modules on a desktop PC
contains 3 drivers whose modinfo | grep -E '^version' is nonempty
(pata_atiixp, sg, r8169).

However, what 25% or 85% of all drivers do is not quite relevant to a new
driver.

> The whole reason for MODULE_VERSION() is to mark this correctly.

If you (the author, the subsystem maintainer) prefer to have a driver
version, consider to omit the driver init()'s printk at least.  It is
redundant with lsmod, modinfo, or /sys/module/*{,/version}.
-- 
Stefan Richter
-=====-==-== =--- ----=
http://arcgraph.de/sr/

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

* Re: [PATCH 9/9] isci: add version number
  2011-08-01 18:29           ` Stefan Richter
@ 2011-08-01 18:40             ` Stefan Richter
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Richter @ 2011-08-01 18:40 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Bottomley, Dan Williams

On Aug 01 Stefan Richter wrote:
> My random sample of 46 loaded modules on a desktop PC
> contains 3 drivers whose modinfo | grep -E '^version' is nonempty
> (pata_atiixp, sg, r8169).

With compiled-in drivers:  6 out of 77 feature a /sys/module/*/version
(ahci, libata, pata_atiixp, r8169, sg, tcp_cubic; calling themselves 3.0,
3.00, 0.4.6, 2.3LK-NAPI, 3.5.34, 2.3 although they are all at version 3.0).
-- 
Stefan Richter
-=====-==-== =--- ----=
http://arcgraph.de/sr/

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

end of thread, other threads:[~2011-08-01 18:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-30  0:16 [GIT PATCH 0/9] isci updates for 3.1 Dan Williams
2011-07-30  0:16 ` [PATCH 1/9] isci: fix sata response handling Dan Williams
2011-07-30  0:16 ` [PATCH 2/9] isci: fix 32-bit operation when CONFIG_HIGHMEM64G=n Dan Williams
2011-07-30  0:16 ` [PATCH 3/9] isci: change sas phy timeouts from 54us to 59us Dan Williams
2011-07-30  0:16 ` [PATCH 4/9] isci: Update MAINTAINERS entry for the isci driver Dan Williams
2011-07-30  0:17 ` [PATCH 5/9] isci: Adding documentation to API change and fixup sysfs registration Dan Williams
2011-07-30  0:17 ` [PATCH 6/9] isci: Leave requests alone if already terminating Dan Williams
2011-07-30  0:17 ` [PATCH 7/9] isci: dynamic interrupt coalescing Dan Williams
2011-07-30  0:17 ` [PATCH 8/9] isci: fix event-get pointer increment Dan Williams
2011-07-30  0:17 ` [PATCH 9/9] isci: add version number Dan Williams
2011-07-30 16:55   ` Stefan Richter
2011-08-01 16:24     ` Dan Williams
2011-08-01 17:38       ` Stefan Richter
2011-08-01 17:54         ` James Bottomley
2011-08-01 18:29           ` Stefan Richter
2011-08-01 18:40             ` Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox