All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010
@ 2015-05-14  0:12 rajinikanth.pandurangan
  2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
                   ` (8 more replies)
  0 siblings, 9 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

This patchset includes the following changes (bug fixes and new feature support)
specific to aacraid driver.

Rajinikanth Pandurangan (9):
  [SCSI] aacraid: Fix for logical device name and UID not exposed to the
    OS
  [SCSI] aacraid: Add Power Management support
  [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  [SCSI] aacraid: Enable 64-bit write to controller register
  [SCSI] aacraid: Tune response path if IsFastPath bit set
  [SCSI] aacraid: Reset irq affinity hints before releasing irq
  [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from
    suspend
  [SCSI] aacraid: Send commit-config to controller firmware
  [SCSI] aacraid: Update driver version

 drivers/scsi/aacraid/aachba.c   | 263 +++++++++++++++++++++-------------------
 drivers/scsi/aacraid/aacraid.h  |  21 +++-
 drivers/scsi/aacraid/comminit.c | 155 ++++++++++++-----------
 drivers/scsi/aacraid/commsup.c  | 114 ++++++++++++-----
 drivers/scsi/aacraid/linit.c    | 140 +++++++++++++++------
 drivers/scsi/aacraid/rx.c       |   1 +
 drivers/scsi/aacraid/sa.c       |   1 +
 drivers/scsi/aacraid/src.c      |  64 +++-------
 8 files changed, 443 insertions(+), 316 deletions(-)

-- 
1.9.3


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

* [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:55   ` Mahesh Rajashekhara
                     ` (2 more replies)
  2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
                   ` (7 subsequent siblings)
  8 siblings, 3 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Driver sends the right size of the response buffer.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
 
 	status = aac_fib_send(ContainerCommand,
 		  cmd_fibcontext,
-		  sizeof (struct aac_get_name),
+		  sizeof(struct aac_get_name_resp),
 		  FsaNormal,
 		  0, 1,
 		  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd)
 
 	status = aac_fib_send(ContainerCommand,
 		  cmd_fibcontext,
-		  sizeof (struct aac_get_serial),
+		  sizeof(struct aac_get_serial_resp),
 		  FsaNormal,
 		  0, 1,
 		  (fib_callback) get_container_serial_callback,
-- 
1.9.3


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

* [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
  2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:56   ` Mahesh Rajashekhara
                     ` (3 more replies)
  2015-05-14  0:12 ` [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
                   ` (6 subsequent siblings)
  8 siblings, 4 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	* .suspend() and .resume() routines implemented in the driver
	* aac_release_resources() initiates firmware shutdown
	* aac_acquire_resources re-initializes the host interface

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 ++++++++++++++++++++--------------------
 drivers/scsi/aacraid/linit.c    | 147 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/aacraid/rx.c       |   1 +
 drivers/scsi/aacraid/sa.c       |   1 +
 drivers/scsi/aacraid/src.c      |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
 	int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4);
 	int  (*adapter_check_health)(struct aac_dev *dev);
 	int  (*adapter_restart)(struct aac_dev *dev, int bled);
+	void (*adapter_start)(struct aac_dev *dev);
 	/* Transport operations */
 	int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
 	irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
 	(dev)->a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+	((dev)->a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
 	(dev)->a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);
 int aac_src_init(struct aac_dev *dev);
 int aac_srcv_init(struct aac_dev *dev);
 int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);
 unsigned int aac_command_normal(struct aac_queue * q);
 unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index,
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45db84a..45a0a04 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include "aacraid.h"
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
 	.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
 	return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev)
+{
+	int i, msi_count;
+
+	msi_count = i = 0;
+	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+	if (dev->max_msix == 0 ||
+	    dev->pdev->device == PMC_DEVICE_S6 ||
+	    dev->sync_mode) {
+		dev->max_msix = 1;
+		dev->vector_cap =
+			dev->scsi_host_ptr->can_queue +
+			AAC_NUM_MGT_FIB;
+		return;
+	}
+
+	/* Don't bother allocating more MSI-X vectors than cpus */
+	msi_count = min(dev->max_msix,
+		(unsigned int)num_online_cpus());
+
+	dev->max_msix = msi_count;
+
+	if (msi_count > AAC_MAX_MSIX)
+		msi_count = AAC_MAX_MSIX;
+
+	for (i = 0; i < msi_count; i++)
+		dev->msixentry[i].entry = i;
+
+	if (msi_count > 1 &&
+	    pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
+		i = pci_enable_msix(dev->pdev,
+				    dev->msixentry,
+				    msi_count);
+		 /* Check how many MSIX vectors are allocated */
+		if (i >= 0) {
+			dev->msi_enabled = 1;
+			if (i) {
+				msi_count = i;
+				if (pci_enable_msix(dev->pdev,
+				    dev->msixentry,
+				    msi_count)) {
+					dev->msi_enabled = 0;
+					printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
+							dev->name, dev->id, i);
+				}
+			}
+		} else {
+			dev->msi_enabled = 0;
+			printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
+					dev->name, dev->id, i);
+		}
+	}
+
+	if (!dev->msi_enabled) {
+		msi_count = 1;
+		i = pci_enable_msi(dev->pdev);
+
+		if (!i) {
+			dev->msi_enabled = 1;
+			dev->msi = 1;
+		} else {
+			printk(KERN_ERR "%s%d: MSI not supported!! Will try INTx 0x%x.\n",
+					dev->name, dev->id, i);
+		}
+	}
+
+	if (!dev->msi_enabled)
+		dev->max_msix = msi_count = 1;
+	else {
+		if (dev->max_msix > msi_count)
+			dev->max_msix = msi_count;
+	}
+	dev->vector_cap =
+		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
+		msi_count;
+}
 struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 {
 	u32 status[5];
@@ -508,79 +582,3 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 	return dev;
 }
 
-static void aac_define_int_mode(struct aac_dev *dev)
-{
-
-	int i, msi_count;
-
-	msi_count = i = 0;
-	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
-	if (dev->max_msix == 0 ||
-	    dev->pdev->device == PMC_DEVICE_S6 ||
-	    dev->sync_mode) {
-		dev->max_msix = 1;
-		dev->vector_cap =
-			dev->scsi_host_ptr->can_queue +
-			AAC_NUM_MGT_FIB;
-		return;
-	}
-
-	msi_count = min(dev->max_msix,
-		(unsigned int)num_online_cpus());
-
-	dev->max_msix = msi_count;
-
-	if (msi_count > AAC_MAX_MSIX)
-		msi_count = AAC_MAX_MSIX;
-
-	for (i = 0; i < msi_count; i++)
-		dev->msixentry[i].entry = i;
-
-	if (msi_count > 1 &&
-	    pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
-		i = pci_enable_msix(dev->pdev,
-				    dev->msixentry,
-				    msi_count);
-		 /* Check how many MSIX vectors are allocated */
-		if (i >= 0) {
-			dev->msi_enabled = 1;
-			if (i) {
-				msi_count = i;
-				if (pci_enable_msix(dev->pdev,
-				    dev->msixentry,
-				    msi_count)) {
-					dev->msi_enabled = 0;
-					printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
-							dev->name, dev->id, i);
-				}
-			}
-		} else {
-			dev->msi_enabled = 0;
-			printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
-					dev->name, dev->id, i);
-		}
-	}
-
-	if (!dev->msi_enabled) {
-		msi_count = 1;
-		i = pci_enable_msi(dev->pdev);
-
-		if (!i) {
-			dev->msi_enabled = 1;
-			dev->msi = 1;
-		} else {
-			printk(KERN_ERR "%s%d: MSI not supported!! Will try INTx 0x%x.\n",
-					dev->name, dev->id, i);
-		}
-	}
-
-	if (!dev->msi_enabled)
-		dev->max_msix = msi_count = 1;
-	else {
-		if (dev->max_msix > msi_count)
-			dev->max_msix = msi_count;
-	}
-	dev->vector_cap =
-		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
-		msi_count;
-}
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9eec027..be30e43 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1317,6 +1317,149 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	return error;
 }
 
+#if (defined(CONFIG_PM))
+void aac_release_resources(struct aac_dev *aac)
+{
+	int i;
+
+	aac_adapter_disable_int(aac);
+	if (aac->pdev->device == PMC_DEVICE_S6 ||
+	    aac->pdev->device == PMC_DEVICE_S7 ||
+	    aac->pdev->device == PMC_DEVICE_S8 ||
+	    aac->pdev->device == PMC_DEVICE_S9) {
+		if (aac->max_msix > 1) {
+			for (i = 0; i < aac->max_msix; i++)
+				free_irq(aac->msixentry[i].vector,
+					&(aac->aac_msix[i]));
+		} else {
+			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
+		}
+	} else {
+		free_irq(aac->pdev->irq, aac);
+	}
+	if (aac->msi)
+		pci_disable_msi(aac->pdev);
+	else if (aac->max_msix > 1)
+		pci_disable_msix(aac->pdev);
+
+}
+
+static int aac_acquire_resources(struct aac_dev *dev)
+{
+	int i, j;
+	int instance = dev->id;
+	const char *name = dev->name;
+	unsigned long status;
+	/*
+	 *	First clear out all interrupts.  Then enable the one's that we
+	 *	can handle.
+	 */
+	while (!((status = src_readl(dev, MUnit.OMR)) & KERNEL_UP_AND_RUNNING)
+		|| status == 0xffffffff)
+			msleep(1);
+
+	aac_adapter_disable_int(dev);
+	aac_adapter_enable_int(dev);
+
+
+	if ((dev->pdev->device == PMC_DEVICE_S7 ||
+	     dev->pdev->device == PMC_DEVICE_S8 ||
+	     dev->pdev->device == PMC_DEVICE_S9))
+		aac_define_int_mode(dev);
+
+	if (dev->msi_enabled)
+		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
+
+	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
+		for (i = 0; i < dev->max_msix; i++) {
+			dev->aac_msix[i].vector_no = i;
+			dev->aac_msix[i].dev = dev;
+
+			if (request_irq(dev->msixentry[i].vector,
+					dev->a_ops.adapter_intr,
+					0, "aacraid", &(dev->aac_msix[i]))) {
+				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
+						name, instance, i);
+				for (j = 0 ; j < i ; j++)
+					free_irq(dev->msixentry[j].vector,
+						 &(dev->aac_msix[j]));
+				pci_disable_msix(dev->pdev);
+				goto error_iounmap;
+			}
+		}
+	} else {
+		dev->aac_msix[0].vector_no = 0;
+		dev->aac_msix[0].dev = dev;
+
+		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
+			IRQF_SHARED|IRQF_DISABLED, "aacraid",
+			&(dev->aac_msix[0])) < 0) {
+			if (dev->msi)
+				pci_disable_msi(dev->pdev);
+			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
+					name, instance);
+			goto error_iounmap;
+		}
+	}
+
+	aac_adapter_enable_int(dev);
+
+	if (!dev->sync_mode)
+		aac_adapter_start(dev);
+	return 0;
+
+error_iounmap:
+	return -1;
+
+}
+static int aac_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+
+	struct Scsi_Host *shost = pci_get_drvdata(pdev);
+	struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
+
+	scsi_block_requests(shost);
+	aac_send_shutdown(aac);
+
+	aac_release_resources(aac);
+
+	pci_set_drvdata(pdev, shost);
+	pci_save_state(pdev);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
+	return 0;
+}
+
+static int aac_resume(struct pci_dev *pdev)
+{
+	struct Scsi_Host *shost = pci_get_drvdata(pdev);
+	struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
+	int r;
+
+	pci_set_power_state(pdev, PCI_D0);
+	pci_enable_wake(pdev, PCI_D0, 0);
+	pci_restore_state(pdev);
+	r = pci_enable_device(pdev);
+
+	if (r)
+		goto fail_device;
+
+	pci_set_master(pdev);
+	if (aac_acquire_resources(aac))
+		goto fail_device;
+	scsi_unblock_requests(shost);
+
+	return 0;
+
+fail_device:
+	printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id);
+	scsi_host_put(shost);
+	pci_disable_device(pdev);
+	return -ENODEV;
+}
+#endif
+
 static void aac_shutdown(struct pci_dev *dev)
 {
 	struct Scsi_Host *shost = pci_get_drvdata(dev);
@@ -1356,6 +1499,10 @@ static struct pci_driver aac_pci_driver = {
 	.id_table	= aac_pci_tbl,
 	.probe		= aac_probe_one,
 	.remove		= aac_remove_one,
+#if (defined(CONFIG_PM))
+	.suspend	= aac_suspend,
+	.resume		= aac_resume,
+#endif
 	.shutdown	= aac_shutdown,
 };
 
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index 9570612..ac16380 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -623,6 +623,7 @@ int _aac_rx_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_rx_check_health;
 	dev->a_ops.adapter_restart = aac_rx_restart_adapter;
+	dev->a_ops.adapter_start = aac_rx_start_adapter;
 
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index e66477c..869aea2 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -372,6 +372,7 @@ int aac_sa_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_sa_check_health;
 	dev->a_ops.adapter_restart = aac_sa_restart_adapter;
+	dev->a_ops.adapter_start = aac_sa_start_adapter;
 	dev->a_ops.adapter_intr = aac_sa_intr;
 	dev->a_ops.adapter_deliver = aac_rx_deliver_producer;
 	dev->a_ops.adapter_ioremap = aac_sa_ioremap;
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 4596e9d..b0204d0 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -726,6 +726,7 @@ int aac_src_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = src_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_src_check_health;
 	dev->a_ops.adapter_restart = aac_src_restart_adapter;
+	dev->a_ops.adapter_start = aac_src_start_adapter;
 
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
@@ -892,6 +893,7 @@ int aac_srcv_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = src_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_src_check_health;
 	dev->a_ops.adapter_restart = aac_src_restart_adapter;
+	dev->a_ops.adapter_start = aac_src_start_adapter;
 
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
-- 
1.9.3


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

* [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
  2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
  2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:56   ` Mahesh Rajashekhara
                     ` (2 more replies)
  2015-05-14  0:12 ` [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
                   ` (5 subsequent siblings)
  8 siblings, 3 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Enable MSI interrupt mode for series-6 controller.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/src.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index b0204d0..ae494c5 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
 	if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
 		goto error_iounmap;
 
-	dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
+	dev->msi = !pci_enable_msi(dev->pdev);
 
 	dev->aac_msix[0].vector_no = 0;
 	dev->aac_msix[0].dev = dev;
-- 
1.9.3


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

* [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
                   ` (2 preceding siblings ...)
  2015-05-14  0:12 ` [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
                     ` (2 more replies)
  2015-05-14  0:12 ` [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set rajinikanth.pandurangan
                   ` (4 subsequent siblings)
  8 siblings, 3 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
        If writeq() not supported, then do atomic two 32bit write

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h  | 12 ++++++++++++
 drivers/scsi/aacraid/comminit.c |  1 +
 drivers/scsi/aacraid/src.c      | 12 ++++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 62b0999..9e69e3e 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -719,6 +719,9 @@ struct sa_registers {
 #define sa_readl(AEP, CSR)		readl(&((AEP)->regs.sa->CSR))
 #define sa_writew(AEP, CSR, value)	writew(value, &((AEP)->regs.sa->CSR))
 #define sa_writel(AEP, CSR, value)	writel(value, &((AEP)->regs.sa->CSR))
+#if defined(writeq)
+#define	sa_writeq(AEP, CSR, value)	writeq(value, &((AEP)->regs.sa->CSR))
+#endif
 
 /*
  *	Rx Message Unit Registers
@@ -844,6 +847,10 @@ struct src_registers {
 						&((AEP)->regs.src.bar0->CSR))
 #define src_writel(AEP, CSR, value)	writel(value, \
 						&((AEP)->regs.src.bar0->CSR))
+#if defined(writeq)
+#define	src_writeq(AEP, CSR, value)	writeq(value, \
+						&((AEP)->regs.src.bar0->CSR))
+#endif
 
 #define SRC_ODR_SHIFT		12
 #define SRC_IDR_SHIFT		9
@@ -1163,6 +1170,11 @@ struct aac_dev
 	struct fsa_dev_info	*fsa_dev;
 	struct task_struct	*thread;
 	int			cardtype;
+	/*
+	 *This lock will protect the two 32-bit
+	 *writes to the Inbound Queue
+	 */
+	spinlock_t		iq_lock;
 
 	/*
 	 *	The following is the device specific extension.
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45a0a04..4043245 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 	dev->management_fib_count = 0;
 	spin_lock_init(&dev->manage_lock);
 	spin_lock_init(&dev->sync_lock);
+	spin_lock_init(&dev->iq_lock);
 	dev->max_fib_size = sizeof(struct hw_fib);
 	dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
 		- sizeof(struct aac_fibhdr)
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index ae494c5..109863a 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
 	u32 fibsize;
 	dma_addr_t address;
 	struct aac_fib_xporthdr *pFibX;
+#if !defined(writeq)
+	unsigned long flags;
+#endif
+
 	u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
 
 	atomic_inc(&q->numpending);
@@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
 			return -EINVAL;
 		address |= fibsize;
 	}
-
+#if defined(writeq)
+	src_writeq(dev, MUnit.IQ_L, (u64)address);
+#else
+	spin_lock_irqsave(&fib->dev->iq_lock, flags);
 	src_writel(dev, MUnit.IQ_H, upper_32_bits(address) & 0xffffffff);
 	src_writel(dev, MUnit.IQ_L, address & 0xffffffff);
-
+	spin_unlock_irqrestore(&fib->dev->iq_lock, flags);
+#endif
 	return 0;
 }
 
-- 
1.9.3


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

* [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
                   ` (3 preceding siblings ...)
  2015-05-14  0:12 ` [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-27 14:45   ` Tomas Henzl
  2015-05-14  0:12 ` [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq rajinikanth.pandurangan
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
        If 'IsFastPath' bit is set, then response path assumes no error
        and skips error check.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aachba.c | 259 ++++++++++++++++++++++--------------------
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index fe59b00..864e9f6 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 		return;
 
 	BUG_ON(fibptr == NULL);
-
 	dev = fibptr->dev;
 
-	srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+	scsi_dma_unmap(scsicmd);
 
+	/* expose physical device if expose_physicald flag is on */
+	if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01)
+	  && expose_physicals > 0)
+		aac_expose_phy_device(scsicmd);
+
+	srbreply = (struct aac_srb_reply *) fib_data(fibptr);
 	scsicmd->sense_buffer[0] = '\0';  /* Initialize sense valid flag to false */
 
 	if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) {
@@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 		 */
 		scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
 				   - le32_to_cpu(srbreply->data_xfer_length));
-	}
-
-	scsi_dma_unmap(scsicmd);
-
-	/* expose physical device if expose_physicald flag is on */
-	if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01)
-	  && expose_physicals > 0)
-		aac_expose_phy_device(scsicmd);
+		/*
+		 * First check the fib status
+		 */
 
-	/*
-	 * First check the fib status
-	 */
+		if (le32_to_cpu(srbreply->status) != ST_OK) {
+			int len;
 
-	if (le32_to_cpu(srbreply->status) != ST_OK){
-		int len;
-		printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
-		len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
-			    SCSI_SENSE_BUFFERSIZE);
-		scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
-		memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
-	}
+			printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
+			len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
+				    SCSI_SENSE_BUFFERSIZE);
+			scsicmd->result = DID_ERROR << 16
+						| COMMAND_COMPLETE << 8
+						| SAM_STAT_CHECK_CONDITION;
+			memcpy(scsicmd->sense_buffer,
+					srbreply->sense_data, len);
+		}
 
-	/*
-	 * Next check the srb status
-	 */
-	switch( (le32_to_cpu(srbreply->srb_status))&0x3f){
-	case SRB_STATUS_ERROR_RECOVERY:
-	case SRB_STATUS_PENDING:
-	case SRB_STATUS_SUCCESS:
-		scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
-		break;
-	case SRB_STATUS_DATA_OVERRUN:
-		switch(scsicmd->cmnd[0]){
-		case  READ_6:
-		case  WRITE_6:
-		case  READ_10:
-		case  WRITE_10:
-		case  READ_12:
-		case  WRITE_12:
-		case  READ_16:
-		case  WRITE_16:
-			if (le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow) {
-				printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
-			} else {
-				printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
+		/*
+		 * Next check the srb status
+		 */
+		switch ((le32_to_cpu(srbreply->srb_status))&0x3f) {
+		case SRB_STATUS_ERROR_RECOVERY:
+		case SRB_STATUS_PENDING:
+		case SRB_STATUS_SUCCESS:
+			scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+			break;
+		case SRB_STATUS_DATA_OVERRUN:
+			switch (scsicmd->cmnd[0]) {
+			case  READ_6:
+			case  WRITE_6:
+			case  READ_10:
+			case  WRITE_10:
+			case  READ_12:
+			case  WRITE_12:
+			case  READ_16:
+			case  WRITE_16:
+				if (le32_to_cpu(srbreply->data_xfer_length)
+							< scsicmd->underflow)
+					printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
+				else
+					printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
+				scsicmd->result = DID_ERROR << 16
+							| COMMAND_COMPLETE << 8;
+				break;
+			case INQUIRY: {
+				scsicmd->result = DID_OK << 16
+							| COMMAND_COMPLETE << 8;
+				break;
+			}
+			default:
+				scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+				break;
 			}
-			scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
 			break;
-		case INQUIRY: {
-			scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+		case SRB_STATUS_ABORTED:
+			scsicmd->result = DID_ABORT << 16 | ABORT << 8;
 			break;
-		}
-		default:
-			scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+		case SRB_STATUS_ABORT_FAILED:
+			/*
+			 * Not sure about this one - but assuming the
+			 * hba was trying to abort for some reason
+			 */
+			scsicmd->result = DID_ERROR << 16 | ABORT << 8;
+			break;
+		case SRB_STATUS_PARITY_ERROR:
+			scsicmd->result = DID_PARITY << 16
+						| MSG_PARITY_ERROR << 8;
+			break;
+		case SRB_STATUS_NO_DEVICE:
+		case SRB_STATUS_INVALID_PATH_ID:
+		case SRB_STATUS_INVALID_TARGET_ID:
+		case SRB_STATUS_INVALID_LUN:
+		case SRB_STATUS_SELECTION_TIMEOUT:
+			scsicmd->result = DID_NO_CONNECT << 16
+						| COMMAND_COMPLETE << 8;
 			break;
-		}
-		break;
-	case SRB_STATUS_ABORTED:
-		scsicmd->result = DID_ABORT << 16 | ABORT << 8;
-		break;
-	case SRB_STATUS_ABORT_FAILED:
-		// Not sure about this one - but assuming the hba was trying to abort for some reason
-		scsicmd->result = DID_ERROR << 16 | ABORT << 8;
-		break;
-	case SRB_STATUS_PARITY_ERROR:
-		scsicmd->result = DID_PARITY << 16 | MSG_PARITY_ERROR << 8;
-		break;
-	case SRB_STATUS_NO_DEVICE:
-	case SRB_STATUS_INVALID_PATH_ID:
-	case SRB_STATUS_INVALID_TARGET_ID:
-	case SRB_STATUS_INVALID_LUN:
-	case SRB_STATUS_SELECTION_TIMEOUT:
-		scsicmd->result = DID_NO_CONNECT << 16 | COMMAND_COMPLETE << 8;
-		break;
 
-	case SRB_STATUS_COMMAND_TIMEOUT:
-	case SRB_STATUS_TIMEOUT:
-		scsicmd->result = DID_TIME_OUT << 16 | COMMAND_COMPLETE << 8;
-		break;
+		case SRB_STATUS_COMMAND_TIMEOUT:
+		case SRB_STATUS_TIMEOUT:
+			scsicmd->result = DID_TIME_OUT << 16
+						| COMMAND_COMPLETE << 8;
+			break;
 
-	case SRB_STATUS_BUSY:
-		scsicmd->result = DID_BUS_BUSY << 16 | COMMAND_COMPLETE << 8;
-		break;
+		case SRB_STATUS_BUSY:
+			scsicmd->result = DID_BUS_BUSY << 16
+						| COMMAND_COMPLETE << 8;
+			break;
 
-	case SRB_STATUS_BUS_RESET:
-		scsicmd->result = DID_RESET << 16 | COMMAND_COMPLETE << 8;
-		break;
+		case SRB_STATUS_BUS_RESET:
+			scsicmd->result = DID_RESET << 16
+						| COMMAND_COMPLETE << 8;
+			break;
 
-	case SRB_STATUS_MESSAGE_REJECTED:
-		scsicmd->result = DID_ERROR << 16 | MESSAGE_REJECT << 8;
-		break;
-	case SRB_STATUS_REQUEST_FLUSHED:
-	case SRB_STATUS_ERROR:
-	case SRB_STATUS_INVALID_REQUEST:
-	case SRB_STATUS_REQUEST_SENSE_FAILED:
-	case SRB_STATUS_NO_HBA:
-	case SRB_STATUS_UNEXPECTED_BUS_FREE:
-	case SRB_STATUS_PHASE_SEQUENCE_FAILURE:
-	case SRB_STATUS_BAD_SRB_BLOCK_LENGTH:
-	case SRB_STATUS_DELAYED_RETRY:
-	case SRB_STATUS_BAD_FUNCTION:
-	case SRB_STATUS_NOT_STARTED:
-	case SRB_STATUS_NOT_IN_USE:
-	case SRB_STATUS_FORCE_ABORT:
-	case SRB_STATUS_DOMAIN_VALIDATION_FAIL:
-	default:
+		case SRB_STATUS_MESSAGE_REJECTED:
+			scsicmd->result = DID_ERROR << 16
+						| MESSAGE_REJECT << 8;
+			break;
+		case SRB_STATUS_REQUEST_FLUSHED:
+		case SRB_STATUS_ERROR:
+		case SRB_STATUS_INVALID_REQUEST:
+		case SRB_STATUS_REQUEST_SENSE_FAILED:
+		case SRB_STATUS_NO_HBA:
+		case SRB_STATUS_UNEXPECTED_BUS_FREE:
+		case SRB_STATUS_PHASE_SEQUENCE_FAILURE:
+		case SRB_STATUS_BAD_SRB_BLOCK_LENGTH:
+		case SRB_STATUS_DELAYED_RETRY:
+		case SRB_STATUS_BAD_FUNCTION:
+		case SRB_STATUS_NOT_STARTED:
+		case SRB_STATUS_NOT_IN_USE:
+		case SRB_STATUS_FORCE_ABORT:
+		case SRB_STATUS_DOMAIN_VALIDATION_FAIL:
+		default:
 #ifdef AAC_DETAILED_STATUS_INFO
-		printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n",
-			le32_to_cpu(srbreply->srb_status) & 0x3F,
-			aac_get_status_string(
-				le32_to_cpu(srbreply->srb_status) & 0x3F),
-			scsicmd->cmnd[0],
-			le32_to_cpu(srbreply->scsi_status));
+			printk(KERN_INFO "aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n",
+				le32_to_cpu(srbreply->srb_status) & 0x3F,
+				aac_get_status_string(
+					le32_to_cpu(srbreply->srb_status) & 0x3F),
+				scsicmd->cmnd[0],
+				le32_to_cpu(srbreply->scsi_status));
 #endif
-		if ((scsicmd->cmnd[0] == ATA_12)
-		  || (scsicmd->cmnd[0] == ATA_16)) {
-			if (scsicmd->cmnd[2] & (0x01 << 5)) {
-				scsicmd->result = DID_OK << 16
-						| COMMAND_COMPLETE << 8;
+			if ((scsicmd->cmnd[0] == ATA_12)
+				|| (scsicmd->cmnd[0] == ATA_16)) {
+					if (scsicmd->cmnd[2] & (0x01 << 5)) {
+						scsicmd->result = DID_OK << 16
+							| COMMAND_COMPLETE << 8;
 				break;
+				} else {
+					scsicmd->result = DID_ERROR << 16
+						| COMMAND_COMPLETE << 8;
+					break;
+				}
 			} else {
 				scsicmd->result = DID_ERROR << 16
-						| COMMAND_COMPLETE << 8;
+					| COMMAND_COMPLETE << 8;
 				break;
 			}
-		} else {
-			scsicmd->result = DID_ERROR << 16
-					| COMMAND_COMPLETE << 8;
-			break;
 		}
-	}
-	if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) {
-		int len;
-		scsicmd->result |= SAM_STAT_CHECK_CONDITION;
-		len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
-			    SCSI_SENSE_BUFFERSIZE);
+		if (le32_to_cpu(srbreply->scsi_status)
+				== SAM_STAT_CHECK_CONDITION) {
+			int len;
+
+			scsicmd->result |= SAM_STAT_CHECK_CONDITION;
+			len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
+				    SCSI_SENSE_BUFFERSIZE);
 #ifdef AAC_DETAILED_STATUS_INFO
-		printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
-					le32_to_cpu(srbreply->status), len);
+			printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
+						le32_to_cpu(srbreply->status), len);
 #endif
-		memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
+			memcpy(scsicmd->sense_buffer,
+					srbreply->sense_data, len);
+		}
 	}
 	/*
 	 * OR in the scsi status (already shifted up a bit)
-- 
1.9.3


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

* [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
                   ` (4 preceding siblings ...)
  2015-05-14  0:12 ` [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-27 14:45   ` Tomas Henzl
  2015-05-14  0:12 ` [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend rajinikanth.pandurangan
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
        Reset irq affinity hints before releasing IRQ
        Removed duplicate code of IRQ acquire/release

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h |   2 +
 drivers/scsi/aacraid/commsup.c | 114 ++++++++++++++++++++++++++++++-----------
 drivers/scsi/aacraid/linit.c   |  93 ++-------------------------------
 drivers/scsi/aacraid/src.c     |  50 ++----------------
 4 files changed, 94 insertions(+), 165 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9e69e3e..ec32a2bdd 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2113,6 +2113,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
 #define AAC_OWNER_ERROR_HANDLER	0x103
 #define AAC_OWNER_FIRMWARE	0x106
 
+int aac_acquire_irq(struct aac_dev *dev);
+void aac_free_irq(struct aac_dev *dev);
 const char *aac_driverinfo(struct Scsi_Host *);
 struct fib *aac_fib_alloc(struct aac_dev *dev);
 int aac_fib_setup(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 4da5749..3ff18f4 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1270,13 +1270,12 @@ retry_next:
 static int _aac_reset_adapter(struct aac_dev *aac, int forced)
 {
 	int index, quirks;
-	int retval, i;
+	int retval;
 	struct Scsi_Host *host;
 	struct scsi_device *dev;
 	struct scsi_cmnd *command;
 	struct scsi_cmnd *command_list;
 	int jafo = 0;
-	int cpu;
 
 	/*
 	 * Assumptions:
@@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
 	aac->comm_phys = 0;
 	kfree(aac->queues);
 	aac->queues = NULL;
-	cpu = cpumask_first(cpu_online_mask);
-	if (aac->pdev->device == PMC_DEVICE_S6 ||
-	    aac->pdev->device == PMC_DEVICE_S7 ||
-	    aac->pdev->device == PMC_DEVICE_S8 ||
-	    aac->pdev->device == PMC_DEVICE_S9) {
-		if (aac->max_msix > 1) {
-			for (i = 0; i < aac->max_msix; i++) {
-				if (irq_set_affinity_hint(
-				    aac->msixentry[i].vector,
-				    NULL)) {
-					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
-						aac->name,
-						aac->id,
-						cpu);
-				}
-				cpu = cpumask_next(cpu,
-						cpu_online_mask);
-				free_irq(aac->msixentry[i].vector,
-					 &(aac->aac_msix[i]));
-			}
-			pci_disable_msix(aac->pdev);
-		} else {
-			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
-		}
-	} else {
-		free_irq(aac->pdev->irq, aac);
-	}
-	if (aac->msi)
-		pci_disable_msi(aac->pdev);
+	aac_free_irq(aac);
 	kfree(aac->fsa_dev);
 	aac->fsa_dev = NULL;
 	quirks = aac_get_driver_ident(index)->quirks;
@@ -1978,3 +1949,84 @@ int aac_command_thread(void *data)
 	dev->aif_thread = 0;
 	return 0;
 }
+
+int aac_acquire_irq(struct aac_dev *dev)
+{
+	int i;
+	int j;
+	int ret = 0;
+	int cpu;
+
+	cpu = cpumask_first(cpu_online_mask);
+	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
+		for (i = 0; i < dev->max_msix; i++) {
+			dev->aac_msix[i].vector_no = i;
+			dev->aac_msix[i].dev = dev;
+			if (request_irq(dev->msixentry[i].vector,
+					dev->a_ops.adapter_intr,
+					0, "aacraid", &(dev->aac_msix[i]))) {
+				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
+						dev->name, dev->id, i);
+				for (j = 0 ; j < i ; j++)
+					free_irq(dev->msixentry[j].vector,
+						 &(dev->aac_msix[j]));
+				pci_disable_msix(dev->pdev);
+				ret = -1;
+			}
+			if (irq_set_affinity_hint(dev->msixentry[i].vector,
+							get_cpu_mask(cpu))) {
+				printk(KERN_ERR "%s%d: Failed to set IRQ affinity for cpu %d\n",
+					    dev->name, dev->id, cpu);
+			}
+			cpu = cpumask_next(cpu, cpu_online_mask);
+		}
+	} else {
+		dev->aac_msix[0].vector_no = 0;
+		dev->aac_msix[0].dev = dev;
+
+		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
+			IRQF_SHARED|IRQF_DISABLED, "aacraid",
+			&(dev->aac_msix[0])) < 0) {
+			if (dev->msi)
+				pci_disable_msi(dev->pdev);
+			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
+					dev->name, dev->id);
+			ret = -1;
+		}
+	}
+	return ret;
+}
+
+void aac_free_irq(struct aac_dev *dev)
+{
+	int i;
+	int cpu;
+
+	cpu = cpumask_first(cpu_online_mask);
+	if (dev->pdev->device == PMC_DEVICE_S6 ||
+	    dev->pdev->device == PMC_DEVICE_S7 ||
+	    dev->pdev->device == PMC_DEVICE_S8 ||
+	    dev->pdev->device == PMC_DEVICE_S9) {
+		if (dev->max_msix > 1) {
+			for (i = 0; i < dev->max_msix; i++) {
+				if (irq_set_affinity_hint(
+					dev->msixentry[i].vector, NULL)) {
+					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
+					    dev->name, dev->id, cpu);
+				}
+				cpu = cpumask_next(cpu, cpu_online_mask);
+				free_irq(dev->msixentry[i].vector,
+						&(dev->aac_msix[i]));
+			}
+		} else {
+			free_irq(dev->pdev->irq, &(dev->aac_msix[0]));
+		}
+	} else {
+		free_irq(dev->pdev->irq, dev);
+	}
+	if (dev->msi)
+		pci_disable_msi(dev->pdev);
+	else if (dev->max_msix > 1)
+		pci_disable_msix(dev->pdev);
+}
+
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index be30e43..62a928f 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1072,9 +1072,6 @@ static struct scsi_host_template aac_driver_template = {
 
 static void __aac_shutdown(struct aac_dev * aac)
 {
-	int i;
-	int cpu;
-
 	if (aac->aif_thread) {
 		int i;
 		/* Clear out events first */
@@ -1088,37 +1085,7 @@ static void __aac_shutdown(struct aac_dev * aac)
 	}
 	aac_send_shutdown(aac);
 	aac_adapter_disable_int(aac);
-	cpu = cpumask_first(cpu_online_mask);
-	if (aac->pdev->device == PMC_DEVICE_S6 ||
-	    aac->pdev->device == PMC_DEVICE_S7 ||
-	    aac->pdev->device == PMC_DEVICE_S8 ||
-	    aac->pdev->device == PMC_DEVICE_S9) {
-		if (aac->max_msix > 1) {
-			for (i = 0; i < aac->max_msix; i++) {
-				if (irq_set_affinity_hint(
-				    aac->msixentry[i].vector,
-				    NULL)) {
-					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
-						aac->name,
-						aac->id,
-						cpu);
-				}
-				cpu = cpumask_next(cpu,
-						cpu_online_mask);
-				free_irq(aac->msixentry[i].vector,
-					 &(aac->aac_msix[i]));
-			}
-		} else {
-			free_irq(aac->pdev->irq,
-				 &(aac->aac_msix[0]));
-		}
-	} else {
-		free_irq(aac->pdev->irq, aac);
-	}
-	if (aac->msi)
-		pci_disable_msi(aac->pdev);
-	else if (aac->max_msix > 1)
-		pci_disable_msix(aac->pdev);
+	aac_free_irq(aac);
 }
 
 static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -1320,35 +1287,12 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 #if (defined(CONFIG_PM))
 void aac_release_resources(struct aac_dev *aac)
 {
-	int i;
-
 	aac_adapter_disable_int(aac);
-	if (aac->pdev->device == PMC_DEVICE_S6 ||
-	    aac->pdev->device == PMC_DEVICE_S7 ||
-	    aac->pdev->device == PMC_DEVICE_S8 ||
-	    aac->pdev->device == PMC_DEVICE_S9) {
-		if (aac->max_msix > 1) {
-			for (i = 0; i < aac->max_msix; i++)
-				free_irq(aac->msixentry[i].vector,
-					&(aac->aac_msix[i]));
-		} else {
-			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
-		}
-	} else {
-		free_irq(aac->pdev->irq, aac);
-	}
-	if (aac->msi)
-		pci_disable_msi(aac->pdev);
-	else if (aac->max_msix > 1)
-		pci_disable_msix(aac->pdev);
-
+	aac_free_irq(aac);
 }
 
 static int aac_acquire_resources(struct aac_dev *dev)
 {
-	int i, j;
-	int instance = dev->id;
-	const char *name = dev->name;
 	unsigned long status;
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
@@ -1370,37 +1314,8 @@ static int aac_acquire_resources(struct aac_dev *dev)
 	if (dev->msi_enabled)
 		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
 
-	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
-		for (i = 0; i < dev->max_msix; i++) {
-			dev->aac_msix[i].vector_no = i;
-			dev->aac_msix[i].dev = dev;
-
-			if (request_irq(dev->msixentry[i].vector,
-					dev->a_ops.adapter_intr,
-					0, "aacraid", &(dev->aac_msix[i]))) {
-				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
-						name, instance, i);
-				for (j = 0 ; j < i ; j++)
-					free_irq(dev->msixentry[j].vector,
-						 &(dev->aac_msix[j]));
-				pci_disable_msix(dev->pdev);
-				goto error_iounmap;
-			}
-		}
-	} else {
-		dev->aac_msix[0].vector_no = 0;
-		dev->aac_msix[0].dev = dev;
-
-		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
-			IRQF_SHARED|IRQF_DISABLED, "aacraid",
-			&(dev->aac_msix[0])) < 0) {
-			if (dev->msi)
-				pci_disable_msi(dev->pdev);
-			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
-					name, instance);
-			goto error_iounmap;
-		}
-	}
+	if (aac_acquire_irq(dev))
+		goto error_iounmap;
 
 	aac_adapter_enable_int(dev);
 
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 109863a..f3e830c 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -798,9 +798,7 @@ int aac_srcv_init(struct aac_dev *dev)
 	unsigned long status;
 	int restart = 0;
 	int instance = dev->id;
-	int i, j;
 	const char *name = dev->name;
-	int cpu;
 
 	dev->a_ops.adapter_ioremap = aac_srcv_ioremap;
 	dev->a_ops.adapter_comm = aac_src_select_comm;
@@ -918,48 +916,10 @@ int aac_srcv_init(struct aac_dev *dev)
 		goto error_iounmap;
 	if (dev->msi_enabled)
 		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
-	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
-		cpu = cpumask_first(cpu_online_mask);
-		for (i = 0; i < dev->max_msix; i++) {
-			dev->aac_msix[i].vector_no = i;
-			dev->aac_msix[i].dev = dev;
-
-			if (request_irq(dev->msixentry[i].vector,
-					dev->a_ops.adapter_intr,
-					0,
-					"aacraid",
-					&(dev->aac_msix[i]))) {
-				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
-						name, instance, i);
-				for (j = 0 ; j < i ; j++)
-					free_irq(dev->msixentry[j].vector,
-						 &(dev->aac_msix[j]));
-				pci_disable_msix(dev->pdev);
-				goto error_iounmap;
-			}
-			if (irq_set_affinity_hint(
-			   dev->msixentry[i].vector,
-			   get_cpu_mask(cpu))) {
-				printk(KERN_ERR "%s%d: Failed to set IRQ affinity for cpu %d\n",
-						name, instance, cpu);
-			}
-			cpu = cpumask_next(cpu, cpu_online_mask);
-		}
-	} else {
-		dev->aac_msix[0].vector_no = 0;
-		dev->aac_msix[0].dev = dev;
-
-		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
-				IRQF_SHARED,
-				"aacraid",
-				&(dev->aac_msix[0])) < 0) {
-			if (dev->msi)
-				pci_disable_msi(dev->pdev);
-			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
-					name, instance);
-			goto error_iounmap;
-		}
-	}
+
+	if (aac_acquire_irq(dev))
+		goto error_iounmap;
+
 	dev->dbg_base = dev->base_start;
 	dev->dbg_base_mapped = dev->base;
 	dev->dbg_size = dev->base_size;
-- 
1.9.3


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

* [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
                   ` (5 preceding siblings ...)
  2015-05-14  0:12 ` [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-27 14:45   ` Tomas Henzl
  2015-05-14  0:12 ` [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware rajinikanth.pandurangan
  2015-05-14  0:12 ` [PATCH 9/9] [SCSI] aacraid: Update driver version rajinikanth.pandurangan
  8 siblings, 2 replies; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Driver blocks ioctls once it received shutdown/suspend request during
	suspend/hybernation. This patch unblocks ioctls on resume path.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/linit.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 62a928f..d977cd2 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1363,6 +1363,11 @@ static int aac_resume(struct pci_dev *pdev)
 	pci_set_master(pdev);
 	if (aac_acquire_resources(aac))
 		goto fail_device;
+	/*
+	* reset this flag to unblock ioctl() as it was set at
+	* aac_send_shutdown() to block ioctls from upperlayer
+	*/
+	aac->adapter_shutdown = 0;
 	scsi_unblock_requests(shost);
 
 	return 0;
-- 
1.9.3


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

* [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
                   ` (6 preceding siblings ...)
  2015-05-14  0:12 ` [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-14  0:12 ` [PATCH 9/9] [SCSI] aacraid: Update driver version rajinikanth.pandurangan
  8 siblings, 1 reply; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Controller BIOS/UEFI driver used to send this request.  But for
	IBM-Power system there is no BIOS/UEFI driver.  So this change is
	required for IBM, otherwise controller will be read-only mode.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/linit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index d977cd2..332f8be 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1237,8 +1237,11 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		shost->max_channel = aac->maximum_num_channels;
 	else
 		shost->max_channel = 0;
-
+#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
+	aac_get_config_status(aac, 1);
+#else
 	aac_get_config_status(aac, 0);
+#endif
 	aac_get_containers(aac);
 	list_add(&aac->entry, insert);
 
-- 
1.9.3


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

* [PATCH 9/9] [SCSI] aacraid: Update driver version
  2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
                   ` (7 preceding siblings ...)
  2015-05-14  0:12 ` [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware rajinikanth.pandurangan
@ 2015-05-14  0:12 ` rajinikanth.pandurangan
  2015-05-15  2:58   ` Mahesh Rajashekhara
  8 siblings, 1 reply; 38+ messages in thread
From: rajinikanth.pandurangan @ 2015-05-14  0:12 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat,
	rajinikanth.pandurangan

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index ec32a2bdd..7a73eca 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #define	PMC_GLOBAL_INT_BIT0		0x00000001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS	32
-- 
1.9.3


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

* RE: [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
@ 2015-05-15  2:55   ` Mahesh Rajashekhara
  2015-05-22 13:18   ` Tomas Henzl
  2015-05-27 14:41   ` Tomas Henzl
  2 siblings, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:55 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Driver sends the right size of the response buffer.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
 
 	status = aac_fib_send(ContainerCommand,
 		  cmd_fibcontext,
-		  sizeof (struct aac_get_name),
+		  sizeof(struct aac_get_name_resp),
 		  FsaNormal,
 		  0, 1,
 		  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd)
 
 	status = aac_fib_send(ContainerCommand,
 		  cmd_fibcontext,
-		  sizeof (struct aac_get_serial),
+		  sizeof(struct aac_get_serial_resp),
 		  FsaNormal,
 		  0, 1,
 		  (fib_callback) get_container_serial_callback,
--
1.9.3


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

* RE: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
@ 2015-05-15  2:56   ` Mahesh Rajashekhara
  2015-05-22 13:36   ` Tomas Henzl
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:56 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 2/9] [SCSI] aacraid: Add Power Management support

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	* .suspend() and .resume() routines implemented in the driver
	* aac_release_resources() initiates firmware shutdown
	* aac_acquire_resources re-initializes the host interface

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 ++++++++++++++++++++--------------------
 drivers/scsi/aacraid/linit.c    | 147 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/aacraid/rx.c       |   1 +
 drivers/scsi/aacraid/sa.c       |   1 +
 drivers/scsi/aacraid/src.c      |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
 	int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4);
 	int  (*adapter_check_health)(struct aac_dev *dev);
 	int  (*adapter_restart)(struct aac_dev *dev, int bled);
+	void (*adapter_start)(struct aac_dev *dev);
 	/* Transport operations */
 	int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
 	irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
 	(dev)->a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+	((dev)->a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
 	(dev)->a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);  int aac_src_init(struct aac_dev *dev);  int aac_srcv_init(struct aac_dev *dev);  int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);  unsigned int aac_command_normal(struct aac_queue * q);  unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index, diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 45db84a..45a0a04 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include "aacraid.h"
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
 	.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
 	return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev) {
+	int i, msi_count;
+
+	msi_count = i = 0;
+	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+	if (dev->max_msix == 0 ||
+	    dev->pdev->device == PMC_DEVICE_S6 ||
+	    dev->sync_mode) {
+		dev->max_msix = 1;
+		dev->vector_cap =
+			dev->scsi_host_ptr->can_queue +
+			AAC_NUM_MGT_FIB;
+		return;
+	}
+
+	/* Don't bother allocating more MSI-X vectors than cpus */
+	msi_count = min(dev->max_msix,
+		(unsigned int)num_online_cpus());
+
+	dev->max_msix = msi_count;
+
+	if (msi_count > AAC_MAX_MSIX)
+		msi_count = AAC_MAX_MSIX;
+
+	for (i = 0; i < msi_count; i++)
+		dev->msixentry[i].entry = i;
+
+	if (msi_count > 1 &&
+	    pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
+		i = pci_enable_msix(dev->pdev,
+				    dev->msixentry,
+				    msi_count);
+		 /* Check how many MSIX vectors are allocated */
+		if (i >= 0) {
+			dev->msi_enabled = 1;
+			if (i) {
+				msi_count = i;
+				if (pci_enable_msix(dev->pdev,
+				    dev->msixentry,
+				    msi_count)) {
+					dev->msi_enabled = 0;
+					printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
+							dev->name, dev->id, i);
+				}
+			}
+		} else {
+			dev->msi_enabled = 0;
+			printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
+					dev->name, dev->id, i);
+		}
+	}
+
+	if (!dev->msi_enabled) {
+		msi_count = 1;
+		i = pci_enable_msi(dev->pdev);
+
+		if (!i) {
+			dev->msi_enabled = 1;
+			dev->msi = 1;
+		} else {
+			printk(KERN_ERR "%s%d: MSI not supported!! Will try INTx 0x%x.\n",
+					dev->name, dev->id, i);
+		}
+	}
+
+	if (!dev->msi_enabled)
+		dev->max_msix = msi_count = 1;
+	else {
+		if (dev->max_msix > msi_count)
+			dev->max_msix = msi_count;
+	}
+	dev->vector_cap =
+		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
+		msi_count;
+}
 struct aac_dev *aac_init_adapter(struct aac_dev *dev)  {
 	u32 status[5];
@@ -508,79 +582,3 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 	return dev;
 }
 
-static void aac_define_int_mode(struct aac_dev *dev) -{
-
-	int i, msi_count;
-
-	msi_count = i = 0;
-	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
-	if (dev->max_msix == 0 ||
-	    dev->pdev->device == PMC_DEVICE_S6 ||
-	    dev->sync_mode) {
-		dev->max_msix = 1;
-		dev->vector_cap =
-			dev->scsi_host_ptr->can_queue +
-			AAC_NUM_MGT_FIB;
-		return;
-	}
-
-	msi_count = min(dev->max_msix,
-		(unsigned int)num_online_cpus());
-
-	dev->max_msix = msi_count;
-
-	if (msi_count > AAC_MAX_MSIX)
-		msi_count = AAC_MAX_MSIX;
-
-	for (i = 0; i < msi_count; i++)
-		dev->msixentry[i].entry = i;
-
-	if (msi_count > 1 &&
-	    pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
-		i = pci_enable_msix(dev->pdev,
-				    dev->msixentry,
-				    msi_count);
-		 /* Check how many MSIX vectors are allocated */
-		if (i >= 0) {
-			dev->msi_enabled = 1;
-			if (i) {
-				msi_count = i;
-				if (pci_enable_msix(dev->pdev,
-				    dev->msixentry,
-				    msi_count)) {
-					dev->msi_enabled = 0;
-					printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
-							dev->name, dev->id, i);
-				}
-			}
-		} else {
-			dev->msi_enabled = 0;
-			printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
-					dev->name, dev->id, i);
-		}
-	}
-
-	if (!dev->msi_enabled) {
-		msi_count = 1;
-		i = pci_enable_msi(dev->pdev);
-
-		if (!i) {
-			dev->msi_enabled = 1;
-			dev->msi = 1;
-		} else {
-			printk(KERN_ERR "%s%d: MSI not supported!! Will try INTx 0x%x.\n",
-					dev->name, dev->id, i);
-		}
-	}
-
-	if (!dev->msi_enabled)
-		dev->max_msix = msi_count = 1;
-	else {
-		if (dev->max_msix > msi_count)
-			dev->max_msix = msi_count;
-	}
-	dev->vector_cap =
-		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
-		msi_count;
-}
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 9eec027..be30e43 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1317,6 +1317,149 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	return error;
 }
 
+#if (defined(CONFIG_PM))
+void aac_release_resources(struct aac_dev *aac) {
+	int i;
+
+	aac_adapter_disable_int(aac);
+	if (aac->pdev->device == PMC_DEVICE_S6 ||
+	    aac->pdev->device == PMC_DEVICE_S7 ||
+	    aac->pdev->device == PMC_DEVICE_S8 ||
+	    aac->pdev->device == PMC_DEVICE_S9) {
+		if (aac->max_msix > 1) {
+			for (i = 0; i < aac->max_msix; i++)
+				free_irq(aac->msixentry[i].vector,
+					&(aac->aac_msix[i]));
+		} else {
+			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
+		}
+	} else {
+		free_irq(aac->pdev->irq, aac);
+	}
+	if (aac->msi)
+		pci_disable_msi(aac->pdev);
+	else if (aac->max_msix > 1)
+		pci_disable_msix(aac->pdev);
+
+}
+
+static int aac_acquire_resources(struct aac_dev *dev) {
+	int i, j;
+	int instance = dev->id;
+	const char *name = dev->name;
+	unsigned long status;
+	/*
+	 *	First clear out all interrupts.  Then enable the one's that we
+	 *	can handle.
+	 */
+	while (!((status = src_readl(dev, MUnit.OMR)) & KERNEL_UP_AND_RUNNING)
+		|| status == 0xffffffff)
+			msleep(1);
+
+	aac_adapter_disable_int(dev);
+	aac_adapter_enable_int(dev);
+
+
+	if ((dev->pdev->device == PMC_DEVICE_S7 ||
+	     dev->pdev->device == PMC_DEVICE_S8 ||
+	     dev->pdev->device == PMC_DEVICE_S9))
+		aac_define_int_mode(dev);
+
+	if (dev->msi_enabled)
+		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
+
+	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
+		for (i = 0; i < dev->max_msix; i++) {
+			dev->aac_msix[i].vector_no = i;
+			dev->aac_msix[i].dev = dev;
+
+			if (request_irq(dev->msixentry[i].vector,
+					dev->a_ops.adapter_intr,
+					0, "aacraid", &(dev->aac_msix[i]))) {
+				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
+						name, instance, i);
+				for (j = 0 ; j < i ; j++)
+					free_irq(dev->msixentry[j].vector,
+						 &(dev->aac_msix[j]));
+				pci_disable_msix(dev->pdev);
+				goto error_iounmap;
+			}
+		}
+	} else {
+		dev->aac_msix[0].vector_no = 0;
+		dev->aac_msix[0].dev = dev;
+
+		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
+			IRQF_SHARED|IRQF_DISABLED, "aacraid",
+			&(dev->aac_msix[0])) < 0) {
+			if (dev->msi)
+				pci_disable_msi(dev->pdev);
+			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
+					name, instance);
+			goto error_iounmap;
+		}
+	}
+
+	aac_adapter_enable_int(dev);
+
+	if (!dev->sync_mode)
+		aac_adapter_start(dev);
+	return 0;
+
+error_iounmap:
+	return -1;
+
+}
+static int aac_suspend(struct pci_dev *pdev, pm_message_t state) {
+
+	struct Scsi_Host *shost = pci_get_drvdata(pdev);
+	struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
+
+	scsi_block_requests(shost);
+	aac_send_shutdown(aac);
+
+	aac_release_resources(aac);
+
+	pci_set_drvdata(pdev, shost);
+	pci_save_state(pdev);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
+	return 0;
+}
+
+static int aac_resume(struct pci_dev *pdev) {
+	struct Scsi_Host *shost = pci_get_drvdata(pdev);
+	struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
+	int r;
+
+	pci_set_power_state(pdev, PCI_D0);
+	pci_enable_wake(pdev, PCI_D0, 0);
+	pci_restore_state(pdev);
+	r = pci_enable_device(pdev);
+
+	if (r)
+		goto fail_device;
+
+	pci_set_master(pdev);
+	if (aac_acquire_resources(aac))
+		goto fail_device;
+	scsi_unblock_requests(shost);
+
+	return 0;
+
+fail_device:
+	printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id);
+	scsi_host_put(shost);
+	pci_disable_device(pdev);
+	return -ENODEV;
+}
+#endif
+
 static void aac_shutdown(struct pci_dev *dev)  {
 	struct Scsi_Host *shost = pci_get_drvdata(dev); @@ -1356,6 +1499,10 @@ static struct pci_driver aac_pci_driver = {
 	.id_table	= aac_pci_tbl,
 	.probe		= aac_probe_one,
 	.remove		= aac_remove_one,
+#if (defined(CONFIG_PM))
+	.suspend	= aac_suspend,
+	.resume		= aac_resume,
+#endif
 	.shutdown	= aac_shutdown,
 };
 
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 9570612..ac16380 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -623,6 +623,7 @@ int _aac_rx_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_rx_check_health;
 	dev->a_ops.adapter_restart = aac_rx_restart_adapter;
+	dev->a_ops.adapter_start = aac_rx_start_adapter;
 
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index e66477c..869aea2 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -372,6 +372,7 @@ int aac_sa_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_sa_check_health;
 	dev->a_ops.adapter_restart = aac_sa_restart_adapter;
+	dev->a_ops.adapter_start = aac_sa_start_adapter;
 	dev->a_ops.adapter_intr = aac_sa_intr;
 	dev->a_ops.adapter_deliver = aac_rx_deliver_producer;
 	dev->a_ops.adapter_ioremap = aac_sa_ioremap; diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 4596e9d..b0204d0 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -726,6 +726,7 @@ int aac_src_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = src_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_src_check_health;
 	dev->a_ops.adapter_restart = aac_src_restart_adapter;
+	dev->a_ops.adapter_start = aac_src_start_adapter;
 
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
@@ -892,6 +893,7 @@ int aac_srcv_init(struct aac_dev *dev)
 	dev->a_ops.adapter_sync_cmd = src_sync_cmd;
 	dev->a_ops.adapter_check_health = aac_src_check_health;
 	dev->a_ops.adapter_restart = aac_src_restart_adapter;
+	dev->a_ops.adapter_start = aac_src_start_adapter;
 
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
--
1.9.3


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

* RE: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  2015-05-14  0:12 ` [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
@ 2015-05-15  2:56   ` Mahesh Rajashekhara
  2015-05-22 13:40   ` Tomas Henzl
  2015-05-27 14:42   ` Tomas Henzl
  2 siblings, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:56 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Enable MSI interrupt mode for series-6 controller.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/src.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index b0204d0..ae494c5 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
 	if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
 		goto error_iounmap;
 
-	dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
+	dev->msi = !pci_enable_msi(dev->pdev);
 
 	dev->aac_msix[0].vector_no = 0;
 	dev->aac_msix[0].dev = dev;
--
1.9.3


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

* RE: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
  2015-05-14  0:12 ` [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
@ 2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-22 14:02   ` Tomas Henzl
  2015-05-27 14:44   ` Tomas Henzl
  2 siblings, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:57 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
        If writeq() not supported, then do atomic two 32bit write

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h  | 12 ++++++++++++  drivers/scsi/aacraid/comminit.c |  1 +
 drivers/scsi/aacraid/src.c      | 12 ++++++++++--
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 62b0999..9e69e3e 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -719,6 +719,9 @@ struct sa_registers {
 #define sa_readl(AEP, CSR)		readl(&((AEP)->regs.sa->CSR))
 #define sa_writew(AEP, CSR, value)	writew(value, &((AEP)->regs.sa->CSR))
 #define sa_writel(AEP, CSR, value)	writel(value, &((AEP)->regs.sa->CSR))
+#if defined(writeq)
+#define	sa_writeq(AEP, CSR, value)	writeq(value, &((AEP)->regs.sa->CSR))
+#endif
 
 /*
  *	Rx Message Unit Registers
@@ -844,6 +847,10 @@ struct src_registers {
 						&((AEP)->regs.src.bar0->CSR))
 #define src_writel(AEP, CSR, value)	writel(value, \
 						&((AEP)->regs.src.bar0->CSR))
+#if defined(writeq)
+#define	src_writeq(AEP, CSR, value)	writeq(value, \
+						&((AEP)->regs.src.bar0->CSR))
+#endif
 
 #define SRC_ODR_SHIFT		12
 #define SRC_IDR_SHIFT		9
@@ -1163,6 +1170,11 @@ struct aac_dev
 	struct fsa_dev_info	*fsa_dev;
 	struct task_struct	*thread;
 	int			cardtype;
+	/*
+	 *This lock will protect the two 32-bit
+	 *writes to the Inbound Queue
+	 */
+	spinlock_t		iq_lock;
 
 	/*
 	 *	The following is the device specific extension.
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 45a0a04..4043245 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 	dev->management_fib_count = 0;
 	spin_lock_init(&dev->manage_lock);
 	spin_lock_init(&dev->sync_lock);
+	spin_lock_init(&dev->iq_lock);
 	dev->max_fib_size = sizeof(struct hw_fib);
 	dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
 		- sizeof(struct aac_fibhdr)
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index ae494c5..109863a 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
 	u32 fibsize;
 	dma_addr_t address;
 	struct aac_fib_xporthdr *pFibX;
+#if !defined(writeq)
+	unsigned long flags;
+#endif
+
 	u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
 
 	atomic_inc(&q->numpending);
@@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
 			return -EINVAL;
 		address |= fibsize;
 	}
-
+#if defined(writeq)
+	src_writeq(dev, MUnit.IQ_L, (u64)address); #else
+	spin_lock_irqsave(&fib->dev->iq_lock, flags);
 	src_writel(dev, MUnit.IQ_H, upper_32_bits(address) & 0xffffffff);
 	src_writel(dev, MUnit.IQ_L, address & 0xffffffff);
-
+	spin_unlock_irqrestore(&fib->dev->iq_lock, flags); #endif
 	return 0;
 }
 
--
1.9.3


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

* RE: [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set
  2015-05-14  0:12 ` [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set rajinikanth.pandurangan
@ 2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-27 14:45   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:57 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
        If 'IsFastPath' bit is set, then response path assumes no error
        and skips error check.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aachba.c | 259 ++++++++++++++++++++++--------------------
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index fe59b00..864e9f6 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 		return;
 
 	BUG_ON(fibptr == NULL);
-
 	dev = fibptr->dev;
 
-	srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+	scsi_dma_unmap(scsicmd);
 
+	/* expose physical device if expose_physicald flag is on */
+	if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01)
+	  && expose_physicals > 0)
+		aac_expose_phy_device(scsicmd);
+
+	srbreply = (struct aac_srb_reply *) fib_data(fibptr);
 	scsicmd->sense_buffer[0] = '\0';  /* Initialize sense valid flag to false */
 
 	if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) { @@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
 		 */
 		scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
 				   - le32_to_cpu(srbreply->data_xfer_length));
-	}
-
-	scsi_dma_unmap(scsicmd);
-
-	/* expose physical device if expose_physicald flag is on */
-	if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01)
-	  && expose_physicals > 0)
-		aac_expose_phy_device(scsicmd);
+		/*
+		 * First check the fib status
+		 */
 
-	/*
-	 * First check the fib status
-	 */
+		if (le32_to_cpu(srbreply->status) != ST_OK) {
+			int len;
 
-	if (le32_to_cpu(srbreply->status) != ST_OK){
-		int len;
-		printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
-		len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
-			    SCSI_SENSE_BUFFERSIZE);
-		scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
-		memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
-	}
+			printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
+			len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
+				    SCSI_SENSE_BUFFERSIZE);
+			scsicmd->result = DID_ERROR << 16
+						| COMMAND_COMPLETE << 8
+						| SAM_STAT_CHECK_CONDITION;
+			memcpy(scsicmd->sense_buffer,
+					srbreply->sense_data, len);
+		}
 
-	/*
-	 * Next check the srb status
-	 */
-	switch( (le32_to_cpu(srbreply->srb_status))&0x3f){
-	case SRB_STATUS_ERROR_RECOVERY:
-	case SRB_STATUS_PENDING:
-	case SRB_STATUS_SUCCESS:
-		scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
-		break;
-	case SRB_STATUS_DATA_OVERRUN:
-		switch(scsicmd->cmnd[0]){
-		case  READ_6:
-		case  WRITE_6:
-		case  READ_10:
-		case  WRITE_10:
-		case  READ_12:
-		case  WRITE_12:
-		case  READ_16:
-		case  WRITE_16:
-			if (le32_to_cpu(srbreply->data_xfer_length) < scsicmd->underflow) {
-				printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
-			} else {
-				printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
+		/*
+		 * Next check the srb status
+		 */
+		switch ((le32_to_cpu(srbreply->srb_status))&0x3f) {
+		case SRB_STATUS_ERROR_RECOVERY:
+		case SRB_STATUS_PENDING:
+		case SRB_STATUS_SUCCESS:
+			scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+			break;
+		case SRB_STATUS_DATA_OVERRUN:
+			switch (scsicmd->cmnd[0]) {
+			case  READ_6:
+			case  WRITE_6:
+			case  READ_10:
+			case  WRITE_10:
+			case  READ_12:
+			case  WRITE_12:
+			case  READ_16:
+			case  WRITE_16:
+				if (le32_to_cpu(srbreply->data_xfer_length)
+							< scsicmd->underflow)
+					printk(KERN_WARNING"aacraid: SCSI CMD underflow\n");
+				else
+					printk(KERN_WARNING"aacraid: SCSI CMD Data Overrun\n");
+				scsicmd->result = DID_ERROR << 16
+							| COMMAND_COMPLETE << 8;
+				break;
+			case INQUIRY: {
+				scsicmd->result = DID_OK << 16
+							| COMMAND_COMPLETE << 8;
+				break;
+			}
+			default:
+				scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+				break;
 			}
-			scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8;
 			break;
-		case INQUIRY: {
-			scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+		case SRB_STATUS_ABORTED:
+			scsicmd->result = DID_ABORT << 16 | ABORT << 8;
 			break;
-		}
-		default:
-			scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+		case SRB_STATUS_ABORT_FAILED:
+			/*
+			 * Not sure about this one - but assuming the
+			 * hba was trying to abort for some reason
+			 */
+			scsicmd->result = DID_ERROR << 16 | ABORT << 8;
+			break;
+		case SRB_STATUS_PARITY_ERROR:
+			scsicmd->result = DID_PARITY << 16
+						| MSG_PARITY_ERROR << 8;
+			break;
+		case SRB_STATUS_NO_DEVICE:
+		case SRB_STATUS_INVALID_PATH_ID:
+		case SRB_STATUS_INVALID_TARGET_ID:
+		case SRB_STATUS_INVALID_LUN:
+		case SRB_STATUS_SELECTION_TIMEOUT:
+			scsicmd->result = DID_NO_CONNECT << 16
+						| COMMAND_COMPLETE << 8;
 			break;
-		}
-		break;
-	case SRB_STATUS_ABORTED:
-		scsicmd->result = DID_ABORT << 16 | ABORT << 8;
-		break;
-	case SRB_STATUS_ABORT_FAILED:
-		// Not sure about this one - but assuming the hba was trying to abort for some reason
-		scsicmd->result = DID_ERROR << 16 | ABORT << 8;
-		break;
-	case SRB_STATUS_PARITY_ERROR:
-		scsicmd->result = DID_PARITY << 16 | MSG_PARITY_ERROR << 8;
-		break;
-	case SRB_STATUS_NO_DEVICE:
-	case SRB_STATUS_INVALID_PATH_ID:
-	case SRB_STATUS_INVALID_TARGET_ID:
-	case SRB_STATUS_INVALID_LUN:
-	case SRB_STATUS_SELECTION_TIMEOUT:
-		scsicmd->result = DID_NO_CONNECT << 16 | COMMAND_COMPLETE << 8;
-		break;
 
-	case SRB_STATUS_COMMAND_TIMEOUT:
-	case SRB_STATUS_TIMEOUT:
-		scsicmd->result = DID_TIME_OUT << 16 | COMMAND_COMPLETE << 8;
-		break;
+		case SRB_STATUS_COMMAND_TIMEOUT:
+		case SRB_STATUS_TIMEOUT:
+			scsicmd->result = DID_TIME_OUT << 16
+						| COMMAND_COMPLETE << 8;
+			break;
 
-	case SRB_STATUS_BUSY:
-		scsicmd->result = DID_BUS_BUSY << 16 | COMMAND_COMPLETE << 8;
-		break;
+		case SRB_STATUS_BUSY:
+			scsicmd->result = DID_BUS_BUSY << 16
+						| COMMAND_COMPLETE << 8;
+			break;
 
-	case SRB_STATUS_BUS_RESET:
-		scsicmd->result = DID_RESET << 16 | COMMAND_COMPLETE << 8;
-		break;
+		case SRB_STATUS_BUS_RESET:
+			scsicmd->result = DID_RESET << 16
+						| COMMAND_COMPLETE << 8;
+			break;
 
-	case SRB_STATUS_MESSAGE_REJECTED:
-		scsicmd->result = DID_ERROR << 16 | MESSAGE_REJECT << 8;
-		break;
-	case SRB_STATUS_REQUEST_FLUSHED:
-	case SRB_STATUS_ERROR:
-	case SRB_STATUS_INVALID_REQUEST:
-	case SRB_STATUS_REQUEST_SENSE_FAILED:
-	case SRB_STATUS_NO_HBA:
-	case SRB_STATUS_UNEXPECTED_BUS_FREE:
-	case SRB_STATUS_PHASE_SEQUENCE_FAILURE:
-	case SRB_STATUS_BAD_SRB_BLOCK_LENGTH:
-	case SRB_STATUS_DELAYED_RETRY:
-	case SRB_STATUS_BAD_FUNCTION:
-	case SRB_STATUS_NOT_STARTED:
-	case SRB_STATUS_NOT_IN_USE:
-	case SRB_STATUS_FORCE_ABORT:
-	case SRB_STATUS_DOMAIN_VALIDATION_FAIL:
-	default:
+		case SRB_STATUS_MESSAGE_REJECTED:
+			scsicmd->result = DID_ERROR << 16
+						| MESSAGE_REJECT << 8;
+			break;
+		case SRB_STATUS_REQUEST_FLUSHED:
+		case SRB_STATUS_ERROR:
+		case SRB_STATUS_INVALID_REQUEST:
+		case SRB_STATUS_REQUEST_SENSE_FAILED:
+		case SRB_STATUS_NO_HBA:
+		case SRB_STATUS_UNEXPECTED_BUS_FREE:
+		case SRB_STATUS_PHASE_SEQUENCE_FAILURE:
+		case SRB_STATUS_BAD_SRB_BLOCK_LENGTH:
+		case SRB_STATUS_DELAYED_RETRY:
+		case SRB_STATUS_BAD_FUNCTION:
+		case SRB_STATUS_NOT_STARTED:
+		case SRB_STATUS_NOT_IN_USE:
+		case SRB_STATUS_FORCE_ABORT:
+		case SRB_STATUS_DOMAIN_VALIDATION_FAIL:
+		default:
 #ifdef AAC_DETAILED_STATUS_INFO
-		printk("aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n",
-			le32_to_cpu(srbreply->srb_status) & 0x3F,
-			aac_get_status_string(
-				le32_to_cpu(srbreply->srb_status) & 0x3F),
-			scsicmd->cmnd[0],
-			le32_to_cpu(srbreply->scsi_status));
+			printk(KERN_INFO "aacraid: SRB ERROR(%u) %s scsi cmd 0x%x - scsi status 0x%x\n",
+				le32_to_cpu(srbreply->srb_status) & 0x3F,
+				aac_get_status_string(
+					le32_to_cpu(srbreply->srb_status) & 0x3F),
+				scsicmd->cmnd[0],
+				le32_to_cpu(srbreply->scsi_status));
 #endif
-		if ((scsicmd->cmnd[0] == ATA_12)
-		  || (scsicmd->cmnd[0] == ATA_16)) {
-			if (scsicmd->cmnd[2] & (0x01 << 5)) {
-				scsicmd->result = DID_OK << 16
-						| COMMAND_COMPLETE << 8;
+			if ((scsicmd->cmnd[0] == ATA_12)
+				|| (scsicmd->cmnd[0] == ATA_16)) {
+					if (scsicmd->cmnd[2] & (0x01 << 5)) {
+						scsicmd->result = DID_OK << 16
+							| COMMAND_COMPLETE << 8;
 				break;
+				} else {
+					scsicmd->result = DID_ERROR << 16
+						| COMMAND_COMPLETE << 8;
+					break;
+				}
 			} else {
 				scsicmd->result = DID_ERROR << 16
-						| COMMAND_COMPLETE << 8;
+					| COMMAND_COMPLETE << 8;
 				break;
 			}
-		} else {
-			scsicmd->result = DID_ERROR << 16
-					| COMMAND_COMPLETE << 8;
-			break;
 		}
-	}
-	if (le32_to_cpu(srbreply->scsi_status) == SAM_STAT_CHECK_CONDITION) {
-		int len;
-		scsicmd->result |= SAM_STAT_CHECK_CONDITION;
-		len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
-			    SCSI_SENSE_BUFFERSIZE);
+		if (le32_to_cpu(srbreply->scsi_status)
+				== SAM_STAT_CHECK_CONDITION) {
+			int len;
+
+			scsicmd->result |= SAM_STAT_CHECK_CONDITION;
+			len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
+				    SCSI_SENSE_BUFFERSIZE);
 #ifdef AAC_DETAILED_STATUS_INFO
-		printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
-					le32_to_cpu(srbreply->status), len);
+			printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
+						le32_to_cpu(srbreply->status), len);
 #endif
-		memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
+			memcpy(scsicmd->sense_buffer,
+					srbreply->sense_data, len);
+		}
 	}
 	/*
 	 * OR in the scsi status (already shifted up a bit)
--
1.9.3


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

* RE: [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq
  2015-05-14  0:12 ` [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq rajinikanth.pandurangan
@ 2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-27 14:45   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:57 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
        Reset irq affinity hints before releasing IRQ
        Removed duplicate code of IRQ acquire/release

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h |   2 +
 drivers/scsi/aacraid/commsup.c | 114 ++++++++++++++++++++++++++++++-----------
 drivers/scsi/aacraid/linit.c   |  93 ++-------------------------------
 drivers/scsi/aacraid/src.c     |  50 ++----------------
 4 files changed, 94 insertions(+), 165 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 9e69e3e..ec32a2bdd 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2113,6 +2113,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
 #define AAC_OWNER_ERROR_HANDLER	0x103
 #define AAC_OWNER_FIRMWARE	0x106
 
+int aac_acquire_irq(struct aac_dev *dev); void aac_free_irq(struct 
+aac_dev *dev);
 const char *aac_driverinfo(struct Scsi_Host *);  struct fib *aac_fib_alloc(struct aac_dev *dev);  int aac_fib_setup(struct aac_dev *dev); diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 4da5749..3ff18f4 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1270,13 +1270,12 @@ retry_next:
 static int _aac_reset_adapter(struct aac_dev *aac, int forced)  {
 	int index, quirks;
-	int retval, i;
+	int retval;
 	struct Scsi_Host *host;
 	struct scsi_device *dev;
 	struct scsi_cmnd *command;
 	struct scsi_cmnd *command_list;
 	int jafo = 0;
-	int cpu;
 
 	/*
 	 * Assumptions:
@@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
 	aac->comm_phys = 0;
 	kfree(aac->queues);
 	aac->queues = NULL;
-	cpu = cpumask_first(cpu_online_mask);
-	if (aac->pdev->device == PMC_DEVICE_S6 ||
-	    aac->pdev->device == PMC_DEVICE_S7 ||
-	    aac->pdev->device == PMC_DEVICE_S8 ||
-	    aac->pdev->device == PMC_DEVICE_S9) {
-		if (aac->max_msix > 1) {
-			for (i = 0; i < aac->max_msix; i++) {
-				if (irq_set_affinity_hint(
-				    aac->msixentry[i].vector,
-				    NULL)) {
-					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
-						aac->name,
-						aac->id,
-						cpu);
-				}
-				cpu = cpumask_next(cpu,
-						cpu_online_mask);
-				free_irq(aac->msixentry[i].vector,
-					 &(aac->aac_msix[i]));
-			}
-			pci_disable_msix(aac->pdev);
-		} else {
-			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
-		}
-	} else {
-		free_irq(aac->pdev->irq, aac);
-	}
-	if (aac->msi)
-		pci_disable_msi(aac->pdev);
+	aac_free_irq(aac);
 	kfree(aac->fsa_dev);
 	aac->fsa_dev = NULL;
 	quirks = aac_get_driver_ident(index)->quirks;
@@ -1978,3 +1949,84 @@ int aac_command_thread(void *data)
 	dev->aif_thread = 0;
 	return 0;
 }
+
+int aac_acquire_irq(struct aac_dev *dev) {
+	int i;
+	int j;
+	int ret = 0;
+	int cpu;
+
+	cpu = cpumask_first(cpu_online_mask);
+	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
+		for (i = 0; i < dev->max_msix; i++) {
+			dev->aac_msix[i].vector_no = i;
+			dev->aac_msix[i].dev = dev;
+			if (request_irq(dev->msixentry[i].vector,
+					dev->a_ops.adapter_intr,
+					0, "aacraid", &(dev->aac_msix[i]))) {
+				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
+						dev->name, dev->id, i);
+				for (j = 0 ; j < i ; j++)
+					free_irq(dev->msixentry[j].vector,
+						 &(dev->aac_msix[j]));
+				pci_disable_msix(dev->pdev);
+				ret = -1;
+			}
+			if (irq_set_affinity_hint(dev->msixentry[i].vector,
+							get_cpu_mask(cpu))) {
+				printk(KERN_ERR "%s%d: Failed to set IRQ affinity for cpu %d\n",
+					    dev->name, dev->id, cpu);
+			}
+			cpu = cpumask_next(cpu, cpu_online_mask);
+		}
+	} else {
+		dev->aac_msix[0].vector_no = 0;
+		dev->aac_msix[0].dev = dev;
+
+		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
+			IRQF_SHARED|IRQF_DISABLED, "aacraid",
+			&(dev->aac_msix[0])) < 0) {
+			if (dev->msi)
+				pci_disable_msi(dev->pdev);
+			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
+					dev->name, dev->id);
+			ret = -1;
+		}
+	}
+	return ret;
+}
+
+void aac_free_irq(struct aac_dev *dev)
+{
+	int i;
+	int cpu;
+
+	cpu = cpumask_first(cpu_online_mask);
+	if (dev->pdev->device == PMC_DEVICE_S6 ||
+	    dev->pdev->device == PMC_DEVICE_S7 ||
+	    dev->pdev->device == PMC_DEVICE_S8 ||
+	    dev->pdev->device == PMC_DEVICE_S9) {
+		if (dev->max_msix > 1) {
+			for (i = 0; i < dev->max_msix; i++) {
+				if (irq_set_affinity_hint(
+					dev->msixentry[i].vector, NULL)) {
+					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
+					    dev->name, dev->id, cpu);
+				}
+				cpu = cpumask_next(cpu, cpu_online_mask);
+				free_irq(dev->msixentry[i].vector,
+						&(dev->aac_msix[i]));
+			}
+		} else {
+			free_irq(dev->pdev->irq, &(dev->aac_msix[0]));
+		}
+	} else {
+		free_irq(dev->pdev->irq, dev);
+	}
+	if (dev->msi)
+		pci_disable_msi(dev->pdev);
+	else if (dev->max_msix > 1)
+		pci_disable_msix(dev->pdev);
+}
+
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index be30e43..62a928f 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1072,9 +1072,6 @@ static struct scsi_host_template aac_driver_template = {
 
 static void __aac_shutdown(struct aac_dev * aac)  {
-	int i;
-	int cpu;
-
 	if (aac->aif_thread) {
 		int i;
 		/* Clear out events first */
@@ -1088,37 +1085,7 @@ static void __aac_shutdown(struct aac_dev * aac)
 	}
 	aac_send_shutdown(aac);
 	aac_adapter_disable_int(aac);
-	cpu = cpumask_first(cpu_online_mask);
-	if (aac->pdev->device == PMC_DEVICE_S6 ||
-	    aac->pdev->device == PMC_DEVICE_S7 ||
-	    aac->pdev->device == PMC_DEVICE_S8 ||
-	    aac->pdev->device == PMC_DEVICE_S9) {
-		if (aac->max_msix > 1) {
-			for (i = 0; i < aac->max_msix; i++) {
-				if (irq_set_affinity_hint(
-				    aac->msixentry[i].vector,
-				    NULL)) {
-					printk(KERN_ERR "%s%d: Failed to reset IRQ affinity for cpu %d\n",
-						aac->name,
-						aac->id,
-						cpu);
-				}
-				cpu = cpumask_next(cpu,
-						cpu_online_mask);
-				free_irq(aac->msixentry[i].vector,
-					 &(aac->aac_msix[i]));
-			}
-		} else {
-			free_irq(aac->pdev->irq,
-				 &(aac->aac_msix[0]));
-		}
-	} else {
-		free_irq(aac->pdev->irq, aac);
-	}
-	if (aac->msi)
-		pci_disable_msi(aac->pdev);
-	else if (aac->max_msix > 1)
-		pci_disable_msix(aac->pdev);
+	aac_free_irq(aac);
 }
 
 static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) @@ -1320,35 +1287,12 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)  #if (defined(CONFIG_PM))  void aac_release_resources(struct aac_dev *aac)  {
-	int i;
-
 	aac_adapter_disable_int(aac);
-	if (aac->pdev->device == PMC_DEVICE_S6 ||
-	    aac->pdev->device == PMC_DEVICE_S7 ||
-	    aac->pdev->device == PMC_DEVICE_S8 ||
-	    aac->pdev->device == PMC_DEVICE_S9) {
-		if (aac->max_msix > 1) {
-			for (i = 0; i < aac->max_msix; i++)
-				free_irq(aac->msixentry[i].vector,
-					&(aac->aac_msix[i]));
-		} else {
-			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
-		}
-	} else {
-		free_irq(aac->pdev->irq, aac);
-	}
-	if (aac->msi)
-		pci_disable_msi(aac->pdev);
-	else if (aac->max_msix > 1)
-		pci_disable_msix(aac->pdev);
-
+	aac_free_irq(aac);
 }
 
 static int aac_acquire_resources(struct aac_dev *dev)  {
-	int i, j;
-	int instance = dev->id;
-	const char *name = dev->name;
 	unsigned long status;
 	/*
 	 *	First clear out all interrupts.  Then enable the one's that we
@@ -1370,37 +1314,8 @@ static int aac_acquire_resources(struct aac_dev *dev)
 	if (dev->msi_enabled)
 		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
 
-	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
-		for (i = 0; i < dev->max_msix; i++) {
-			dev->aac_msix[i].vector_no = i;
-			dev->aac_msix[i].dev = dev;
-
-			if (request_irq(dev->msixentry[i].vector,
-					dev->a_ops.adapter_intr,
-					0, "aacraid", &(dev->aac_msix[i]))) {
-				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
-						name, instance, i);
-				for (j = 0 ; j < i ; j++)
-					free_irq(dev->msixentry[j].vector,
-						 &(dev->aac_msix[j]));
-				pci_disable_msix(dev->pdev);
-				goto error_iounmap;
-			}
-		}
-	} else {
-		dev->aac_msix[0].vector_no = 0;
-		dev->aac_msix[0].dev = dev;
-
-		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
-			IRQF_SHARED|IRQF_DISABLED, "aacraid",
-			&(dev->aac_msix[0])) < 0) {
-			if (dev->msi)
-				pci_disable_msi(dev->pdev);
-			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
-					name, instance);
-			goto error_iounmap;
-		}
-	}
+	if (aac_acquire_irq(dev))
+		goto error_iounmap;
 
 	aac_adapter_enable_int(dev);
 
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 109863a..f3e830c 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -798,9 +798,7 @@ int aac_srcv_init(struct aac_dev *dev)
 	unsigned long status;
 	int restart = 0;
 	int instance = dev->id;
-	int i, j;
 	const char *name = dev->name;
-	int cpu;
 
 	dev->a_ops.adapter_ioremap = aac_srcv_ioremap;
 	dev->a_ops.adapter_comm = aac_src_select_comm; @@ -918,48 +916,10 @@ int aac_srcv_init(struct aac_dev *dev)
 		goto error_iounmap;
 	if (dev->msi_enabled)
 		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
-	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
-		cpu = cpumask_first(cpu_online_mask);
-		for (i = 0; i < dev->max_msix; i++) {
-			dev->aac_msix[i].vector_no = i;
-			dev->aac_msix[i].dev = dev;
-
-			if (request_irq(dev->msixentry[i].vector,
-					dev->a_ops.adapter_intr,
-					0,
-					"aacraid",
-					&(dev->aac_msix[i]))) {
-				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
-						name, instance, i);
-				for (j = 0 ; j < i ; j++)
-					free_irq(dev->msixentry[j].vector,
-						 &(dev->aac_msix[j]));
-				pci_disable_msix(dev->pdev);
-				goto error_iounmap;
-			}
-			if (irq_set_affinity_hint(
-			   dev->msixentry[i].vector,
-			   get_cpu_mask(cpu))) {
-				printk(KERN_ERR "%s%d: Failed to set IRQ affinity for cpu %d\n",
-						name, instance, cpu);
-			}
-			cpu = cpumask_next(cpu, cpu_online_mask);
-		}
-	} else {
-		dev->aac_msix[0].vector_no = 0;
-		dev->aac_msix[0].dev = dev;
-
-		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
-				IRQF_SHARED,
-				"aacraid",
-				&(dev->aac_msix[0])) < 0) {
-			if (dev->msi)
-				pci_disable_msi(dev->pdev);
-			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
-					name, instance);
-			goto error_iounmap;
-		}
-	}
+
+	if (aac_acquire_irq(dev))
+		goto error_iounmap;
+
 	dev->dbg_base = dev->base_start;
 	dev->dbg_base_mapped = dev->base;
 	dev->dbg_size = dev->base_size;
--
1.9.3


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

* RE: [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend
  2015-05-14  0:12 ` [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend rajinikanth.pandurangan
@ 2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-27 14:45   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:57 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Driver blocks ioctls once it received shutdown/suspend request during
	suspend/hybernation. This patch unblocks ioctls on resume path.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/linit.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 62a928f..d977cd2 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1363,6 +1363,11 @@ static int aac_resume(struct pci_dev *pdev)
 	pci_set_master(pdev);
 	if (aac_acquire_resources(aac))
 		goto fail_device;
+	/*
+	* reset this flag to unblock ioctl() as it was set at
+	* aac_send_shutdown() to block ioctls from upperlayer
+	*/
+	aac->adapter_shutdown = 0;
 	scsi_unblock_requests(shost);
 
 	return 0;
--
1.9.3


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

* RE: [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware
  2015-05-14  0:12 ` [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware rajinikanth.pandurangan
@ 2015-05-15  2:57   ` Mahesh Rajashekhara
  0 siblings, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:57 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Description:
	Controller BIOS/UEFI driver used to send this request.  But for
	IBM-Power system there is no BIOS/UEFI driver.  So this change is
	required for IBM, otherwise controller will be read-only mode.

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/linit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index d977cd2..332f8be 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1237,8 +1237,11 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		shost->max_channel = aac->maximum_num_channels;
 	else
 		shost->max_channel = 0;
-
+#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
+	aac_get_config_status(aac, 1);
+#else
 	aac_get_config_status(aac, 0);
+#endif
 	aac_get_containers(aac);
 	list_add(&aac->entry, insert);
 
--
1.9.3


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

* RE: [PATCH 9/9] [SCSI] aacraid: Update driver version
  2015-05-14  0:12 ` [PATCH 9/9] [SCSI] aacraid: Update driver version rajinikanth.pandurangan
@ 2015-05-15  2:58   ` Mahesh Rajashekhara
  0 siblings, 0 replies; 38+ messages in thread
From: Mahesh Rajashekhara @ 2015-05-15  2:58 UTC (permalink / raw)
  To: jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat,
	Rajinikanth Pandurangan

Reviewed-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

-----Original Message-----
From: rajinikanth.pandurangan@pmcs.com [mailto:rajinikanth.pandurangan@pmcs.com] 
Sent: Thursday, May 14, 2015 5:43 AM
To: jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [PATCH 9/9] [SCSI] aacraid: Update driver version

From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>

Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index ec32a2bdd..7a73eca 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #define	PMC_GLOBAL_INT_BIT0		0x00000001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS	32
--
1.9.3


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

* Re: [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
  2015-05-15  2:55   ` Mahesh Rajashekhara
@ 2015-05-22 13:18   ` Tomas Henzl
  2015-05-26 18:06     ` Rajinikanth Pandurangan
  2015-05-27 14:41   ` Tomas Henzl
  2 siblings, 1 reply; 38+ messages in thread
From: Tomas Henzl @ 2015-05-22 13:18 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Driver sends the right size of the response buffer.
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/aachba.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index 9b3dd6e..fe59b00 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
>  
>  	status = aac_fib_send(ContainerCommand,
>  		  cmd_fibcontext,
> -		  sizeof (struct aac_get_name),
> +		  sizeof(struct aac_get_name_resp),
Hi Rajinikanth,
in aac_fib_send the size parameter is used in just one place
and a comment there says "Set the size of the Fib we want to send to the
adapter"
>From that^ it looks like it is the size of the command you sending,
to the hw. Do I miss something?
Cheers,
Tomas
>  		  FsaNormal,
>  		  0, 1,
>  		  (fib_callback)get_container_name_callback,
> @@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd)
>  
>  	status = aac_fib_send(ContainerCommand,
>  		  cmd_fibcontext,
> -		  sizeof (struct aac_get_serial),
> +		  sizeof(struct aac_get_serial_resp),
>  		  FsaNormal,
>  		  0, 1,
>  		  (fib_callback) get_container_serial_callback,
> 


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

* Re: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
  2015-05-15  2:56   ` Mahesh Rajashekhara
@ 2015-05-22 13:36   ` Tomas Henzl
  2015-05-27 14:41   ` Tomas Henzl
  2015-06-01 15:14   ` James Bottomley
  3 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-22 13:36 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	* .suspend() and .resume() routines implemented in the driver
> 	* aac_release_resources() initiates firmware shutdown
> 	* aac_acquire_resources re-initializes the host interface
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/aacraid.h  |   5 ++
>  drivers/scsi/aacraid/comminit.c | 154 ++++++++++++++++++++--------------------
>  drivers/scsi/aacraid/linit.c    | 147 ++++++++++++++++++++++++++++++++++++++
>  drivers/scsi/aacraid/rx.c       |   1 +
>  drivers/scsi/aacraid/sa.c       |   1 +
>  drivers/scsi/aacraid/src.c      |   2 +
>  6 files changed, 232 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index 40fe65c..62b0999 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -547,6 +547,7 @@ struct adapter_ops
>  	int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4);
>  	int  (*adapter_check_health)(struct aac_dev *dev);
>  	int  (*adapter_restart)(struct aac_dev *dev, int bled);
> +	void (*adapter_start)(struct aac_dev *dev);
>  	/* Transport operations */
>  	int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
>  	irq_handler_t adapter_intr;
> @@ -1247,6 +1248,9 @@ struct aac_dev
>  #define aac_adapter_restart(dev,bled) \
>  	(dev)->a_ops.adapter_restart(dev,bled)
>  
> +#define aac_adapter_start(dev) \
> +	((dev)->a_ops.adapter_start(dev))
> +
>  #define aac_adapter_ioremap(dev, size) \
>  	(dev)->a_ops.adapter_ioremap(dev, size)
>  
> @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);
>  int aac_src_init(struct aac_dev *dev);
>  int aac_srcv_init(struct aac_dev *dev);
>  int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
> +void aac_define_int_mode(struct aac_dev *dev);
>  unsigned int aac_response_normal(struct aac_queue * q);
>  unsigned int aac_command_normal(struct aac_queue * q);
>  unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index,
> diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
> index 45db84a..45a0a04 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -43,8 +43,6 @@
>  
>  #include "aacraid.h"
>  
> -static void aac_define_int_mode(struct aac_dev *dev);
> -
>  struct aac_common aac_config = {
>  	.irq_mod = 1
>  };
> @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
>  	return 0;
>  }
>  
> +void aac_define_int_mode(struct aac_dev *dev)
> +{
> +	int i, msi_count;
> +
> +	msi_count = i = 0;
> +	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
> +	if (dev->max_msix == 0 ||
> +	    dev->pdev->device == PMC_DEVICE_S6 ||
> +	    dev->sync_mode) {
> +		dev->max_msix = 1;
> +		dev->vector_cap =
> +			dev->scsi_host_ptr->can_queue +
> +			AAC_NUM_MGT_FIB;
> +		return;
> +	}
> +
> +	/* Don't bother allocating more MSI-X vectors than cpus */
> +	msi_count = min(dev->max_msix,
> +		(unsigned int)num_online_cpus());
> +
> +	dev->max_msix = msi_count;
> +
> +	if (msi_count > AAC_MAX_MSIX)
> +		msi_count = AAC_MAX_MSIX;
> +
> +	for (i = 0; i < msi_count; i++)
> +		dev->msixentry[i].entry = i;
> +
> +	if (msi_count > 1 &&
> +	    pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> +		i = pci_enable_msix(dev->pdev,
> +				    dev->msixentry,
> +				    msi_count);
Has the previous series already been accepted? Anyway
please use pci_enable_msix_range instead of pci_enable_msix
Tomas
> +		 /* Check how many MSIX vectors are allocated */
> +		if (i >= 0) {
> +			dev->msi_enabled = 1;
> +			if (i) {
> +				msi_count = i;
> +				if (pci_enable_msix(dev->pdev,
> +				    dev->msixentry,
> +				    msi_count)) {
> +					dev->msi_enabled = 0;
> +					printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
> +							dev->name, dev->id, i);
> +				}
> +			}
> +		} else {
> +			dev->msi_enabled = 0;
> +			printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
> +					dev->name, dev->id, i);
> +		}
> +	}
> +
> +	if (!dev->msi_enabled) {
> +		msi_count = 1;
> +		i = pci_enable_msi(dev->pdev);
> +
> +		if (!i) {
> +			dev->msi_enabled = 1;
> +			dev->msi = 1;
> +		} else {
> +			printk(KERN_ERR "%s%d: MSI not supported!! Will try INTx 0x%x.\n",
> +					dev->name, dev->id, i);
> +		}
> +	}
> +
> +	if (!dev->msi_enabled)
> +		dev->max_msix = msi_count = 1;
> +	else {
> +		if (dev->max_msix > msi_count)
> +			dev->max_msix = msi_count;
> +	}
> +	dev->vector_cap =
> +		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
> +		msi_count;
> +}
>  struct aac_dev *aac_init_adapter(struct aac_dev *dev)
>  {
>  	u32 status[5];
> @@ -508,79 +582,3 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
>  	return dev;
>  }
>  
> -static void aac_define_int_mode(struct aac_dev *dev)
> -{
> -
> -	int i, msi_count;
> -
> -	msi_count = i = 0;
> -	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
> -	if (dev->max_msix == 0 ||
> -	    dev->pdev->device == PMC_DEVICE_S6 ||
> -	    dev->sync_mode) {
> -		dev->max_msix = 1;
> -		dev->vector_cap =
> -			dev->scsi_host_ptr->can_queue +
> -			AAC_NUM_MGT_FIB;
> -		return;
> -	}
> -
> -	msi_count = min(dev->max_msix,
> -		(unsigned int)num_online_cpus());
> -
> -	dev->max_msix = msi_count;
> -
> -	if (msi_count > AAC_MAX_MSIX)
> -		msi_count = AAC_MAX_MSIX;
> -
> -	for (i = 0; i < msi_count; i++)
> -		dev->msixentry[i].entry = i;
> -
> -	if (msi_count > 1 &&
> -	    pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> -		i = pci_enable_msix(dev->pdev,
> -				    dev->msixentry,
> -				    msi_count);
> -		 /* Check how many MSIX vectors are allocated */
> -		if (i >= 0) {
> -			dev->msi_enabled = 1;
> -			if (i) {
> -				msi_count = i;
> -				if (pci_enable_msix(dev->pdev,
> -				    dev->msixentry,
> -				    msi_count)) {
> -					dev->msi_enabled = 0;
> -					printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
> -							dev->name, dev->id, i);
> -				}
> -			}
> -		} else {
> -			dev->msi_enabled = 0;
> -			printk(KERN_ERR "%s%d: MSIX not supported!! Will try MSI 0x%x.\n",
> -					dev->name, dev->id, i);
> -		}
> -	}
> -
> -	if (!dev->msi_enabled) {
> -		msi_count = 1;
> -		i = pci_enable_msi(dev->pdev);
> -
> -		if (!i) {
> -			dev->msi_enabled = 1;
> -			dev->msi = 1;
> -		} else {
> -			printk(KERN_ERR "%s%d: MSI not supported!! Will try INTx 0x%x.\n",
> -					dev->name, dev->id, i);
> -		}
> -	}
> -
> -	if (!dev->msi_enabled)
> -		dev->max_msix = msi_count = 1;
> -	else {
> -		if (dev->max_msix > msi_count)
> -			dev->max_msix = msi_count;
> -	}
> -	dev->vector_cap =
> -		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) /
> -		msi_count;
> -}
> diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
> index 9eec027..be30e43 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -1317,6 +1317,149 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>  	return error;
>  }
>  
> +#if (defined(CONFIG_PM))
> +void aac_release_resources(struct aac_dev *aac)
> +{
> +	int i;
> +
> +	aac_adapter_disable_int(aac);
> +	if (aac->pdev->device == PMC_DEVICE_S6 ||
> +	    aac->pdev->device == PMC_DEVICE_S7 ||
> +	    aac->pdev->device == PMC_DEVICE_S8 ||
> +	    aac->pdev->device == PMC_DEVICE_S9) {
> +		if (aac->max_msix > 1) {
> +			for (i = 0; i < aac->max_msix; i++)
> +				free_irq(aac->msixentry[i].vector,
> +					&(aac->aac_msix[i]));
> +		} else {
> +			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
> +		}
> +	} else {
> +		free_irq(aac->pdev->irq, aac);
> +	}
> +	if (aac->msi)
> +		pci_disable_msi(aac->pdev);
> +	else if (aac->max_msix > 1)
> +		pci_disable_msix(aac->pdev);
> +
> +}
> +
> +static int aac_acquire_resources(struct aac_dev *dev)
> +{
> +	int i, j;
> +	int instance = dev->id;
> +	const char *name = dev->name;
> +	unsigned long status;
> +	/*
> +	 *	First clear out all interrupts.  Then enable the one's that we
> +	 *	can handle.
> +	 */
> +	while (!((status = src_readl(dev, MUnit.OMR)) & KERNEL_UP_AND_RUNNING)
> +		|| status == 0xffffffff)
> +			msleep(1);
> +
> +	aac_adapter_disable_int(dev);
> +	aac_adapter_enable_int(dev);
> +
> +
> +	if ((dev->pdev->device == PMC_DEVICE_S7 ||
> +	     dev->pdev->device == PMC_DEVICE_S8 ||
> +	     dev->pdev->device == PMC_DEVICE_S9))
> +		aac_define_int_mode(dev);
> +
> +	if (dev->msi_enabled)
> +		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
> +
> +	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> +		for (i = 0; i < dev->max_msix; i++) {
> +			dev->aac_msix[i].vector_no = i;
> +			dev->aac_msix[i].dev = dev;
> +
> +			if (request_irq(dev->msixentry[i].vector,
> +					dev->a_ops.adapter_intr,
> +					0, "aacraid", &(dev->aac_msix[i]))) {
> +				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
> +						name, instance, i);
> +				for (j = 0 ; j < i ; j++)
> +					free_irq(dev->msixentry[j].vector,
> +						 &(dev->aac_msix[j]));
> +				pci_disable_msix(dev->pdev);
> +				goto error_iounmap;
> +			}
> +		}
> +	} else {
> +		dev->aac_msix[0].vector_no = 0;
> +		dev->aac_msix[0].dev = dev;
> +
> +		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
> +			IRQF_SHARED|IRQF_DISABLED, "aacraid",
> +			&(dev->aac_msix[0])) < 0) {
> +			if (dev->msi)
> +				pci_disable_msi(dev->pdev);
> +			printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
> +					name, instance);
> +			goto error_iounmap;
> +		}
> +	}
> +
> +	aac_adapter_enable_int(dev);
> +
> +	if (!dev->sync_mode)
> +		aac_adapter_start(dev);
> +	return 0;
> +
> +error_iounmap:
> +	return -1;
> +
> +}
> +static int aac_suspend(struct pci_dev *pdev, pm_message_t state)
> +{
> +
> +	struct Scsi_Host *shost = pci_get_drvdata(pdev);
> +	struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
> +
> +	scsi_block_requests(shost);
> +	aac_send_shutdown(aac);
> +
> +	aac_release_resources(aac);
> +
> +	pci_set_drvdata(pdev, shost);
> +	pci_save_state(pdev);
> +	pci_disable_device(pdev);
> +	pci_set_power_state(pdev, pci_choose_state(pdev, state));
> +
> +	return 0;
> +}
> +
> +static int aac_resume(struct pci_dev *pdev)
> +{
> +	struct Scsi_Host *shost = pci_get_drvdata(pdev);
> +	struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
> +	int r;
> +
> +	pci_set_power_state(pdev, PCI_D0);
> +	pci_enable_wake(pdev, PCI_D0, 0);
> +	pci_restore_state(pdev);
> +	r = pci_enable_device(pdev);
> +
> +	if (r)
> +		goto fail_device;
> +
> +	pci_set_master(pdev);
> +	if (aac_acquire_resources(aac))
> +		goto fail_device;
> +	scsi_unblock_requests(shost);
> +
> +	return 0;
> +
> +fail_device:
> +	printk(KERN_INFO "%s%d: resume failed.\n", aac->name, aac->id);
> +	scsi_host_put(shost);
> +	pci_disable_device(pdev);
> +	return -ENODEV;
> +}
> +#endif
> +
>  static void aac_shutdown(struct pci_dev *dev)
>  {
>  	struct Scsi_Host *shost = pci_get_drvdata(dev);
> @@ -1356,6 +1499,10 @@ static struct pci_driver aac_pci_driver = {
>  	.id_table	= aac_pci_tbl,
>  	.probe		= aac_probe_one,
>  	.remove		= aac_remove_one,
> +#if (defined(CONFIG_PM))
> +	.suspend	= aac_suspend,
> +	.resume		= aac_resume,
> +#endif
>  	.shutdown	= aac_shutdown,
>  };
>  
> diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
> index 9570612..ac16380 100644
> --- a/drivers/scsi/aacraid/rx.c
> +++ b/drivers/scsi/aacraid/rx.c
> @@ -623,6 +623,7 @@ int _aac_rx_init(struct aac_dev *dev)
>  	dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
>  	dev->a_ops.adapter_check_health = aac_rx_check_health;
>  	dev->a_ops.adapter_restart = aac_rx_restart_adapter;
> +	dev->a_ops.adapter_start = aac_rx_start_adapter;
>  
>  	/*
>  	 *	First clear out all interrupts.  Then enable the one's that we
> diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
> index e66477c..869aea2 100644
> --- a/drivers/scsi/aacraid/sa.c
> +++ b/drivers/scsi/aacraid/sa.c
> @@ -372,6 +372,7 @@ int aac_sa_init(struct aac_dev *dev)
>  	dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
>  	dev->a_ops.adapter_check_health = aac_sa_check_health;
>  	dev->a_ops.adapter_restart = aac_sa_restart_adapter;
> +	dev->a_ops.adapter_start = aac_sa_start_adapter;
>  	dev->a_ops.adapter_intr = aac_sa_intr;
>  	dev->a_ops.adapter_deliver = aac_rx_deliver_producer;
>  	dev->a_ops.adapter_ioremap = aac_sa_ioremap;
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index 4596e9d..b0204d0 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -726,6 +726,7 @@ int aac_src_init(struct aac_dev *dev)
>  	dev->a_ops.adapter_sync_cmd = src_sync_cmd;
>  	dev->a_ops.adapter_check_health = aac_src_check_health;
>  	dev->a_ops.adapter_restart = aac_src_restart_adapter;
> +	dev->a_ops.adapter_start = aac_src_start_adapter;
>  
>  	/*
>  	 *	First clear out all interrupts.  Then enable the one's that we
> @@ -892,6 +893,7 @@ int aac_srcv_init(struct aac_dev *dev)
>  	dev->a_ops.adapter_sync_cmd = src_sync_cmd;
>  	dev->a_ops.adapter_check_health = aac_src_check_health;
>  	dev->a_ops.adapter_restart = aac_src_restart_adapter;
> +	dev->a_ops.adapter_start = aac_src_start_adapter;
>  
>  	/*
>  	 *	First clear out all interrupts.  Then enable the one's that we
> 


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

* Re: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  2015-05-14  0:12 ` [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
  2015-05-15  2:56   ` Mahesh Rajashekhara
@ 2015-05-22 13:40   ` Tomas Henzl
  2015-05-22 23:46     ` Rajinikanth Pandurangan
  2015-05-27 14:42   ` Tomas Henzl
  2 siblings, 1 reply; 38+ messages in thread
From: Tomas Henzl @ 2015-05-22 13:40 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Enable MSI interrupt mode for series-6 controller.
aac_msi is a driver option, how is it related to series-6 controller?
Tomas
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/src.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index b0204d0..ae494c5 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
>  	if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
>  		goto error_iounmap;
>  
> -	dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
> +	dev->msi = !pci_enable_msi(dev->pdev);
>  
>  	dev->aac_msix[0].vector_no = 0;
>  	dev->aac_msix[0].dev = dev;
> 


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

* Re: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
  2015-05-14  0:12 ` [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
@ 2015-05-22 14:02   ` Tomas Henzl
  2015-05-22 23:52     ` Rajinikanth Pandurangan
  2015-05-27 14:44   ` Tomas Henzl
  2 siblings, 1 reply; 38+ messages in thread
From: Tomas Henzl @ 2015-05-22 14:02 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
>         If writeq() not supported, then do atomic two 32bit write
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/aacraid.h  | 12 ++++++++++++
>  drivers/scsi/aacraid/comminit.c |  1 +
>  drivers/scsi/aacraid/src.c      | 12 ++++++++++--
>  3 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index 62b0999..9e69e3e 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -719,6 +719,9 @@ struct sa_registers {
>  #define sa_readl(AEP, CSR)		readl(&((AEP)->regs.sa->CSR))
>  #define sa_writew(AEP, CSR, value)	writew(value, &((AEP)->regs.sa->CSR))
>  #define sa_writel(AEP, CSR, value)	writel(value, &((AEP)->regs.sa->CSR))
> +#if defined(writeq)
> +#define	sa_writeq(AEP, CSR, value)	writeq(value, &((AEP)->regs.sa->CSR))
This^ is used nowhere, is it needed?
> +#endif
>  
>  /*
>   *	Rx Message Unit Registers
> @@ -844,6 +847,10 @@ struct src_registers {
>  						&((AEP)->regs.src.bar0->CSR))
>  #define src_writel(AEP, CSR, value)	writel(value, \
>  						&((AEP)->regs.src.bar0->CSR))
> +#if defined(writeq)
> +#define	src_writeq(AEP, CSR, value)	writeq(value, \
> +						&((AEP)->regs.src.bar0->CSR))
> +#endif
>  
>  #define SRC_ODR_SHIFT		12
>  #define SRC_IDR_SHIFT		9
> @@ -1163,6 +1170,11 @@ struct aac_dev
>  	struct fsa_dev_info	*fsa_dev;
>  	struct task_struct	*thread;
>  	int			cardtype;
> +	/*
> +	 *This lock will protect the two 32-bit
> +	 *writes to the Inbound Queue
> +	 */
> +	spinlock_t		iq_lock;
>  
>  	/*
>  	 *	The following is the device specific extension.
> diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
> index 45a0a04..4043245 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
>  	dev->management_fib_count = 0;
>  	spin_lock_init(&dev->manage_lock);
>  	spin_lock_init(&dev->sync_lock);
> +	spin_lock_init(&dev->iq_lock);
>  	dev->max_fib_size = sizeof(struct hw_fib);
>  	dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
>  		- sizeof(struct aac_fibhdr)
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index ae494c5..109863a 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
>  	u32 fibsize;
>  	dma_addr_t address;
>  	struct aac_fib_xporthdr *pFibX;
> +#if !defined(writeq)
> +	unsigned long flags;
> +#endif
> +
>  	u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
>  
>  	atomic_inc(&q->numpending);
> @@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
>  			return -EINVAL;
>  		address |= fibsize;
>  	}
> -
> +#if defined(writeq)
> +	src_writeq(dev, MUnit.IQ_L, (u64)address);
What about just using the writeq directly without the macro ?
	writeq(value, address); ?
> +#else
> +	spin_lock_irqsave(&fib->dev->iq_lock, flags);
>  	src_writel(dev, MUnit.IQ_H, upper_32_bits(address) & 0xffffffff);
>  	src_writel(dev, MUnit.IQ_L, address & 0xffffffff);
> -
> +	spin_unlock_irqrestore(&fib->dev->iq_lock, flags);
> +#endif
>  	return 0;
>  }
>  
> 


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

* RE: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  2015-05-22 13:40   ` Tomas Henzl
@ 2015-05-22 23:46     ` Rajinikanth Pandurangan
  2015-05-24 19:31       ` Tomas Henzl
  0 siblings, 1 reply; 38+ messages in thread
From: Rajinikanth Pandurangan @ 2015-05-22 23:46 UTC (permalink / raw)
  To: Tomas Henzl, jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

Hello Tomas,

As the function aac_src_init() itself specific to Series-6 controller, change applicable only to series-6.

Thanks,
-Raj P.

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com] 
Sent: Friday, May 22, 2015 6:40 AM
To: Rajinikanth Pandurangan; jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
Subject: Re: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Enable MSI interrupt mode for series-6 controller.
aac_msi is a driver option, how is it related to series-6 controller?
Tomas
> 
> Signed-off-by: Rajinikanth Pandurangan 
> <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/src.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c 
> index b0204d0..ae494c5 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
>  	if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
>  		goto error_iounmap;
>  
> -	dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
> +	dev->msi = !pci_enable_msi(dev->pdev);
>  
>  	dev->aac_msix[0].vector_no = 0;
>  	dev->aac_msix[0].dev = dev;
> 


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

* RE: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
  2015-05-22 14:02   ` Tomas Henzl
@ 2015-05-22 23:52     ` Rajinikanth Pandurangan
  2015-05-24 19:31       ` Tomas Henzl
  0 siblings, 1 reply; 38+ messages in thread
From: Rajinikanth Pandurangan @ 2015-05-22 23:52 UTC (permalink / raw)
  To: Tomas Henzl, jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com] 
Sent: Friday, May 22, 2015 7:02 AM
To: Rajinikanth Pandurangan; jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
Subject: Re: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
>         If writeq() not supported, then do atomic two 32bit write
> 
> Signed-off-by: Rajinikanth Pandurangan 
> <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/aacraid.h  | 12 ++++++++++++  
> drivers/scsi/aacraid/comminit.c |  1 +
>  drivers/scsi/aacraid/src.c      | 12 ++++++++++--
>  3 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h 
> b/drivers/scsi/aacraid/aacraid.h index 62b0999..9e69e3e 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -719,6 +719,9 @@ struct sa_registers {
>  #define sa_readl(AEP, CSR)		readl(&((AEP)->regs.sa->CSR))
>  #define sa_writew(AEP, CSR, value)	writew(value, &((AEP)->regs.sa->CSR))
>  #define sa_writel(AEP, CSR, value)	writel(value, &((AEP)->regs.sa->CSR))
> +#if defined(writeq)
> +#define	sa_writeq(AEP, CSR, value)	writeq(value, &((AEP)->regs.sa->CSR))
This^ is used nowhere, is it needed?

[rajp] Yes, it's not needed.

> +#endif
>  
>  /*
>   *	Rx Message Unit Registers
> @@ -844,6 +847,10 @@ struct src_registers {
>  						&((AEP)->regs.src.bar0->CSR))
>  #define src_writel(AEP, CSR, value)	writel(value, \
>  						&((AEP)->regs.src.bar0->CSR))
> +#if defined(writeq)
> +#define	src_writeq(AEP, CSR, value)	writeq(value, \
> +						&((AEP)->regs.src.bar0->CSR))
> +#endif
>  
>  #define SRC_ODR_SHIFT		12
>  #define SRC_IDR_SHIFT		9
> @@ -1163,6 +1170,11 @@ struct aac_dev
>  	struct fsa_dev_info	*fsa_dev;
>  	struct task_struct	*thread;
>  	int			cardtype;
> +	/*
> +	 *This lock will protect the two 32-bit
> +	 *writes to the Inbound Queue
> +	 */
> +	spinlock_t		iq_lock;
>  
>  	/*
>  	 *	The following is the device specific extension.
> diff --git a/drivers/scsi/aacraid/comminit.c 
> b/drivers/scsi/aacraid/comminit.c index 45a0a04..4043245 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
>  	dev->management_fib_count = 0;
>  	spin_lock_init(&dev->manage_lock);
>  	spin_lock_init(&dev->sync_lock);
> +	spin_lock_init(&dev->iq_lock);
>  	dev->max_fib_size = sizeof(struct hw_fib);
>  	dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
>  		- sizeof(struct aac_fibhdr)
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c 
> index ae494c5..109863a 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
>  	u32 fibsize;
>  	dma_addr_t address;
>  	struct aac_fib_xporthdr *pFibX;
> +#if !defined(writeq)
> +	unsigned long flags;
> +#endif
> +
>  	u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
>  
>  	atomic_inc(&q->numpending);
> @@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
>  			return -EINVAL;
>  		address |= fibsize;
>  	}
> -
> +#if defined(writeq)
> +	src_writeq(dev, MUnit.IQ_L, (u64)address);
What about just using the writeq directly without the macro ?
	writeq(value, address); ?

[Rajp] All other place we have macro. This is just for the uniformity.

> +#else
> +	spin_lock_irqsave(&fib->dev->iq_lock, flags);
>  	src_writel(dev, MUnit.IQ_H, upper_32_bits(address) & 0xffffffff);
>  	src_writel(dev, MUnit.IQ_L, address & 0xffffffff);
> -
> +	spin_unlock_irqrestore(&fib->dev->iq_lock, flags); #endif
>  	return 0;
>  }
>  
> 


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

* Re: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  2015-05-22 23:46     ` Rajinikanth Pandurangan
@ 2015-05-24 19:31       ` Tomas Henzl
  0 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-24 19:31 UTC (permalink / raw)
  To: Rajinikanth Pandurangan, jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

On 05/23/2015 01:46 AM, Rajinikanth Pandurangan wrote:
> Hello Tomas,
> 
> As the function aac_src_init() itself specific to Series-6 controller, change applicable only to series-6.
The change removes a kernel option, which assumedly
is used to control which kind of interrupt handling
the driver may use. With aac_msi = 1 the driver
might have used MSI -> the text "Enable MSI interrupt mode"
is misleading.
Let's say the text isn't precise - but i can accept it,
so you don't have to repost.

Tomas


> Thanks,
> -Raj P.
> 
> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com] 
> Sent: Friday, May 22, 2015 6:40 AM
> To: Rajinikanth Pandurangan; jbottomley@parallels.com; linux-scsi@vger.kernel.org
> Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
> Subject: Re: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
> 
> On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
>> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
>>
>> Description:
>> 	Enable MSI interrupt mode for series-6 controller.
> aac_msi is a driver option, how is it related to series-6 controller?
> Tomas
>>
>> Signed-off-by: Rajinikanth Pandurangan 
>> <rajinikanth.pandurangan@pmcs.com>
>> ---
>>  drivers/scsi/aacraid/src.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c 
>> index b0204d0..ae494c5 100644
>> --- a/drivers/scsi/aacraid/src.c
>> +++ b/drivers/scsi/aacraid/src.c
>> @@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
>>  	if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
>>  		goto error_iounmap;
>>  
>> -	dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
>> +	dev->msi = !pci_enable_msi(dev->pdev);
>>  
>>  	dev->aac_msix[0].vector_no = 0;
>>  	dev->aac_msix[0].dev = dev;
>>
> 
> --
> 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] 38+ messages in thread

* Re: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
  2015-05-22 23:52     ` Rajinikanth Pandurangan
@ 2015-05-24 19:31       ` Tomas Henzl
  0 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-24 19:31 UTC (permalink / raw)
  To: Rajinikanth Pandurangan, jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

On 05/23/2015 01:52 AM, Rajinikanth Pandurangan wrote:
> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com] 
> Sent: Friday, May 22, 2015 7:02 AM
> To: Rajinikanth Pandurangan; jbottomley@parallels.com; linux-scsi@vger.kernel.org
> Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
> Subject: Re: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
> 
> On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
>> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
>>
>> Description:
>>         If writeq() not supported, then do atomic two 32bit write
>>
>> Signed-off-by: Rajinikanth Pandurangan 
>> <rajinikanth.pandurangan@pmcs.com>
>> ---
>>  drivers/scsi/aacraid/aacraid.h  | 12 ++++++++++++  
>> drivers/scsi/aacraid/comminit.c |  1 +
>>  drivers/scsi/aacraid/src.c      | 12 ++++++++++--
>>  3 files changed, 23 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/aacraid/aacraid.h 
>> b/drivers/scsi/aacraid/aacraid.h index 62b0999..9e69e3e 100644
>> --- a/drivers/scsi/aacraid/aacraid.h
>> +++ b/drivers/scsi/aacraid/aacraid.h
>> @@ -719,6 +719,9 @@ struct sa_registers {
>>  #define sa_readl(AEP, CSR)		readl(&((AEP)->regs.sa->CSR))
>>  #define sa_writew(AEP, CSR, value)	writew(value, &((AEP)->regs.sa->CSR))
>>  #define sa_writel(AEP, CSR, value)	writel(value, &((AEP)->regs.sa->CSR))
>> +#if defined(writeq)
>> +#define	sa_writeq(AEP, CSR, value)	writeq(value, &((AEP)->regs.sa->CSR))
> This^ is used nowhere, is it needed?
> 
> [rajp] Yes, it's not needed.
> 
>> +#endif
>>  
>>  /*
>>   *	Rx Message Unit Registers
>> @@ -844,6 +847,10 @@ struct src_registers {
>>  						&((AEP)->regs.src.bar0->CSR))
>>  #define src_writel(AEP, CSR, value)	writel(value, \
>>  						&((AEP)->regs.src.bar0->CSR))
>> +#if defined(writeq)
>> +#define	src_writeq(AEP, CSR, value)	writeq(value, \
>> +						&((AEP)->regs.src.bar0->CSR))
>> +#endif
>>  
>>  #define SRC_ODR_SHIFT		12
>>  #define SRC_IDR_SHIFT		9
>> @@ -1163,6 +1170,11 @@ struct aac_dev
>>  	struct fsa_dev_info	*fsa_dev;
>>  	struct task_struct	*thread;
>>  	int			cardtype;
>> +	/*
>> +	 *This lock will protect the two 32-bit
>> +	 *writes to the Inbound Queue
>> +	 */
>> +	spinlock_t		iq_lock;
>>  
>>  	/*
>>  	 *	The following is the device specific extension.
>> diff --git a/drivers/scsi/aacraid/comminit.c 
>> b/drivers/scsi/aacraid/comminit.c index 45a0a04..4043245 100644
>> --- a/drivers/scsi/aacraid/comminit.c
>> +++ b/drivers/scsi/aacraid/comminit.c
>> @@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
>>  	dev->management_fib_count = 0;
>>  	spin_lock_init(&dev->manage_lock);
>>  	spin_lock_init(&dev->sync_lock);
>> +	spin_lock_init(&dev->iq_lock);
>>  	dev->max_fib_size = sizeof(struct hw_fib);
>>  	dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
>>  		- sizeof(struct aac_fibhdr)
>> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c 
>> index ae494c5..109863a 100644
>> --- a/drivers/scsi/aacraid/src.c
>> +++ b/drivers/scsi/aacraid/src.c
>> @@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
>>  	u32 fibsize;
>>  	dma_addr_t address;
>>  	struct aac_fib_xporthdr *pFibX;
>> +#if !defined(writeq)
>> +	unsigned long flags;
>> +#endif
>> +
>>  	u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
>>  
>>  	atomic_inc(&q->numpending);
>> @@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
>>  			return -EINVAL;
>>  		address |= fibsize;
>>  	}
>> -
>> +#if defined(writeq)
>> +	src_writeq(dev, MUnit.IQ_L, (u64)address);
> What about just using the writeq directly without the macro ?
> 	writeq(value, address); ?
> 
> [Rajp] All other place we have macro. This is just for the uniformity.
Okay,
Tomas
> 
>> +#else
>> +	spin_lock_irqsave(&fib->dev->iq_lock, flags);
>>  	src_writel(dev, MUnit.IQ_H, upper_32_bits(address) & 0xffffffff);
>>  	src_writel(dev, MUnit.IQ_L, address & 0xffffffff);
>> -
>> +	spin_unlock_irqrestore(&fib->dev->iq_lock, flags); #endif
>>  	return 0;
>>  }
>>  
>>
> 
> --
> 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] 38+ messages in thread

* RE: [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  2015-05-22 13:18   ` Tomas Henzl
@ 2015-05-26 18:06     ` Rajinikanth Pandurangan
  0 siblings, 0 replies; 38+ messages in thread
From: Rajinikanth Pandurangan @ 2015-05-26 18:06 UTC (permalink / raw)
  To: Tomas Henzl, jbottomley, linux-scsi
  Cc: aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

Hello Tomas,

Yes, you are right.  The mentioned comment is right for some cases where as in some cases it should actually be the size of response buffer instead of request buffer.

To "get logical device name", it request size of response buffer instead of size of the request.

Thanks,
-Raj P.

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com] 
Sent: Friday, May 22, 2015 6:19 AM
To: Rajinikanth Pandurangan; jbottomley@parallels.com; linux-scsi@vger.kernel.org
Cc: aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
Subject: Re: [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Driver sends the right size of the response buffer.
> 
> Signed-off-by: Rajinikanth Pandurangan 
> <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/aachba.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c 
> b/drivers/scsi/aacraid/aachba.c index 9b3dd6e..fe59b00 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd 
> * scsicmd)
>  
>  	status = aac_fib_send(ContainerCommand,
>  		  cmd_fibcontext,
> -		  sizeof (struct aac_get_name),
> +		  sizeof(struct aac_get_name_resp),
Hi Rajinikanth,
in aac_fib_send the size parameter is used in just one place and a comment there says "Set the size of the Fib we want to send to the adapter"
>From that^ it looks like it is the size of the command you sending, to the hw. Do I miss something?
Cheers,
Tomas
>  		  FsaNormal,
>  		  0, 1,
>  		  (fib_callback)get_container_name_callback,
> @@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct 
> scsi_cmnd * scsicmd)
>  
>  	status = aac_fib_send(ContainerCommand,
>  		  cmd_fibcontext,
> -		  sizeof (struct aac_get_serial),
> +		  sizeof(struct aac_get_serial_resp),
>  		  FsaNormal,
>  		  0, 1,
>  		  (fib_callback) get_container_serial_callback,
> 


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

* Re: [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
  2015-05-15  2:55   ` Mahesh Rajashekhara
  2015-05-22 13:18   ` Tomas Henzl
@ 2015-05-27 14:41   ` Tomas Henzl
  2 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:41 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Driver sends the right size of the response buffer.
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas


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

* Re: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
  2015-05-15  2:56   ` Mahesh Rajashekhara
  2015-05-22 13:36   ` Tomas Henzl
@ 2015-05-27 14:41   ` Tomas Henzl
  2015-06-01 15:14   ` James Bottomley
  3 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:41 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	* .suspend() and .resume() routines implemented in the driver
> 	* aac_release_resources() initiates firmware shutdown
> 	* aac_acquire_resources re-initializes the host interface
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas



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

* Re: [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller
  2015-05-14  0:12 ` [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
  2015-05-15  2:56   ` Mahesh Rajashekhara
  2015-05-22 13:40   ` Tomas Henzl
@ 2015-05-27 14:42   ` Tomas Henzl
  2 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:42 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Enable MSI interrupt mode for series-6 controller.
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/src.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
> index b0204d0..ae494c5 100644
> --- a/drivers/scsi/aacraid/src.c
> +++ b/drivers/scsi/aacraid/src.c
> @@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
>  	if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
>  		goto error_iounmap;
>  
> -	dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
> +	dev->msi = !pci_enable_msi(dev->pdev);
>  
>  	dev->aac_msix[0].vector_no = 0;
>  	dev->aac_msix[0].dev = dev;
> 
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas


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

* Re: [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register
  2015-05-14  0:12 ` [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
  2015-05-22 14:02   ` Tomas Henzl
@ 2015-05-27 14:44   ` Tomas Henzl
  2 siblings, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:44 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
>         If writeq() not supported, then do atomic two 32bit write
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas


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

* Re: [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set
  2015-05-14  0:12 ` [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
@ 2015-05-27 14:45   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:45 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
>         If 'IsFastPath' bit is set, then response path assumes no error
>         and skips error check.
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas


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

* Re: [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq
  2015-05-14  0:12 ` [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
@ 2015-05-27 14:45   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:45 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
>         Reset irq affinity hints before releasing IRQ
>         Removed duplicate code of IRQ acquire/release
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas



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

* Re: [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend
  2015-05-14  0:12 ` [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend rajinikanth.pandurangan
  2015-05-15  2:57   ` Mahesh Rajashekhara
@ 2015-05-27 14:45   ` Tomas Henzl
  1 sibling, 0 replies; 38+ messages in thread
From: Tomas Henzl @ 2015-05-27 14:45 UTC (permalink / raw)
  To: rajinikanth.pandurangan, jbottomley, linux-scsi
  Cc: aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On 05/14/2015 02:12 AM, rajinikanth.pandurangan@pmcs.com wrote:
> From: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> 
> Description:
> 	Driver blocks ioctls once it received shutdown/suspend request during
> 	suspend/hybernation. This patch unblocks ioctls on resume path.
> 
> Signed-off-by: Rajinikanth Pandurangan <rajinikanth.pandurangan@pmcs.com>
> ---
>  drivers/scsi/aacraid/linit.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
> index 62a928f..d977cd2 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -1363,6 +1363,11 @@ static int aac_resume(struct pci_dev *pdev)
>  	pci_set_master(pdev);
>  	if (aac_acquire_resources(aac))
>  		goto fail_device;
> +	/*
> +	* reset this flag to unblock ioctl() as it was set at
> +	* aac_send_shutdown() to block ioctls from upperlayer
> +	*/
> +	aac->adapter_shutdown = 0;
>  	scsi_unblock_requests(shost);
>  
>  	return 0;
> 
Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas


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

* Re: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
                     ` (2 preceding siblings ...)
  2015-05-27 14:41   ` Tomas Henzl
@ 2015-06-01 15:14   ` James Bottomley
  2015-06-01 21:16     ` Rajinikanth Pandurangan
  3 siblings, 1 reply; 38+ messages in thread
From: James Bottomley @ 2015-06-01 15:14 UTC (permalink / raw)
  To: rajinikanth.pandurangan
  Cc: linux-scsi, aacraid, harry.yang, rich.bono, achim.leubner, murthy.bhat

On Wed, 2015-05-13 at 17:12 -0700, rajinikanth.pandurangan@pmcs.com
wrote:
> diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
> index 9eec027..be30e43 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -1317,6 +1317,149 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>  	return error;
>  }
>  
> +#if (defined(CONFIG_PM))
> +void aac_release_resources(struct aac_dev *aac)
> +{
> +	int i;
> +
> +	aac_adapter_disable_int(aac);
> +	if (aac->pdev->device == PMC_DEVICE_S6 ||
> +	    aac->pdev->device == PMC_DEVICE_S7 ||
> +	    aac->pdev->device == PMC_DEVICE_S8 ||
> +	    aac->pdev->device == PMC_DEVICE_S9) {
> +		if (aac->max_msix > 1) {
> +			for (i = 0; i < aac->max_msix; i++)
> +				free_irq(aac->msixentry[i].vector,
> +					&(aac->aac_msix[i]));
> +		} else {
> +			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
> +		}
> +	} else {
> +		free_irq(aac->pdev->irq, aac);
> +	}
> +	if (aac->msi)
> +		pci_disable_msi(aac->pdev);
> +	else if (aac->max_msix > 1)
> +		pci_disable_msix(aac->pdev);
> +
> +}
> +
> +static int aac_acquire_resources(struct aac_dev *dev)
> +{
> +	int i, j;
> +	int instance = dev->id;
> +	const char *name = dev->name;
> +	unsigned long status;
> +	/*
> +	 *	First clear out all interrupts.  Then enable the one's that we
> +	 *	can handle.
> +	 */
> +	while (!((status = src_readl(dev, MUnit.OMR)) & KERNEL_UP_AND_RUNNING)
> +		|| status == 0xffffffff)
> +			msleep(1);

checkpatch would warn you not to do this.  Use msleep(20) to keep it
quiet.

> +
> +	aac_adapter_disable_int(dev);
> +	aac_adapter_enable_int(dev);
> +
> +
> +	if ((dev->pdev->device == PMC_DEVICE_S7 ||
> +	     dev->pdev->device == PMC_DEVICE_S8 ||
> +	     dev->pdev->device == PMC_DEVICE_S9))
> +		aac_define_int_mode(dev);
> +
> +	if (dev->msi_enabled)
> +		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
> +
> +	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> +		for (i = 0; i < dev->max_msix; i++) {
> +			dev->aac_msix[i].vector_no = i;
> +			dev->aac_msix[i].dev = dev;
> +
> +			if (request_irq(dev->msixentry[i].vector,
> +					dev->a_ops.adapter_intr,
> +					0, "aacraid", &(dev->aac_msix[i]))) {
> +				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
> +						name, instance, i);
> +				for (j = 0 ; j < i ; j++)
> +					free_irq(dev->msixentry[j].vector,
> +						 &(dev->aac_msix[j]));
> +				pci_disable_msix(dev->pdev);
> +				goto error_iounmap;
> +			}
> +		}
> +	} else {
> +		dev->aac_msix[0].vector_no = 0;
> +		dev->aac_msix[0].dev = dev;
> +
> +		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
> +			IRQF_SHARED|IRQF_DISABLED, "aacraid",
> +			&(dev->aac_msix[0])) < 0) {

And this won't compile:

drivers/scsi/aacraid/linit.c: In function ‘aac_acquire_resources’:
drivers/scsi/aacraid/linit.c:1395:16: error: ‘IRQF_DISABLED’ undeclared
(first use in this function)
    IRQF_SHARED|IRQF_DISABLED, "aacraid",

Please run checkpatch and compile against the kernel you're submitting
for.  The reason for this failure is that IRQF_DISABLED got eliminated
from the kernel somewhere in the 3.x series.

James


--
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] 38+ messages in thread

* RE: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-06-01 15:14   ` James Bottomley
@ 2015-06-01 21:16     ` Rajinikanth Pandurangan
  2015-06-01 21:38       ` James Bottomley
  0 siblings, 1 reply; 38+ messages in thread
From: Rajinikanth Pandurangan @ 2015-06-01 21:16 UTC (permalink / raw)
  To: James Bottomley
  Cc: linux-scsi, aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com] 
Sent: Monday, June 01, 2015 8:15 AM
To: Rajinikanth Pandurangan
Cc: linux-scsi@vger.kernel.org; aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
Subject: Re: [PATCH 2/9] [SCSI] aacraid: Add Power Management support

On Wed, 2015-05-13 at 17:12 -0700, rajinikanth.pandurangan@pmcs.com
wrote:
> diff --git a/drivers/scsi/aacraid/linit.c 
> b/drivers/scsi/aacraid/linit.c index 9eec027..be30e43 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -1317,6 +1317,149 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>  	return error;
>  }
>  
> +#if (defined(CONFIG_PM))
> +void aac_release_resources(struct aac_dev *aac) {
> +	int i;
> +
> +	aac_adapter_disable_int(aac);
> +	if (aac->pdev->device == PMC_DEVICE_S6 ||
> +	    aac->pdev->device == PMC_DEVICE_S7 ||
> +	    aac->pdev->device == PMC_DEVICE_S8 ||
> +	    aac->pdev->device == PMC_DEVICE_S9) {
> +		if (aac->max_msix > 1) {
> +			for (i = 0; i < aac->max_msix; i++)
> +				free_irq(aac->msixentry[i].vector,
> +					&(aac->aac_msix[i]));
> +		} else {
> +			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
> +		}
> +	} else {
> +		free_irq(aac->pdev->irq, aac);
> +	}
> +	if (aac->msi)
> +		pci_disable_msi(aac->pdev);
> +	else if (aac->max_msix > 1)
> +		pci_disable_msix(aac->pdev);
> +
> +}
> +
> +static int aac_acquire_resources(struct aac_dev *dev) {
> +	int i, j;
> +	int instance = dev->id;
> +	const char *name = dev->name;
> +	unsigned long status;
> +	/*
> +	 *	First clear out all interrupts.  Then enable the one's that we
> +	 *	can handle.
> +	 */
> +	while (!((status = src_readl(dev, MUnit.OMR)) & KERNEL_UP_AND_RUNNING)
> +		|| status == 0xffffffff)
> +			msleep(1);

checkpatch would warn you not to do this.  Use msleep(20) to keep it quiet.

[RajP] Yes, will change and make it part of next patchset.

> +
> +	aac_adapter_disable_int(dev);
> +	aac_adapter_enable_int(dev);
> +
> +
> +	if ((dev->pdev->device == PMC_DEVICE_S7 ||
> +	     dev->pdev->device == PMC_DEVICE_S8 ||
> +	     dev->pdev->device == PMC_DEVICE_S9))
> +		aac_define_int_mode(dev);
> +
> +	if (dev->msi_enabled)
> +		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
> +
> +	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> +		for (i = 0; i < dev->max_msix; i++) {
> +			dev->aac_msix[i].vector_no = i;
> +			dev->aac_msix[i].dev = dev;
> +
> +			if (request_irq(dev->msixentry[i].vector,
> +					dev->a_ops.adapter_intr,
> +					0, "aacraid", &(dev->aac_msix[i]))) {
> +				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
> +						name, instance, i);
> +				for (j = 0 ; j < i ; j++)
> +					free_irq(dev->msixentry[j].vector,
> +						 &(dev->aac_msix[j]));
> +				pci_disable_msix(dev->pdev);
> +				goto error_iounmap;
> +			}
> +		}
> +	} else {
> +		dev->aac_msix[0].vector_no = 0;
> +		dev->aac_msix[0].dev = dev;
> +
> +		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
> +			IRQF_SHARED|IRQF_DISABLED, "aacraid",
> +			&(dev->aac_msix[0])) < 0) {

And this won't compile:

drivers/scsi/aacraid/linit.c: In function ‘aac_acquire_resources’:
drivers/scsi/aacraid/linit.c:1395:16: error: ‘IRQF_DISABLED’ undeclared (first use in this function)
    IRQF_SHARED|IRQF_DISABLED, "aacraid",

Please run checkpatch and compile against the kernel you're submitting for.  The reason for this failure is that IRQF_DISABLED got eliminated from the kernel somewhere in the 3.x series.

[RajP] Yes, I had compiled against the kernel 4.0.0-rc2+ and did not get any compile error.  In fact, checkpatch didn't warn either.  Am I missing something?

James



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

* Re: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
  2015-06-01 21:16     ` Rajinikanth Pandurangan
@ 2015-06-01 21:38       ` James Bottomley
  0 siblings, 0 replies; 38+ messages in thread
From: James Bottomley @ 2015-06-01 21:38 UTC (permalink / raw)
  To: Rajinikanth Pandurangan
  Cc: linux-scsi, aacraid, Harry Yang, Rich Bono, Achim Leubner, Murthy Bhat

On Mon, 2015-06-01 at 21:16 +0000, Rajinikanth Pandurangan wrote:
> -----Original Message-----
> From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com] 
> Sent: Monday, June 01, 2015 8:15 AM
> To: Rajinikanth Pandurangan
> Cc: linux-scsi@vger.kernel.org; aacraid@pmc-sierra.com; Harry Yang; Rich Bono; Achim Leubner; Murthy Bhat
> Subject: Re: [PATCH 2/9] [SCSI] aacraid: Add Power Management support
> 
> On Wed, 2015-05-13 at 17:12 -0700, rajinikanth.pandurangan@pmcs.com
> wrote:
> > diff --git a/drivers/scsi/aacraid/linit.c 
> > b/drivers/scsi/aacraid/linit.c index 9eec027..be30e43 100644
> > --- a/drivers/scsi/aacraid/linit.c
> > +++ b/drivers/scsi/aacraid/linit.c
> > @@ -1317,6 +1317,149 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
> >  	return error;
> >  }
> >  
> > +#if (defined(CONFIG_PM))
> > +void aac_release_resources(struct aac_dev *aac) {
> > +	int i;
> > +
> > +	aac_adapter_disable_int(aac);
> > +	if (aac->pdev->device == PMC_DEVICE_S6 ||
> > +	    aac->pdev->device == PMC_DEVICE_S7 ||
> > +	    aac->pdev->device == PMC_DEVICE_S8 ||
> > +	    aac->pdev->device == PMC_DEVICE_S9) {
> > +		if (aac->max_msix > 1) {
> > +			for (i = 0; i < aac->max_msix; i++)
> > +				free_irq(aac->msixentry[i].vector,
> > +					&(aac->aac_msix[i]));
> > +		} else {
> > +			free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
> > +		}
> > +	} else {
> > +		free_irq(aac->pdev->irq, aac);
> > +	}
> > +	if (aac->msi)
> > +		pci_disable_msi(aac->pdev);
> > +	else if (aac->max_msix > 1)
> > +		pci_disable_msix(aac->pdev);
> > +
> > +}
> > +
> > +static int aac_acquire_resources(struct aac_dev *dev) {
> > +	int i, j;
> > +	int instance = dev->id;
> > +	const char *name = dev->name;
> > +	unsigned long status;
> > +	/*
> > +	 *	First clear out all interrupts.  Then enable the one's that we
> > +	 *	can handle.
> > +	 */
> > +	while (!((status = src_readl(dev, MUnit.OMR)) & KERNEL_UP_AND_RUNNING)
> > +		|| status == 0xffffffff)
> > +			msleep(1);
> 
> checkpatch would warn you not to do this.  Use msleep(20) to keep it quiet.
> 
> [RajP] Yes, will change and make it part of next patchset.
> 
> > +
> > +	aac_adapter_disable_int(dev);
> > +	aac_adapter_enable_int(dev);
> > +
> > +
> > +	if ((dev->pdev->device == PMC_DEVICE_S7 ||
> > +	     dev->pdev->device == PMC_DEVICE_S8 ||
> > +	     dev->pdev->device == PMC_DEVICE_S9))
> > +		aac_define_int_mode(dev);
> > +
> > +	if (dev->msi_enabled)
> > +		aac_src_access_devreg(dev, AAC_ENABLE_MSIX);
> > +
> > +	if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
> > +		for (i = 0; i < dev->max_msix; i++) {
> > +			dev->aac_msix[i].vector_no = i;
> > +			dev->aac_msix[i].dev = dev;
> > +
> > +			if (request_irq(dev->msixentry[i].vector,
> > +					dev->a_ops.adapter_intr,
> > +					0, "aacraid", &(dev->aac_msix[i]))) {
> > +				printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n",
> > +						name, instance, i);
> > +				for (j = 0 ; j < i ; j++)
> > +					free_irq(dev->msixentry[j].vector,
> > +						 &(dev->aac_msix[j]));
> > +				pci_disable_msix(dev->pdev);
> > +				goto error_iounmap;
> > +			}
> > +		}
> > +	} else {
> > +		dev->aac_msix[0].vector_no = 0;
> > +		dev->aac_msix[0].dev = dev;
> > +
> > +		if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
> > +			IRQF_SHARED|IRQF_DISABLED, "aacraid",
> > +			&(dev->aac_msix[0])) < 0) {
> 
> And this won't compile:
> 
> drivers/scsi/aacraid/linit.c: In function ‘aac_acquire_resources’:
> drivers/scsi/aacraid/linit.c:1395:16: error: ‘IRQF_DISABLED’ undeclared (first use in this function)
>     IRQF_SHARED|IRQF_DISABLED, "aacraid",
> 
> Please run checkpatch and compile against the kernel you're submitting
> for.  The reason for this failure is that IRQF_DISABLED got eliminated
> from the kernel somewhere in the 3.x series.
> 
> [RajP] Yes, I had compiled against the kernel 4.0.0-rc2+ and did not
> get any compile error.  In fact, checkpatch didn't warn either.  Am I
> missing something?

Yes, this:

commit d8bf368d0631d4bc2612d8bf2e4e8e74e620d0cc
Author: Valentin Rothberg <valentinrothberg@gmail.com>
Date:   Thu Mar 5 15:23:08 2015 +0100

    genirq: Remove the deprecated 'IRQF_DISABLED' request_irq() flag
entirely

It went in in the merge window for 4.1.  However, IRQF_DISABLED has been
deprecated for long enough that you shouldn't have been using it anyway.

James


--
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] 38+ messages in thread

end of thread, other threads:[~2015-06-01 21:38 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14  0:12 [PATCH 0/9] aacraid: Patchset for aacraid driver version 41010 rajinikanth.pandurangan
2015-05-14  0:12 ` [PATCH 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS rajinikanth.pandurangan
2015-05-15  2:55   ` Mahesh Rajashekhara
2015-05-22 13:18   ` Tomas Henzl
2015-05-26 18:06     ` Rajinikanth Pandurangan
2015-05-27 14:41   ` Tomas Henzl
2015-05-14  0:12 ` [PATCH 2/9] [SCSI] aacraid: Add Power Management support rajinikanth.pandurangan
2015-05-15  2:56   ` Mahesh Rajashekhara
2015-05-22 13:36   ` Tomas Henzl
2015-05-27 14:41   ` Tomas Henzl
2015-06-01 15:14   ` James Bottomley
2015-06-01 21:16     ` Rajinikanth Pandurangan
2015-06-01 21:38       ` James Bottomley
2015-05-14  0:12 ` [PATCH 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller rajinikanth.pandurangan
2015-05-15  2:56   ` Mahesh Rajashekhara
2015-05-22 13:40   ` Tomas Henzl
2015-05-22 23:46     ` Rajinikanth Pandurangan
2015-05-24 19:31       ` Tomas Henzl
2015-05-27 14:42   ` Tomas Henzl
2015-05-14  0:12 ` [PATCH 4/9] [SCSI] aacraid: Enable 64-bit write to controller register rajinikanth.pandurangan
2015-05-15  2:57   ` Mahesh Rajashekhara
2015-05-22 14:02   ` Tomas Henzl
2015-05-22 23:52     ` Rajinikanth Pandurangan
2015-05-24 19:31       ` Tomas Henzl
2015-05-27 14:44   ` Tomas Henzl
2015-05-14  0:12 ` [PATCH 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set rajinikanth.pandurangan
2015-05-15  2:57   ` Mahesh Rajashekhara
2015-05-27 14:45   ` Tomas Henzl
2015-05-14  0:12 ` [PATCH 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq rajinikanth.pandurangan
2015-05-15  2:57   ` Mahesh Rajashekhara
2015-05-27 14:45   ` Tomas Henzl
2015-05-14  0:12 ` [PATCH 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend rajinikanth.pandurangan
2015-05-15  2:57   ` Mahesh Rajashekhara
2015-05-27 14:45   ` Tomas Henzl
2015-05-14  0:12 ` [PATCH 8/9] [SCSI] aacraid: Send commit-config to controller firmware rajinikanth.pandurangan
2015-05-15  2:57   ` Mahesh Rajashekhara
2015-05-14  0:12 ` [PATCH 9/9] [SCSI] aacraid: Update driver version rajinikanth.pandurangan
2015-05-15  2:58   ` Mahesh Rajashekhara

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