linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] Patches for cciss and hpsa
@ 2010-10-08 20:06 Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 01/13] cciss: remove controllers supported by hpsa Stephen M. Cameron
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

The following series:

* Fixes the "reset_devices" behavior of cciss and hpsa on newer
  controllers which use the "doorbell" method of resetting (this
  means kdump will work now on those controllers that have the
  doorbell reset capability).

* Remove support from cciss for controllers which are supported
  by hpsa so there is no overlap (except by use of hpsa_allow_any=1
  module parameter).

* Allow hpsa to use either "performant" (default) or "simple" mode of
  controller operation selectable by module parameter.

* Some small miscellaneous fixes for cciss and hpsa.

---

Stephen M. Cameron (13):
      cciss: remove controllers supported by hpsa
      hpsa: fix board status waiting code
      hpsa: Use kernel provided PCI state save and restore functions
      hpsa: limit commands allocated on reset_devices
      hpsa: do not reset unknown boards on reset_devices
      cciss: fix board status waiting code
      cciss: Use kernel provided PCI state save and restore functions
      cciss: limit commands allocated on reset_devices
      cciss: use usleep_range not msleep for small sleeps
      hpsa: take the adapter lock in hpsa_wait_for_mode_change_ack
      hpsa: allow driver to put controller in either simple or performant mode
      hpsa: use usleep_range not msleep for small sleeps
      hpsa: defend against zero sized buffers in passthru ioctls


 Documentation/scsi/hpsa.txt |    6 +
 drivers/block/cciss.c       |  160 +++++++++++++-----------------------
 drivers/block/cciss.h       |    4 +
 drivers/scsi/hpsa.c         |  192 +++++++++++++++++++++----------------------
 drivers/scsi/hpsa.h         |    4 +
 5 files changed, 164 insertions(+), 202 deletions(-)

-- 
Signature

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

* [PATCH 01/13] cciss: remove controllers supported by hpsa
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-25 20:09   ` James Bottomley
  2010-10-08 20:06 ` [PATCH 02/13] hpsa: fix board status waiting code Stephen M. Cameron
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

We would prefer not to have any overlap between the two drivers.
Remove the cciss_allow_hpsa option, as it it is no longer needed.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/block/cciss.c |   38 +-------------------------------------
 1 files changed, 1 insertions(+), 37 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 5e4fadc..ca900ea 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -66,12 +66,6 @@ MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
 MODULE_VERSION("3.6.26");
 MODULE_LICENSE("GPL");
 
-static int cciss_allow_hpsa;
-module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(cciss_allow_hpsa,
-	"Prevent cciss driver from accessing hardware known to be "
-	" supported by the hpsa driver");
-
 #include "cciss_cmd.h"
 #include "cciss.h"
 #include <linux/cciss_ioctl.h>
@@ -98,18 +92,6 @@ static const struct pci_device_id cciss_pci_device_id[] = {
 	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3215},
 	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3237},
 	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x323D},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3241},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3243},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3245},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3247},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3249},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324A},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324B},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3250},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3251},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3252},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3253},
-	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3254},
 	{0,}
 };
 
@@ -137,23 +119,9 @@ static struct board_type products[] = {
 	{0x3214103C, "Smart Array E200i", &SA5_access},
 	{0x3215103C, "Smart Array E200i", &SA5_access},
 	{0x3237103C, "Smart Array E500", &SA5_access},
-/* controllers below this line are also supported by the hpsa driver. */
-#define HPSA_BOUNDARY 0x3223103C
 	{0x3223103C, "Smart Array P800", &SA5_access},
 	{0x3234103C, "Smart Array P400", &SA5_access},
 	{0x323D103C, "Smart Array P700m", &SA5_access},
-	{0x3241103C, "Smart Array P212", &SA5_access},
-	{0x3243103C, "Smart Array P410", &SA5_access},
-	{0x3245103C, "Smart Array P410i", &SA5_access},
-	{0x3247103C, "Smart Array P411", &SA5_access},
-	{0x3249103C, "Smart Array P812", &SA5_access},
-	{0x324A103C, "Smart Array P712m", &SA5_access},
-	{0x324B103C, "Smart Array P711m", &SA5_access},
-	{0x3250103C, "Smart Array", &SA5_access},
-	{0x3251103C, "Smart Array", &SA5_access},
-	{0x3252103C, "Smart Array", &SA5_access},
-	{0x3253103C, "Smart Array", &SA5_access},
-	{0x3254103C, "Smart Array", &SA5_access},
 };
 
 /* How long to wait (in milliseconds) for board to go into simple mode */
@@ -3985,13 +3953,9 @@ static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
 	*board_id = ((subsystem_device_id << 16) & 0xffff0000) |
 			subsystem_vendor_id;
 
-	for (i = 0; i < ARRAY_SIZE(products); i++) {
-		/* Stand aside for hpsa driver on request */
-		if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY)
-			return -ENODEV;
+	for (i = 0; i < ARRAY_SIZE(products); i++)
 		if (*board_id == products[i].board_id)
 			return i;
-	}
 	dev_warn(&pdev->dev, "unrecognized board ID: 0x%08x, ignoring.\n",
 		*board_id);
 	return -ENODEV;

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

* [PATCH 02/13] hpsa: fix board status waiting code
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 01/13] cciss: remove controllers supported by hpsa Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 03/13] hpsa: Use kernel provided PCI state save and restore functions Stephen M. Cameron
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

After a reset, we should first wait for the board to become "not ready",
and then wait for it to become "ready", instead of immediately
waiting for it to become "ready", and do this waiting *after*
restoring PCI config space registers.  Also, only wait 10 secs
for board to become "not ready" after a reset (it should quickly
become not ready.)

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |   44 ++++++++++++++++++++++++++++++++++++--------
 drivers/scsi/hpsa.h |    4 ++++
 2 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c5d0606..030a880 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -181,6 +181,10 @@ static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev,
 static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
 	unsigned long *memory_bar);
 static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
+static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
+	void __iomem *vaddr, int wait_for_ready);
+#define BOARD_NOT_READY 0
+#define BOARD_READY 1
 
 static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
 static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
@@ -3260,6 +3264,20 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 	   need a little pause here */
 	msleep(HPSA_POST_RESET_PAUSE_MSECS);
 
+	/* Wait for board to become not ready, then ready. */
+	dev_info(&pdev->dev, "Waiting for board to become ready.\n");
+	rc = hpsa_wait_for_board_state(pdev, vaddr, BOARD_NOT_READY);
+	if (rc)
+		dev_warn(&pdev->dev,
+			"failed waiting for board to become not ready\n");
+	rc = hpsa_wait_for_board_state(pdev, vaddr, BOARD_READY);
+	if (rc) {
+		dev_warn(&pdev->dev,
+			"failed waiting for board to become ready\n");
+		goto unmap_cfgtable;
+	}
+	dev_info(&pdev->dev, "board ready.\n");
+
 	/* Controller should be in simple mode at this point.  If it's not,
 	 * It means we're on one of those controllers which doesn't support
 	 * the doorbell reset method and on which the PCI power management reset
@@ -3455,18 +3473,28 @@ static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
 	return -ENODEV;
 }
 
-static int __devinit hpsa_wait_for_board_ready(struct ctlr_info *h)
+static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
+	void __iomem *vaddr, int wait_for_ready)
 {
-	int i;
+	int i, iterations;
 	u32 scratchpad;
+	if (wait_for_ready)
+		iterations = HPSA_BOARD_READY_ITERATIONS;
+	else
+		iterations = HPSA_BOARD_NOT_READY_ITERATIONS;
 
-	for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) {
-		scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
-		if (scratchpad == HPSA_FIRMWARE_READY)
-			return 0;
+	for (i = 0; i < iterations; i++) {
+		scratchpad = readl(vaddr + SA5_SCRATCHPAD_OFFSET);
+		if (wait_for_ready) {
+			if (scratchpad == HPSA_FIRMWARE_READY)
+				return 0;
+		} else {
+			if (scratchpad != HPSA_FIRMWARE_READY)
+				return 0;
+		}
 		msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS);
 	}
-	dev_warn(&h->pdev->dev, "board not ready, timed out.\n");
+	dev_warn(&pdev->dev, "board not ready, timed out.\n");
 	return -ENODEV;
 }
 
@@ -3658,7 +3686,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
 		err = -ENOMEM;
 		goto err_out_free_res;
 	}
-	err = hpsa_wait_for_board_ready(h);
+	err = hpsa_wait_for_board_state(h->pdev, h->vaddr, BOARD_READY);
 	if (err)
 		goto err_out_free_res;
 	err = hpsa_find_cfgtables(h);
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index a203ef6..9595c57 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -155,12 +155,16 @@ struct ctlr_info {
  * HPSA_BOARD_READY_ITERATIONS are derived from those.
  */
 #define HPSA_BOARD_READY_WAIT_SECS (120)
+#define HPSA_BOARD_NOT_READY_WAIT_SECS (10)
 #define HPSA_BOARD_READY_POLL_INTERVAL_MSECS (100)
 #define HPSA_BOARD_READY_POLL_INTERVAL \
 	((HPSA_BOARD_READY_POLL_INTERVAL_MSECS * HZ) / 1000)
 #define HPSA_BOARD_READY_ITERATIONS \
 	((HPSA_BOARD_READY_WAIT_SECS * 1000) / \
 		HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
+#define HPSA_BOARD_NOT_READY_ITERATIONS \
+	((HPSA_BOARD_NOT_READY_WAIT_SECS * 1000) / \
+		HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
 #define HPSA_POST_RESET_PAUSE_MSECS (3000)
 #define HPSA_POST_RESET_NOOP_RETRIES (12)
 

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

* [PATCH 03/13] hpsa: Use kernel provided PCI state save and restore functions
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 01/13] cciss: remove controllers supported by hpsa Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 02/13] hpsa: fix board status waiting code Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 04/13] hpsa: limit commands allocated on reset_devices Stephen M. Cameron
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

and use the doorbell reset method if available (which doesn't
lock up the controller if you properly save and restore all
the PCI registers that you're supposed to.)

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |   81 +++++++++------------------------------------------
 1 files changed, 15 insertions(+), 66 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 030a880..542cb2b 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3076,38 +3076,6 @@ static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
 #define hpsa_soft_reset_controller(p) hpsa_message(p, 1, 0)
 #define hpsa_noop(p) hpsa_message(p, 3, 0)
 
-static __devinit int hpsa_reset_msi(struct pci_dev *pdev)
-{
-/* the #defines are stolen from drivers/pci/msi.h. */
-#define msi_control_reg(base)		(base + PCI_MSI_FLAGS)
-#define PCI_MSIX_FLAGS_ENABLE		(1 << 15)
-
-	int pos;
-	u16 control = 0;
-
-	pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
-	if (pos) {
-		pci_read_config_word(pdev, msi_control_reg(pos), &control);
-		if (control & PCI_MSI_FLAGS_ENABLE) {
-			dev_info(&pdev->dev, "resetting MSI\n");
-			pci_write_config_word(pdev, msi_control_reg(pos),
-					control & ~PCI_MSI_FLAGS_ENABLE);
-		}
-	}
-
-	pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
-	if (pos) {
-		pci_read_config_word(pdev, msi_control_reg(pos), &control);
-		if (control & PCI_MSIX_FLAGS_ENABLE) {
-			dev_info(&pdev->dev, "resetting MSI-X\n");
-			pci_write_config_word(pdev, msi_control_reg(pos),
-					control & ~PCI_MSIX_FLAGS_ENABLE);
-		}
-	}
-
-	return 0;
-}
-
 static int hpsa_controller_hard_reset(struct pci_dev *pdev,
 	void * __iomem vaddr, bool use_doorbell)
 {
@@ -3163,17 +3131,17 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,
  */
 static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 {
-	u16 saved_config_space[32];
 	u64 cfg_offset;
 	u32 cfg_base_addr;
 	u64 cfg_base_addr_index;
 	void __iomem *vaddr;
 	unsigned long paddr;
 	u32 misc_fw_support, active_transport;
-	int rc, i;
+	int rc;
 	struct CfgTable __iomem *cfgtable;
 	bool use_doorbell;
 	u32 board_id;
+	u16 command_register;
 
 	/* For controllers as old as the P600, this is very nearly
 	 * the same thing as
@@ -3183,14 +3151,6 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 	 * pci_set_power_state(pci_dev, PCI_D0);
 	 * pci_restore_state(pci_dev);
 	 *
-	 * but we can't use these nice canned kernel routines on
-	 * kexec, because they also check the MSI/MSI-X state in PCI
-	 * configuration space and do the wrong thing when it is
-	 * set/cleared.  Also, the pci_save/restore_state functions
-	 * violate the ordering requirements for restoring the
-	 * configuration space from the CCISS document (see the
-	 * comment below).  So we roll our own ....
-	 *
 	 * For controllers newer than the P600, the pci power state
 	 * method of resetting doesn't work so we have another way
 	 * using the doorbell register.
@@ -3207,9 +3167,13 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 	if (board_id == 0x409C0E11 || board_id == 0x409D0E11)
 		return -ENOTSUPP;
 
-	for (i = 0; i < 32; i++)
-		pci_read_config_word(pdev, 2*i, &saved_config_space[i]);
-
+	/* Save the PCI command register */
+	pci_read_config_word(pdev, 4, &command_register);
+	/* Turn the board off.  This is so that later pci_restore_state()
+	 * won't turn the board on before the rest of config space is ready.
+	 */
+	pci_disable_device(pdev);
+	pci_save_state(pdev);
 
 	/* find the first memory BAR, so we can find the cfg table */
 	rc = hpsa_pci_find_memory_BAR(pdev, &paddr);
@@ -3235,30 +3199,17 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 	misc_fw_support = readl(&cfgtable->misc_fw_support);
 	use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET;
 
-	/* The doorbell reset seems to cause lockups on some Smart
-	 * Arrays (e.g. P410, P410i, maybe others).  Until this is
-	 * fixed or at least isolated, avoid the doorbell reset.
-	 */
-	use_doorbell = 0;
-
 	rc = hpsa_controller_hard_reset(pdev, vaddr, use_doorbell);
 	if (rc)
 		goto unmap_cfgtable;
 
-	/* Restore the PCI configuration space.  The Open CISS
-	 * Specification says, "Restore the PCI Configuration
-	 * Registers, offsets 00h through 60h. It is important to
-	 * restore the command register, 16-bits at offset 04h,
-	 * last. Do not restore the configuration status register,
-	 * 16-bits at offset 06h."  Note that the offset is 2*i.
-	 */
-	for (i = 0; i < 32; i++) {
-		if (i == 2 || i == 3)
-			continue;
-		pci_write_config_word(pdev, 2*i, saved_config_space[i]);
+	pci_restore_state(pdev);
+	rc = pci_enable_device(pdev);
+	if (rc) {
+		dev_warn(&pdev->dev, "failed to enable device.\n");
+		goto unmap_cfgtable;
 	}
-	wmb();
-	pci_write_config_word(pdev, 4, saved_config_space[2]);
+	pci_write_config_word(pdev, 4, command_register);
 
 	/* Some devices (notably the HP Smart Array 5i Controller)
 	   need a little pause here */
@@ -3755,8 +3706,6 @@ static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev)
 		return 0; /* just try to do the kdump anyhow. */
 	if (rc)
 		return -ENODEV;
-	if (hpsa_reset_msi(pdev))
-		return -ENODEV;
 
 	/* Now try to get the controller to respond to a no-op */
 	for (i = 0; i < HPSA_POST_RESET_NOOP_RETRIES; i++) {

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

* [PATCH 04/13] hpsa: limit commands allocated on reset_devices
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (2 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 03/13] hpsa: Use kernel provided PCI state save and restore functions Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 05/13] hpsa: do not reset unknown boards " Stephen M. Cameron
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

This is to conserve memory in a memory-limited kdump scenario

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 542cb2b..ba2becc 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3493,6 +3493,11 @@ static int __devinit hpsa_find_cfgtables(struct ctlr_info *h)
 static void __devinit hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
 {
 	h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
+
+	/* Limit commands in memory limited kdump scenario. */
+	if (reset_devices && h->max_commands > 32)
+		h->max_commands = 32;
+
 	if (h->max_commands < 16) {
 		dev_warn(&h->pdev->dev, "Controller reports "
 			"max supported commands of %d, an obvious lie. "

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

* [PATCH 05/13] hpsa: do not reset unknown boards on reset_devices
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (3 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 04/13] hpsa: limit commands allocated on reset_devices Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 06/13] cciss: fix board status waiting code Stephen M. Cameron
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

This is to prevent hpsa from resetting older boards
which the cciss driver may be controlling.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ba2becc..d618432 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3163,7 +3163,11 @@ static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 	 * likely not be happy.  Just forbid resetting this conjoined mess.
 	 * The 640x isn't really supported by hpsa anyway.
 	 */
-	hpsa_lookup_board_id(pdev, &board_id);
+	rc = hpsa_lookup_board_id(pdev, &board_id);
+	if (rc < 0) {
+		dev_warn(&pdev->dev, "Not resetting device.\n");
+		return -ENODEV;
+	}
 	if (board_id == 0x409C0E11 || board_id == 0x409D0E11)
 		return -ENOTSUPP;
 

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

* [PATCH 06/13] cciss: fix board status waiting code
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (4 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 05/13] hpsa: do not reset unknown boards " Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 07/13] cciss: Use kernel provided PCI state save and restore functions Stephen M. Cameron
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

After a reset, we should first wait for the board to become "not ready",
and then wait for it to become "ready", instead of immediately
waiting for it to become "ready", and do this waiting *after*
restoring PCI config space registers.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/block/cciss.c |   43 +++++++++++++++++++++++++++++++++++--------
 drivers/block/cciss.h |    4 ++++
 2 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index ca900ea..9fe6acf 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3986,18 +3986,31 @@ static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev,
 	return -ENODEV;
 }
 
-static int __devinit cciss_wait_for_board_ready(ctlr_info_t *h)
+static int __devinit cciss_wait_for_board_state(struct pci_dev *pdev,
+	void __iomem *vaddr, int wait_for_ready)
+#define BOARD_READY 1
+#define BOARD_NOT_READY 0
 {
-	int i;
+	int i, iterations;
 	u32 scratchpad;
 
-	for (i = 0; i < CCISS_BOARD_READY_ITERATIONS; i++) {
-		scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
-		if (scratchpad == CCISS_FIRMWARE_READY)
-			return 0;
+	if (wait_for_ready)
+		iterations = CCISS_BOARD_READY_ITERATIONS;
+	else
+		iterations = CCISS_BOARD_NOT_READY_ITERATIONS;
+
+	for (i = 0; i < iterations; i++) {
+		scratchpad = readl(vaddr + SA5_SCRATCHPAD_OFFSET);
+		if (wait_for_ready) {
+			if (scratchpad == CCISS_FIRMWARE_READY)
+				return 0;
+		} else {
+			if (scratchpad != CCISS_FIRMWARE_READY)
+				return 0;
+		}
 		msleep(CCISS_BOARD_READY_POLL_INTERVAL_MSECS);
 	}
-	dev_warn(&h->pdev->dev, "board not ready, timed out.\n");
+	dev_warn(&pdev->dev, "board not ready, timed out.\n");
 	return -ENODEV;
 }
 
@@ -4163,7 +4176,7 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
 		err = -ENOMEM;
 		goto err_out_free_res;
 	}
-	err = cciss_wait_for_board_ready(h);
+	err = cciss_wait_for_board_state(h->pdev, h->vaddr, BOARD_READY);
 	if (err)
 		goto err_out_free_res;
 	err = cciss_find_cfgtables(h);
@@ -4514,6 +4527,20 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
 	   need a little pause here */
 	msleep(CCISS_POST_RESET_PAUSE_MSECS);
 
+	/* Wait for board to become not ready, then ready. */
+	dev_info(&pdev->dev, "Waiting for board to become ready.\n");
+	rc = cciss_wait_for_board_state(pdev, vaddr, BOARD_NOT_READY);
+	if (rc) /* Don't bail, might be E500, etc. which can't be reset */
+		dev_warn(&pdev->dev,
+			"failed waiting for board to become not ready\n");
+	rc = cciss_wait_for_board_state(pdev, vaddr, BOARD_READY);
+	if (rc) {
+		dev_warn(&pdev->dev,
+			"failed waiting for board to become ready\n");
+		goto unmap_cfgtable;
+	}
+	dev_info(&pdev->dev, "board ready.\n");
+
 	/* Controller should be in simple mode at this point.  If it's not,
 	 * It means we're on one of those controllers which doesn't support
 	 * the doorbell reset method and on which the PCI power management reset
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
index ae340ff..4b8933d 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
@@ -200,10 +200,14 @@ struct ctlr_info
  * the above.
  */
 #define CCISS_BOARD_READY_WAIT_SECS (120)
+#define CCISS_BOARD_NOT_READY_WAIT_SECS (10)
 #define CCISS_BOARD_READY_POLL_INTERVAL_MSECS (100)
 #define CCISS_BOARD_READY_ITERATIONS \
 	((CCISS_BOARD_READY_WAIT_SECS * 1000) / \
 		CCISS_BOARD_READY_POLL_INTERVAL_MSECS)
+#define CCISS_BOARD_NOT_READY_ITERATIONS \
+	((CCISS_BOARD_NOT_READY_WAIT_SECS * 1000) / \
+		CCISS_BOARD_READY_POLL_INTERVAL_MSECS)
 #define CCISS_POST_RESET_PAUSE_MSECS (3000)
 #define CCISS_POST_RESET_NOOP_INTERVAL_MSECS (1000)
 #define CCISS_POST_RESET_NOOP_RETRIES (12)

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

* [PATCH 07/13] cciss: Use kernel provided PCI state save and restore functions
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (5 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 06/13] cciss: fix board status waiting code Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 08/13] cciss: limit commands allocated on reset_devices Stephen M. Cameron
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

and use the doorbell reset method if available (which doesn't
lock up the controller if you properly save and restore all
the PCI registers that you're supposed to.)

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/block/cciss.c |   72 ++++++++++---------------------------------------
 1 files changed, 15 insertions(+), 57 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 9fe6acf..7741e3b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4341,36 +4341,6 @@ static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, u
 #define cciss_soft_reset_controller(p) cciss_message(p, 1, 0)
 #define cciss_noop(p) cciss_message(p, 3, 0)
 
-static __devinit int cciss_reset_msi(struct pci_dev *pdev)
-{
-/* the #defines are stolen from drivers/pci/msi.h. */
-#define msi_control_reg(base)		(base + PCI_MSI_FLAGS)
-#define PCI_MSIX_FLAGS_ENABLE		(1 << 15)
-
-	int pos;
-	u16 control = 0;
-
-	pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
-	if (pos) {
-		pci_read_config_word(pdev, msi_control_reg(pos), &control);
-		if (control & PCI_MSI_FLAGS_ENABLE) {
-			dev_info(&pdev->dev, "resetting MSI\n");
-			pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE);
-		}
-	}
-
-	pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
-	if (pos) {
-		pci_read_config_word(pdev, msi_control_reg(pos), &control);
-		if (control & PCI_MSIX_FLAGS_ENABLE) {
-			dev_info(&pdev->dev, "resetting MSI-X\n");
-			pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE);
-		}
-	}
-
-	return 0;
-}
-
 static int cciss_controller_hard_reset(struct pci_dev *pdev,
 	void * __iomem vaddr, bool use_doorbell)
 {
@@ -4425,17 +4395,17 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
  * states or using the doorbell register. */
 static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
 {
-	u16 saved_config_space[32];
 	u64 cfg_offset;
 	u32 cfg_base_addr;
 	u64 cfg_base_addr_index;
 	void __iomem *vaddr;
 	unsigned long paddr;
 	u32 misc_fw_support, active_transport;
-	int rc, i;
+	int rc;
 	CfgTable_struct __iomem *cfgtable;
 	bool use_doorbell;
 	u32 board_id;
+	u16 command_register;
 
 	/* For controllers as old a the p600, this is very nearly
 	 * the same thing as
@@ -4445,14 +4415,6 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
 	 * pci_set_power_state(pci_dev, PCI_D0);
 	 * pci_restore_state(pci_dev);
 	 *
-	 * but we can't use these nice canned kernel routines on
-	 * kexec, because they also check the MSI/MSI-X state in PCI
-	 * configuration space and do the wrong thing when it is
-	 * set/cleared.  Also, the pci_save/restore_state functions
-	 * violate the ordering requirements for restoring the
-	 * configuration space from the CCISS document (see the
-	 * comment below).  So we roll our own ....
-	 *
 	 * For controllers newer than the P600, the pci power state
 	 * method of resetting doesn't work so we have another way
 	 * using the doorbell register.
@@ -4471,8 +4433,13 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < 32; i++)
-		pci_read_config_word(pdev, 2*i, &saved_config_space[i]);
+	/* Save the PCI command register */
+	pci_read_config_word(pdev, 4, &command_register);
+	/* Turn the board off.  This is so that later pci_restore_state()
+	 * won't turn the board on before the rest of config space is ready.
+	 */
+	pci_disable_device(pdev);
+	pci_save_state(pdev);
 
 	/* find the first memory BAR, so we can find the cfg table */
 	rc = cciss_pci_find_memory_BAR(pdev, &paddr);
@@ -4508,20 +4475,13 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
 	if (rc)
 		goto unmap_cfgtable;
 
-	/* Restore the PCI configuration space.  The Open CISS
-	 * Specification says, "Restore the PCI Configuration
-	 * Registers, offsets 00h through 60h. It is important to
-	 * restore the command register, 16-bits at offset 04h,
-	 * last. Do not restore the configuration status register,
-	 * 16-bits at offset 06h."  Note that the offset is 2*i.
-	 */
-	for (i = 0; i < 32; i++) {
-		if (i == 2 || i == 3)
-			continue;
-		pci_write_config_word(pdev, 2*i, saved_config_space[i]);
+	pci_restore_state(pdev);
+	rc = pci_enable_device(pdev);
+	if (rc) {
+		dev_warn(&pdev->dev, "failed to enable device.\n");
+		goto unmap_cfgtable;
 	}
-	wmb();
-	pci_write_config_word(pdev, 4, saved_config_space[2]);
+	pci_write_config_word(pdev, 4, command_register);
 
 	/* Some devices (notably the HP Smart Array 5i Controller)
 	   need a little pause here */
@@ -4581,8 +4541,6 @@ static __devinit int cciss_init_reset_devices(struct pci_dev *pdev)
 		return 0; /* just try to do the kdump anyhow. */
 	if (rc)
 		return -ENODEV;
-	if (cciss_reset_msi(pdev))
-		return -ENODEV;
 
 	/* Now try to get the controller to respond to a no-op */
 	for (i = 0; i < CCISS_POST_RESET_NOOP_RETRIES; i++) {

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

* [PATCH 08/13] cciss: limit commands allocated on reset_devices
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (6 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 07/13] cciss: Use kernel provided PCI state save and restore functions Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 09/13] cciss: use usleep_range not msleep for small sleeps Stephen M. Cameron
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

This is to conserve memory in a memory-limited kdump scenario

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/block/cciss.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7741e3b..08cbee8 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4059,6 +4059,11 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h)
 static void __devinit cciss_get_max_perf_mode_cmds(struct ctlr_info *h)
 {
 	h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
+
+	/* Limit commands in memory limited kdump scenario. */
+	if (reset_devices && h->max_commands > 32)
+		h->max_commands = 32;
+
 	if (h->max_commands < 16) {
 		dev_warn(&h->pdev->dev, "Controller reports "
 			"max supported commands of %d, an obvious lie. "

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

* [PATCH 09/13] cciss: use usleep_range not msleep for small sleeps
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (7 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 08/13] cciss: limit commands allocated on reset_devices Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 10/13] hpsa: take the adapter lock in hpsa_wait_for_mode_change_ack Stephen M. Cameron
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/block/cciss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 08cbee8..7d2959c 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3769,7 +3769,7 @@ static void __devinit cciss_wait_for_mode_change_ack(ctlr_info_t *h)
 	for (i = 0; i < MAX_CONFIG_WAIT; i++) {
 		if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
 			break;
-		msleep(10);
+		usleep_range(10000, 20000);
 	}
 }
 

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

* [PATCH 10/13] hpsa: take the adapter lock in hpsa_wait_for_mode_change_ack
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (8 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 09/13] cciss: use usleep_range not msleep for small sleeps Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:06 ` [PATCH 11/13] hpsa: allow driver to put controller in either simple or performant mode Stephen M. Cameron
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

Need to take the lock while accessing the register to check to
see if config table changes have taken effect.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index d618432..ffc5f74 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3576,13 +3576,18 @@ static inline void hpsa_p600_dma_prefetch_quirk(struct ctlr_info *h)
 static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
 {
 	int i;
+	u32 doorbell_value;
+	unsigned long flags;
 
 	/* under certain very rare conditions, this can take awhile.
 	 * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right
 	 * as we enter this code.)
 	 */
 	for (i = 0; i < MAX_CONFIG_WAIT; i++) {
-		if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
+		spin_lock_irqsave(&h->lock, flags);
+		doorbell_value = readl(h->vaddr + SA5_DOORBELL);
+		spin_unlock_irqrestore(&h->lock, flags);
+		if (!doorbell_value & CFGTBL_ChangeReq)
 			break;
 		/* delay and try again */
 		msleep(10);
@@ -3754,6 +3759,8 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
 	h->busy_initializing = 1;
 	INIT_HLIST_HEAD(&h->cmpQ);
 	INIT_HLIST_HEAD(&h->reqQ);
+	spin_lock_init(&h->lock);
+	spin_lock_init(&h->scan_lock);
 	rc = hpsa_pci_init(h);
 	if (rc != 0)
 		goto clean1;
@@ -3813,8 +3820,6 @@ static int __devinit hpsa_init_one(struct pci_dev *pdev,
 	}
 	if (hpsa_allocate_sg_chain_blocks(h))
 		goto clean4;
-	spin_lock_init(&h->lock);
-	spin_lock_init(&h->scan_lock);
 	init_waitqueue_head(&h->scan_wait_queue);
 	h->scan_finished = 1; /* no scan currently in progress */
 

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

* [PATCH 11/13] hpsa: allow driver to put controller in either simple or performant mode
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (9 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 10/13] hpsa: take the adapter lock in hpsa_wait_for_mode_change_ack Stephen M. Cameron
@ 2010-10-08 20:06 ` Stephen M. Cameron
  2010-10-08 20:07 ` [PATCH 12/13] hpsa: use usleep_range not msleep for small sleeps Stephen M. Cameron
  2010-10-08 20:07 ` [PATCH 13/13] hpsa: defend against zero sized buffers in passthru ioctls Stephen M. Cameron
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:06 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 Documentation/scsi/hpsa.txt |    6 ++++++
 drivers/scsi/hpsa.c         |    7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Documentation/scsi/hpsa.txt b/Documentation/scsi/hpsa.txt
index dca6583..b14e6ee 100644
--- a/Documentation/scsi/hpsa.txt
+++ b/Documentation/scsi/hpsa.txt
@@ -28,6 +28,12 @@ boot parameter "hpsa_allow_any=1" is specified, however these are not tested
 nor supported by HP with this driver.  For older Smart Arrays, the cciss
 driver should still be used.
 
+The "hpsa_simple_mode=1" boot parameter may be used to prevent the driver from
+putting the controller into "performant" mode.  The difference is that with simple
+mode, each command completion requires an interrupt, while with "performant mode"
+(the default, and ordinarily better performing) it is possible to have multiple
+command completions indicated by a single interrupt.
+
 HPSA specific entries in /sys
 -----------------------------
 
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ffc5f74..a68dba7 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -75,6 +75,10 @@ static int hpsa_allow_any;
 module_param(hpsa_allow_any, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(hpsa_allow_any,
 		"Allow hpsa driver to access unknown HP Smart Array hardware");
+static int hpsa_simple_mode;
+module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(hpsa_simple_mode,
+	"Use 'simple mode' rather than 'performant mode'");
 
 /* define the PCI info for the cards we can control */
 static const struct pci_device_id hpsa_pci_device_id[] = {
@@ -4061,6 +4065,9 @@ static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
 {
 	u32 trans_support;
 
+	if (hpsa_simple_mode)
+		return;
+
 	trans_support = readl(&(h->cfgtable->TransportSupport));
 	if (!(trans_support & PERFORMANT_MODE))
 		return;


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

* [PATCH 12/13] hpsa: use usleep_range not msleep for small sleeps
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (10 preceding siblings ...)
  2010-10-08 20:06 ` [PATCH 11/13] hpsa: allow driver to put controller in either simple or performant mode Stephen M. Cameron
@ 2010-10-08 20:07 ` Stephen M. Cameron
  2010-10-08 20:07 ` [PATCH 13/13] hpsa: defend against zero sized buffers in passthru ioctls Stephen M. Cameron
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:07 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a68dba7..c36427d 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3594,7 +3594,7 @@ static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
 		if (!doorbell_value & CFGTBL_ChangeReq)
 			break;
 		/* delay and try again */
-		msleep(10);
+		usleep_range(10000, 20000);
 	}
 }
 

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

* [PATCH 13/13] hpsa: defend against zero sized buffers in passthru ioctls
  2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
                   ` (11 preceding siblings ...)
  2010-10-08 20:07 ` [PATCH 12/13] hpsa: use usleep_range not msleep for small sleeps Stephen M. Cameron
@ 2010-10-08 20:07 ` Stephen M. Cameron
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen M. Cameron @ 2010-10-08 20:07 UTC (permalink / raw)
  To: axboe, James.Bottomley
  Cc: akpm, thenzl, mike.miller, linux-scsi, linux-kernel

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |   36 ++++++++++++++++--------------------
 1 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c36427d..cba5bf4 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2458,15 +2458,17 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		buff = kmalloc(iocommand.buf_size, GFP_KERNEL);
 		if (buff == NULL)
 			return -EFAULT;
-	}
-	if (iocommand.Request.Type.Direction == XFER_WRITE) {
-		/* Copy the data into the buffer we created */
-		if (copy_from_user(buff, iocommand.buf, iocommand.buf_size)) {
-			kfree(buff);
-			return -EFAULT;
+		if (iocommand.Request.Type.Direction == XFER_WRITE) {
+			/* Copy the data into the buffer we created */
+			if (copy_from_user(buff, iocommand.buf,
+				iocommand.buf_size)) {
+				kfree(buff);
+				return -EFAULT;
+			}
+		} else {
+			memset(buff, 0, iocommand.buf_size);
 		}
-	} else
-		memset(buff, 0, iocommand.buf_size);
+	}
 	c = cmd_special_alloc(h);
 	if (c == NULL) {
 		kfree(buff);
@@ -2512,8 +2514,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		cmd_special_free(h, c);
 		return -EFAULT;
 	}
-
-	if (iocommand.Request.Type.Direction == XFER_READ) {
+	if (iocommand.Request.Type.Direction == XFER_READ &&
+		iocommand.buf_size > 0) {
 		/* Copy the data out of the buffer we created */
 		if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) {
 			kfree(buff);
@@ -2606,14 +2608,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 	}
 	c->cmd_type = CMD_IOCTL_PEND;
 	c->Header.ReplyQueue = 0;
-
-	if (ioc->buf_size > 0) {
-		c->Header.SGList = sg_used;
-		c->Header.SGTotal = sg_used;
-	} else {
-		c->Header.SGList = 0;
-		c->Header.SGTotal = 0;
-	}
+	c->Header.SGList = c->Header.SGTotal = sg_used;
 	memcpy(&c->Header.LUN, &ioc->LUN_info, sizeof(c->Header.LUN));
 	c->Header.Tag.lower = c->busaddr;
 	memcpy(&c->Request, &ioc->Request, sizeof(c->Request));
@@ -2630,7 +2625,8 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		}
 	}
 	hpsa_scsi_do_simple_cmd_core(h, c);
-	hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
+	if (sg_used)
+		hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
 	check_ioctl_unit_attention(h, c);
 	/* Copy the error information out */
 	memcpy(&ioc->error_info, c->err_info, sizeof(ioc->error_info));
@@ -2639,7 +2635,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
 		status = -EFAULT;
 		goto cleanup1;
 	}
-	if (ioc->Request.Type.Direction == XFER_READ) {
+	if (ioc->Request.Type.Direction == XFER_READ && ioc->buf_size > 0) {
 		/* Copy the data out of the buffer we created */
 		BYTE __user *ptr = ioc->buf;
 		for (i = 0; i < sg_used; i++) {

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

* Re: [PATCH 01/13] cciss: remove controllers supported by hpsa
  2010-10-08 20:06 ` [PATCH 01/13] cciss: remove controllers supported by hpsa Stephen M. Cameron
@ 2010-10-25 20:09   ` James Bottomley
  2010-10-25 20:26     ` Miller, Mike (OS Dev)
  0 siblings, 1 reply; 17+ messages in thread
From: James Bottomley @ 2010-10-25 20:09 UTC (permalink / raw)
  To: Stephen M. Cameron
  Cc: axboe, akpm, thenzl, mike.miller, linux-scsi, linux-kernel

On Fri, 2010-10-08 at 15:06 -0500, Stephen M. Cameron wrote:
> From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> 
> We would prefer not to have any overlap between the two drivers.
> Remove the cciss_allow_hpsa option, as it it is no longer needed.
> 
> Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> ---
>  drivers/block/cciss.c |   38 +-------------------------------------
>  1 files changed, 1 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 5e4fadc..ca900ea 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -66,12 +66,6 @@ MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
>  MODULE_VERSION("3.6.26");
>  MODULE_LICENSE("GPL");
>  
> -static int cciss_allow_hpsa;
> -module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
> -MODULE_PARM_DESC(cciss_allow_hpsa,
> -	"Prevent cciss driver from accessing hardware known to be "
> -	" supported by the hpsa driver");
> -
>  #include "cciss_cmd.h"
>  #include "cciss.h"
>  #include <linux/cciss_ioctl.h>
> @@ -98,18 +92,6 @@ static const struct pci_device_id cciss_pci_device_id[] = {
>  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3215},
>  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3237},
>  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x323D},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3241},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3243},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3245},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3247},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3249},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324A},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324B},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3250},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3251},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3252},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3253},
> -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3254},

This hunk conflicts with the update Mike Miller sent

commit 6362beea8914cbd4630ccde3617d944aeca2d48f
Author: Mike Miller <mike.miller@hp.com>
Date:   Tue Oct 19 09:40:34 2010 +0200

    cciss: fix PCI IDs for new Smart Array controllers

And which is now mainline.

James



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

* RE: [PATCH 01/13] cciss: remove controllers supported by hpsa
  2010-10-25 20:09   ` James Bottomley
@ 2010-10-25 20:26     ` Miller, Mike (OS Dev)
  2010-10-25 22:04       ` scameron
  0 siblings, 1 reply; 17+ messages in thread
From: Miller, Mike (OS Dev) @ 2010-10-25 20:26 UTC (permalink / raw)
  To: James Bottomley, Stephen M. Cameron, Benesh, Scott
  Cc: axboe@kernel.dk, akpm@linux-foundation.org, thenzl@redhat.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com]
> Sent: Monday, October 25, 2010 3:09 PM
> To: Stephen M. Cameron
> Cc: axboe@kernel.dk; akpm@linux-foundation.org; thenzl@redhat.com;
> Miller, Mike (OS Dev); linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH 01/13] cciss: remove controllers supported by hpsa
> 
> On Fri, 2010-10-08 at 15:06 -0500, Stephen M. Cameron wrote:
> > From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> >
> > We would prefer not to have any overlap between the two drivers.
> > Remove the cciss_allow_hpsa option, as it it is no longer needed.
> >
> > Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> > ---
> >  drivers/block/cciss.c |   38 +-------------------------------------
> >  1 files changed, 1 insertions(+), 37 deletions(-)
> >
> > diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> > index 5e4fadc..ca900ea 100644
> > --- a/drivers/block/cciss.c
> > +++ b/drivers/block/cciss.c
> > @@ -66,12 +66,6 @@ MODULE_SUPPORTED_DEVICE("HP Smart Array
> Controllers");
> >  MODULE_VERSION("3.6.26");
> >  MODULE_LICENSE("GPL");
> >
> > -static int cciss_allow_hpsa;
> > -module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
> > -MODULE_PARM_DESC(cciss_allow_hpsa,
> > -	"Prevent cciss driver from accessing hardware known to be "
> > -	" supported by the hpsa driver");
> > -
> >  #include "cciss_cmd.h"
> >  #include "cciss.h"
> >  #include <linux/cciss_ioctl.h>
> > @@ -98,18 +92,6 @@ static const struct pci_device_id
> cciss_pci_device_id[] = {
> >  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C,
> 0x3215},
> >  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C,
> 0x3237},
> >  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C,
> 0x323D},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3241},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3243},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3245},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3247},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3249},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x324A},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x324B},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3250},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3251},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3252},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3253},
> > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> 0x3254},
> 
> This hunk conflicts with the update Mike Miller sent
> 
> commit 6362beea8914cbd4630ccde3617d944aeca2d48f
> Author: Mike Miller <mike.miller@hp.com>
> Date:   Tue Oct 19 09:40:34 2010 +0200
> 
>     cciss: fix PCI IDs for new Smart Array controllers
> 
> And which is now mainline.
> 
> James

I guess I'm the one who jumped the gun on the patch I sent to correct those PCI IDs. I suppose it would be preferable to have no overlapping support between cciss and hpsa. With the distros it's a little easier to draw a line in the sand (or is it?). On some distros it seems migration is impossible, on others it's fairly simple.

I guess my point is what do users want? Does a significant number want to use upstream kernels but they still require cciss? Should we force them to go to hpsa? Or should they just add whatever ID they want and go on with life?

Maybe if we broke out the PCI IDs into a separate include file for both drivers??? Does that help? Probably not. I saw this coming long ago but I still don't know the answer. Any ideas, comments, suggestions, flames?

-- mikem

> 


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

* Re: [PATCH 01/13] cciss: remove controllers supported by hpsa
  2010-10-25 20:26     ` Miller, Mike (OS Dev)
@ 2010-10-25 22:04       ` scameron
  0 siblings, 0 replies; 17+ messages in thread
From: scameron @ 2010-10-25 22:04 UTC (permalink / raw)
  To: Miller, Mike (OS Dev)
  Cc: James Bottomley, Benesh, Scott, axboe@kernel.dk,
	akpm@linux-foundation.org, thenzl@redhat.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	scameron

On Mon, Oct 25, 2010 at 08:26:54PM +0000, Miller, Mike (OS Dev) wrote:
> 
> 
> > -----Original Message-----
> > From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com]
> > Sent: Monday, October 25, 2010 3:09 PM
> > To: Stephen M. Cameron
> > Cc: axboe@kernel.dk; akpm@linux-foundation.org; thenzl@redhat.com;
> > Miller, Mike (OS Dev); linux-scsi@vger.kernel.org; linux-
> > kernel@vger.kernel.org
> > Subject: Re: [PATCH 01/13] cciss: remove controllers supported by hpsa
> > 
> > On Fri, 2010-10-08 at 15:06 -0500, Stephen M. Cameron wrote:
> > > From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> > >
> > > We would prefer not to have any overlap between the two drivers.
> > > Remove the cciss_allow_hpsa option, as it it is no longer needed.
> > >
> > > Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> > > ---
> > >  drivers/block/cciss.c |   38 +-------------------------------------
> > >  1 files changed, 1 insertions(+), 37 deletions(-)
> > >
> > > diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> > > index 5e4fadc..ca900ea 100644
> > > --- a/drivers/block/cciss.c
> > > +++ b/drivers/block/cciss.c
> > > @@ -66,12 +66,6 @@ MODULE_SUPPORTED_DEVICE("HP Smart Array
> > Controllers");
> > >  MODULE_VERSION("3.6.26");
> > >  MODULE_LICENSE("GPL");
> > >
> > > -static int cciss_allow_hpsa;
> > > -module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
> > > -MODULE_PARM_DESC(cciss_allow_hpsa,
> > > -	"Prevent cciss driver from accessing hardware known to be "
> > > -	" supported by the hpsa driver");
> > > -
> > >  #include "cciss_cmd.h"
> > >  #include "cciss.h"
> > >  #include <linux/cciss_ioctl.h>
> > > @@ -98,18 +92,6 @@ static const struct pci_device_id
> > cciss_pci_device_id[] = {
> > >  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C,
> > 0x3215},
> > >  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C,
> > 0x3237},
> > >  	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C,
> > 0x323D},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3241},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3243},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3245},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3247},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3249},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x324A},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x324B},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3250},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3251},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3252},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3253},
> > > -	{PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C,
> > 0x3254},
> > 
> > This hunk conflicts with the update Mike Miller sent
> > 
> > commit 6362beea8914cbd4630ccde3617d944aeca2d48f
> > Author: Mike Miller <mike.miller@hp.com>
> > Date:   Tue Oct 19 09:40:34 2010 +0200
> > 
> >     cciss: fix PCI IDs for new Smart Array controllers
> > 
> > And which is now mainline.
> > 
> > James
> 
> I guess I'm the one who jumped the gun on the patch I sent to correct those
> PCI IDs. I suppose it would be preferable to have no overlapping support
> between cciss and hpsa. With the distros it's a little easier to draw a line in
> the sand (or is it?). On some distros it seems migration is impossible, on
> others it's fairly simple.  
> 
> I guess my point is what do users want? Does a significant number want to use
> upstream kernels but they still require cciss? Should we force them to go to
> hpsa? Or should they just add whatever ID they want and go on with life?  
> 
> Maybe if we broke out the PCI IDs into a separate include file for both
> drivers??? Does that help? Probably not. I saw this coming long ago but I still
> don't know the answer. Any ideas, comments, suggestions, flames?  > 

I don't think we want to open this can of worms.  We want disjoint
sets if at all possible.  The only reason they weren't disjoint
sets from the get go was because at the time, nobody had any of
the newer boards, and we needed something to test hpsa on.

>From what I've seen of newer distro betas, the udev stuff does seem to
behave pretty nicely nowadays and one can transparently boot up and mount
filesystems and so on despite swapping out cciss for hpsa or vice
versa without any need to fix anything up.  However, there are
issues.  For example, with the newer distro betas I've seen, The module
load order is not deterministic, and esp. tends to differ in the
kdump initrd case vs. the "normal" initrd kernel case.  If you're
running cciss and hpsa with hpsa_allow_any=1 -- or have other
overlapping device support -- then this means you
can't be certain which driver will get which hardware on any given
boot, which, even though udev makes it mostly work transparently,
it's a bit disconcerting if you aren't expecting it to see all your
filesystems suddenly mounted from strange places, to say the least.
In particular, with overlapping device support, I noticed things
likely to swap around when kdump kernel was loading, with the result
being that the kdump didn't work, because the kdump initrd is a bit
stripped down and lacking in features (I forget now *exactly* what
went wrong, but it was due to some diff between kdump initrd and
the normal initrd in the distro I was looking at.)

All this is avoided if there's no overlapping device support
by default.

I was trying to make things match what we have in our (HP's) variant
of the driver.

Which is to say, cciss should contain:

        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISS,  0x0E11, 0x4070},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSB, 0x0E11, 0x4080},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSB, 0x0E11, 0x4082},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSB, 0x0E11, 0x4083},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, 0x0E11, 0x4091},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, 0x0E11, 0x409A},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, 0x0E11, 0x409B},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, 0x0E11, 0x409C},
        {PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, 0x0E11, 0x409D},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSA,     0x103C, 0x3225},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3223},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3234},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3235},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3211},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3212},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3213},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3214},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSD,     0x103C, 0x3215},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x3237},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSC,     0x103C, 0x323D},
	{0,}

and

        {0x40700E11, "Smart Array 5300", &SA5_access},
        {0x40800E11, "Smart Array 5i", &SA5B_access},
        {0x40820E11, "Smart Array 532", &SA5B_access},
        {0x40830E11, "Smart Array 5312", &SA5B_access},
        {0x409A0E11, "Smart Array 641", &SA5_access},
        {0x409B0E11, "Smart Array 642", &SA5_access},
        {0x409C0E11, "Smart Array 6400", &SA5_access},
        {0x409D0E11, "Smart Array 6400 EM", &SA5_access},
        {0x40910E11, "Smart Array 6i", &SA5_access},
        {0x3225103C, "Smart Array P600", &SA5_access},
        {0x3223103C, "Smart Array P800", &SA5_access},
        {0x3234103C, "Smart Array P400", &SA5_access},
        {0x3235103C, "Smart Array P400i", &SA5_access},
        {0x3211103C, "Smart Array E200i", &SA5_access},
        {0x3212103C, "Smart Array E200", &SA5_access},
        {0x3213103C, "Smart Array E200i", &SA5_access},
        {0x3214103C, "Smart Array E200i", &SA5_access},
        {0x3215103C, "Smart Array E200i", &SA5_access},
        {0x3237103C, "Smart Array E500", &SA5_access},
        {0x323d103c, "Smart Array P700M", &SA5_access},

and hpsa should contain:

        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3241},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3243},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3245},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3247},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3249},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324a},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324b},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3233},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSG,     0x103C, 0x3350},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSG,     0x103C, 0x3351},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSG,     0x103C, 0x3352},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSG,     0x103C, 0x3353},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSG,     0x103C, 0x3354},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSG,     0x103C, 0x3355},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x333F},
        {PCI_VENDOR_ID_HP,     PCI_ANY_ID,             PCI_ANY_ID, PCI_ANY_ID,
                PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
        {PCI_VENDOR_ID_COMPAQ,     PCI_ANY_ID,             PCI_ANY_ID, PCI_ANY_ID,
                PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
        {0,}

and

        {0x3241103C, "Smart Array P212", &SA5_access},
        {0x3243103C, "Smart Array P410", &SA5_access},
        {0x3245103C, "Smart Array P410i", &SA5_access},
        {0x3247103C, "Smart Array P411", &SA5_access},
        {0x3249103C, "Smart Array P812", &SA5_access},
        {0x324a103C, "Smart Array P712m", &SA5_access},
        {0x324b103C, "Smart Array P711m", &SA5_access},
        {0x3233103C, "StorageWorks P1210m", &SA5_access},
        {0x333F103C, "StorageWorks P1210m", &SA5_access},
        {0x3350103C, "Smart Array", &SA5_access},
        {0x3351103C, "Smart Array", &SA5_access},
        {0x3352103C, "Smart Array", &SA5_access},
        {0x3353103C, "Smart Array", &SA5_access},
        {0x3354103C, "Smart Array", &SA5_access},
        {0x3355103C, "Smart Array", &SA5_access},


Of course patches to this kind of code tend to be fragile and not have
much of a shelf life.  Sounds like mine had already rotted. 

-- steve

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

end of thread, other threads:[~2010-10-25 22:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-08 20:06 [PATCH 00/13] Patches for cciss and hpsa Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 01/13] cciss: remove controllers supported by hpsa Stephen M. Cameron
2010-10-25 20:09   ` James Bottomley
2010-10-25 20:26     ` Miller, Mike (OS Dev)
2010-10-25 22:04       ` scameron
2010-10-08 20:06 ` [PATCH 02/13] hpsa: fix board status waiting code Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 03/13] hpsa: Use kernel provided PCI state save and restore functions Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 04/13] hpsa: limit commands allocated on reset_devices Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 05/13] hpsa: do not reset unknown boards " Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 06/13] cciss: fix board status waiting code Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 07/13] cciss: Use kernel provided PCI state save and restore functions Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 08/13] cciss: limit commands allocated on reset_devices Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 09/13] cciss: use usleep_range not msleep for small sleeps Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 10/13] hpsa: take the adapter lock in hpsa_wait_for_mode_change_ack Stephen M. Cameron
2010-10-08 20:06 ` [PATCH 11/13] hpsa: allow driver to put controller in either simple or performant mode Stephen M. Cameron
2010-10-08 20:07 ` [PATCH 12/13] hpsa: use usleep_range not msleep for small sleeps Stephen M. Cameron
2010-10-08 20:07 ` [PATCH 13/13] hpsa: defend against zero sized buffers in passthru ioctls Stephen M. Cameron

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 NNTP newsgroup(s).