All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-10  2:34 ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-10  2:34 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
Happen.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   53 +++++++++++++++++++----------------
 drivers/scsi/megaraid/megaraid_sas.h |   27 +++++++++++++++--
 2 files changed, 52 insertions(+), 28 deletions(-)

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:32:43.000000000 -0400
@@ -164,7 +164,7 @@ megasas_return_cmd(struct megasas_instan
 static inline void
 megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs)
 {
-	writel(1, &(regs)->outbound_intr_mask);
+	writel(0, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -200,24 +200,27 @@ static int 
 megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_OB_INTR_STATUS_MASK)) {
-		return 1;
-	}
+	if (status & MFI_OB_INTR_STATUS_MASK)
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	if (status & MFI_XSCALE_OMR0_CHANGE_INTERRUPT)
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_intr_status);
+	if (mfiStatus)
+		writel(status, &regs->outbound_intr_status);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 
 /**
@@ -264,7 +267,7 @@ megasas_enable_intr_ppc(struct megasas_r
 {
 	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
     
-	writel(~0x80000004, &(regs)->outbound_intr_mask);
+	writel(~0x80000000, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -307,7 +310,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_REPLY_1078_MESSAGE_INTERRUPT)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -318,7 +321,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_doorbell_clear);
 
-	return 0;
+	return 1;
 }
 /**
  * megasas_fire_cmd_ppc -	Sends command to the FW
@@ -397,7 +400,7 @@ megasas_clear_intr_skinny(struct megasas
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_SKINNY_ENABLE_INTERRUPT_MASK)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -410,7 +413,7 @@ megasas_clear_intr_skinny(struct megasas
 	*/
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return 1;
 }
 
 /**
@@ -425,12 +428,9 @@ megasas_fire_cmd_skinny(struct megasas_i
 			u32 frame_count,
 			struct megasas_register_set __iomem *regs)
 {
-	unsigned long flags;
-	spin_lock_irqsave(&instance->fire_lock, flags);
 	writel(0, &(regs)->inbound_high_queue_port);
 	writel((frame_phys_addr | (frame_count<<1))|1,
 		&(regs)->inbound_low_queue_port);
-	spin_unlock_irqrestore(&instance->fire_lock, flags);
 }
 
 static struct megasas_instance_template megasas_instance_template_skinny = {
@@ -495,23 +495,29 @@ static int
 megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK))
-		return 1;
+	if (status & MFI_GEN2_ENABLE_INTERRUPT_MASK) {
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	}
+	if (status & MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT) {
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	}
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_doorbell_clear);
+	if (mfiStatus)
+		writel(status, &regs->outbound_doorbell_clear);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 /**
  * megasas_fire_cmd_gen2 -     Sends command to the FW
@@ -540,7 +546,7 @@ static struct megasas_instance_template 
 
 /**
 *	This is the end of set of functions & definitions
-* 	specific to ppc (deviceid : 0x60) controllers
+*       specific to gen2 (deviceid : 0x78, 0x79) controllers
 */
 
 /**
@@ -599,8 +605,7 @@ megasas_issue_blocked_cmd(struct megasas
 	instance->instancet->fire_cmd(instance,
 			cmd->frame_phys_addr, 0, instance->reg_set);
 
-	wait_event_timeout(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->int_cmd_wait_q, cmd->cmd_status != ENODATA);
 
 	return 0;
 }
@@ -648,8 +653,8 @@ megasas_issue_blocked_abort_cmd(struct m
 	/*
 	 * Wait for this cmd to complete
 	 */
-	wait_event_timeout(instance->abort_cmd_wait_q, (cmd->cmd_status != 0xFF),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->abort_cmd_wait_q, cmd->cmd_status != 0xFF);
+	cmd->sync_cmd = 0;
 
 	megasas_return_cmd(instance, cmd);
 	return 0;
@@ -3137,7 +3142,7 @@ megasas_probe_one(struct pci_dev *pdev, 
 	init_waitqueue_head(&instance->abort_cmd_wait_q);
 
 	spin_lock_init(&instance->cmd_pool_lock);
-	spin_lock_init(&instance->fire_lock);
+	spin_lock_init(&instance->hba_lock);
 	spin_lock_init(&instance->completion_lock);
 	spin_lock_init(&poll_aen_lock);
 
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:24:50.000000000 -0400
@@ -73,6 +73,12 @@
  * HOTPLUG	: Resume from Hotplug
  * MFI_STOP_ADP	: Send signal to FW to stop processing
  */
+#define WRITE_SEQUENCE_OFFSET		(0x0000000FC) /* I20 */
+#define HOST_DIAGNOSTIC_OFFSET		(0x000000F8)  /* I20 */
+#define DIAG_WRITE_ENABLE			(0x00000080)
+#define DIAG_RESET_ADAPTER			(0x00000004)
+
+#define MFI_ADP_RESET				0x00000040
 #define MFI_INIT_ABORT				0x00000001
 #define MFI_INIT_READY				0x00000002
 #define MFI_INIT_MFIMODE			0x00000004
@@ -704,6 +710,12 @@ struct megasas_ctrl_info {
  */
 #define IS_DMA64				(sizeof(dma_addr_t) == 8)
 
+#define MFI_XSCALE_OMR0_CHANGE_INTERRUPT		0x00000001
+
+#define MFI_INTR_FLAG_REPLY_MESSAGE			0x00000001
+#define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE		0x00000002
+#define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT	0x00000004
+
 #define MFI_OB_INTR_STATUS_MASK			0x00000002
 #define MFI_POLL_TIMEOUT_SECS			60
 #define MEGASAS_COMPLETION_TIMER_INTERVAL      (HZ/10)
@@ -714,6 +726,9 @@ struct megasas_ctrl_info {
 #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT	0x40000000
 #define MFI_SKINNY_ENABLE_INTERRUPT_MASK	(0x00000001)
 
+#define MFI_1068_PCSR_OFFSET			0x84
+#define MFI_1068_FW_HANDSHAKE_OFFSET		0x64
+#define MFI_1068_FW_READY			0xDDDD0000
 /*
 * register set for both 1068 and 1078 controllers
 * structure extended for 1078 registers
@@ -755,8 +770,10 @@ struct megasas_register_set {
 	u32 	inbound_high_queue_port ;	/*00C4h*/
 
 	u32 	reserved_5;			/*00C8h*/
-	u32 	index_registers[820];		/*00CCh*/
-
+	u32	res_6[11];			/*CCh*/
+	u32	host_diag;
+	u32	seq_offset;
+	u32 	index_registers[807];		/*00CCh*/
 } __attribute__ ((packed));
 
 struct megasas_sge32 {
@@ -1226,11 +1243,12 @@ struct megasas_instance {
 
 	struct megasas_cmd **cmd_list;
 	struct list_head cmd_pool;
+	/* used to sync fire the cmd to fw */
 	spinlock_t cmd_pool_lock;
+	/* used to sync fire the cmd to fw */
+	spinlock_t hba_lock;
 	/* used to synch producer, consumer ptrs in dpc */
 	spinlock_t completion_lock;
-	/* used to sync fire the cmd to fw */
-	spinlock_t fire_lock;
 	struct dma_pool *frame_dma_pool;
 	struct dma_pool *sense_dma_pool;
 
@@ -1257,6 +1275,7 @@ struct megasas_instance {
 	u8 flag;
 	u8 unload;
 	u8 flag_ieee;
+	u8 adprecovery;
 	unsigned long last_time;
 
 	struct timer_list io_completion_timer; 

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

* [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-10  2:34 ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-10  2:34 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
Happen.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   53 +++++++++++++++++++----------------
 drivers/scsi/megaraid/megaraid_sas.h |   27 +++++++++++++++--
 2 files changed, 52 insertions(+), 28 deletions(-)

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:32:43.000000000 -0400
@@ -164,7 +164,7 @@ megasas_return_cmd(struct megasas_instan
 static inline void
 megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs)
 {
-	writel(1, &(regs)->outbound_intr_mask);
+	writel(0, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -200,24 +200,27 @@ static int 
 megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_OB_INTR_STATUS_MASK)) {
-		return 1;
-	}
+	if (status & MFI_OB_INTR_STATUS_MASK)
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	if (status & MFI_XSCALE_OMR0_CHANGE_INTERRUPT)
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_intr_status);
+	if (mfiStatus)
+		writel(status, &regs->outbound_intr_status);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 
 /**
@@ -264,7 +267,7 @@ megasas_enable_intr_ppc(struct megasas_r
 {
 	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
     
-	writel(~0x80000004, &(regs)->outbound_intr_mask);
+	writel(~0x80000000, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -307,7 +310,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_REPLY_1078_MESSAGE_INTERRUPT)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -318,7 +321,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_doorbell_clear);
 
-	return 0;
+	return 1;
 }
 /**
  * megasas_fire_cmd_ppc -	Sends command to the FW
@@ -397,7 +400,7 @@ megasas_clear_intr_skinny(struct megasas
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_SKINNY_ENABLE_INTERRUPT_MASK)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -410,7 +413,7 @@ megasas_clear_intr_skinny(struct megasas
 	*/
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return 1;
 }
 
 /**
@@ -425,12 +428,9 @@ megasas_fire_cmd_skinny(struct megasas_i
 			u32 frame_count,
 			struct megasas_register_set __iomem *regs)
 {
-	unsigned long flags;
-	spin_lock_irqsave(&instance->fire_lock, flags);
 	writel(0, &(regs)->inbound_high_queue_port);
 	writel((frame_phys_addr | (frame_count<<1))|1,
 		&(regs)->inbound_low_queue_port);
-	spin_unlock_irqrestore(&instance->fire_lock, flags);
 }
 
 static struct megasas_instance_template megasas_instance_template_skinny = {
@@ -495,23 +495,29 @@ static int
 megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK))
-		return 1;
+	if (status & MFI_GEN2_ENABLE_INTERRUPT_MASK) {
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	}
+	if (status & MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT) {
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	}
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_doorbell_clear);
+	if (mfiStatus)
+		writel(status, &regs->outbound_doorbell_clear);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 /**
  * megasas_fire_cmd_gen2 -     Sends command to the FW
@@ -540,7 +546,7 @@ static struct megasas_instance_template 
 
 /**
 *	This is the end of set of functions & definitions
-* 	specific to ppc (deviceid : 0x60) controllers
+*       specific to gen2 (deviceid : 0x78, 0x79) controllers
 */
 
 /**
@@ -599,8 +605,7 @@ megasas_issue_blocked_cmd(struct megasas
 	instance->instancet->fire_cmd(instance,
 			cmd->frame_phys_addr, 0, instance->reg_set);
 
-	wait_event_timeout(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->int_cmd_wait_q, cmd->cmd_status != ENODATA);
 
 	return 0;
 }
@@ -648,8 +653,8 @@ megasas_issue_blocked_abort_cmd(struct m
 	/*
 	 * Wait for this cmd to complete
 	 */
-	wait_event_timeout(instance->abort_cmd_wait_q, (cmd->cmd_status != 0xFF),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->abort_cmd_wait_q, cmd->cmd_status != 0xFF);
+	cmd->sync_cmd = 0;
 
 	megasas_return_cmd(instance, cmd);
 	return 0;
@@ -3137,7 +3142,7 @@ megasas_probe_one(struct pci_dev *pdev, 
 	init_waitqueue_head(&instance->abort_cmd_wait_q);
 
 	spin_lock_init(&instance->cmd_pool_lock);
-	spin_lock_init(&instance->fire_lock);
+	spin_lock_init(&instance->hba_lock);
 	spin_lock_init(&instance->completion_lock);
 	spin_lock_init(&poll_aen_lock);
 
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:24:50.000000000 -0400
@@ -73,6 +73,12 @@
  * HOTPLUG	: Resume from Hotplug
  * MFI_STOP_ADP	: Send signal to FW to stop processing
  */
+#define WRITE_SEQUENCE_OFFSET		(0x0000000FC) /* I20 */
+#define HOST_DIAGNOSTIC_OFFSET		(0x000000F8)  /* I20 */
+#define DIAG_WRITE_ENABLE			(0x00000080)
+#define DIAG_RESET_ADAPTER			(0x00000004)
+
+#define MFI_ADP_RESET				0x00000040
 #define MFI_INIT_ABORT				0x00000001
 #define MFI_INIT_READY				0x00000002
 #define MFI_INIT_MFIMODE			0x00000004
@@ -704,6 +710,12 @@ struct megasas_ctrl_info {
  */
 #define IS_DMA64				(sizeof(dma_addr_t) == 8)
 
+#define MFI_XSCALE_OMR0_CHANGE_INTERRUPT		0x00000001
+
+#define MFI_INTR_FLAG_REPLY_MESSAGE			0x00000001
+#define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE		0x00000002
+#define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT	0x00000004
+
 #define MFI_OB_INTR_STATUS_MASK			0x00000002
 #define MFI_POLL_TIMEOUT_SECS			60
 #define MEGASAS_COMPLETION_TIMER_INTERVAL      (HZ/10)
@@ -714,6 +726,9 @@ struct megasas_ctrl_info {
 #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT	0x40000000
 #define MFI_SKINNY_ENABLE_INTERRUPT_MASK	(0x00000001)
 
+#define MFI_1068_PCSR_OFFSET			0x84
+#define MFI_1068_FW_HANDSHAKE_OFFSET		0x64
+#define MFI_1068_FW_READY			0xDDDD0000
 /*
 * register set for both 1068 and 1078 controllers
 * structure extended for 1078 registers
@@ -755,8 +770,10 @@ struct megasas_register_set {
 	u32 	inbound_high_queue_port ;	/*00C4h*/
 
 	u32 	reserved_5;			/*00C8h*/
-	u32 	index_registers[820];		/*00CCh*/
-
+	u32	res_6[11];			/*CCh*/
+	u32	host_diag;
+	u32	seq_offset;
+	u32 	index_registers[807];		/*00CCh*/
 } __attribute__ ((packed));
 
 struct megasas_sge32 {
@@ -1226,11 +1243,12 @@ struct megasas_instance {
 
 	struct megasas_cmd **cmd_list;
 	struct list_head cmd_pool;
+	/* used to sync fire the cmd to fw */
 	spinlock_t cmd_pool_lock;
+	/* used to sync fire the cmd to fw */
+	spinlock_t hba_lock;
 	/* used to synch producer, consumer ptrs in dpc */
 	spinlock_t completion_lock;
-	/* used to sync fire the cmd to fw */
-	spinlock_t fire_lock;
 	struct dma_pool *frame_dma_pool;
 	struct dma_pool *sense_dma_pool;
 
@@ -1257,6 +1275,7 @@ struct megasas_instance {
 	u8 flag;
 	u8 unload;
 	u8 flag_ieee;
+	u8 adprecovery;
 	unsigned long last_time;
 
 	struct timer_list io_completion_timer; 

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

* Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I:  Enable Online Controller Reset Bit in register related functions
  2010-06-10  2:34 ` Yang, Bo
@ 2010-06-18 21:18   ` Yinghai Lu
  -1 siblings, 0 replies; 70+ messages in thread
From: Yinghai Lu @ 2010-06-18 21:18 UTC (permalink / raw)
  To: Yang, Bo
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> Happen.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>

This patch cause kernel hang just after
[  136.996297] megasas: FW now in Ready state

# lspci -vvxxx -s 01:00.0
01:00.0 RAID bus controller: LSI Logic / Symbios Logic LSI MegaSAS 9260 (rev 03)
	Subsystem: LSI Logic / Symbios Logic MegaRAID SAS 9262-8i
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+
Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 256 bytes
	Interrupt: pin A routed to IRQ 28
	Region 0: I/O ports at 1c00 [size=256]
	Region 1: Memory at aaefc000 (64-bit, non-prefetchable) [size=16K]
	Region 3: Memory at aae80000 (64-bit, non-prefetchable) [size=256K]
	Expansion ROM at aae40000 [disabled] [size=256K]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [68] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
		DevCtl:	Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ FLReset-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 5GT/s, Width x8, ASPM L0s, Latency L0 <64ns, L1 <1us
			ClockPM- Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 5GT/s, Width x4, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-,
Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance-
ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB
	Capabilities: [d0] Vital Product Data
pcilib: sysfs_read_vpd: read failed: Connection timed out
		Not readable
	Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [c0] MSI-X: Enable- Count=15 Masked-
		Vector table: BAR=1 offset=00002000
		PBA: BAR=1 offset=00003800
	Capabilities: [100] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [138] Power Budgeting <?>
	Kernel driver in use: megaraid_sas
00: 00 10 79 00 47 01 10 00 03 00 04 01 40 00 00 00
10: 01 1c 00 00 04 c0 ef aa 00 00 00 00 04 00 e8 aa
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 10 62 92
30: 00 00 e4 aa 50 00 00 00 00 00 00 00 0a 01 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 68 03 06 08 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 01 00 00 10 d0 02 00 25 80 00 10
70: 17 28 00 00 82 04 00 00 40 00 42 10 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00
90: 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 05 c0 80 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 11 00 0e 00 01 20 00 00 01 38 00 00 00 00 00 00
d0: 03 a8 ff 1f 82 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



YH

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

* Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-18 21:18   ` Yinghai Lu
  0 siblings, 0 replies; 70+ messages in thread
From: Yinghai Lu @ 2010-06-18 21:18 UTC (permalink / raw)
  To: Yang, Bo
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> Happen.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>

This patch cause kernel hang just after
[  136.996297] megasas: FW now in Ready state

# lspci -vvxxx -s 01:00.0
01:00.0 RAID bus controller: LSI Logic / Symbios Logic LSI MegaSAS 9260 (rev 03)
	Subsystem: LSI Logic / Symbios Logic MegaRAID SAS 9262-8i
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+
Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 256 bytes
	Interrupt: pin A routed to IRQ 28
	Region 0: I/O ports at 1c00 [size=256]
	Region 1: Memory at aaefc000 (64-bit, non-prefetchable) [size=16K]
	Region 3: Memory at aae80000 (64-bit, non-prefetchable) [size=256K]
	Expansion ROM at aae40000 [disabled] [size=256K]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [68] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
		DevCtl:	Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ FLReset-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 5GT/s, Width x8, ASPM L0s, Latency L0 <64ns, L1 <1us
			ClockPM- Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 5GT/s, Width x4, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-,
Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance-
ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB
	Capabilities: [d0] Vital Product Data
pcilib: sysfs_read_vpd: read failed: Connection timed out
		Not readable
	Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [c0] MSI-X: Enable- Count=15 Masked-
		Vector table: BAR=1 offset=00002000
		PBA: BAR=1 offset=00003800
	Capabilities: [100] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [138] Power Budgeting <?>
	Kernel driver in use: megaraid_sas
00: 00 10 79 00 47 01 10 00 03 00 04 01 40 00 00 00
10: 01 1c 00 00 04 c0 ef aa 00 00 00 00 04 00 e8 aa
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 10 62 92
30: 00 00 e4 aa 50 00 00 00 00 00 00 00 0a 01 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 68 03 06 08 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 01 00 00 10 d0 02 00 25 80 00 10
70: 17 28 00 00 82 04 00 00 40 00 42 10 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00
90: 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 05 c0 80 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 11 00 0e 00 01 20 00 00 01 38 00 00 00 00 00 00
d0: 03 a8 ff 1f 82 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



YH

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-18 21:18   ` Yinghai Lu
@ 2010-06-18 21:21     ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-18 21:21 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

Yinghai,

You need to apply patches 1/12 to 8/12 for this online controller reset (OCR) support.

Regards,

Bo Yang

-----Original Message-----
From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of Yinghai Lu
Sent: Friday, June 18, 2010 5:19 PM
To: Yang, Bo
Cc: James.Bottomley@HansenPartnership.com; James.Bottomley@suse.de; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> Happen.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>

This patch cause kernel hang just after
[  136.996297] megasas: FW now in Ready state

# lspci -vvxxx -s 01:00.0
01:00.0 RAID bus controller: LSI Logic / Symbios Logic LSI MegaSAS 9260 (rev 03)
	Subsystem: LSI Logic / Symbios Logic MegaRAID SAS 9262-8i
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+
Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 256 bytes
	Interrupt: pin A routed to IRQ 28
	Region 0: I/O ports at 1c00 [size=256]
	Region 1: Memory at aaefc000 (64-bit, non-prefetchable) [size=16K]
	Region 3: Memory at aae80000 (64-bit, non-prefetchable) [size=256K]
	Expansion ROM at aae40000 [disabled] [size=256K]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [68] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
		DevCtl:	Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ FLReset-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 5GT/s, Width x8, ASPM L0s, Latency L0 <64ns, L1 <1us
			ClockPM- Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 5GT/s, Width x4, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-,
Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance-
ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB
	Capabilities: [d0] Vital Product Data
pcilib: sysfs_read_vpd: read failed: Connection timed out
		Not readable
	Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [c0] MSI-X: Enable- Count=15 Masked-
		Vector table: BAR=1 offset=00002000
		PBA: BAR=1 offset=00003800
	Capabilities: [100] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [138] Power Budgeting <?>
	Kernel driver in use: megaraid_sas
00: 00 10 79 00 47 01 10 00 03 00 04 01 40 00 00 00
10: 01 1c 00 00 04 c0 ef aa 00 00 00 00 04 00 e8 aa
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 10 62 92
30: 00 00 e4 aa 50 00 00 00 00 00 00 00 0a 01 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 68 03 06 08 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 01 00 00 10 d0 02 00 25 80 00 10
70: 17 28 00 00 82 04 00 00 40 00 42 10 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00
90: 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 05 c0 80 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 11 00 0e 00 01 20 00 00 01 38 00 00 00 00 00 00
d0: 03 a8 ff 1f 82 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



YH

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-18 21:21     ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-18 21:21 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

Yinghai,

You need to apply patches 1/12 to 8/12 for this online controller reset (OCR) support.

Regards,

Bo Yang

-----Original Message-----
From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of Yinghai Lu
Sent: Friday, June 18, 2010 5:19 PM
To: Yang, Bo
Cc: James.Bottomley@HansenPartnership.com; James.Bottomley@suse.de; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> Happen.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>

This patch cause kernel hang just after
[  136.996297] megasas: FW now in Ready state

# lspci -vvxxx -s 01:00.0
01:00.0 RAID bus controller: LSI Logic / Symbios Logic LSI MegaSAS 9260 (rev 03)
	Subsystem: LSI Logic / Symbios Logic MegaRAID SAS 9262-8i
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+
Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 256 bytes
	Interrupt: pin A routed to IRQ 28
	Region 0: I/O ports at 1c00 [size=256]
	Region 1: Memory at aaefc000 (64-bit, non-prefetchable) [size=16K]
	Region 3: Memory at aae80000 (64-bit, non-prefetchable) [size=256K]
	Expansion ROM at aae40000 [disabled] [size=256K]
	Capabilities: [50] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [68] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
		DevCtl:	Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ FLReset-
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
		LnkCap:	Port #0, Speed 5GT/s, Width x8, ASPM L0s, Latency L0 <64ns, L1 <1us
			ClockPM- Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 5GT/s, Width x4, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range BC, TimeoutDis+
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-,
Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance-
ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB
	Capabilities: [d0] Vital Product Data
pcilib: sysfs_read_vpd: read failed: Connection timed out
		Not readable
	Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [c0] MSI-X: Enable- Count=15 Masked-
		Vector table: BAR=1 offset=00002000
		PBA: BAR=1 offset=00003800
	Capabilities: [100] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [138] Power Budgeting <?>
	Kernel driver in use: megaraid_sas
00: 00 10 79 00 47 01 10 00 03 00 04 01 40 00 00 00
10: 01 1c 00 00 04 c0 ef aa 00 00 00 00 04 00 e8 aa
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 10 62 92
30: 00 00 e4 aa 50 00 00 00 00 00 00 00 0a 01 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 01 68 03 06 08 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 01 00 00 10 d0 02 00 25 80 00 10
70: 17 28 00 00 82 04 00 00 40 00 42 10 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00
90: 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 05 c0 80 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 11 00 0e 00 01 20 00 00 01 38 00 00 00 00 00 00
d0: 03 a8 ff 1f 82 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



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

* Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I:  Enable Online Controller Reset Bit in register related functions
  2010-06-18 21:21     ` Yang, Bo
@ 2010-06-18 21:37       ` Yinghai Lu
  -1 siblings, 0 replies; 70+ messages in thread
From: Yinghai Lu @ 2010-06-18 21:37 UTC (permalink / raw)
  To: Yang, Bo
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

On Fri, Jun 18, 2010 at 2:21 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Yinghai,
>
> You need to apply patches 1/12 to 8/12 for this online controller reset (OCR) support.

current scsi-next only have

commit 6faad24ad989798475e9ab4a2a809008fff6e872
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:34:43 2010 -0600

    [SCSI] megaraid_sas: Enable Online Controller Reset Bit in
register related functions


commit 4f3a268eca4e7073d315e7f9b0a4dc94a38da560
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:51:48 2010 -0600

    [SCSI] megaraid_sas: Add the Chip reset functions to the driver

commit baf13c9440869a55d2493190dbc68c2bb165dad5
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:59:43 2010 -0600

    [SCSI] megaraid_sas: add the reset function for Gen2 related chip

commit 449ee85225f9f41f2475f16b41d035000c8ee395
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 21:25:17 2010 -0600

    [SCSI] megaraid_sas: return RESET in timeout routine



so looks like James didn't put
[PATCH 8/12] scsi: megaraid_sas - Online Controller Reset (OCR):
Driver re-issue the pending cmds to FW

in the tree yet.

or your patchset will break the bisecting?

Thanks

Yinghai

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

* Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-18 21:37       ` Yinghai Lu
  0 siblings, 0 replies; 70+ messages in thread
From: Yinghai Lu @ 2010-06-18 21:37 UTC (permalink / raw)
  To: Yang, Bo
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

On Fri, Jun 18, 2010 at 2:21 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Yinghai,
>
> You need to apply patches 1/12 to 8/12 for this online controller reset (OCR) support.

current scsi-next only have

commit 6faad24ad989798475e9ab4a2a809008fff6e872
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:34:43 2010 -0600

    [SCSI] megaraid_sas: Enable Online Controller Reset Bit in
register related functions


commit 4f3a268eca4e7073d315e7f9b0a4dc94a38da560
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:51:48 2010 -0600

    [SCSI] megaraid_sas: Add the Chip reset functions to the driver

commit baf13c9440869a55d2493190dbc68c2bb165dad5
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:59:43 2010 -0600

    [SCSI] megaraid_sas: add the reset function for Gen2 related chip

commit 449ee85225f9f41f2475f16b41d035000c8ee395
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 21:25:17 2010 -0600

    [SCSI] megaraid_sas: return RESET in timeout routine



so looks like James didn't put
[PATCH 8/12] scsi: megaraid_sas - Online Controller Reset (OCR):
Driver re-issue the pending cmds to FW

in the tree yet.

or your patchset will break the bisecting?

Thanks

Yinghai

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-18 21:37       ` Yinghai Lu
@ 2010-06-18 21:56         ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-18 21:56 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

Thanks, Yinghai.  It is possible James didn't push (patches 5-12) yet.

Regards,

Bo Yang

-----Original Message-----
From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of Yinghai Lu
Sent: Friday, June 18, 2010 5:37 PM
To: Yang, Bo
Cc: James.Bottomley@HansenPartnership.com; James.Bottomley@suse.de; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, Jun 18, 2010 at 2:21 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Yinghai,
>
> You need to apply patches 1/12 to 8/12 for this online controller reset (OCR) support.

current scsi-next only have

commit 6faad24ad989798475e9ab4a2a809008fff6e872
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:34:43 2010 -0600

    [SCSI] megaraid_sas: Enable Online Controller Reset Bit in
register related functions


commit 4f3a268eca4e7073d315e7f9b0a4dc94a38da560
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:51:48 2010 -0600

    [SCSI] megaraid_sas: Add the Chip reset functions to the driver

commit baf13c9440869a55d2493190dbc68c2bb165dad5
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:59:43 2010 -0600

    [SCSI] megaraid_sas: add the reset function for Gen2 related chip

commit 449ee85225f9f41f2475f16b41d035000c8ee395
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 21:25:17 2010 -0600

    [SCSI] megaraid_sas: return RESET in timeout routine



so looks like James didn't put
[PATCH 8/12] scsi: megaraid_sas - Online Controller Reset (OCR):
Driver re-issue the pending cmds to FW

in the tree yet.

or your patchset will break the bisecting?

Thanks

Yinghai

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-18 21:56         ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-18 21:56 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: James.Bottomley@HansenPartnership.com, James.Bottomley,
	linux-scsi, akpm, linux-kernel

Thanks, Yinghai.  It is possible James didn't push (patches 5-12) yet.

Regards,

Bo Yang

-----Original Message-----
From: yhlu.kernel@gmail.com [mailto:yhlu.kernel@gmail.com] On Behalf Of Yinghai Lu
Sent: Friday, June 18, 2010 5:37 PM
To: Yang, Bo
Cc: James.Bottomley@HansenPartnership.com; James.Bottomley@suse.de; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, Jun 18, 2010 at 2:21 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> Yinghai,
>
> You need to apply patches 1/12 to 8/12 for this online controller reset (OCR) support.

current scsi-next only have

commit 6faad24ad989798475e9ab4a2a809008fff6e872
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:34:43 2010 -0600

    [SCSI] megaraid_sas: Enable Online Controller Reset Bit in
register related functions


commit 4f3a268eca4e7073d315e7f9b0a4dc94a38da560
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:51:48 2010 -0600

    [SCSI] megaraid_sas: Add the Chip reset functions to the driver

commit baf13c9440869a55d2493190dbc68c2bb165dad5
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 20:59:43 2010 -0600

    [SCSI] megaraid_sas: add the reset function for Gen2 related chip

commit 449ee85225f9f41f2475f16b41d035000c8ee395
Author: Yang, Bo <Bo.Yang@lsi.com>
Date:   Wed Jun 9 21:25:17 2010 -0600

    [SCSI] megaraid_sas: return RESET in timeout routine



so looks like James didn't put
[PATCH 8/12] scsi: megaraid_sas - Online Controller Reset (OCR):
Driver re-issue the pending cmds to FW

in the tree yet.

or your patchset will break the bisecting?

Thanks

Yinghai

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-18 21:56         ` Yang, Bo
  (?)
@ 2010-06-20 14:54         ` James Bottomley
  -1 siblings, 0 replies; 70+ messages in thread
From: James Bottomley @ 2010-06-20 14:54 UTC (permalink / raw)
  To: Yang, Bo; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

On Fri, 2010-06-18 at 15:56 -0600, Yang, Bo wrote:
> Thanks, Yinghai.  It is possible James didn't push (patches 5-12) yet.

Well, that was because of the compile failure.

However, we can't have a sequence of patches that hangs the controller
in the middle because, as has already been pointed out, that breaks
bisectability too.  It's just lacking the hardware, I can't check for
that particular problem.

What grouping do these 12 patches have to be applied in to get a working
controller in between them?

James



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

* Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-18 21:18   ` Yinghai Lu
  (?)
  (?)
@ 2010-06-20 15:01   ` James Bottomley
  2010-06-20 19:27       ` Yang, Bo
  -1 siblings, 1 reply; 70+ messages in thread
From: James Bottomley @ 2010-06-20 15:01 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Yang, Bo, linux-scsi, akpm, linux-kernel

On Fri, 2010-06-18 at 14:18 -0700, Yinghai Lu wrote:
> On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> > Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> > The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> > Happen.
> >
> > Signed-off-by Bo Yang<bo.yang@lsi.com>
> 
> This patch cause kernel hang just after
> [  136.996297] megasas: FW now in Ready state

OK, I dropped all the megaraid_sas patches for now ... I'll reapply once
we get the bisection intervals sorted out.

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 15:01   ` James Bottomley
@ 2010-06-20 19:27       ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-20 19:27 UTC (permalink / raw)
  To: James Bottomley, Yinghai Lu; +Cc: linux-scsi, akpm, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1316 bytes --]

James,

The online controller reset (OCR) need to apply [Patch 1/12  --  patch 8/12].  I already submitted all of them.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 11:01 AM
To: Yinghai Lu
Cc: Yang, Bo; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-06-18 at 14:18 -0700, Yinghai Lu wrote:
> On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> > Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> > The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> > Happen.
> >
> > Signed-off-by Bo Yang<bo.yang@lsi.com>
> 
> This patch cause kernel hang just after
> [  136.996297] megasas: FW now in Ready state

OK, I dropped all the megaraid_sas patches for now ... I'll reapply once
we get the bisection intervals sorted out.

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-20 19:27       ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-20 19:27 UTC (permalink / raw)
  To: James Bottomley, Yinghai Lu; +Cc: linux-scsi, akpm, linux-kernel

James,

The online controller reset (OCR) need to apply [Patch 1/12  --  patch 8/12].  I already submitted all of them.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 11:01 AM
To: Yinghai Lu
Cc: Yang, Bo; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-06-18 at 14:18 -0700, Yinghai Lu wrote:
> On Wed, Jun 9, 2010 at 7:34 PM, Yang, Bo <Bo.Yang@lsi.com> wrote:
> > Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
> > The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
> > Happen.
> >
> > Signed-off-by Bo Yang<bo.yang@lsi.com>
> 
> This patch cause kernel hang just after
> [  136.996297] megasas: FW now in Ready state

OK, I dropped all the megaraid_sas patches for now ... I'll reapply once
we get the bisection intervals sorted out.

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 19:27       ` Yang, Bo
  (?)
@ 2010-06-20 19:47       ` James Bottomley
  2010-06-20 20:19           ` Yang, Bo
  -1 siblings, 1 reply; 70+ messages in thread
From: James Bottomley @ 2010-06-20 19:47 UTC (permalink / raw)
  To: Yang, Bo; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

On Sun, 2010-06-20 at 13:27 -0600, Yang, Bo wrote:
> The online controller reset (OCR) need to apply [Patch 1/12  --  patch
> 8/12].  I already submitted all of them.

So 1-8 have to be done as a single commit and 9-12 can apply
individually?

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 19:47       ` James Bottomley
@ 2010-06-20 20:19           ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-20 20:19 UTC (permalink / raw)
  To: James Bottomley; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 809 bytes --]

James,

Yes.  

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 3:48 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 13:27 -0600, Yang, Bo wrote:
> The online controller reset (OCR) need to apply [Patch 1/12  --  patch
> 8/12].  I already submitted all of them.

So 1-8 have to be done as a single commit and 9-12 can apply
individually?

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-20 20:19           ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-20 20:19 UTC (permalink / raw)
  To: James Bottomley; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

James,

Yes.  

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 3:48 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 13:27 -0600, Yang, Bo wrote:
> The online controller reset (OCR) need to apply [Patch 1/12  --  patch
> 8/12].  I already submitted all of them.

So 1-8 have to be done as a single commit and 9-12 can apply
individually?

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 20:19           ` Yang, Bo
  (?)
@ 2010-06-20 20:48           ` James Bottomley
  2010-06-21 15:35               ` Yang, Bo
                               ` (2 more replies)
  -1 siblings, 3 replies; 70+ messages in thread
From: James Bottomley @ 2010-06-20 20:48 UTC (permalink / raw)
  To: Yang, Bo; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 20:48           ` James Bottomley
@ 2010-06-21 15:35               ` Yang, Bo
  2010-07-20 13:08               ` Yang, Bo
  2010-07-30 18:53               ` Yang, Bo
  2 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-21 15:35 UTC (permalink / raw)
  To: James Bottomley; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2553 bytes --]

James,

Attached is the changelog for OCR. 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:41:31.000000000 -0400
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:55:42.000000000 -0400
@@ -1,3 +1,36 @@
+1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.17.1-rc1
+
+1.	Add the Online Controller Reset (OCR) to the Driver.
+	OCR is the new feature for megaraid_sas driver which
+	will allow the fw to do the chip reset which will not
+	affact the OS behavious.
+
+	To add the OCR support, driver need to do: 
+		a). reset the controller chips -- Xscale and Gen2 which
+		will change the function calls and add the reset function
+		related to this two chips.
+		
+		b). during the reset, driver will store the pending cmds
+		which not returned by FW to driver's pending queue.  Driver
+		will re-issue those pending cmds again to FW after the OCR
+		finished.
+		
+		c). In driver's timeout routine, driver will report to
+		OS as reset. Also driver's queue routine will block the
+		cmds until the OCR finished.
+		
+		d). in Driver's ISR routine, if driver get the FW state as
+		state change, FW in Failure status and FW support online controller
+		reset (OCR), driver will start to do the controller reset.
+		
+		e). In driver's IOCTL routine, the application cmds will wait for the
+		OCR to finish, then issue the cmds to FW.
+		 
 1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang


-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-06-21 15:35               ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-06-21 15:35 UTC (permalink / raw)
  To: James Bottomley; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

James,

Attached is the changelog for OCR. 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:41:31.000000000 -0400
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:55:42.000000000 -0400
@@ -1,3 +1,36 @@
+1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.17.1-rc1
+
+1.	Add the Online Controller Reset (OCR) to the Driver.
+	OCR is the new feature for megaraid_sas driver which
+	will allow the fw to do the chip reset which will not
+	affact the OS behavious.
+
+	To add the OCR support, driver need to do: 
+		a). reset the controller chips -- Xscale and Gen2 which
+		will change the function calls and add the reset function
+		related to this two chips.
+		
+		b). during the reset, driver will store the pending cmds
+		which not returned by FW to driver's pending queue.  Driver
+		will re-issue those pending cmds again to FW after the OCR
+		finished.
+		
+		c). In driver's timeout routine, driver will report to
+		OS as reset. Also driver's queue routine will block the
+		cmds until the OCR finished.
+		
+		d). in Driver's ISR routine, if driver get the FW state as
+		state change, FW in Failure status and FW support online controller
+		reset (OCR), driver will start to do the controller reset.
+		
+		e). In driver's IOCTL routine, the application cmds will wait for the
+		OCR to finish, then issue the cmds to FW.
+		 
 1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang


-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 20:48           ` James Bottomley
@ 2010-07-20 13:08               ` Yang, Bo
  2010-07-20 13:08               ` Yang, Bo
  2010-07-30 18:53               ` Yang, Bo
  2 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-07-20 13:08 UTC (permalink / raw)
  To: Yang, Bo, James Bottomley; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2992 bytes --]

James,

Do you get chances to view this changes and apply the patches to the main tree?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Monday, June 21, 2010 11:36 AM
To: 'James Bottomley'
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Attached is the changelog for OCR. 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:41:31.000000000 -0400
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:55:42.000000000 -0400
@@ -1,3 +1,36 @@
+1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.17.1-rc1
+
+1.	Add the Online Controller Reset (OCR) to the Driver.
+	OCR is the new feature for megaraid_sas driver which
+	will allow the fw to do the chip reset which will not
+	affact the OS behavious.
+
+	To add the OCR support, driver need to do: 
+		a). reset the controller chips -- Xscale and Gen2 which
+		will change the function calls and add the reset function
+		related to this two chips.
+		
+		b). during the reset, driver will store the pending cmds
+		which not returned by FW to driver's pending queue.  Driver
+		will re-issue those pending cmds again to FW after the OCR
+		finished.
+		
+		c). In driver's timeout routine, driver will report to
+		OS as reset. Also driver's queue routine will block the
+		cmds until the OCR finished.
+		
+		d). in Driver's ISR routine, if driver get the FW state as
+		state change, FW in Failure status and FW support online controller
+		reset (OCR), driver will start to do the controller reset.
+		
+		e). In driver's IOCTL routine, the application cmds will wait for the
+		OCR to finish, then issue the cmds to FW.
+		 
 1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang


-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-07-20 13:08               ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-07-20 13:08 UTC (permalink / raw)
  To: Yang, Bo, James Bottomley; +Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel

James,

Do you get chances to view this changes and apply the patches to the main tree?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Monday, June 21, 2010 11:36 AM
To: 'James Bottomley'
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Attached is the changelog for OCR. 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:41:31.000000000 -0400
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:55:42.000000000 -0400
@@ -1,3 +1,36 @@
+1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.17.1-rc1
+
+1.	Add the Online Controller Reset (OCR) to the Driver.
+	OCR is the new feature for megaraid_sas driver which
+	will allow the fw to do the chip reset which will not
+	affact the OS behavious.
+
+	To add the OCR support, driver need to do: 
+		a). reset the controller chips -- Xscale and Gen2 which
+		will change the function calls and add the reset function
+		related to this two chips.
+		
+		b). during the reset, driver will store the pending cmds
+		which not returned by FW to driver's pending queue.  Driver
+		will re-issue those pending cmds again to FW after the OCR
+		finished.
+		
+		c). In driver's timeout routine, driver will report to
+		OS as reset. Also driver's queue routine will block the
+		cmds until the OCR finished.
+		
+		d). in Driver's ISR routine, if driver get the FW state as
+		state change, FW in Failure status and FW support online controller
+		reset (OCR), driver will start to do the controller reset.
+		
+		e). In driver's IOCTL routine, the application cmds will wait for the
+		OCR to finish, then issue the cmds to FW.
+		 
 1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang


-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-20 20:48           ` James Bottomley
@ 2010-07-30 18:53               ` Yang, Bo
  2010-07-20 13:08               ` Yang, Bo
  2010-07-30 18:53               ` Yang, Bo
  2 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-07-30 18:53 UTC (permalink / raw)
  To: Yang, Bo, James Bottomley
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3441 bytes --]

James,

Do you know when those patches (12 patches) will be pushed to upstream?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Tuesday, July 20, 2010 9:08 AM
To: Yang, Bo; 'James Bottomley'
Cc: 'Yinghai Lu'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Do you get chances to view this changes and apply the patches to the main tree?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Monday, June 21, 2010 11:36 AM
To: 'James Bottomley'
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Attached is the changelog for OCR. 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:41:31.000000000 -0400
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:55:42.000000000 -0400
@@ -1,3 +1,36 @@
+1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.17.1-rc1
+
+1.	Add the Online Controller Reset (OCR) to the Driver.
+	OCR is the new feature for megaraid_sas driver which
+	will allow the fw to do the chip reset which will not
+	affact the OS behavious.
+
+	To add the OCR support, driver need to do: 
+		a). reset the controller chips -- Xscale and Gen2 which
+		will change the function calls and add the reset function
+		related to this two chips.
+		
+		b). during the reset, driver will store the pending cmds
+		which not returned by FW to driver's pending queue.  Driver
+		will re-issue those pending cmds again to FW after the OCR
+		finished.
+		
+		c). In driver's timeout routine, driver will report to
+		OS as reset. Also driver's queue routine will block the
+		cmds until the OCR finished.
+		
+		d). in Driver's ISR routine, if driver get the FW state as
+		state change, FW in Failure status and FW support online controller
+		reset (OCR), driver will start to do the controller reset.
+		
+		e). In driver's IOCTL routine, the application cmds will wait for the
+		OCR to finish, then issue the cmds to FW.
+		 
 1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang


-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-07-30 18:53               ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-07-30 18:53 UTC (permalink / raw)
  To: Yang, Bo, James Bottomley
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

James,

Do you know when those patches (12 patches) will be pushed to upstream?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Tuesday, July 20, 2010 9:08 AM
To: Yang, Bo; 'James Bottomley'
Cc: 'Yinghai Lu'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Do you get chances to view this changes and apply the patches to the main tree?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Monday, June 21, 2010 11:36 AM
To: 'James Bottomley'
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Attached is the changelog for OCR. 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:41:31.000000000 -0400
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-06-20 03:55:42.000000000 -0400
@@ -1,3 +1,36 @@
+1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.17.1-rc1
+3 Older Version   : 00.00.04.17.1-rc1
+
+1.	Add the Online Controller Reset (OCR) to the Driver.
+	OCR is the new feature for megaraid_sas driver which
+	will allow the fw to do the chip reset which will not
+	affact the OS behavious.
+
+	To add the OCR support, driver need to do: 
+		a). reset the controller chips -- Xscale and Gen2 which
+		will change the function calls and add the reset function
+		related to this two chips.
+		
+		b). during the reset, driver will store the pending cmds
+		which not returned by FW to driver's pending queue.  Driver
+		will re-issue those pending cmds again to FW after the OCR
+		finished.
+		
+		c). In driver's timeout routine, driver will report to
+		OS as reset. Also driver's queue routine will block the
+		cmds until the OCR finished.
+		
+		d). in Driver's ISR routine, if driver get the FW state as
+		state change, FW in Failure status and FW support online controller
+		reset (OCR), driver will start to do the controller reset.
+		
+		e). In driver's IOCTL routine, the application cmds will wait for the
+		OCR to finish, then issue the cmds to FW.
+		 
 1 Release Date    : Thur.  Oct 29, 2009 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang


-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Sun, 2010-06-20 at 14:19 -0600, Yang, Bo wrote:
> Yes.  

OK, can you give me the single changelog for this one commit, then,
please?

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-07-30 18:53               ` Yang, Bo
  (?)
@ 2010-07-31 17:46               ` James Bottomley
  2010-08-05 20:44                   ` Yang, Bo
                                   ` (2 more replies)
  -1 siblings, 3 replies; 70+ messages in thread
From: James Bottomley @ 2010-07-31 17:46 UTC (permalink / raw)
  To: Yang, Bo
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James



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

* [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-06-10  2:34 ` Yang, Bo
@ 2010-08-05 19:47   ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-05 19:47 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant

James Bottomley suggested me to resubmit those patches (12 patches).  First 8 patches should be downloaded together and them compile them.

Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
Happen.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   53 +++++++++++++++++++----------------
 drivers/scsi/megaraid/megarad_sas.h |   27 +++++++++++++++--
 2 files changed, 52 insertions(+), 28 deletions(-)

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:32:43.000000000 -0400
@@ -164,7 +164,7 @@ megasas_return_cmd(struct megasas_instan
 static inline void
 megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs)
 {
-	writel(1, &(regs)->outbound_intr_mask);
+	writel(0, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -200,24 +200,27 @@ static int 
 megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_OB_INTR_STATUS_MASK)) {
-		return 1;
-	}
+	if (status & MFI_OB_INTR_STATUS_MASK)
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	if (status & MFI_XSCALE_OMR0_CHANGE_INTERRUPT)
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_intr_status);
+	if (mfiStatus)
+		writel(status, &regs->outbound_intr_status);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 
 /**
@@ -264,7 +267,7 @@ megasas_enable_intr_ppc(struct megasas_r
 {
 	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
     
-	writel(~0x80000004, &(regs)->outbound_intr_mask);
+	writel(~0x80000000, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -307,7 +310,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_REPLY_1078_MESSAGE_INTERRUPT)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -318,7 +321,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_doorbell_clear);
 
-	return 0;
+	return 1;
 }
 /**
  * megasas_fire_cmd_ppc -	Sends command to the FW
@@ -397,7 +400,7 @@ megasas_clear_intr_skinny(struct megasas
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_SKINNY_ENABLE_INTERRUPT_MASK)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -410,7 +413,7 @@ megasas_clear_intr_skinny(struct megasas
 	*/
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return 1;
 }
 
 /**
@@ -425,12 +428,9 @@ megasas_fire_cmd_skinny(struct megasas_i
 			u32 frame_count,
 			struct megasas_register_set __iomem *regs)
 {
-	unsigned long flags;
-	spin_lock_irqsave(&instance->fire_lock, flags);
 	writel(0, &(regs)->inbound_high_queue_port);
 	writel((frame_phys_addr | (frame_count<<1))|1,
 		&(regs)->inbound_low_queue_port);
-	spin_unlock_irqrestore(&instance->fire_lock, flags);
 }
 
 static struct megasas_instance_template megasas_instance_template_skinny = {
@@ -495,23 +495,29 @@ static int
 megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK))
-		return 1;
+	if (status & MFI_GEN2_ENABLE_INTERRUPT_MASK) {
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	}
+	if (status & MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT) {
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	}
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_doorbell_clear);
+	if (mfiStatus)
+		writel(status, &regs->outbound_doorbell_clear);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 /**
  * megasas_fire_cmd_gen2 -     Sends command to the FW
@@ -540,7 +546,7 @@ static struct megasas_instance_template 
 
 /**
 *	This is the end of set of functions & definitions
-* 	specific to ppc (deviceid : 0x60) controllers
+*       specific to gen2 (deviceid : 0x78, 0x79) controllers
 */
 
 /**
@@ -599,8 +605,7 @@ megasas_issue_blocked_cmd(struct megasas
 	instance->instancet->fire_cmd(instance,
 			cmd->frame_phys_addr, 0, instance->reg_set);
 
-	wait_event_timeout(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->int_cmd_wait_q, cmd->cmd_status != ENODATA);
 
 	return 0;
 }
@@ -648,8 +653,8 @@ megasas_issue_blocked_abort_cmd(struct m
 	/*
 	 * Wait for this cmd to complete
 	 */
-	wait_event_timeout(instance->abort_cmd_wait_q, (cmd->cmd_status != 0xFF),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->abort_cmd_wait_q, cmd->cmd_status != 0xFF);
+	cmd->sync_cmd = 0;
 
 	megasas_return_cmd(instance, cmd);
 	return 0;
@@ -3137,7 +3142,7 @@ megasas_probe_one(struct pci_dev *pdev, 
 	init_waitqueue_head(&instance->abort_cmd_wait_q);
 
 	spin_lock_init(&instance->cmd_pool_lock);
-	spin_lock_init(&instance->fire_lock);
+	spin_lock_init(&instance->hba_lock);
 	spin_lock_init(&instance->completion_lock);
 	spin_lock_init(&poll_aen_lock);
 
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:24:50.000000000 -0400
@@ -73,6 +73,12 @@
  * HOTPLUG	: Resume from Hotplug
  * MFI_STOP_ADP	: Send signal to FW to stop processing
  */
+#define WRITE_SEQUENCE_OFFSET		(0x0000000FC) /* I20 */
+#define HOST_DIAGNOSTIC_OFFSET		(0x000000F8)  /* I20 */
+#define DIAG_WRITE_ENABLE			(0x00000080)
+#define DIAG_RESET_ADAPTER			(0x00000004)
+
+#define MFI_ADP_RESET				0x00000040
 #define MFI_INIT_ABORT				0x00000001
 #define MFI_INIT_READY				0x00000002
 #define MFI_INIT_MFIMODE			0x00000004
@@ -704,6 +710,12 @@ struct megasas_ctrl_info {
  */
 #define IS_DMA64				(sizeof(dma_addr_t) == 8)
 
+#define MFI_XSCALE_OMR0_CHANGE_INTERRUPT		0x00000001
+
+#define MFI_INTR_FLAG_REPLY_MESSAGE			0x00000001
+#define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE		0x00000002
+#define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT	0x00000004
+
 #define MFI_OB_INTR_STATUS_MASK			0x00000002
 #define MFI_POLL_TIMEOUT_SECS			60
 #define MEGASAS_COMPLETION_TIMER_INTERVAL      (HZ/10)
@@ -714,6 +726,9 @@ struct megasas_ctrl_info {
 #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT	0x40000000
 #define MFI_SKINNY_ENABLE_INTERRUPT_MASK	(0x00000001)
 
+#define MFI_1068_PCSR_OFFSET			0x84
+#define MFI_1068_FW_HANDSHAKE_OFFSET		0x64
+#define MFI_1068_FW_READY			0xDDDD0000
 /*
 * register set for both 1068 and 1078 controllers
 * structure extended for 1078 registers
@@ -755,8 +770,10 @@ struct megasas_register_set {
 	u32 	inbound_high_queue_port ;	/*00C4h*/
 
 	u32 	reserved_5;			/*00C8h*/
-	u32 	index_registers[820];		/*00CCh*/
-
+	u32	res_6[11];			/*CCh*/
+	u32	host_diag;
+	u32	seq_offset;
+	u32 	index_registers[807];		/*00CCh*/
 } __attribute__ ((packed));
 
 struct megasas_sge32 {
@@ -1226,11 +1243,12 @@ struct megasas_instance {
 
 	struct megasas_cmd **cmd_list;
 	struct list_head cmd_pool;
+	/* used to sync fire the cmd to fw */
 	spinlock_t cmd_pool_lock;
+	/* used to sync fire the cmd to fw */
+	spinlock_t hba_lock;
 	/* used to synch producer, consumer ptrs in dpc */
 	spinlock_t completion_lock;
-	/* used to sync fire the cmd to fw */
-	spinlock_t fire_lock;
 	struct dma_pool *frame_dma_pool;
 	struct dma_pool *sense_dma_pool;
 
@@ -1257,6 +1275,7 @@ struct megasas_instance {
 	u8 flag;
 	u8 unload;
 	u8 flag_ieee;
+	u8 adprecovery;
 	unsigned long last_time;
 
 	struct timer_list io_completion_timer; 

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

* [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-08-05 19:47   ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-05 19:47 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant

James Bottomley suggested me to resubmit those patches (12 patches).  First 8 patches should be downloaded together and them compile them.

Enable the Online Controller reset bit in the register related functions.  This is first part of the Online Controller Reset.
The driver supports XScle and Gen2 chips.  Driver need to read the FW state register to see if there is FW state change
Happen.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   53 +++++++++++++++++++----------------
 drivers/scsi/megaraid/megarad_sas.h |   27 +++++++++++++++--
 2 files changed, 52 insertions(+), 28 deletions(-)

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-06-08 14:32:43.000000000 -0400
@@ -164,7 +164,7 @@ megasas_return_cmd(struct megasas_instan
 static inline void
 megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs)
 {
-	writel(1, &(regs)->outbound_intr_mask);
+	writel(0, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -200,24 +200,27 @@ static int 
 megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_OB_INTR_STATUS_MASK)) {
-		return 1;
-	}
+	if (status & MFI_OB_INTR_STATUS_MASK)
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	if (status & MFI_XSCALE_OMR0_CHANGE_INTERRUPT)
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_intr_status);
+	if (mfiStatus)
+		writel(status, &regs->outbound_intr_status);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 
 /**
@@ -264,7 +267,7 @@ megasas_enable_intr_ppc(struct megasas_r
 {
 	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
     
-	writel(~0x80000004, &(regs)->outbound_intr_mask);
+	writel(~0x80000000, &(regs)->outbound_intr_mask);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
@@ -307,7 +310,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_REPLY_1078_MESSAGE_INTERRUPT)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -318,7 +321,7 @@ megasas_clear_intr_ppc(struct megasas_re
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_doorbell_clear);
 
-	return 0;
+	return 1;
 }
 /**
  * megasas_fire_cmd_ppc -	Sends command to the FW
@@ -397,7 +400,7 @@ megasas_clear_intr_skinny(struct megasas
 	status = readl(&regs->outbound_intr_status);
 
 	if (!(status & MFI_SKINNY_ENABLE_INTERRUPT_MASK)) {
-		return 1;
+		return 0;
 	}
 
 	/*
@@ -410,7 +413,7 @@ megasas_clear_intr_skinny(struct megasas
 	*/
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return 1;
 }
 
 /**
@@ -425,12 +428,9 @@ megasas_fire_cmd_skinny(struct megasas_i
 			u32 frame_count,
 			struct megasas_register_set __iomem *regs)
 {
-	unsigned long flags;
-	spin_lock_irqsave(&instance->fire_lock, flags);
 	writel(0, &(regs)->inbound_high_queue_port);
 	writel((frame_phys_addr | (frame_count<<1))|1,
 		&(regs)->inbound_low_queue_port);
-	spin_unlock_irqrestore(&instance->fire_lock, flags);
 }
 
 static struct megasas_instance_template megasas_instance_template_skinny = {
@@ -495,23 +495,29 @@ static int
 megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
 	/*
 	 * Check if it is our interrupt
 	 */
 	status = readl(&regs->outbound_intr_status);
 
-	if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK))
-		return 1;
+	if (status & MFI_GEN2_ENABLE_INTERRUPT_MASK) {
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+	}
+	if (status & MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT) {
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	}
 
 	/*
 	 * Clear the interrupt by writing back the same value
 	 */
-	writel(status, &regs->outbound_doorbell_clear);
+	if (mfiStatus)
+		writel(status, &regs->outbound_doorbell_clear);
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_status);
 
-	return 0;
+	return mfiStatus;
 }
 /**
  * megasas_fire_cmd_gen2 -     Sends command to the FW
@@ -540,7 +546,7 @@ static struct megasas_instance_template 
 
 /**
 *	This is the end of set of functions & definitions
-* 	specific to ppc (deviceid : 0x60) controllers
+*       specific to gen2 (deviceid : 0x78, 0x79) controllers
 */
 
 /**
@@ -599,8 +605,7 @@ megasas_issue_blocked_cmd(struct megasas
 	instance->instancet->fire_cmd(instance,
 			cmd->frame_phys_addr, 0, instance->reg_set);
 
-	wait_event_timeout(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->int_cmd_wait_q, cmd->cmd_status != ENODATA);
 
 	return 0;
 }
@@ -648,8 +653,8 @@ megasas_issue_blocked_abort_cmd(struct m
 	/*
 	 * Wait for this cmd to complete
 	 */
-	wait_event_timeout(instance->abort_cmd_wait_q, (cmd->cmd_status != 0xFF),
-		MEGASAS_INTERNAL_CMD_WAIT_TIME*HZ);
+	wait_event(instance->abort_cmd_wait_q, cmd->cmd_status != 0xFF);
+	cmd->sync_cmd = 0;
 
 	megasas_return_cmd(instance, cmd);
 	return 0;
@@ -3137,7 +3142,7 @@ megasas_probe_one(struct pci_dev *pdev, 
 	init_waitqueue_head(&instance->abort_cmd_wait_q);
 
 	spin_lock_init(&instance->cmd_pool_lock);
-	spin_lock_init(&instance->fire_lock);
+	spin_lock_init(&instance->hba_lock);
 	spin_lock_init(&instance->completion_lock);
 	spin_lock_init(&poll_aen_lock);
 
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:02:55.000000000 -0400
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-06-08 14:24:50.000000000 -0400
@@ -73,6 +73,12 @@
  * HOTPLUG	: Resume from Hotplug
  * MFI_STOP_ADP	: Send signal to FW to stop processing
  */
+#define WRITE_SEQUENCE_OFFSET		(0x0000000FC) /* I20 */
+#define HOST_DIAGNOSTIC_OFFSET		(0x000000F8)  /* I20 */
+#define DIAG_WRITE_ENABLE			(0x00000080)
+#define DIAG_RESET_ADAPTER			(0x00000004)
+
+#define MFI_ADP_RESET				0x00000040
 #define MFI_INIT_ABORT				0x00000001
 #define MFI_INIT_READY				0x00000002
 #define MFI_INIT_MFIMODE			0x00000004
@@ -704,6 +710,12 @@ struct megasas_ctrl_info {
  */
 #define IS_DMA64				(sizeof(dma_addr_t) == 8)
 
+#define MFI_XSCALE_OMR0_CHANGE_INTERRUPT		0x00000001
+
+#define MFI_INTR_FLAG_REPLY_MESSAGE			0x00000001
+#define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE		0x00000002
+#define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT	0x00000004
+
 #define MFI_OB_INTR_STATUS_MASK			0x00000002
 #define MFI_POLL_TIMEOUT_SECS			60
 #define MEGASAS_COMPLETION_TIMER_INTERVAL      (HZ/10)
@@ -714,6 +726,9 @@ struct megasas_ctrl_info {
 #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT	0x40000000
 #define MFI_SKINNY_ENABLE_INTERRUPT_MASK	(0x00000001)
 
+#define MFI_1068_PCSR_OFFSET			0x84
+#define MFI_1068_FW_HANDSHAKE_OFFSET		0x64
+#define MFI_1068_FW_READY			0xDDDD0000
 /*
 * register set for both 1068 and 1078 controllers
 * structure extended for 1078 registers
@@ -755,8 +770,10 @@ struct megasas_register_set {
 	u32 	inbound_high_queue_port ;	/*00C4h*/
 
 	u32 	reserved_5;			/*00C8h*/
-	u32 	index_registers[820];		/*00CCh*/
-
+	u32	res_6[11];			/*CCh*/
+	u32	host_diag;
+	u32	seq_offset;
+	u32 	index_registers[807];		/*00CCh*/
 } __attribute__ ((packed));
 
 struct megasas_sge32 {
@@ -1226,11 +1243,12 @@ struct megasas_instance {
 
 	struct megasas_cmd **cmd_list;
 	struct list_head cmd_pool;
+	/* used to sync fire the cmd to fw */
 	spinlock_t cmd_pool_lock;
+	/* used to sync fire the cmd to fw */
+	spinlock_t hba_lock;
 	/* used to synch producer, consumer ptrs in dpc */
 	spinlock_t completion_lock;
-	/* used to sync fire the cmd to fw */
-	spinlock_t fire_lock;
 	struct dma_pool *frame_dma_pool;
 	struct dma_pool *sense_dma_pool;
 
@@ -1257,6 +1275,7 @@ struct megasas_instance {
 	u8 flag;
 	u8 unload;
 	u8 flag_ieee;
+	u8 adprecovery;
 	unsigned long last_time;
 
 	struct timer_list io_completion_timer; 

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-07-31 17:46               ` James Bottomley
@ 2010-08-05 20:44                   ` Yang, Bo
  2010-08-12 15:20                   ` Yang, Bo
  2010-08-16 14:22                   ` Yang, Bo
  2 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-05 20:44 UTC (permalink / raw)
  To: James Bottomley
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1088 bytes --]

James,

I re-submitted all 12 patches.  Can you help to push them to main tree?

Thanks,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-08-05 20:44                   ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-05 20:44 UTC (permalink / raw)
  To: James Bottomley
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

James,

I re-submitted all 12 patches.  Can you help to push them to main tree?

Thanks,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-08-05 20:44                   ` Yang, Bo
  (?)
@ 2010-08-06  0:36                   ` James Bottomley
  -1 siblings, 0 replies; 70+ messages in thread
From: James Bottomley @ 2010-08-06  0:36 UTC (permalink / raw)
  To: Yang, Bo
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

On Thu, 2010-08-05 at 14:44 -0600, Yang, Bo wrote:
> I re-submitted all 12 patches.  Can you help to push them to main tree?

That's actually not what I asked for.  I said please send the set of
individually compilable patches.  I think that's something like 1-8
rolled up as one patch with one change set and then the remaining 4 sent
as individual patches.

So let me put it this way. I'm sorry I managed to lose the tree I was
trying to build for this.  However, I have two conferences and four
talks coming up before the end of the merge window, so I have no time to
do this again.  If you want this patch set in for 2.6.36, please redo it
as indicated above ASAP.  Otherwise, I'll take another look when I get
some free time.

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-07-31 17:46               ` James Bottomley
@ 2010-08-12 15:20                   ` Yang, Bo
  2010-08-12 15:20                   ` Yang, Bo
  2010-08-16 14:22                   ` Yang, Bo
  2 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-12 15:20 UTC (permalink / raw)
  To: James Bottomley
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1150 bytes --]

James,

Just let you know the new patches already submitted yesterday.  Please let me know after you updated those patches to the main tree.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-08-12 15:20                   ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-12 15:20 UTC (permalink / raw)
  To: James Bottomley
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant

James,

Just let you know the new patches already submitted yesterday.  Please let me know after you updated those patches to the main tree.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-07-31 17:46               ` James Bottomley
@ 2010-08-16 14:22                   ` Yang, Bo
  2010-08-12 15:20                   ` Yang, Bo
  2010-08-16 14:22                   ` Yang, Bo
  2 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-16 14:22 UTC (permalink / raw)
  To: Yang, Bo, James Bottomley, Austria, Winston
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant, Benz, Michael

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1645 bytes --]

James,

We submitted the patches on 8/11.  Do you get the chances to update those patches to main tree?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Thursday, August 12, 2010 11:21 AM
To: 'James Bottomley'
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Just let you know the new patches already submitted yesterday.  Please let me know after you updated those patches to the main tree.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
@ 2010-08-16 14:22                   ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-08-16 14:22 UTC (permalink / raw)
  To: Yang, Bo, James Bottomley, Austria, Winston
  Cc: Yinghai Lu, linux-scsi, akpm, linux-kernel, Maharana, Parag,
	Daftardar, Jayant, Benz, Michael

James,

We submitted the patches on 8/11.  Do you get the chances to update those patches to main tree?

Thanks,

Bo Yang

-----Original Message-----
From: Yang, Bo 
Sent: Thursday, August 12, 2010 11:21 AM
To: 'James Bottomley'
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Just let you know the new patches already submitted yesterday.  Please let me know after you updated those patches to the main tree.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@suse.de] 
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; linux-scsi@vger.kernel.org; akpm@osdl.org; linux-kernel@vger.kernel.org; Maharana, Parag; Daftardar, Jayant
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

On Fri, 2010-07-30 at 12:53 -0600, Yang, Bo wrote:
> Do you know when those patches (12 patches) will be pushed to upstream?

Well, it looks like I lost the branch I was fixing all this up in
somewhere.  I don't really have time to redo that work, so could you
send the series correctly (that's the 8 OCR patches that don't
individually compile as a single patch with a correct changelog plus the
four others).

Thanks,

James



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

* RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions
  2010-08-16 14:22                   ` Yang, Bo
  (?)
@ 2010-08-16 15:06                   ` James Bottomley
  -1 siblings, 0 replies; 70+ messages in thread
From: James Bottomley @ 2010-08-16 15:06 UTC (permalink / raw)
  To: Yang, Bo
  Cc: Austria, Winston, Yinghai Lu, linux-scsi, akpm, linux-kernel,
	Maharana, Parag, Daftardar, Jayant, Benz, Michael

On Mon, 2010-08-16 at 08:22 -0600, Yang, Bo wrote:
> We submitted the patches on 8/11.  Do you get the chances to update those patches to main tree?

Yes, they'll go in the next merge window.

James



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

* [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset
  2010-08-05 19:47   ` Yang, Bo
@ 2010-11-19 16:33     ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 16:33 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl

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

Change the 30 seconds wait in OCR routine to ssleep and give more time to FW come out from failed status

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
 

[-- Attachment #2: megasas-p1-timechange.patch --]
[-- Type: application/octet-stream, Size: 1292 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-10 04:39:48.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:32:31.000000000 -0500
@@ -2294,7 +2294,6 @@ process_fw_state_change_wq(struct work_s
 {
 	struct megasas_instance *instance =
 		container_of(work, struct megasas_instance, work_init);
-	u32 wait;
 	unsigned long flags;
 
 	if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
@@ -2320,10 +2319,8 @@ process_fw_state_change_wq(struct work_s
 		printk(KERN_NOTICE "megaraid_sas: HBA recovery state machine,"
 					"state 2 starting...\n");
 
-		/*waitting for about 20 second before start the second init*/
-		for (wait = 0; wait < 30; wait++) {
-			msleep(1000);
-		}
+		/*waitting for about 30 second before start the second init*/
+		ssleep(30);
 
 		if (megasas_transition_to_ready(instance)) {
 			printk(KERN_NOTICE "megaraid_sas:adapter not ready\n");
@@ -2487,7 +2484,9 @@ megasas_transition_to_ready(struct megas
 		case MFI_STATE_FAULT:
 
 			printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
-			return -ENODEV;
+			max_wait = MEGASAS_RESET_WAIT_TIME;
+			cur_state = MFI_STATE_FAULT;
+			break;
 
 		case MFI_STATE_WAIT_HANDSHAKE:
 			/*

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

* [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset
@ 2010-11-19 16:33     ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 16:33 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl

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

Change the 30 seconds wait in OCR routine to ssleep and give more time to FW come out from failed status

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
 

[-- Attachment #2: megasas-p1-timechange.patch --]
[-- Type: application/octet-stream, Size: 1292 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-10 04:39:48.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:32:31.000000000 -0500
@@ -2294,7 +2294,6 @@ process_fw_state_change_wq(struct work_s
 {
 	struct megasas_instance *instance =
 		container_of(work, struct megasas_instance, work_init);
-	u32 wait;
 	unsigned long flags;
 
 	if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
@@ -2320,10 +2319,8 @@ process_fw_state_change_wq(struct work_s
 		printk(KERN_NOTICE "megaraid_sas: HBA recovery state machine,"
 					"state 2 starting...\n");
 
-		/*waitting for about 20 second before start the second init*/
-		for (wait = 0; wait < 30; wait++) {
-			msleep(1000);
-		}
+		/*waitting for about 30 second before start the second init*/
+		ssleep(30);
 
 		if (megasas_transition_to_ready(instance)) {
 			printk(KERN_NOTICE "megaraid_sas:adapter not ready\n");
@@ -2487,7 +2484,9 @@ megasas_transition_to_ready(struct megas
 		case MFI_STATE_FAULT:
 
 			printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
-			return -ENODEV;
+			max_wait = MEGASAS_RESET_WAIT_TIME;
+			cur_state = MFI_STATE_FAULT;
+			break;
 
 		case MFI_STATE_WAIT_HANDSHAKE:
 			/*

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

* [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives
  2010-11-19 16:33     ` Yang, Bo
@ 2010-11-19 16:53       ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 16:53 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl

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

Driver only report tape drive, JBOD and logic drives to OS

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

[-- Attachment #2: megasas-p2-enclusure.patch --]
[-- Type: application/octet-stream, Size: 1255 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:33:25.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:34:00.000000000 -0500
@@ -1445,15 +1445,22 @@ static int megasas_slave_configure(struc
 	*        That will be fixed once LSI engineers have audited the
 	*        firmware for possible issues.
 	*/
-	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS &&
-				sdev->type == TYPE_DISK) {
-		pd_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) +
-								sdev->id;
-		if (instance->pd_list[pd_index].driveState ==
-						MR_PD_STATE_SYSTEM) {
+	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
+		if (sdev->type == TYPE_TAPE) {
 			blk_queue_rq_timeout(sdev->request_queue,
 				MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
 			return 0;
+		} else if (sdev->type == TYPE_DISK) {
+		pd_index =
+		(sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id;
+			if ((instance->pd_list[pd_index].driveState ==
+					MR_PD_STATE_SYSTEM) &&
+				(instance->pd_list[pd_index].driveType ==
+						TYPE_DISK)) {
+				blk_queue_rq_timeout(sdev->request_queue,
+					MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
+				return 0;
+			}
 		}
 		return -ENXIO;
 	}

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

* [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives
@ 2010-11-19 16:53       ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 16:53 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl

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

Driver only report tape drive, JBOD and logic drives to OS

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

[-- Attachment #2: megasas-p2-enclusure.patch --]
[-- Type: application/octet-stream, Size: 1255 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:33:25.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:34:00.000000000 -0500
@@ -1445,15 +1445,22 @@ static int megasas_slave_configure(struc
 	*        That will be fixed once LSI engineers have audited the
 	*        firmware for possible issues.
 	*/
-	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS &&
-				sdev->type == TYPE_DISK) {
-		pd_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) +
-								sdev->id;
-		if (instance->pd_list[pd_index].driveState ==
-						MR_PD_STATE_SYSTEM) {
+	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
+		if (sdev->type == TYPE_TAPE) {
 			blk_queue_rq_timeout(sdev->request_queue,
 				MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
 			return 0;
+		} else if (sdev->type == TYPE_DISK) {
+		pd_index =
+		(sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id;
+			if ((instance->pd_list[pd_index].driveState ==
+					MR_PD_STATE_SYSTEM) &&
+				(instance->pd_list[pd_index].driveType ==
+						TYPE_DISK)) {
+				blk_queue_rq_timeout(sdev->request_queue,
+					MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
+				return 0;
+			}
 		}
 		return -ENXIO;
 	}

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

* [PATCH 3/9] scsi: megaraid_sas - Driver will scan device after receive event MR_EVT_LD_STATE_CHANGE
  2010-11-19 16:53       ` Yang, Bo
@ 2010-11-19 17:03         ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:03 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl, Karlikova, Lenka, Nielson, Mike,
	Jablonski, Charles

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

Driver will scan devices after receive event code MR_EVT_LD_STATE_CHANGE from megasas fw

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |    1 +
 1 file changed, 1 insertion(+)

[-- Attachment #2: megasas-p3.patch --]
[-- Type: application/octet-stream, Size: 482 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:37:21.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:38:00.000000000 -0500
@@ -4990,6 +4990,7 @@ megasas_aen_polling(struct work_struct *
 			break;
 		case MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED:
 		case MR_EVT_FOREIGN_CFG_IMPORTED:
+		case MR_EVT_LD_STATE_CHANGE:
 			doscan = 1;
 			break;
 		default:

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

* [PATCH 3/9] scsi: megaraid_sas - Driver will scan device after receive event MR_EVT_LD_STATE_CHANGE
@ 2010-11-19 17:03         ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:03 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl, Karlikova, Lenka, Nielson, Mike,
	Jablonski, Charles

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

Driver will scan devices after receive event code MR_EVT_LD_STATE_CHANGE from megasas fw

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |    1 +
 1 file changed, 1 insertion(+)

[-- Attachment #2: megasas-p3.patch --]
[-- Type: application/octet-stream, Size: 482 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:37:21.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:38:00.000000000 -0500
@@ -4990,6 +4990,7 @@ megasas_aen_polling(struct work_struct *
 			break;
 		case MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED:
 		case MR_EVT_FOREIGN_CFG_IMPORTED:
+		case MR_EVT_LD_STATE_CHANGE:
 			doscan = 1;
 			break;
 		default:

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

* [PATCH 4/9] scsi: megaraid_sas - Driver provide the version to FW
  2010-11-19 17:03         ` Yang, Bo
@ 2010-11-19 17:08           ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:08 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl, Karlikova, Lenka, Nielson, Mike,
	Jablonski, Charles

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

Driver added the version parmeter to provide the version to megaraid sas FW during the driver load

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   22 ++++++++++++++++++++++
drivers/scsi/megaraid/megaraid_sas.h |    8 +++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

[-- Attachment #2: megasas-p4-version.patch --]
[-- Type: application/octet-stream, Size: 2466 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:40:53.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:47:47.000000000 -0500
@@ -3146,6 +3146,15 @@ megasas_issue_init_mfi(struct megasas_in
 
 	init_frame->cmd = MFI_CMD_INIT;
 	init_frame->cmd_status = 0xFF;
+
+	if (instance->verbuf) {
+	snprintf((char *)instance->verbuf, strlen(MEGASAS_VERSION) + 2, "%s\n",
+			MEGASAS_VERSION);
+
+		init_frame->driver_ver_lo = instance->verbuf_h;
+		init_frame->driver_ver_hi = 0;
+	}
+
 	init_frame->queue_info_new_phys_addr_lo = initq_info_h;
 
 	init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
@@ -3323,6 +3332,14 @@ static int megasas_init_mfi(struct megas
 		goto fail_reply_queue;
 	}
 
+	instance->verbuf = pci_alloc_consistent(instance->pdev,
+						MEGASAS_MAX_NAME*sizeof(u32),
+						&instance->verbuf_h);
+
+	if (!instance->verbuf) {
+		printk(KERN_DEBUG "megasas: Can't allocate version buffer\n");
+	}
+
 	if (megasas_issue_init_mfi(instance))
 		goto fail_fw_init;
 
@@ -4228,6 +4245,11 @@ static void __devexit megasas_detach_one
 	pci_free_consistent(pdev, sizeof(u32), instance->consumer,
 			    instance->consumer_h);
 
+	if (instance->verbuf) {
+		pci_free_consistent(pdev, MEGASAS_MAX_NAME*sizeof(u32),
+			instance->verbuf, instance->verbuf_h);
+	}
+
 	scsi_host_put(host);
 
 	pci_set_drvdata(pdev, NULL);
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-11 05:46:19.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 14:25:14.000000000 -0500
@@ -706,6 +706,7 @@ struct megasas_ctrl_info {
 #define MEGASAS_MAX_LD_IDS			(MEGASAS_MAX_LD_CHANNELS * \
 						MEGASAS_MAX_DEV_PER_CHANNEL)
 
+#define MEGASAS_MAX_NAME			32
 #define MEGASAS_MAX_SECTORS                    (2*1024)
 #define MEGASAS_DBG_LVL				1
 
@@ -887,7 +888,10 @@ struct megasas_init_frame {
 	u32 queue_info_old_phys_addr_lo;	/*20h */
 	u32 queue_info_old_phys_addr_hi;	/*24h */
 
-	u32 reserved_4[6];	/*28h */
+	u32 driver_ver_lo;
+	u32 driver_ver_hi;
+
+	u32 reserved_4[4];	/*28h */
 
 } __attribute__ ((packed));
 
@@ -1259,6 +1263,8 @@ struct megasas_instance {
 	dma_addr_t producer_h;
 	u32 *consumer;
 	dma_addr_t consumer_h;
+	u32 *verbuf;
+	dma_addr_t verbuf_h;
 
 	u32 *reply_queue;
 	dma_addr_t reply_queue_h;

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

* [PATCH 4/9] scsi: megaraid_sas - Driver provide the version to FW
@ 2010-11-19 17:08           ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:08 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl, Karlikova, Lenka, Nielson, Mike,
	Jablonski, Charles

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

Driver added the version parmeter to provide the version to megaraid sas FW during the driver load

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   22 ++++++++++++++++++++++
drivers/scsi/megaraid/megaraid_sas.h |    8 +++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

[-- Attachment #2: megasas-p4-version.patch --]
[-- Type: application/octet-stream, Size: 2466 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:40:53.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:47:47.000000000 -0500
@@ -3146,6 +3146,15 @@ megasas_issue_init_mfi(struct megasas_in
 
 	init_frame->cmd = MFI_CMD_INIT;
 	init_frame->cmd_status = 0xFF;
+
+	if (instance->verbuf) {
+	snprintf((char *)instance->verbuf, strlen(MEGASAS_VERSION) + 2, "%s\n",
+			MEGASAS_VERSION);
+
+		init_frame->driver_ver_lo = instance->verbuf_h;
+		init_frame->driver_ver_hi = 0;
+	}
+
 	init_frame->queue_info_new_phys_addr_lo = initq_info_h;
 
 	init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
@@ -3323,6 +3332,14 @@ static int megasas_init_mfi(struct megas
 		goto fail_reply_queue;
 	}
 
+	instance->verbuf = pci_alloc_consistent(instance->pdev,
+						MEGASAS_MAX_NAME*sizeof(u32),
+						&instance->verbuf_h);
+
+	if (!instance->verbuf) {
+		printk(KERN_DEBUG "megasas: Can't allocate version buffer\n");
+	}
+
 	if (megasas_issue_init_mfi(instance))
 		goto fail_fw_init;
 
@@ -4228,6 +4245,11 @@ static void __devexit megasas_detach_one
 	pci_free_consistent(pdev, sizeof(u32), instance->consumer,
 			    instance->consumer_h);
 
+	if (instance->verbuf) {
+		pci_free_consistent(pdev, MEGASAS_MAX_NAME*sizeof(u32),
+			instance->verbuf, instance->verbuf_h);
+	}
+
 	scsi_host_put(host);
 
 	pci_set_drvdata(pdev, NULL);
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-11 05:46:19.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 14:25:14.000000000 -0500
@@ -706,6 +706,7 @@ struct megasas_ctrl_info {
 #define MEGASAS_MAX_LD_IDS			(MEGASAS_MAX_LD_CHANNELS * \
 						MEGASAS_MAX_DEV_PER_CHANNEL)
 
+#define MEGASAS_MAX_NAME			32
 #define MEGASAS_MAX_SECTORS                    (2*1024)
 #define MEGASAS_DBG_LVL				1
 
@@ -887,7 +888,10 @@ struct megasas_init_frame {
 	u32 queue_info_old_phys_addr_lo;	/*20h */
 	u32 queue_info_old_phys_addr_hi;	/*24h */
 
-	u32 reserved_4[6];	/*28h */
+	u32 driver_ver_lo;
+	u32 driver_ver_hi;
+
+	u32 reserved_4[4];	/*28h */
 
 } __attribute__ ((packed));
 
@@ -1259,6 +1263,8 @@ struct megasas_instance {
 	dma_addr_t producer_h;
 	u32 *consumer;
 	dma_addr_t consumer_h;
+	u32 *verbuf;
+	dma_addr_t verbuf_h;
 
 	u32 *reply_queue;
 	dma_addr_t reply_queue_h;

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

* [PATCH 5/9] scsi: megaraid_sas -  report different io sectors for ieee support
  2010-11-19 17:08           ` Yang, Bo
@ 2010-11-19 17:23             ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:23 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver will report different I/O max sectors for ieee sge support 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |    4 ++++
drivers/scsi/megaraid/megaraid_sas.h |    1 +
 2 files changed, 5 insertions(+)

[-- Attachment #2: megasas-p5-ieee.patch --]
[-- Type: application/octet-stream, Size: 1136 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:49:16.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:54:32.000000000 -0500
@@ -3686,6 +3686,10 @@ static int megasas_io_attach(struct mega
 			instance->max_fw_cmds - MEGASAS_INT_CMDS;
 	host->this_id = instance->init_id;
 	host->sg_tablesize = instance->max_num_sge;
+
+	if (instance->fw_support_ieee)
+		instance->max_sectors_per_req = MEGASAS_MAX_SECTORS_IEEE;
+
 	/*
 	 * Check if the module parameter value for max_sectors can be used
 	 */
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 14:31:29.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 14:35:28.000000000 -0500
@@ -708,6 +708,7 @@ struct megasas_ctrl_info {
 
 #define MEGASAS_MAX_NAME			32
 #define MEGASAS_MAX_SECTORS                    (2*1024)
+#define MEGASAS_MAX_SECTORS_IEEE               (2*128)
 #define MEGASAS_DBG_LVL				1
 
 #define MEGASAS_FW_BUSY				1

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

* [PATCH 5/9] scsi: megaraid_sas -  report different io sectors for ieee support
@ 2010-11-19 17:23             ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:23 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver will report different I/O max sectors for ieee sge support 

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |    4 ++++
drivers/scsi/megaraid/megaraid_sas.h |    1 +
 2 files changed, 5 insertions(+)

[-- Attachment #2: megasas-p5-ieee.patch --]
[-- Type: application/octet-stream, Size: 1136 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:49:16.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-14 15:54:32.000000000 -0500
@@ -3686,6 +3686,10 @@ static int megasas_io_attach(struct mega
 			instance->max_fw_cmds - MEGASAS_INT_CMDS;
 	host->this_id = instance->init_id;
 	host->sg_tablesize = instance->max_num_sge;
+
+	if (instance->fw_support_ieee)
+		instance->max_sectors_per_req = MEGASAS_MAX_SECTORS_IEEE;
+
 	/*
 	 * Check if the module parameter value for max_sectors can be used
 	 */
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 14:31:29.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 14:35:28.000000000 -0500
@@ -708,6 +708,7 @@ struct megasas_ctrl_info {
 
 #define MEGASAS_MAX_NAME			32
 #define MEGASAS_MAX_SECTORS                    (2*1024)
+#define MEGASAS_MAX_SECTORS_IEEE               (2*128)
 #define MEGASAS_DBG_LVL				1
 
 #define MEGASAS_FW_BUSY				1

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

* [PATCH 6/9] scsi: megaraid_sas -  Add the online reset to iMR chip
  2010-11-19 17:23             ` Yang, Bo
@ 2010-11-19 17:29               ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:29 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver added the OCR (online controller reset) support to megaraid sas iMR chip.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   74 ++++++++++++++++++++---------------
drivers/scsi/megaraid/megaraid_sas.h |    5 +-
 2 files changed, 47 insertions(+), 32 deletions(-)

[-- Attachment #2: megasas-p6-imrocr.patch --]
[-- Type: application/octet-stream, Size: 6137 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-16 06:29:31.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 13:08:03.000000000 -0500
@@ -121,6 +121,12 @@ static void
 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		     u8 alt_status);
 
+static u32
+megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem *regs);
+
+static int megasas_adp_reset_gen2(struct megasas_instance *instance,
+				struct megasas_register_set __iomem *reg_set);
+
 /**
  * megasas_get_cmd -	Get a command from the free pool
  * @instance:		Adapter soft state
@@ -497,6 +503,8 @@ static int
 megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
+
 	/*
 	 * Check if it is our interrupt
 	 */
@@ -507,6 +515,15 @@ megasas_clear_intr_skinny(struct megasas
 	}
 
 	/*
+	 * Check if it is our interrupt
+	 */
+	if ((megasas_read_fw_status_reg_gen2( regs) & MFI_STATE_MASK ) ==
+						MFI_STATE_FAULT ) {
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	} else
+		mfiStatus |=  MFI_INTR_FLAG_REPLY_MESSAGE;
+
+	/*
 	 * Clear the interrupt by writing back the same value
 	 */
 	writel(status, &regs->outbound_intr_status);
@@ -516,7 +533,7 @@ megasas_clear_intr_skinny(struct megasas
 	*/
 	readl(&regs->outbound_intr_status);
 
-	return 1;
+	return mfiStatus;
 }
 
 /**
@@ -540,17 +557,6 @@ megasas_fire_cmd_skinny(struct megasas_i
 }
 
 /**
- * megasas_adp_reset_skinny -	For controller reset
- * @regs:				MFI register set
- */
-static int
-megasas_adp_reset_skinny(struct megasas_instance *instance,
-			struct megasas_register_set __iomem *regs)
-{
-	return 0;
-}
-
-/**
  * megasas_check_reset_skinny -	For controller reset check
  * @regs:				MFI register set
  */
@@ -568,7 +574,7 @@ static struct megasas_instance_template
 	.disable_intr = megasas_disable_intr_skinny,
 	.clear_intr = megasas_clear_intr_skinny,
 	.read_fw_status_reg = megasas_read_fw_status_reg_skinny,
-	.adp_reset = megasas_adp_reset_skinny,
+	.adp_reset = megasas_adp_reset_gen2,
 	.check_reset = megasas_check_reset_skinny,
 };
 
@@ -678,20 +684,26 @@ megasas_adp_reset_gen2(struct megasas_in
 {
 	u32			retry = 0 ;
 	u32			HostDiag;
+	u32			*seq_offset = &reg_set->seq_offset;
+	u32			*hostdiag_offset = &reg_set->host_diag;
 
-	writel(0, &reg_set->seq_offset);
-	writel(4, &reg_set->seq_offset);
-	writel(0xb, &reg_set->seq_offset);
-	writel(2, &reg_set->seq_offset);
-	writel(7, &reg_set->seq_offset);
-	writel(0xd, &reg_set->seq_offset);
-	msleep(1000);
+	if (instance->instancet ==  &megasas_instance_template_skinny ) {
+		seq_offset = &reg_set->fusion_seq_offset;
+		hostdiag_offset = &reg_set->fusion_host_diag;
+	}
+	writel(0, seq_offset);
+	writel(4, seq_offset);
+	writel(0xb, seq_offset);
+	writel(2, seq_offset);
+	writel(7, seq_offset);
+	writel(0xd, seq_offset);
 
-	HostDiag = (u32)readl(&reg_set->host_diag);
+	msleep(1000);
+	HostDiag = (u32)readl(hostdiag_offset);
 
 	while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
 		msleep(100);
-		HostDiag = (u32)readl(&reg_set->host_diag);
+		HostDiag = (u32)readl(hostdiag_offset);
 		printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n",
 					retry, HostDiag);
 
@@ -701,15 +713,15 @@ megasas_adp_reset_gen2(struct megasas_in
 	}
 
 	printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
-
-	writel((HostDiag | DIAG_RESET_ADAPTER), &reg_set->host_diag);
+	writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);
 
 	ssleep(10);
 
-	HostDiag = (u32)readl(&reg_set->host_diag);
+	HostDiag = (u32)readl(hostdiag_offset);
+
 	while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
 		msleep(100);
-		HostDiag = (u32)readl(&reg_set->host_diag);
+		HostDiag = (u32)readl(hostdiag_offset);
 		printk(KERN_NOTICE "RESET_GEN2: retry=%x, hostdiag=%x\n",
 				retry, HostDiag);
 
@@ -1502,7 +1514,7 @@ static void megaraid_sas_kill_hba(struct
 	if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
 		(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 		writel(MFI_STOP_ADP,
-			&instance->reg_set->reserved_0[0]);
+			&instance->reg_set->reserved_0);
 	} else {
 		writel(MFI_STOP_ADP,
 			&instance->reg_set->inbound_doorbell);
@@ -1754,7 +1766,7 @@ static int megasas_wait_for_outstanding(
 			(instance->pdev->device ==
 			PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 			writel(MFI_STOP_ADP,
-				&instance->reg_set->reserved_0[0]);
+				&instance->reg_set->reserved_0);
 		} else {
 			writel(MFI_STOP_ADP,
 				&instance->reg_set->inbound_doorbell);
@@ -2506,7 +2518,7 @@ megasas_transition_to_ready(struct megas
 
 				writel(
 				  MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG,
-				  &instance->reg_set->reserved_0[0]);
+				&instance->reg_set->reserved_0);
 			} else {
 				writel(
 				    MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG,
@@ -2523,7 +2535,7 @@ megasas_transition_to_ready(struct megas
 			(instance->pdev->device ==
 				PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 				writel(MFI_INIT_HOTPLUG,
-				&instance->reg_set->reserved_0[0]);
+				&instance->reg_set->reserved_0);
 			} else
 				writel(MFI_INIT_HOTPLUG,
 					&instance->reg_set->inbound_doorbell);
@@ -2542,7 +2554,7 @@ megasas_transition_to_ready(struct megas
 				(instance->pdev->device ==
 				PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 				writel(MFI_RESET_FLAGS,
-					&instance->reg_set->reserved_0[0]);
+					&instance->reg_set->reserved_0);
 			} else
 				writel(MFI_RESET_FLAGS,
 					&instance->reg_set->inbound_doorbell);
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-16 06:29:31.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 16:23:04.000000000 -0500
@@ -771,7 +771,10 @@ struct megasas_ctrl_info {
 */
  
 struct megasas_register_set {
-	u32 	reserved_0[4];			/*0000h*/
+	u32 	reserved_0;			/*0000h*/
+	u32	fusion_seq_offset;		/*0004h*/
+	u32	fusion_host_diag;		/*0008h*/
+	u32	reserved_01;			/*000Ch*/
 
 	u32 	inbound_msg_0;			/*0010h*/
 	u32 	inbound_msg_1;			/*0014h*/

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

* [PATCH 6/9] scsi: megaraid_sas -  Add the online reset to iMR chip
@ 2010-11-19 17:29               ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:29 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver added the OCR (online controller reset) support to megaraid sas iMR chip.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   74 ++++++++++++++++++++---------------
drivers/scsi/megaraid/megaraid_sas.h |    5 +-
 2 files changed, 47 insertions(+), 32 deletions(-)

[-- Attachment #2: megasas-p6-imrocr.patch --]
[-- Type: application/octet-stream, Size: 6137 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-16 06:29:31.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 13:08:03.000000000 -0500
@@ -121,6 +121,12 @@ static void
 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		     u8 alt_status);
 
+static u32
+megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem *regs);
+
+static int megasas_adp_reset_gen2(struct megasas_instance *instance,
+				struct megasas_register_set __iomem *reg_set);
+
 /**
  * megasas_get_cmd -	Get a command from the free pool
  * @instance:		Adapter soft state
@@ -497,6 +503,8 @@ static int
 megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus = 0;
+
 	/*
 	 * Check if it is our interrupt
 	 */
@@ -507,6 +515,15 @@ megasas_clear_intr_skinny(struct megasas
 	}
 
 	/*
+	 * Check if it is our interrupt
+	 */
+	if ((megasas_read_fw_status_reg_gen2( regs) & MFI_STATE_MASK ) ==
+						MFI_STATE_FAULT ) {
+		mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	} else
+		mfiStatus |=  MFI_INTR_FLAG_REPLY_MESSAGE;
+
+	/*
 	 * Clear the interrupt by writing back the same value
 	 */
 	writel(status, &regs->outbound_intr_status);
@@ -516,7 +533,7 @@ megasas_clear_intr_skinny(struct megasas
 	*/
 	readl(&regs->outbound_intr_status);
 
-	return 1;
+	return mfiStatus;
 }
 
 /**
@@ -540,17 +557,6 @@ megasas_fire_cmd_skinny(struct megasas_i
 }
 
 /**
- * megasas_adp_reset_skinny -	For controller reset
- * @regs:				MFI register set
- */
-static int
-megasas_adp_reset_skinny(struct megasas_instance *instance,
-			struct megasas_register_set __iomem *regs)
-{
-	return 0;
-}
-
-/**
  * megasas_check_reset_skinny -	For controller reset check
  * @regs:				MFI register set
  */
@@ -568,7 +574,7 @@ static struct megasas_instance_template
 	.disable_intr = megasas_disable_intr_skinny,
 	.clear_intr = megasas_clear_intr_skinny,
 	.read_fw_status_reg = megasas_read_fw_status_reg_skinny,
-	.adp_reset = megasas_adp_reset_skinny,
+	.adp_reset = megasas_adp_reset_gen2,
 	.check_reset = megasas_check_reset_skinny,
 };
 
@@ -678,20 +684,26 @@ megasas_adp_reset_gen2(struct megasas_in
 {
 	u32			retry = 0 ;
 	u32			HostDiag;
+	u32			*seq_offset = &reg_set->seq_offset;
+	u32			*hostdiag_offset = &reg_set->host_diag;
 
-	writel(0, &reg_set->seq_offset);
-	writel(4, &reg_set->seq_offset);
-	writel(0xb, &reg_set->seq_offset);
-	writel(2, &reg_set->seq_offset);
-	writel(7, &reg_set->seq_offset);
-	writel(0xd, &reg_set->seq_offset);
-	msleep(1000);
+	if (instance->instancet ==  &megasas_instance_template_skinny ) {
+		seq_offset = &reg_set->fusion_seq_offset;
+		hostdiag_offset = &reg_set->fusion_host_diag;
+	}
+	writel(0, seq_offset);
+	writel(4, seq_offset);
+	writel(0xb, seq_offset);
+	writel(2, seq_offset);
+	writel(7, seq_offset);
+	writel(0xd, seq_offset);
 
-	HostDiag = (u32)readl(&reg_set->host_diag);
+	msleep(1000);
+	HostDiag = (u32)readl(hostdiag_offset);
 
 	while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
 		msleep(100);
-		HostDiag = (u32)readl(&reg_set->host_diag);
+		HostDiag = (u32)readl(hostdiag_offset);
 		printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n",
 					retry, HostDiag);
 
@@ -701,15 +713,15 @@ megasas_adp_reset_gen2(struct megasas_in
 	}
 
 	printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
-
-	writel((HostDiag | DIAG_RESET_ADAPTER), &reg_set->host_diag);
+	writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);
 
 	ssleep(10);
 
-	HostDiag = (u32)readl(&reg_set->host_diag);
+	HostDiag = (u32)readl(hostdiag_offset);
+
 	while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
 		msleep(100);
-		HostDiag = (u32)readl(&reg_set->host_diag);
+		HostDiag = (u32)readl(hostdiag_offset);
 		printk(KERN_NOTICE "RESET_GEN2: retry=%x, hostdiag=%x\n",
 				retry, HostDiag);
 
@@ -1502,7 +1514,7 @@ static void megaraid_sas_kill_hba(struct
 	if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
 		(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 		writel(MFI_STOP_ADP,
-			&instance->reg_set->reserved_0[0]);
+			&instance->reg_set->reserved_0);
 	} else {
 		writel(MFI_STOP_ADP,
 			&instance->reg_set->inbound_doorbell);
@@ -1754,7 +1766,7 @@ static int megasas_wait_for_outstanding(
 			(instance->pdev->device ==
 			PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 			writel(MFI_STOP_ADP,
-				&instance->reg_set->reserved_0[0]);
+				&instance->reg_set->reserved_0);
 		} else {
 			writel(MFI_STOP_ADP,
 				&instance->reg_set->inbound_doorbell);
@@ -2506,7 +2518,7 @@ megasas_transition_to_ready(struct megas
 
 				writel(
 				  MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG,
-				  &instance->reg_set->reserved_0[0]);
+				&instance->reg_set->reserved_0);
 			} else {
 				writel(
 				    MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG,
@@ -2523,7 +2535,7 @@ megasas_transition_to_ready(struct megas
 			(instance->pdev->device ==
 				PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 				writel(MFI_INIT_HOTPLUG,
-				&instance->reg_set->reserved_0[0]);
+				&instance->reg_set->reserved_0);
 			} else
 				writel(MFI_INIT_HOTPLUG,
 					&instance->reg_set->inbound_doorbell);
@@ -2542,7 +2554,7 @@ megasas_transition_to_ready(struct megas
 				(instance->pdev->device ==
 				PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
 				writel(MFI_RESET_FLAGS,
-					&instance->reg_set->reserved_0[0]);
+					&instance->reg_set->reserved_0);
 			} else
 				writel(MFI_RESET_FLAGS,
 					&instance->reg_set->inbound_doorbell);
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-16 06:29:31.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-14 16:23:04.000000000 -0500
@@ -771,7 +771,10 @@ struct megasas_ctrl_info {
 */
  
 struct megasas_register_set {
-	u32 	reserved_0[4];			/*0000h*/
+	u32 	reserved_0;			/*0000h*/
+	u32	fusion_seq_offset;		/*0004h*/
+	u32	fusion_host_diag;		/*0008h*/
+	u32	reserved_01;			/*000Ch*/
 
 	u32 	inbound_msg_0;			/*0010h*/
 	u32 	inbound_msg_1;			/*0014h*/

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

* [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
  2010-11-19 17:29               ` Yang, Bo
@ 2010-11-19 17:37                 ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:37 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

[-- Attachment #2: megasas-p7-workqueue.patch --]
[-- Type: application/octet-stream, Size: 1593 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 13:46:11.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 13:47:46.000000000 -0500
@@ -108,6 +108,7 @@ static struct megasas_mgmt_info megasas_
 static struct fasync_struct *megasas_async_queue;
 static DEFINE_MUTEX(megasas_async_queue_mutex);
 
+static struct workqueue_struct *megasas_ocr_wq;
 static int megasas_poll_wait_aen;
 static DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait);
 static u32 support_poll_for_event;
@@ -2435,7 +2436,7 @@ megasas_deplete_reply_queue(struct megas
 			printk(KERN_NOTICE "megasas: fwState=%x, stage:%d\n",
 					fw_state, instance->adprecovery);
 
-			schedule_work(&instance->work_init);
+			queue_work(megasas_ocr_wq, &instance->work_init);
 			return IRQ_HANDLED;
 
 		} else {
@@ -5157,6 +5158,11 @@ static int __init megasas_init(void)
 		goto err_pcidrv;
 	}
 
+	megasas_ocr_wq = create_workqueue("megasas_ocr");
+
+	if ( !megasas_ocr_wq )
+		printk(KERN_DEBUG "megasas: Failed to create workqueue.\n");
+
 	rval = driver_create_file(&megasas_pci_driver.driver,
 				  &driver_attr_version);
 	if (rval)
@@ -5228,6 +5234,11 @@ static void __exit megasas_exit(void)
 			   &driver_attr_release_date);
 	driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
 
+	if (megasas_ocr_wq) {
+		destroy_workqueue(megasas_ocr_wq);
+		megasas_ocr_wq = NULL;
+	}
+
 	pci_unregister_driver(&megasas_pci_driver);
 	unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
 }

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

* [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
@ 2010-11-19 17:37                 ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:37 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

[-- Attachment #2: megasas-p7-workqueue.patch --]
[-- Type: application/octet-stream, Size: 1593 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 13:46:11.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 13:47:46.000000000 -0500
@@ -108,6 +108,7 @@ static struct megasas_mgmt_info megasas_
 static struct fasync_struct *megasas_async_queue;
 static DEFINE_MUTEX(megasas_async_queue_mutex);
 
+static struct workqueue_struct *megasas_ocr_wq;
 static int megasas_poll_wait_aen;
 static DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait);
 static u32 support_poll_for_event;
@@ -2435,7 +2436,7 @@ megasas_deplete_reply_queue(struct megas
 			printk(KERN_NOTICE "megasas: fwState=%x, stage:%d\n",
 					fw_state, instance->adprecovery);
 
-			schedule_work(&instance->work_init);
+			queue_work(megasas_ocr_wq, &instance->work_init);
 			return IRQ_HANDLED;
 
 		} else {
@@ -5157,6 +5158,11 @@ static int __init megasas_init(void)
 		goto err_pcidrv;
 	}
 
+	megasas_ocr_wq = create_workqueue("megasas_ocr");
+
+	if ( !megasas_ocr_wq )
+		printk(KERN_DEBUG "megasas: Failed to create workqueue.\n");
+
 	rval = driver_create_file(&megasas_pci_driver.driver,
 				  &driver_attr_version);
 	if (rval)
@@ -5228,6 +5234,11 @@ static void __exit megasas_exit(void)
 			   &driver_attr_release_date);
 	driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
 
+	if (megasas_ocr_wq) {
+		destroy_workqueue(megasas_ocr_wq);
+		megasas_ocr_wq = NULL;
+	}
+
 	pci_unregister_driver(&megasas_pci_driver);
 	unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
 }

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

* [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
  2010-11-19 17:37                 ` Yang, Bo
@ 2010-11-19 17:43                   ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:43 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver added the new feature to take some of the workloads from FW to increase
performance of the iMR controller.  FW assigns the read cmds back to driver
which will increase the performance for megaraid sas iMR controller.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c | 1299 +++++++++++++++++++++++++++++++++++
drivers/scsi/megaraid/megaraid_sas.h |  185 ++++
 2 files changed, 1484 insertions(+)

[-- Attachment #2: megasas-p8-cpx.patch --]
[-- Type: application/octet-stream, Size: 39597 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 14:08:13.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 14:08:46.000000000 -0500
@@ -75,6 +75,12 @@ static int megasas_get_pd_list(struct me
 static int megasas_issue_init_mfi(struct megasas_instance *instance);
 static int megasas_register_aen(struct megasas_instance *instance,
 				u32 seq_num, u32 class_locale_word);
+
+static int megasas_check_cpx_support( struct megasas_instance *instance);
+static u32 megasas_remove_cpx( struct megasas_instance *instance);
+static int megasas_send_cpx_queue_data( struct megasas_instance *instance );
+static int megasas_handle_cpx_requests( struct megasas_instance *instance);
+
 /*
  * PCI ID table for all supported controllers
  */
@@ -793,6 +799,10 @@ megasas_issue_polled(struct megasas_inst
 	 */
 	for (i = 0; (i < msecs) && (frame_hdr->cmd_status == 0xff); i++) {
 		rmb();
+
+		/* FW using xor/copy as soon as we enable cpx */
+		if ((instance->unload == 1) && instance->cpx_supported )
+			megasas_handle_cpx_requests( instance);
 		msleep(1);
 	}
 
@@ -1522,6 +1532,1092 @@ static void megaraid_sas_kill_hba(struct
 	}
 }
 
+
+void xor_gen_15x1(u32 *buff_ptrs[16], u32 bytes)
+{
+	u32    off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+	u32	*s10, *s11, *s12, *s13, *s14, *s15;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+	s15 = buff_ptrs[15];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+	s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off]^s14[off]^s15[off];
+}
+
+
+void xor_gen_14x1(u32 *buff_ptrs[15], u32 bytes)
+{
+	u32    off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+	u32	*s9, *s10, *s11, *s12, *s13, *s14;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+	s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off]^s14[off];
+}
+
+
+void xor_gen_13x1(u32 *buff_ptrs[14], u32 bytes)
+{
+	u32    	off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u32	*s8, *s9, *s10, *s11, *s12, *s13;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+	s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off];
+
+}
+
+
+void xor_gen_12x1(u32 *buff_ptrs[13], u32 bytes)
+{
+	u32    	off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u32	*s8, *s9, *s10, *s11, *s12;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	    d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off]^s12[off];
+}
+
+
+void xor_gen_11x1(u32 *buff_ptrs[12], u32 bytes)
+{
+
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10, *s11;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off] ^ s9[off] ^ s10[off] ^ s11[off];
+}
+
+
+void xor_gen_10x1(u32 *buff_ptrs[11], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off] ^ s9[off] ^ s10[off];
+
+}
+
+
+void xor_gen_9x1(u32 *buff_ptrs[10], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off] ^ s9[off];
+}
+
+
+void xor_gen_8x1(u32 *buff_ptrs[9], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^\
+		s7[off]^s8[off];
+}
+
+
+void xor_gen_7x1(u32 *buff_ptrs[8], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off]^s2[off]^s3[off]^s4[off]^\
+			s5[off]^s6[off]^s7[off];
+
+}
+
+
+void xor_gen_6x1(u32 *buff_ptrs[7], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off]^s2[off]^s3[off]^\
+			s4[off]^s5[off]^s6[off];
+}
+
+
+void xor_gen_5x1(u32 *buff_ptrs[6], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off] ^ s3[off]^\
+			s4[off] ^ s5[off];
+}
+
+
+void xor_gen_4x1(u32 *buff_ptrs[5], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off] ^ s3[off] ^ s4[off];
+}
+
+
+void xor_gen_3x1(u32 *buff_ptrs[4], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off] ^ s3[off];
+}
+
+
+void xor_gen_2x1(u32 *buff_ptrs[3], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off];
+}
+
+
+void xor_gen_1x1(u32 *buff_ptrs[2], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off];
+
+}
+
+
+u8 xor_chk_15x1(u32 *buff_ptrs[16], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+	u32	*s9, *s10, *s11, *s12, *s13, *s14, *s15;
+	u8     xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+	s15 = buff_ptrs[15];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = 	d[off]^s1[off]^s2[off]^s3[off]^\
+			s4[off]^s5[off]^s6[off]^s7[off]^\
+			s8[off]^s9[off]^s10[off]^s11[off]^
+			s12[off]^s13[off]^s14[off]^s15[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_14x1(u32 *buff_ptrs[15], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5, *s6;
+	u32	*s7, *s8, *s9, *s10, *s11, *s12, *s13, *s14;
+	u8   	xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off] ^ s1[off] ^ s2[off] ^ s3[off]^\
+		s4[off] ^ s5[off] ^ s6[off] ^ s7[off]^\
+		s8[off] ^ s9[off] ^ s10[off] ^ s11[off]^\
+		s12[off] ^ s13[off] ^ s14[off];
+	if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+	}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_13x1(u32 *buff_ptrs[14], u32 bytes)
+{
+	u32     off, words;
+	u32     r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u32	*s8, *s9, *s10, *s11, *s12, *s13;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^s4[off]^\
+		s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+
+}
+
+
+u8 xor_chk_12x1(u32 *buff_ptrs[13], u32 bytes)
+{
+	u32    off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5, *s6;
+	u32	*s7, *s8, *s9, *s10, *s11, *s12;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off]^s12[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_11x1(u32 *buff_ptrs[12], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5;
+	u32	*s6, *s7, *s8, *s9, *s10, *s11;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_10x1(u32 *buff_ptrs[11], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5;
+	u32	*s6, *s7, *s8, *s9, *s10;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off]^s1[off]^s2[off]^s3[off]^s4[off]^\
+		s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_9x1(u32 *buff_ptrs[10], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4;
+	u32	*s5, *s6, *s7, *s8, *s9;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_8x1(u32 *buff_ptrs[9], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r =	d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^s8[off];
+
+	if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_7x1(u32 *buff_ptrs[8], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u8    xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off];
+	if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_6x1(u32 *buff_ptrs[7], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+u8 xor_chk_5x1(u32 *buff_ptrs[6], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off]^\
+		s3[off] ^ s4[off] ^ s5[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_4x1(u32 *buff_ptrs[5], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off] ^ s3[off] ^ s4[off];
+		if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_3x1(u32 *buff_ptrs[4], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off] ^ s3[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_2x1(u32 *buff_ptrs[3], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+
+	return xor_result;
+}
+
+u8 xor_chk_1x1(u32 *buff_ptrs[2], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		if (d[off] != s1[off]) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] = s1[off];
+		}
+	}
+
+	return xor_result;
+}
+
+void  (*xor_gen_funcs[MAX_MR_ROW_SIZE])(u32 **, u32) = {
+	xor_gen_1x1,
+	xor_gen_2x1,
+	xor_gen_3x1,
+	xor_gen_4x1,
+	xor_gen_5x1,
+	xor_gen_6x1,
+	xor_gen_7x1,
+	xor_gen_8x1,
+	xor_gen_9x1,
+	xor_gen_10x1,
+	xor_gen_11x1,
+	xor_gen_12x1,
+	xor_gen_13x1,
+	xor_gen_14x1,
+	xor_gen_15x1,
+};
+
+u8  (*xor_check_funcs[MAX_MR_ROW_SIZE])(u32 **, u32) = {
+	xor_chk_1x1,
+	xor_chk_2x1,
+	xor_chk_3x1,
+	xor_chk_4x1,
+	xor_chk_5x1,
+	xor_chk_6x1,
+	xor_chk_7x1,
+	xor_chk_8x1,
+	xor_chk_9x1,
+	xor_chk_10x1,
+	xor_chk_11x1,
+	xor_chk_12x1,
+	xor_chk_13x1,
+	xor_chk_14x1,
+	xor_chk_15x1,
+};
+
+static inline u8 megasas_scan_set_bit(u32 bitmap)
+{
+	u8  bit = 0;
+	while (bitmap) {
+		if (bitmap & 1)
+			return bit;
+
+		bitmap >>= 1;
+		bit++;
+	}
+	return ~0;
+}
+
+/**
+* megasas_do_cpx_xor - completes the xor operation
+* @xor_des		: soruce and dest buffers details.
+* @host_mem		: previously mapped memory for fw
+* @host_mem_len	: mapped memory length in bytes.
+*
+* @return 0 on success != 0 on failure
+*
+**/
+static u8 megasas_do_cpx_xor( struct mr_cpx_xor_descriptor *xor_des,
+			const u8 *host_mem, const  u32 host_mem_len)
+{
+
+	u32 buff_valid_bit_map = xor_des->buff_valid_bitmap;
+	u32 *buf_ptr_list[MAX_MR_ROW_SIZE];
+	u32 tx_count = xor_des->size;
+	u8 dest_idx, buf_idx, bit;
+	u8          is_op_gen;
+	u8  status = MR_CPX_STATUS_SUCCESS;
+
+	/* make the first buffer ptr as the destination.*/
+	if ( xor_des->op ==  MR_CPX_XOR_OP_GEN_P ||
+		xor_des->op == MR_CPX_XOR_OP_CHECK_P )
+		dest_idx = xor_des->p_idx;
+	else
+		dest_idx = xor_des->q_idx;
+
+	buf_ptr_list[0] = (u32 *)(host_mem + xor_des->buff_list[dest_idx]);
+
+	is_op_gen = MR_CPX_XOR_OP_IS_GEN(xor_des->op);
+
+	if ( xor_des->buff_list[dest_idx]+tx_count > host_mem_len) {
+		printk(KERN_ERR "1st host memory over flow detected.\n");
+		return MR_CPX_STATUS_FAILURE;
+	}
+
+	/*
+	* For XOR_OP_CHECK_P, our check routine expects
+	* bufPtrs[0] to be both parity
+	* source and parity destination; clear
+	* out the P-index from our working bitmap
+	* so that the source-buffer scan loop below
+	* doesn't include P as one of the
+	* explicit source buffers in bufPtrs[].
+	 */
+	if ( !is_op_gen)
+		buff_valid_bit_map &= ~(1<<xor_des->p_idx);
+
+	/* populate buf_ptr_list with valid buffer pointers.*/
+	for ( buf_idx = 1 ; buff_valid_bit_map != 0 ; buf_idx++ ) {
+		bit = megasas_scan_set_bit( buff_valid_bit_map);
+		buf_ptr_list[buf_idx] =
+			(u32 *)(host_mem + (u32)xor_des->buff_list[bit]);
+		if ( xor_des->buff_list[bit]+tx_count > host_mem_len) {
+			printk(KERN_ERR "host memory over flow detected.\n");
+			return MR_CPX_STATUS_FAILURE;
+		}
+		buff_valid_bit_map &= ~(1 << bit);
+	}
+	/* call the xor gen fuctions.*/
+	if ( is_op_gen )
+		(*xor_gen_funcs[buf_idx-2])(buf_ptr_list, tx_count);
+	else
+		status =
+		(*xor_check_funcs[buf_idx-2])(buf_ptr_list, tx_count);
+
+	return status;
+}
+
+static u8 megasas_copy( struct page *page, u32 page_offset,
+			u32 sge_offset, u8 *host_ptr, u32 len, u8 dir)
+{
+	u8 *page_addr;
+	u32 off;
+	u32 bytes_copied;
+	u32 remaining;
+
+	remaining = len;
+	off = page_offset+sge_offset;
+
+	/* kmap_atomic maps single page size but os sg element can have size
+	 more than page size, handle it.**/
+
+	while (remaining > 0 ) {
+
+		bytes_copied =
+			min((size_t)remaining,
+			(size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
+
+		page_addr =
+			kmap_atomic(page + (off >> PAGE_SHIFT), KM_SOFTIRQ0);
+		if ( page_addr == NULL ) {
+			printk(KERN_NOTICE "kmap_atomic is failed.\n");
+			return MR_CPX_STATUS_FAILURE;
+		}
+		if ( dir == MR_CPX_DIR_WRITE )
+			memcpy( host_ptr,
+				page_addr+(off & ~PAGE_MASK),
+				bytes_copied );
+		else
+			memcpy( page_addr+(off & ~PAGE_MASK),
+				host_ptr,
+				bytes_copied );
+
+		kunmap_atomic ( page_addr, KM_SOFTIRQ0 );
+
+		host_ptr += bytes_copied;
+		remaining -= bytes_copied;
+		off += bytes_copied;
+	}
+
+	return MR_CPX_STATUS_SUCCESS;
+}
+
+/**
+* megasas_do_cpx_copy - Completes the copy opreation
+* @instance		: Driver soft state.
+* @cpy_des		: input for copying the data.
+*
+* @return 0 on success != 0 on failure
+*
+*/
+
+static u8 megasas_do_cpx_copy( struct megasas_instance *instance,
+				struct mr_cpx_copy_descriptor *cpy_des)
+{
+	u8			status = MR_CPX_STATUS_SUCCESS ;
+	u32			total_remaining_len = cpy_des->total_byte_count;
+	u32			row_remaining_length;
+	u32	os_sge_sz = 0, os_sge_offset = 0, os_sge_idx = 0, os_sge_len;
+	u8	sge_cnt, row_idx, *fw_ptr = NULL, host_skip_count_handled;
+	struct scsi_cmnd	*os_cmd;
+	struct scatterlist	*os_sgl;
+	struct megasas_cmd	*mega_cmd;
+	struct megasas_io_frame *ldio;
+
+	if ( cpy_des->mfi_cmd_cxt  >= instance->max_fw_cmds ) {
+		printk(KERN_NOTICE "invalid context - 0x%x shoul be < 0x%x \n",
+				cpy_des->mfi_cmd_cxt, instance->max_fw_cmds );
+		return MR_CPX_STATUS_FAILURE;
+	}
+
+	mega_cmd =
+		(struct megasas_cmd *)instance->cmd_list[cpy_des->mfi_cmd_cxt];
+	os_cmd = mega_cmd->scmd;
+	ldio = (struct megasas_io_frame *)mega_cmd->frame;
+	sge_cnt = ldio->sge_count;
+
+	host_skip_count_handled = 0;
+	row_idx = 0;
+	row_remaining_length = 0;
+
+	scsi_for_each_sg(os_cmd, os_sgl, sge_cnt, os_sge_idx) {
+
+		os_sge_len = sg_dma_len(os_sgl);
+
+		if ( !host_skip_count_handled  &&
+			cpy_des->host_skip_count < (os_sge_sz += os_sge_len)) {
+
+			os_sge_offset =
+			cpy_des->host_skip_count - ( os_sge_sz -os_sge_len );
+			os_sge_len -= os_sge_offset;
+			host_skip_count_handled = 1;
+		} else if (!host_skip_count_handled &&
+			cpy_des->host_skip_count == os_sge_sz ) {
+			os_sge_offset = 0;
+			host_skip_count_handled = 1;
+			continue;
+		}
+
+		if ( !host_skip_count_handled )
+			continue;
+
+		for ( ; total_remaining_len &&  row_idx < MAX_MR_ROW_SIZE;
+			row_idx++ ) {
+
+			if ( !row_remaining_length ) {
+		fw_ptr =
+		(u8 *)(instance->host_mem_virt+cpy_des->copy_buf[row_idx].buf);
+			row_remaining_length = cpy_des->copy_buf[row_idx].size;
+		}
+
+			status = megasas_copy( 	sg_page(os_sgl),
+						os_sgl->offset,
+						os_sge_offset,
+						fw_ptr,
+					MIN(os_sge_len, row_remaining_length),
+					cpy_des->dir);
+			if (status)
+			     break;
+
+			total_remaining_len -=
+					MIN(os_sge_len, row_remaining_length);
+
+			if ( os_sge_len <= row_remaining_length ) {
+				fw_ptr += os_sge_len;
+				row_remaining_length -= os_sge_len;
+				if (!(row_remaining_length))
+					row_idx++;
+				os_sge_offset = 0;
+				break;
+			}else{
+				os_sge_len -= row_remaining_length;
+				os_sge_offset += row_remaining_length;
+				row_remaining_length = 0;
+			}
+
+		}
+		if ( row_idx >= MAX_MR_ROW_SIZE && total_remaining_len )
+			printk(KERN_NOTICE "row_idx=0x%x,remaining_len= 0x%x\n",
+			       row_idx, total_remaining_len);
+
+		if (total_remaining_len == 0 ||
+			status == MR_CPX_STATUS_FAILURE )
+			break;
+	}
+
+	if ( os_sge_idx >= sge_cnt && total_remaining_len )
+		printk(KERN_NOTICE "sge_idx = 0x%x, remaining_len = 0x%x \n",
+			       os_sge_idx, total_remaining_len);
+
+	return status;
+
+}
+/**
+* megasas_handle_cpx_requests - Manages the fw queues
+* @instance		: Driver soft state.
+*
+* @return 0 on success != 0 on failure
+*
+*/
+static int megasas_handle_cpx_requests( struct megasas_instance *instance)
+{
+	struct mr_cpx_request_queue *req_q = instance->cpx_request_queue;
+	u32 producer_idx, consumer_idx;
+	u8 retval = 0;
+	unsigned long flags;
+
+	producer_idx = req_q->producer_idx;
+	consumer_idx = req_q->consumer_idx;
+
+	while ((producer_idx != consumer_idx) &&
+		(instance->adprecovery == MEGASAS_HBA_OPERATIONAL)) {
+		union  mr_cpx_descriptor *cpx_des =
+			&instance->cpx_dscrptr[consumer_idx];
+		union  mr_cpx_response_data rsp_data;
+
+		if ( cpx_des->cpx_copy_desc.hdr.type ==
+				MR_CPX_DESCRIPTOR_TYPE_COPY )
+			retval = megasas_do_cpx_copy(instance,
+				(struct mr_cpx_copy_descriptor *)cpx_des );
+
+		else if (cpx_des->cpx_copy_desc.hdr.type ==
+					MR_CPX_DESCRIPTOR_TYPE_XOR )
+			retval = megasas_do_cpx_xor(
+				(struct mr_cpx_xor_descriptor *)cpx_des,
+					(u8 *)instance->host_mem_virt,
+					instance->host_mem_len );
+		else{
+			printk(KERN_ERR "Got invalid descriptor type...\n");
+			retval = MR_CPX_STATUS_FAILURE;
+			break;
+		}
+
+		rsp_data.r.status = retval;
+		rsp_data.r.context = cpx_des->cpx_copy_desc.hdr.context;
+		rsp_data.r.type = cpx_des->cpx_copy_desc.hdr.type;
+
+		/* notify fw.*/
+		spin_lock_irqsave(&instance->hba_lock, flags);
+		writel( ~0, &instance->reg_set->inbound_high_queue_port);
+		writel( rsp_data.w, &instance->reg_set->inbound_low_queue_port);
+		spin_unlock_irqrestore(&instance->hba_lock, flags);
+
+		consumer_idx++;
+		if ( consumer_idx == instance->cpx_dscrptr_cnt )
+			consumer_idx = 0;
+
+	}
+	req_q->consumer_idx = producer_idx;
+
+	return 0;
+}
+
 /**
  * megasas_complete_cmd_dpc	 -	Returns FW's controller structure
  * @instance_addr:			Address of adapter soft state
@@ -1569,6 +2665,9 @@ static void megasas_complete_cmd_dpc(uns
 
 	spin_unlock_irqrestore(&instance->completion_lock, flags);
 
+	if ( instance->cpx_supported )
+		megasas_handle_cpx_requests( instance);
+
 	/*
 	 * Check if we can restore can_queue
 	 */
@@ -2359,6 +3458,17 @@ process_fw_state_change_wq(struct work_s
 			*instance->consumer = 0;
 			*instance->producer = 0;
 		}
+		if (instance->cpx_supported){
+			instance->cpx_request_queue->consumer_idx =
+				instance->cpx_request_queue->producer_idx = 0;
+
+			if ( megasas_check_cpx_support( instance ) == 0  ){
+				if ( megasas_send_cpx_queue_data( instance ) ){
+				printk(KERN_NOTICE "Send cpx failed.\n");
+					megasas_remove_cpx(instance);
+				}
+			}
+		}
 
 		megasas_issue_init_mfi(instance);
 
@@ -3111,6 +4221,180 @@ megasas_get_ctrl_info(struct megasas_ins
 	return ret;
 }
 
+
+/**
+ * megasas_check_cpx_support : Tries to get the host memory address if fails then cpx
+				not supported else cpx supported.
+ * @instance:		Adapter soft state
+ *
+ * @return 0 on success non-zero on failure.
+ */
+static int megasas_check_cpx_support( struct megasas_instance *instance)
+{
+	struct megasas_cmd *cmd;
+	struct megasas_dcmd_frame *dcmd;
+	struct mr_cpx_init_data *cpx_init_data;
+	dma_addr_t cpx_init_data_h;
+	int retval = 0;
+
+	cmd = megasas_get_cmd(instance);
+	if (!cmd) {
+		printk(KERN_DEBUG "Failed to get cmd\n");
+		return -ENOMEM;
+	}
+
+	cpx_init_data = pci_alloc_consistent(instance->pdev,
+			sizeof( struct mr_cpx_init_data), &cpx_init_data_h);
+
+	if (cpx_init_data == NULL) {
+		printk(KERN_DEBUG "Failed to alloc mem for cpx_init_data. \n");
+		megasas_return_cmd(instance, cmd);
+		return -ENOMEM;
+	}
+
+	dcmd = &cmd->frame->dcmd;
+	dcmd->flags = 0;
+	dcmd->opcode = MR_DCMD_CTRL_MISC_CPX_INIT_DATA_GET;
+	dcmd->data_xfer_len  = sizeof(struct mr_cpx_init_data );
+	dcmd->cmd = MFI_CMD_DCMD;
+	dcmd->cmd_status  = 0xff;
+	dcmd->sge_count = 1;
+	dcmd->sgl.sge32[0].phys_addr = cpx_init_data_h;
+	dcmd->sgl.sge32[0].length = sizeof(struct mr_cpx_init_data);
+
+	retval = megasas_issue_polled ( instance, cmd );
+
+	if (retval == 0 && cmd->frame->hdr.cmd_status == 0) {
+		instance->host_mem_phys = cpx_init_data->phys_addr_cache_buf;
+		instance->host_mem_len  = cpx_init_data->size;
+		instance->cpx_dscrptr_cnt = cpx_init_data->cpx_desc_count;
+
+		if ( instance->host_mem_len == 0 ||
+			instance->host_mem_phys == 0 ||
+			!instance->cpx_dscrptr_cnt ){
+
+		printk(KERN_ERR "No host_mem_phys/cpx_descriptor\n");
+			retval = 1;
+		}
+	} else {
+		printk(KERN_NOTICE "megasas: cpx is not supported.\n");
+		retval = 1;
+	}
+
+	instance->cpx_supported = (retval ? 0:1);
+
+	pci_free_consistent(instance->pdev,
+			sizeof(struct mr_cpx_init_data),
+			cpx_init_data, cpx_init_data_h);
+
+	megasas_return_cmd(instance, cmd);
+
+	return retval;
+}
+
+/**
+ * megasas_send_cpx_queue_data : Sends the queue setup info to fw.
+ * @instance:		Adapter soft state
+ *
+ * @return 0 on success non-zero on failure.
+ */
+
+static int megasas_send_cpx_queue_data( struct megasas_instance *instance )
+{
+
+	struct megasas_cmd *cmd;
+	struct megasas_dcmd_frame *dcmd;
+	int retval = 0;
+
+	cmd = megasas_get_cmd(instance);
+	if (!cmd) {
+		printk(KERN_DEBUG "Failed to get cmd\n");
+		return -ENOMEM;
+	}
+
+	dcmd = &cmd->frame->dcmd;
+	dcmd->flags = 0;
+	dcmd->opcode = MR_DCMD_CTRL_MISC_CPX_QUEUE_DATA;
+	dcmd->data_xfer_len  = sizeof( struct mr_cpx_queue_data );
+	dcmd->cmd = MFI_CMD_DCMD;
+	dcmd->cmd_status  = 0xff;
+	dcmd->sge_count = 1;
+	dcmd->mbox.w[0] = instance->cpx_request_queue_h;
+	dcmd->mbox.w[1] = 0;
+	dcmd->mbox.w[2] = instance->cpx_dscrptr_cnt;
+
+	retval = megasas_issue_polled ( instance, cmd );
+
+	megasas_return_cmd( instance, cmd);
+
+	if ( retval == 0 ) {
+		instance->cpx_request_queue->consumer_idx =
+			instance->cpx_request_queue->producer_idx = 0;
+		instance->cpx_supported = 1;
+	}
+
+	return retval;
+}
+
+static u32 megasas_get_cpx_mem_len( u16 max_fw_cmds )
+{
+	return (sizeof( struct mr_cpx_request_queue ) +
+		sizeof( union mr_cpx_descriptor ) * ( max_fw_cmds) );
+}
+
+static u32 megasas_remove_cpx( struct megasas_instance *instance)
+{
+		if ( instance->host_mem_virt )
+			iounmap(instance->host_mem_virt);
+
+		if ( instance->cpx_request_queue )
+			pci_free_consistent(instance->pdev,
+			megasas_get_cpx_mem_len( instance->cpx_dscrptr_cnt),
+			instance->cpx_request_queue,
+			instance->cpx_request_queue_h );
+
+		instance->cpx_supported = 0;
+
+	return 0;
+}
+
+/* should have host_mem_phys intialized before calling this function.*/
+static int megasas_init_cpx( struct megasas_instance *instance)
+{
+	instance->host_mem_virt = ioremap(instance->host_mem_phys,
+					instance->host_mem_len);
+	if ( instance->host_mem_virt == NULL ) {
+		printk(KERN_ERR "megasas: Failed to ioremap host memory.\n");
+		goto error_unload;
+	}
+
+	/* allocate memory for indices and descriptors response array's */
+	instance->cpx_request_queue =
+			pci_alloc_consistent( instance->pdev,
+			megasas_get_cpx_mem_len (instance->cpx_dscrptr_cnt),
+			&instance->cpx_request_queue_h );
+
+	if ( instance->cpx_request_queue == NULL ) {
+		printk(KERN_ERR "Out of DMA memory for cpx operations.\n");
+		goto error_unload;
+	}
+
+	/*initialize queues*/
+	instance->cpx_dscrptr =
+		(union mr_cpx_descriptor *)((u8 *)instance->cpx_request_queue +
+			(sizeof(instance->cpx_request_queue->consumer_idx)*2 ));
+
+	if ( megasas_send_cpx_queue_data( instance ) ) {
+		printk(KERN_ERR " Sending cpx queue data to FW failed.\n");
+		goto error_unload;
+	}
+	return 0;
+
+error_unload:
+	megasas_remove_cpx( instance );
+	return -1;
+}
+
 /**
  * megasas_issue_init_mfi -	Initializes the FW
  * @instance:		Adapter soft state
@@ -3353,6 +4637,10 @@ static int megasas_init_mfi(struct megas
 		printk(KERN_DEBUG "megasas: Can't allocate version buffer\n");
 	}
 
+	if ( megasas_check_cpx_support( instance ) == 0  )
+		if ( megasas_init_cpx( instance ) )
+			printk(KERN_ERR "Error in initilizing cpx.\n");
+
 	if (megasas_issue_init_mfi(instance))
 		goto fail_fw_init;
 
@@ -3455,6 +4743,8 @@ static void megasas_release_mfi(struct m
 
 	iounmap(instance->reg_set);
 
+	megasas_remove_cpx( instance );
+
 	pci_release_selected_regions(instance->pdev,
 		pci_select_bars(instance->pdev, IORESOURCE_MEM));
 }
@@ -4141,6 +5431,15 @@ megasas_resume(struct pci_dev *pdev)
 	if (megasas_transition_to_ready(instance))
 		goto fail_ready_state;
 
+	if ( megasas_check_cpx_support( instance ) == 0  ) {
+		if ( megasas_send_cpx_queue_data( instance ) ) {
+			printk(KERN_ERR "Send cpx queue to FW failed.\n");
+			megasas_remove_cpx(instance);
+		}else
+			instance->cpx_request_queue->consumer_idx =
+				instance->cpx_request_queue->producer_idx = 0;
+	}
+
 	if (megasas_issue_init_mfi(instance))
 		goto fail_init_mfi;
 
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-15 04:45:34.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-17 02:18:53.000000000 -0500
@@ -144,6 +144,14 @@
 #define MR_DCMD_CLUSTER_RESET_LD		0x08010200
 #define MR_DCMD_PD_LIST_QUERY                   0x02010100
 
+#define MR_DCMD_CTRL_MISC_CPX			0x0100e200
+#define MR_DCMD_CTRL_MISC_CPX_INIT_DATA_GET	0x0100e201
+#define MR_DCMD_CTRL_MISC_CPX_QUEUE_DATA	0x0100e202
+#define MR_DCMD_CTRL_MISC_CPX_UNREGISTER	0x0100e203
+#define MAX_MR_ROW_SIZE				32
+#define MR_CPX_DIR_WRITE			1
+#define MR_CPX_DIR_READ				0
+#define MR_CPX_VERSION				1
 /*
  * MFI command completion codes
  */
@@ -1256,6 +1264,174 @@ struct megasas_evt_detail {
 
 } __attribute__ ((packed));
 
+#define MIN(a, b) ((a) < (b) ? (a):(b))
+
+
+/*
+* enumerates type of descriptor
+*/
+
+enum MR_CPX_DESCRIPTOR_TYPE {
+	MR_CPX_DESCRIPTOR_TYPE_COPY   = 1,
+	MR_CPX_DESCRIPTOR_TYPE_XOR    = 2
+};
+
+/*
+* status information of copy or xor operation
+*/
+enum MR_CPX_STATUS {
+	MR_CPX_STATUS_SUCCESS      = 0,
+	MR_CPX_STATUS_INCONSISTENT = 1,
+	MR_CPX_STATUS_FAILURE      = 2,
+};
+
+/*
+* define the XOR opcodes
+*/
+enum MR_CPX_XOR_OP {
+	MR_CPX_XOR_OP_GEN_P    = 0x01,
+	MR_CPX_XOR_OP_GEN_Q    = 0x02, /* generate Q buffer */
+	MR_CPX_XOR_OP_GEN_PQ   = 0x03, /* generate P+Q buffers */
+	MR_CPX_XOR_OP_CHECK_P  = 0x11, /* check P buffer */
+	MR_CPX_XOR_OP_CHECK_Q  = 0x12, /* check Q buffer */
+	MR_CPX_XOR_OP_CHECK_PQ = 0x13, /* check P+Q buffers */
+};
+
+#define MR_CPX_XOR_OP_IS_CHECK(xorOp)  ((xorOp & 0x10) != 0)
+#define MR_CPX_XOR_OP_IS_GEN(xorOp)    (!MR_CPX_XOR_OP_IS_CHECK(xorOp))
+#define MR_CPX_XOR_OP_IS_P(xorOp)      ((xorOp & 0x01) != 0)
+#define MR_CPX_XOR_OP_IS_Q(xorOp)      ((xorOp & 0x02) != 0)
+#define MR_CPX_XOR_OP_IS_PQ(xorOp)     ((xorOp & 0x03) == 3)
+
+/*
+* this data is passed to driver during driver init.
+*/
+struct mr_cpx_init_data {
+	u32	cpx_desc_count;
+	u32     size;
+	u64     phys_addr_cache_buf;
+
+} __attribute__ ((packed));
+
+/*
+* header passed with each descriptor
+*/
+struct mr_cpx_header {
+	u32        context   : 24;
+	u32        type     :  4;
+	u32        resvd    :  4;
+} __attribute__ ((packed));
+
+/*
+* xor descriptor data
+*/
+struct mr_cpx_xor_descriptor {
+	struct mr_cpx_header      hdr;
+	enum MR_CPX_XOR_OP      op;
+	u32             size;
+	u32             buff_valid_bitmap;
+	u8              p_idx;
+	u8              q_idx;
+	u8              pad[2];
+	u32             buff_list[MAX_MR_ROW_SIZE];
+	u32             mult_list[MAX_MR_ROW_SIZE];
+} __attribute__ ((packed));
+
+
+/*
+* copy buffer for each transfer. each such tranfer between
+* user spare host address and firmware allocated cache data.
+*/
+struct mr_cpx_copy_mr_buffer {
+	u32     buf;
+	u32     size;
+} __attribute__ ((packed));
+
+/*
+* copy descriptor data
+*/
+struct mr_cpx_copy_descriptor {
+	struct mr_cpx_header              hdr;
+	u32                     mfi_cmd_cxt;
+	u32                     total_byte_count;
+	u32                     host_skip_count;
+	u8                      dir;
+	u8                      pad[3];
+	struct mr_cpx_copy_mr_buffer      copy_buf[MAX_MR_ROW_SIZE];
+} __attribute__ ((packed)) ;
+
+/*
+* users of this interface must allocate memory for the size of
+* this structure while allocating memory for descriptors
+*/
+union mr_cpx_descriptor {
+	struct mr_cpx_xor_descriptor       cpx_xor_desc;
+	struct mr_cpx_copy_descriptor     cpx_copy_desc;
+	u8                      pad[512];
+} __attribute__ ((packed));
+
+
+/*
+* request queue.
+* firmware manages producerindex, driver manages consumerindex.
+* number of decriptors is kept as variable. driver must use
+* max host commands supported for allocation.
+*/
+struct mr_cpx_request_queue {
+	u32             consumer_idx;
+	u32             producer_idx;
+	union mr_cpx_descriptor   cpxdescriptor[1];
+} __attribute__ ((packed));
+
+
+/*
+* response data. this data will be posted by driver after copy/xor
+* operation is compete.
+*/
+union mr_cpx_response_data {
+	struct {
+		u32         context     : 24;
+		u32         status      :  4;
+		u32         type        :  4;
+	} r;
+	u32         w;
+} __attribute__ ((packed));
+
+
+/*
+* response queue.
+* driver manages producerindex, firmware manages consumerindex.
+* number of decriptors is kept as variable. driver must use
+* max host commands supported for allocation.
+*/
+struct  mr_cpx_response_queue {
+	u32                 consumer_idx;
+	u32                 producer_idx;
+	union mr_cpx_response_data   cpx_resp_data[1];
+} __attribute__ ((packed));
+
+
+/*
+* the size of each of the structure within this is determined at run time.
+* this structure is for document purpose and shows that the structures
+* lay as shown below in memory
+*/
+struct  mr_cpx_queues {
+	struct mr_cpx_request_queue     requestqueue;
+	struct mr_cpx_response_queue    responsequeue;
+} __attribute__ ((packed));
+
+/*
+* driver sends this queue data during mfi init. firmware
+* will not use the interface if the versions do not match.
+*/
+struct mr_cpx_queue_data {
+	u32         version;
+	u32         count_queue_entries;
+	u64         phys_addr_cpx_queues;
+} __attribute__ ((packed));
+
+
 struct megasas_aen_event {
 	struct work_struct hotplug_work;
 	struct megasas_instance *instance;
@@ -1330,6 +1506,15 @@ struct megasas_instance {
 
 	struct timer_list io_completion_timer;
 	struct list_head internal_reset_pending_q;
+
+	u32 cpx_supported;
+	struct mr_cpx_request_queue *cpx_request_queue;
+	dma_addr_t cpx_request_queue_h;
+	union mr_cpx_descriptor *cpx_dscrptr;
+	u32 cpx_dscrptr_cnt;
+	u64 host_mem_phys;
+	u32 host_mem_len;
+	u8 *host_mem_virt;
 };
 
 enum {

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

* [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
@ 2010-11-19 17:43                   ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:43 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

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

Driver added the new feature to take some of the workloads from FW to increase
performance of the iMR controller.  FW assigns the read cmds back to driver
which will increase the performance for megaraid sas iMR controller.

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
drivers/scsi/megaraid/megaraid_sas.c | 1299 +++++++++++++++++++++++++++++++++++
drivers/scsi/megaraid/megaraid_sas.h |  185 ++++
 2 files changed, 1484 insertions(+)

[-- Attachment #2: megasas-p8-cpx.patch --]
[-- Type: application/octet-stream, Size: 39597 bytes --]

diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 14:08:13.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 14:08:46.000000000 -0500
@@ -75,6 +75,12 @@ static int megasas_get_pd_list(struct me
 static int megasas_issue_init_mfi(struct megasas_instance *instance);
 static int megasas_register_aen(struct megasas_instance *instance,
 				u32 seq_num, u32 class_locale_word);
+
+static int megasas_check_cpx_support( struct megasas_instance *instance);
+static u32 megasas_remove_cpx( struct megasas_instance *instance);
+static int megasas_send_cpx_queue_data( struct megasas_instance *instance );
+static int megasas_handle_cpx_requests( struct megasas_instance *instance);
+
 /*
  * PCI ID table for all supported controllers
  */
@@ -793,6 +799,10 @@ megasas_issue_polled(struct megasas_inst
 	 */
 	for (i = 0; (i < msecs) && (frame_hdr->cmd_status == 0xff); i++) {
 		rmb();
+
+		/* FW using xor/copy as soon as we enable cpx */
+		if ((instance->unload == 1) && instance->cpx_supported )
+			megasas_handle_cpx_requests( instance);
 		msleep(1);
 	}
 
@@ -1522,6 +1532,1092 @@ static void megaraid_sas_kill_hba(struct
 	}
 }
 
+
+void xor_gen_15x1(u32 *buff_ptrs[16], u32 bytes)
+{
+	u32    off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+	u32	*s10, *s11, *s12, *s13, *s14, *s15;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+	s15 = buff_ptrs[15];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+	s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off]^s14[off]^s15[off];
+}
+
+
+void xor_gen_14x1(u32 *buff_ptrs[15], u32 bytes)
+{
+	u32    off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+	u32	*s9, *s10, *s11, *s12, *s13, *s14;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+	s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off]^s14[off];
+}
+
+
+void xor_gen_13x1(u32 *buff_ptrs[14], u32 bytes)
+{
+	u32    	off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u32	*s8, *s9, *s10, *s11, *s12, *s13;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+	s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off];
+
+}
+
+
+void xor_gen_12x1(u32 *buff_ptrs[13], u32 bytes)
+{
+	u32    	off, words;
+	u32    	*d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u32	*s8, *s9, *s10, *s11, *s12;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	    d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off]^s12[off];
+}
+
+
+void xor_gen_11x1(u32 *buff_ptrs[12], u32 bytes)
+{
+
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10, *s11;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off] ^ s9[off] ^ s10[off] ^ s11[off];
+}
+
+
+void xor_gen_10x1(u32 *buff_ptrs[11], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9, *s10;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off] ^ s9[off] ^ s10[off];
+
+}
+
+
+void xor_gen_9x1(u32 *buff_ptrs[10], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off] ^ s9[off];
+}
+
+
+void xor_gen_8x1(u32 *buff_ptrs[9], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+	d[off] = s1[off]^s2[off]^s3[off]^s4[off]^s5[off]^s6[off]^\
+		s7[off]^s8[off];
+}
+
+
+void xor_gen_7x1(u32 *buff_ptrs[8], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off]^s2[off]^s3[off]^s4[off]^\
+			s5[off]^s6[off]^s7[off];
+
+}
+
+
+void xor_gen_6x1(u32 *buff_ptrs[7], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5, *s6;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off]^s2[off]^s3[off]^\
+			s4[off]^s5[off]^s6[off];
+}
+
+
+void xor_gen_5x1(u32 *buff_ptrs[6], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4, *s5;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off] ^ s3[off]^\
+			s4[off] ^ s5[off];
+}
+
+
+void xor_gen_4x1(u32 *buff_ptrs[5], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3, *s4;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off] ^ s3[off] ^ s4[off];
+}
+
+
+void xor_gen_3x1(u32 *buff_ptrs[4], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2, *s3;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off] ^ s3[off];
+}
+
+
+void xor_gen_2x1(u32 *buff_ptrs[3], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1, *s2;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off] ^ s2[off];
+}
+
+
+void xor_gen_1x1(u32 *buff_ptrs[2], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++)
+		d[off] = s1[off];
+
+}
+
+
+u8 xor_chk_15x1(u32 *buff_ptrs[16], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+	u32	*s9, *s10, *s11, *s12, *s13, *s14, *s15;
+	u8     xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+	s15 = buff_ptrs[15];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = 	d[off]^s1[off]^s2[off]^s3[off]^\
+			s4[off]^s5[off]^s6[off]^s7[off]^\
+			s8[off]^s9[off]^s10[off]^s11[off]^
+			s12[off]^s13[off]^s14[off]^s15[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_14x1(u32 *buff_ptrs[15], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5, *s6;
+	u32	*s7, *s8, *s9, *s10, *s11, *s12, *s13, *s14;
+	u8   	xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+	s14 = buff_ptrs[14];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off] ^ s1[off] ^ s2[off] ^ s3[off]^\
+		s4[off] ^ s5[off] ^ s6[off] ^ s7[off]^\
+		s8[off] ^ s9[off] ^ s10[off] ^ s11[off]^\
+		s12[off] ^ s13[off] ^ s14[off];
+	if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+	}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_13x1(u32 *buff_ptrs[14], u32 bytes)
+{
+	u32     off, words;
+	u32     r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u32	*s8, *s9, *s10, *s11, *s12, *s13;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+	s13 = buff_ptrs[13];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^s4[off]^\
+		s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off]^s12[off]^s13[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+
+}
+
+
+u8 xor_chk_12x1(u32 *buff_ptrs[13], u32 bytes)
+{
+	u32    off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5, *s6;
+	u32	*s7, *s8, *s9, *s10, *s11, *s12;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+	s12 = buff_ptrs[12];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off]^s12[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_11x1(u32 *buff_ptrs[12], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5;
+	u32	*s6, *s7, *s8, *s9, *s10, *s11;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+	s11 = buff_ptrs[11];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off]^s11[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_10x1(u32 *buff_ptrs[11], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4, *s5;
+	u32	*s6, *s7, *s8, *s9, *s10;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+	s10 = buff_ptrs[10];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off]^s1[off]^s2[off]^s3[off]^s4[off]^\
+		s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off]^s10[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_9x1(u32 *buff_ptrs[10], u32 bytes)
+{
+	u32    	off, words;
+	u32    	r, *d, *s1, *s2, *s3, *s4;
+	u32	*s5, *s6, *s7, *s8, *s9;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+	s9  = buff_ptrs[9];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^\
+		s8[off]^s9[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_8x1(u32 *buff_ptrs[9], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+	s8  = buff_ptrs[8];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r =	d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off]^s8[off];
+
+	if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_7x1(u32 *buff_ptrs[8], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6, *s7;
+	u8    xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+	s7  = buff_ptrs[7];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+	r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off]^s7[off];
+	if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_6x1(u32 *buff_ptrs[7], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5, *s6;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+	s6  = buff_ptrs[6];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off]^s1[off]^s2[off]^s3[off]^\
+		s4[off]^s5[off]^s6[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+u8 xor_chk_5x1(u32 *buff_ptrs[6], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4, *s5;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+	s5  = buff_ptrs[5];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off]^\
+		s3[off] ^ s4[off] ^ s5[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_4x1(u32 *buff_ptrs[5], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3, *s4;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+	s4  = buff_ptrs[4];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off] ^ s3[off] ^ s4[off];
+		if (r) {
+		xor_result = MR_CPX_STATUS_INCONSISTENT;
+		d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_3x1(u32 *buff_ptrs[4], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2, *s3;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+	s3  = buff_ptrs[3];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off] ^ s3[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+	return xor_result;
+}
+
+
+u8 xor_chk_2x1(u32 *buff_ptrs[3], u32 bytes)
+{
+	u32    off, words;
+	u32    r, *d, *s1, *s2;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+	s2  = buff_ptrs[2];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		r = d[off] ^ s1[off] ^ s2[off];
+		if (r) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] ^= r;
+		}
+	}
+
+	return xor_result;
+}
+
+u8 xor_chk_1x1(u32 *buff_ptrs[2], u32 bytes)
+{
+	u32    off, words;
+	u32    *d, *s1;
+	u8   xor_result = MR_CPX_STATUS_SUCCESS;
+
+	d   = buff_ptrs[0];
+	s1  = buff_ptrs[1];
+
+	for (words = bytes/4, off = 0; words > 0; words--, off++) {
+		if (d[off] != s1[off]) {
+			xor_result = MR_CPX_STATUS_INCONSISTENT;
+			d[off] = s1[off];
+		}
+	}
+
+	return xor_result;
+}
+
+void  (*xor_gen_funcs[MAX_MR_ROW_SIZE])(u32 **, u32) = {
+	xor_gen_1x1,
+	xor_gen_2x1,
+	xor_gen_3x1,
+	xor_gen_4x1,
+	xor_gen_5x1,
+	xor_gen_6x1,
+	xor_gen_7x1,
+	xor_gen_8x1,
+	xor_gen_9x1,
+	xor_gen_10x1,
+	xor_gen_11x1,
+	xor_gen_12x1,
+	xor_gen_13x1,
+	xor_gen_14x1,
+	xor_gen_15x1,
+};
+
+u8  (*xor_check_funcs[MAX_MR_ROW_SIZE])(u32 **, u32) = {
+	xor_chk_1x1,
+	xor_chk_2x1,
+	xor_chk_3x1,
+	xor_chk_4x1,
+	xor_chk_5x1,
+	xor_chk_6x1,
+	xor_chk_7x1,
+	xor_chk_8x1,
+	xor_chk_9x1,
+	xor_chk_10x1,
+	xor_chk_11x1,
+	xor_chk_12x1,
+	xor_chk_13x1,
+	xor_chk_14x1,
+	xor_chk_15x1,
+};
+
+static inline u8 megasas_scan_set_bit(u32 bitmap)
+{
+	u8  bit = 0;
+	while (bitmap) {
+		if (bitmap & 1)
+			return bit;
+
+		bitmap >>= 1;
+		bit++;
+	}
+	return ~0;
+}
+
+/**
+* megasas_do_cpx_xor - completes the xor operation
+* @xor_des		: soruce and dest buffers details.
+* @host_mem		: previously mapped memory for fw
+* @host_mem_len	: mapped memory length in bytes.
+*
+* @return 0 on success != 0 on failure
+*
+**/
+static u8 megasas_do_cpx_xor( struct mr_cpx_xor_descriptor *xor_des,
+			const u8 *host_mem, const  u32 host_mem_len)
+{
+
+	u32 buff_valid_bit_map = xor_des->buff_valid_bitmap;
+	u32 *buf_ptr_list[MAX_MR_ROW_SIZE];
+	u32 tx_count = xor_des->size;
+	u8 dest_idx, buf_idx, bit;
+	u8          is_op_gen;
+	u8  status = MR_CPX_STATUS_SUCCESS;
+
+	/* make the first buffer ptr as the destination.*/
+	if ( xor_des->op ==  MR_CPX_XOR_OP_GEN_P ||
+		xor_des->op == MR_CPX_XOR_OP_CHECK_P )
+		dest_idx = xor_des->p_idx;
+	else
+		dest_idx = xor_des->q_idx;
+
+	buf_ptr_list[0] = (u32 *)(host_mem + xor_des->buff_list[dest_idx]);
+
+	is_op_gen = MR_CPX_XOR_OP_IS_GEN(xor_des->op);
+
+	if ( xor_des->buff_list[dest_idx]+tx_count > host_mem_len) {
+		printk(KERN_ERR "1st host memory over flow detected.\n");
+		return MR_CPX_STATUS_FAILURE;
+	}
+
+	/*
+	* For XOR_OP_CHECK_P, our check routine expects
+	* bufPtrs[0] to be both parity
+	* source and parity destination; clear
+	* out the P-index from our working bitmap
+	* so that the source-buffer scan loop below
+	* doesn't include P as one of the
+	* explicit source buffers in bufPtrs[].
+	 */
+	if ( !is_op_gen)
+		buff_valid_bit_map &= ~(1<<xor_des->p_idx);
+
+	/* populate buf_ptr_list with valid buffer pointers.*/
+	for ( buf_idx = 1 ; buff_valid_bit_map != 0 ; buf_idx++ ) {
+		bit = megasas_scan_set_bit( buff_valid_bit_map);
+		buf_ptr_list[buf_idx] =
+			(u32 *)(host_mem + (u32)xor_des->buff_list[bit]);
+		if ( xor_des->buff_list[bit]+tx_count > host_mem_len) {
+			printk(KERN_ERR "host memory over flow detected.\n");
+			return MR_CPX_STATUS_FAILURE;
+		}
+		buff_valid_bit_map &= ~(1 << bit);
+	}
+	/* call the xor gen fuctions.*/
+	if ( is_op_gen )
+		(*xor_gen_funcs[buf_idx-2])(buf_ptr_list, tx_count);
+	else
+		status =
+		(*xor_check_funcs[buf_idx-2])(buf_ptr_list, tx_count);
+
+	return status;
+}
+
+static u8 megasas_copy( struct page *page, u32 page_offset,
+			u32 sge_offset, u8 *host_ptr, u32 len, u8 dir)
+{
+	u8 *page_addr;
+	u32 off;
+	u32 bytes_copied;
+	u32 remaining;
+
+	remaining = len;
+	off = page_offset+sge_offset;
+
+	/* kmap_atomic maps single page size but os sg element can have size
+	 more than page size, handle it.**/
+
+	while (remaining > 0 ) {
+
+		bytes_copied =
+			min((size_t)remaining,
+			(size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
+
+		page_addr =
+			kmap_atomic(page + (off >> PAGE_SHIFT), KM_SOFTIRQ0);
+		if ( page_addr == NULL ) {
+			printk(KERN_NOTICE "kmap_atomic is failed.\n");
+			return MR_CPX_STATUS_FAILURE;
+		}
+		if ( dir == MR_CPX_DIR_WRITE )
+			memcpy( host_ptr,
+				page_addr+(off & ~PAGE_MASK),
+				bytes_copied );
+		else
+			memcpy( page_addr+(off & ~PAGE_MASK),
+				host_ptr,
+				bytes_copied );
+
+		kunmap_atomic ( page_addr, KM_SOFTIRQ0 );
+
+		host_ptr += bytes_copied;
+		remaining -= bytes_copied;
+		off += bytes_copied;
+	}
+
+	return MR_CPX_STATUS_SUCCESS;
+}
+
+/**
+* megasas_do_cpx_copy - Completes the copy opreation
+* @instance		: Driver soft state.
+* @cpy_des		: input for copying the data.
+*
+* @return 0 on success != 0 on failure
+*
+*/
+
+static u8 megasas_do_cpx_copy( struct megasas_instance *instance,
+				struct mr_cpx_copy_descriptor *cpy_des)
+{
+	u8			status = MR_CPX_STATUS_SUCCESS ;
+	u32			total_remaining_len = cpy_des->total_byte_count;
+	u32			row_remaining_length;
+	u32	os_sge_sz = 0, os_sge_offset = 0, os_sge_idx = 0, os_sge_len;
+	u8	sge_cnt, row_idx, *fw_ptr = NULL, host_skip_count_handled;
+	struct scsi_cmnd	*os_cmd;
+	struct scatterlist	*os_sgl;
+	struct megasas_cmd	*mega_cmd;
+	struct megasas_io_frame *ldio;
+
+	if ( cpy_des->mfi_cmd_cxt  >= instance->max_fw_cmds ) {
+		printk(KERN_NOTICE "invalid context - 0x%x shoul be < 0x%x \n",
+				cpy_des->mfi_cmd_cxt, instance->max_fw_cmds );
+		return MR_CPX_STATUS_FAILURE;
+	}
+
+	mega_cmd =
+		(struct megasas_cmd *)instance->cmd_list[cpy_des->mfi_cmd_cxt];
+	os_cmd = mega_cmd->scmd;
+	ldio = (struct megasas_io_frame *)mega_cmd->frame;
+	sge_cnt = ldio->sge_count;
+
+	host_skip_count_handled = 0;
+	row_idx = 0;
+	row_remaining_length = 0;
+
+	scsi_for_each_sg(os_cmd, os_sgl, sge_cnt, os_sge_idx) {
+
+		os_sge_len = sg_dma_len(os_sgl);
+
+		if ( !host_skip_count_handled  &&
+			cpy_des->host_skip_count < (os_sge_sz += os_sge_len)) {
+
+			os_sge_offset =
+			cpy_des->host_skip_count - ( os_sge_sz -os_sge_len );
+			os_sge_len -= os_sge_offset;
+			host_skip_count_handled = 1;
+		} else if (!host_skip_count_handled &&
+			cpy_des->host_skip_count == os_sge_sz ) {
+			os_sge_offset = 0;
+			host_skip_count_handled = 1;
+			continue;
+		}
+
+		if ( !host_skip_count_handled )
+			continue;
+
+		for ( ; total_remaining_len &&  row_idx < MAX_MR_ROW_SIZE;
+			row_idx++ ) {
+
+			if ( !row_remaining_length ) {
+		fw_ptr =
+		(u8 *)(instance->host_mem_virt+cpy_des->copy_buf[row_idx].buf);
+			row_remaining_length = cpy_des->copy_buf[row_idx].size;
+		}
+
+			status = megasas_copy( 	sg_page(os_sgl),
+						os_sgl->offset,
+						os_sge_offset,
+						fw_ptr,
+					MIN(os_sge_len, row_remaining_length),
+					cpy_des->dir);
+			if (status)
+			     break;
+
+			total_remaining_len -=
+					MIN(os_sge_len, row_remaining_length);
+
+			if ( os_sge_len <= row_remaining_length ) {
+				fw_ptr += os_sge_len;
+				row_remaining_length -= os_sge_len;
+				if (!(row_remaining_length))
+					row_idx++;
+				os_sge_offset = 0;
+				break;
+			}else{
+				os_sge_len -= row_remaining_length;
+				os_sge_offset += row_remaining_length;
+				row_remaining_length = 0;
+			}
+
+		}
+		if ( row_idx >= MAX_MR_ROW_SIZE && total_remaining_len )
+			printk(KERN_NOTICE "row_idx=0x%x,remaining_len= 0x%x\n",
+			       row_idx, total_remaining_len);
+
+		if (total_remaining_len == 0 ||
+			status == MR_CPX_STATUS_FAILURE )
+			break;
+	}
+
+	if ( os_sge_idx >= sge_cnt && total_remaining_len )
+		printk(KERN_NOTICE "sge_idx = 0x%x, remaining_len = 0x%x \n",
+			       os_sge_idx, total_remaining_len);
+
+	return status;
+
+}
+/**
+* megasas_handle_cpx_requests - Manages the fw queues
+* @instance		: Driver soft state.
+*
+* @return 0 on success != 0 on failure
+*
+*/
+static int megasas_handle_cpx_requests( struct megasas_instance *instance)
+{
+	struct mr_cpx_request_queue *req_q = instance->cpx_request_queue;
+	u32 producer_idx, consumer_idx;
+	u8 retval = 0;
+	unsigned long flags;
+
+	producer_idx = req_q->producer_idx;
+	consumer_idx = req_q->consumer_idx;
+
+	while ((producer_idx != consumer_idx) &&
+		(instance->adprecovery == MEGASAS_HBA_OPERATIONAL)) {
+		union  mr_cpx_descriptor *cpx_des =
+			&instance->cpx_dscrptr[consumer_idx];
+		union  mr_cpx_response_data rsp_data;
+
+		if ( cpx_des->cpx_copy_desc.hdr.type ==
+				MR_CPX_DESCRIPTOR_TYPE_COPY )
+			retval = megasas_do_cpx_copy(instance,
+				(struct mr_cpx_copy_descriptor *)cpx_des );
+
+		else if (cpx_des->cpx_copy_desc.hdr.type ==
+					MR_CPX_DESCRIPTOR_TYPE_XOR )
+			retval = megasas_do_cpx_xor(
+				(struct mr_cpx_xor_descriptor *)cpx_des,
+					(u8 *)instance->host_mem_virt,
+					instance->host_mem_len );
+		else{
+			printk(KERN_ERR "Got invalid descriptor type...\n");
+			retval = MR_CPX_STATUS_FAILURE;
+			break;
+		}
+
+		rsp_data.r.status = retval;
+		rsp_data.r.context = cpx_des->cpx_copy_desc.hdr.context;
+		rsp_data.r.type = cpx_des->cpx_copy_desc.hdr.type;
+
+		/* notify fw.*/
+		spin_lock_irqsave(&instance->hba_lock, flags);
+		writel( ~0, &instance->reg_set->inbound_high_queue_port);
+		writel( rsp_data.w, &instance->reg_set->inbound_low_queue_port);
+		spin_unlock_irqrestore(&instance->hba_lock, flags);
+
+		consumer_idx++;
+		if ( consumer_idx == instance->cpx_dscrptr_cnt )
+			consumer_idx = 0;
+
+	}
+	req_q->consumer_idx = producer_idx;
+
+	return 0;
+}
+
 /**
  * megasas_complete_cmd_dpc	 -	Returns FW's controller structure
  * @instance_addr:			Address of adapter soft state
@@ -1569,6 +2665,9 @@ static void megasas_complete_cmd_dpc(uns
 
 	spin_unlock_irqrestore(&instance->completion_lock, flags);
 
+	if ( instance->cpx_supported )
+		megasas_handle_cpx_requests( instance);
+
 	/*
 	 * Check if we can restore can_queue
 	 */
@@ -2359,6 +3458,17 @@ process_fw_state_change_wq(struct work_s
 			*instance->consumer = 0;
 			*instance->producer = 0;
 		}
+		if (instance->cpx_supported){
+			instance->cpx_request_queue->consumer_idx =
+				instance->cpx_request_queue->producer_idx = 0;
+
+			if ( megasas_check_cpx_support( instance ) == 0  ){
+				if ( megasas_send_cpx_queue_data( instance ) ){
+				printk(KERN_NOTICE "Send cpx failed.\n");
+					megasas_remove_cpx(instance);
+				}
+			}
+		}
 
 		megasas_issue_init_mfi(instance);
 
@@ -3111,6 +4221,180 @@ megasas_get_ctrl_info(struct megasas_ins
 	return ret;
 }
 
+
+/**
+ * megasas_check_cpx_support : Tries to get the host memory address if fails then cpx
+				not supported else cpx supported.
+ * @instance:		Adapter soft state
+ *
+ * @return 0 on success non-zero on failure.
+ */
+static int megasas_check_cpx_support( struct megasas_instance *instance)
+{
+	struct megasas_cmd *cmd;
+	struct megasas_dcmd_frame *dcmd;
+	struct mr_cpx_init_data *cpx_init_data;
+	dma_addr_t cpx_init_data_h;
+	int retval = 0;
+
+	cmd = megasas_get_cmd(instance);
+	if (!cmd) {
+		printk(KERN_DEBUG "Failed to get cmd\n");
+		return -ENOMEM;
+	}
+
+	cpx_init_data = pci_alloc_consistent(instance->pdev,
+			sizeof( struct mr_cpx_init_data), &cpx_init_data_h);
+
+	if (cpx_init_data == NULL) {
+		printk(KERN_DEBUG "Failed to alloc mem for cpx_init_data. \n");
+		megasas_return_cmd(instance, cmd);
+		return -ENOMEM;
+	}
+
+	dcmd = &cmd->frame->dcmd;
+	dcmd->flags = 0;
+	dcmd->opcode = MR_DCMD_CTRL_MISC_CPX_INIT_DATA_GET;
+	dcmd->data_xfer_len  = sizeof(struct mr_cpx_init_data );
+	dcmd->cmd = MFI_CMD_DCMD;
+	dcmd->cmd_status  = 0xff;
+	dcmd->sge_count = 1;
+	dcmd->sgl.sge32[0].phys_addr = cpx_init_data_h;
+	dcmd->sgl.sge32[0].length = sizeof(struct mr_cpx_init_data);
+
+	retval = megasas_issue_polled ( instance, cmd );
+
+	if (retval == 0 && cmd->frame->hdr.cmd_status == 0) {
+		instance->host_mem_phys = cpx_init_data->phys_addr_cache_buf;
+		instance->host_mem_len  = cpx_init_data->size;
+		instance->cpx_dscrptr_cnt = cpx_init_data->cpx_desc_count;
+
+		if ( instance->host_mem_len == 0 ||
+			instance->host_mem_phys == 0 ||
+			!instance->cpx_dscrptr_cnt ){
+
+		printk(KERN_ERR "No host_mem_phys/cpx_descriptor\n");
+			retval = 1;
+		}
+	} else {
+		printk(KERN_NOTICE "megasas: cpx is not supported.\n");
+		retval = 1;
+	}
+
+	instance->cpx_supported = (retval ? 0:1);
+
+	pci_free_consistent(instance->pdev,
+			sizeof(struct mr_cpx_init_data),
+			cpx_init_data, cpx_init_data_h);
+
+	megasas_return_cmd(instance, cmd);
+
+	return retval;
+}
+
+/**
+ * megasas_send_cpx_queue_data : Sends the queue setup info to fw.
+ * @instance:		Adapter soft state
+ *
+ * @return 0 on success non-zero on failure.
+ */
+
+static int megasas_send_cpx_queue_data( struct megasas_instance *instance )
+{
+
+	struct megasas_cmd *cmd;
+	struct megasas_dcmd_frame *dcmd;
+	int retval = 0;
+
+	cmd = megasas_get_cmd(instance);
+	if (!cmd) {
+		printk(KERN_DEBUG "Failed to get cmd\n");
+		return -ENOMEM;
+	}
+
+	dcmd = &cmd->frame->dcmd;
+	dcmd->flags = 0;
+	dcmd->opcode = MR_DCMD_CTRL_MISC_CPX_QUEUE_DATA;
+	dcmd->data_xfer_len  = sizeof( struct mr_cpx_queue_data );
+	dcmd->cmd = MFI_CMD_DCMD;
+	dcmd->cmd_status  = 0xff;
+	dcmd->sge_count = 1;
+	dcmd->mbox.w[0] = instance->cpx_request_queue_h;
+	dcmd->mbox.w[1] = 0;
+	dcmd->mbox.w[2] = instance->cpx_dscrptr_cnt;
+
+	retval = megasas_issue_polled ( instance, cmd );
+
+	megasas_return_cmd( instance, cmd);
+
+	if ( retval == 0 ) {
+		instance->cpx_request_queue->consumer_idx =
+			instance->cpx_request_queue->producer_idx = 0;
+		instance->cpx_supported = 1;
+	}
+
+	return retval;
+}
+
+static u32 megasas_get_cpx_mem_len( u16 max_fw_cmds )
+{
+	return (sizeof( struct mr_cpx_request_queue ) +
+		sizeof( union mr_cpx_descriptor ) * ( max_fw_cmds) );
+}
+
+static u32 megasas_remove_cpx( struct megasas_instance *instance)
+{
+		if ( instance->host_mem_virt )
+			iounmap(instance->host_mem_virt);
+
+		if ( instance->cpx_request_queue )
+			pci_free_consistent(instance->pdev,
+			megasas_get_cpx_mem_len( instance->cpx_dscrptr_cnt),
+			instance->cpx_request_queue,
+			instance->cpx_request_queue_h );
+
+		instance->cpx_supported = 0;
+
+	return 0;
+}
+
+/* should have host_mem_phys intialized before calling this function.*/
+static int megasas_init_cpx( struct megasas_instance *instance)
+{
+	instance->host_mem_virt = ioremap(instance->host_mem_phys,
+					instance->host_mem_len);
+	if ( instance->host_mem_virt == NULL ) {
+		printk(KERN_ERR "megasas: Failed to ioremap host memory.\n");
+		goto error_unload;
+	}
+
+	/* allocate memory for indices and descriptors response array's */
+	instance->cpx_request_queue =
+			pci_alloc_consistent( instance->pdev,
+			megasas_get_cpx_mem_len (instance->cpx_dscrptr_cnt),
+			&instance->cpx_request_queue_h );
+
+	if ( instance->cpx_request_queue == NULL ) {
+		printk(KERN_ERR "Out of DMA memory for cpx operations.\n");
+		goto error_unload;
+	}
+
+	/*initialize queues*/
+	instance->cpx_dscrptr =
+		(union mr_cpx_descriptor *)((u8 *)instance->cpx_request_queue +
+			(sizeof(instance->cpx_request_queue->consumer_idx)*2 ));
+
+	if ( megasas_send_cpx_queue_data( instance ) ) {
+		printk(KERN_ERR " Sending cpx queue data to FW failed.\n");
+		goto error_unload;
+	}
+	return 0;
+
+error_unload:
+	megasas_remove_cpx( instance );
+	return -1;
+}
+
 /**
  * megasas_issue_init_mfi -	Initializes the FW
  * @instance:		Adapter soft state
@@ -3353,6 +4637,10 @@ static int megasas_init_mfi(struct megas
 		printk(KERN_DEBUG "megasas: Can't allocate version buffer\n");
 	}
 
+	if ( megasas_check_cpx_support( instance ) == 0  )
+		if ( megasas_init_cpx( instance ) )
+			printk(KERN_ERR "Error in initilizing cpx.\n");
+
 	if (megasas_issue_init_mfi(instance))
 		goto fail_fw_init;
 
@@ -3455,6 +4743,8 @@ static void megasas_release_mfi(struct m
 
 	iounmap(instance->reg_set);
 
+	megasas_remove_cpx( instance );
+
 	pci_release_selected_regions(instance->pdev,
 		pci_select_bars(instance->pdev, IORESOURCE_MEM));
 }
@@ -4141,6 +5431,15 @@ megasas_resume(struct pci_dev *pdev)
 	if (megasas_transition_to_ready(instance))
 		goto fail_ready_state;
 
+	if ( megasas_check_cpx_support( instance ) == 0  ) {
+		if ( megasas_send_cpx_queue_data( instance ) ) {
+			printk(KERN_ERR "Send cpx queue to FW failed.\n");
+			megasas_remove_cpx(instance);
+		}else
+			instance->cpx_request_queue->consumer_idx =
+				instance->cpx_request_queue->producer_idx = 0;
+	}
+
 	if (megasas_issue_init_mfi(instance))
 		goto fail_init_mfi;
 
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-15 04:45:34.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-17 02:18:53.000000000 -0500
@@ -144,6 +144,14 @@
 #define MR_DCMD_CLUSTER_RESET_LD		0x08010200
 #define MR_DCMD_PD_LIST_QUERY                   0x02010100
 
+#define MR_DCMD_CTRL_MISC_CPX			0x0100e200
+#define MR_DCMD_CTRL_MISC_CPX_INIT_DATA_GET	0x0100e201
+#define MR_DCMD_CTRL_MISC_CPX_QUEUE_DATA	0x0100e202
+#define MR_DCMD_CTRL_MISC_CPX_UNREGISTER	0x0100e203
+#define MAX_MR_ROW_SIZE				32
+#define MR_CPX_DIR_WRITE			1
+#define MR_CPX_DIR_READ				0
+#define MR_CPX_VERSION				1
 /*
  * MFI command completion codes
  */
@@ -1256,6 +1264,174 @@ struct megasas_evt_detail {
 
 } __attribute__ ((packed));
 
+#define MIN(a, b) ((a) < (b) ? (a):(b))
+
+
+/*
+* enumerates type of descriptor
+*/
+
+enum MR_CPX_DESCRIPTOR_TYPE {
+	MR_CPX_DESCRIPTOR_TYPE_COPY   = 1,
+	MR_CPX_DESCRIPTOR_TYPE_XOR    = 2
+};
+
+/*
+* status information of copy or xor operation
+*/
+enum MR_CPX_STATUS {
+	MR_CPX_STATUS_SUCCESS      = 0,
+	MR_CPX_STATUS_INCONSISTENT = 1,
+	MR_CPX_STATUS_FAILURE      = 2,
+};
+
+/*
+* define the XOR opcodes
+*/
+enum MR_CPX_XOR_OP {
+	MR_CPX_XOR_OP_GEN_P    = 0x01,
+	MR_CPX_XOR_OP_GEN_Q    = 0x02, /* generate Q buffer */
+	MR_CPX_XOR_OP_GEN_PQ   = 0x03, /* generate P+Q buffers */
+	MR_CPX_XOR_OP_CHECK_P  = 0x11, /* check P buffer */
+	MR_CPX_XOR_OP_CHECK_Q  = 0x12, /* check Q buffer */
+	MR_CPX_XOR_OP_CHECK_PQ = 0x13, /* check P+Q buffers */
+};
+
+#define MR_CPX_XOR_OP_IS_CHECK(xorOp)  ((xorOp & 0x10) != 0)
+#define MR_CPX_XOR_OP_IS_GEN(xorOp)    (!MR_CPX_XOR_OP_IS_CHECK(xorOp))
+#define MR_CPX_XOR_OP_IS_P(xorOp)      ((xorOp & 0x01) != 0)
+#define MR_CPX_XOR_OP_IS_Q(xorOp)      ((xorOp & 0x02) != 0)
+#define MR_CPX_XOR_OP_IS_PQ(xorOp)     ((xorOp & 0x03) == 3)
+
+/*
+* this data is passed to driver during driver init.
+*/
+struct mr_cpx_init_data {
+	u32	cpx_desc_count;
+	u32     size;
+	u64     phys_addr_cache_buf;
+
+} __attribute__ ((packed));
+
+/*
+* header passed with each descriptor
+*/
+struct mr_cpx_header {
+	u32        context   : 24;
+	u32        type     :  4;
+	u32        resvd    :  4;
+} __attribute__ ((packed));
+
+/*
+* xor descriptor data
+*/
+struct mr_cpx_xor_descriptor {
+	struct mr_cpx_header      hdr;
+	enum MR_CPX_XOR_OP      op;
+	u32             size;
+	u32             buff_valid_bitmap;
+	u8              p_idx;
+	u8              q_idx;
+	u8              pad[2];
+	u32             buff_list[MAX_MR_ROW_SIZE];
+	u32             mult_list[MAX_MR_ROW_SIZE];
+} __attribute__ ((packed));
+
+
+/*
+* copy buffer for each transfer. each such tranfer between
+* user spare host address and firmware allocated cache data.
+*/
+struct mr_cpx_copy_mr_buffer {
+	u32     buf;
+	u32     size;
+} __attribute__ ((packed));
+
+/*
+* copy descriptor data
+*/
+struct mr_cpx_copy_descriptor {
+	struct mr_cpx_header              hdr;
+	u32                     mfi_cmd_cxt;
+	u32                     total_byte_count;
+	u32                     host_skip_count;
+	u8                      dir;
+	u8                      pad[3];
+	struct mr_cpx_copy_mr_buffer      copy_buf[MAX_MR_ROW_SIZE];
+} __attribute__ ((packed)) ;
+
+/*
+* users of this interface must allocate memory for the size of
+* this structure while allocating memory for descriptors
+*/
+union mr_cpx_descriptor {
+	struct mr_cpx_xor_descriptor       cpx_xor_desc;
+	struct mr_cpx_copy_descriptor     cpx_copy_desc;
+	u8                      pad[512];
+} __attribute__ ((packed));
+
+
+/*
+* request queue.
+* firmware manages producerindex, driver manages consumerindex.
+* number of decriptors is kept as variable. driver must use
+* max host commands supported for allocation.
+*/
+struct mr_cpx_request_queue {
+	u32             consumer_idx;
+	u32             producer_idx;
+	union mr_cpx_descriptor   cpxdescriptor[1];
+} __attribute__ ((packed));
+
+
+/*
+* response data. this data will be posted by driver after copy/xor
+* operation is compete.
+*/
+union mr_cpx_response_data {
+	struct {
+		u32         context     : 24;
+		u32         status      :  4;
+		u32         type        :  4;
+	} r;
+	u32         w;
+} __attribute__ ((packed));
+
+
+/*
+* response queue.
+* driver manages producerindex, firmware manages consumerindex.
+* number of decriptors is kept as variable. driver must use
+* max host commands supported for allocation.
+*/
+struct  mr_cpx_response_queue {
+	u32                 consumer_idx;
+	u32                 producer_idx;
+	union mr_cpx_response_data   cpx_resp_data[1];
+} __attribute__ ((packed));
+
+
+/*
+* the size of each of the structure within this is determined at run time.
+* this structure is for document purpose and shows that the structures
+* lay as shown below in memory
+*/
+struct  mr_cpx_queues {
+	struct mr_cpx_request_queue     requestqueue;
+	struct mr_cpx_response_queue    responsequeue;
+} __attribute__ ((packed));
+
+/*
+* driver sends this queue data during mfi init. firmware
+* will not use the interface if the versions do not match.
+*/
+struct mr_cpx_queue_data {
+	u32         version;
+	u32         count_queue_entries;
+	u64         phys_addr_cpx_queues;
+} __attribute__ ((packed));
+
+
 struct megasas_aen_event {
 	struct work_struct hotplug_work;
 	struct megasas_instance *instance;
@@ -1330,6 +1506,15 @@ struct megasas_instance {
 
 	struct timer_list io_completion_timer;
 	struct list_head internal_reset_pending_q;
+
+	u32 cpx_supported;
+	struct mr_cpx_request_queue *cpx_request_queue;
+	dma_addr_t cpx_request_queue_h;
+	union mr_cpx_descriptor *cpx_dscrptr;
+	u32 cpx_dscrptr_cnt;
+	u64 host_mem_phys;
+	u32 host_mem_len;
+	u8 *host_mem_virt;
 };
 
 enum {

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

* [PATCH 9/9] scsi: megaraid_sas - Documentation and driver version update
  2010-11-19 17:03         ` Yang, Bo
@ 2010-11-19 17:50           ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:50 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl, Karlikova, Lenka, Nielson, Mike,
	Jablonski, Charles

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

Documentation and driver version update

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   30 ++++++++++++++++++++++++++++++
drivers/scsi/megaraid/megaraid_sas.c      |    2 +-
drivers/scsi/megaraid/megaraid_sas.h      |    6 +++---
 3 files changed, 34 insertions(+), 4 deletions(-)

[-- Attachment #2: megasas-p9-version.patch --]
[-- Type: application/octet-stream, Size: 2405 bytes --]

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-11-17 15:09:12.000000000 -0500
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-11-17 15:09:12.000000000 -0500
@@ -1,3 +1,33 @@
+1 Release Date    : Thur.  Nov.18, 2010 09:12:45 PST 2010 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.38-rc1
+3 Older Version   : 00.00.04.31-rc1
+
+1.	Changed the sleep to ssleep when driver waiting for
+	FW change the state from fail to ready.  Also increase
+	the wait time if fw infailed state.
+
+2.	Driver made the changes to only support JBOD, TYPE device
+	and VDs.
+
+3.	Driver will scan the device after receive the event code:
+	MR_EVT_LD_STATE_CHANGE from FW.
+
+4.	Driver added the changes to provide the version to FW.
+
+5.	If driver support ieee sge, driver will report the 256 K
+	max_sectors to OS
+
+6.	Add the online support for our iMR controller.
+
+7.	Create megasas work_queue to handle the online controller
+	reset thread.
+
+8.	To increase performance, iMR fw will assign some read cmds to driver.
+
+
 1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 15:09:12.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 15:09:12.000000000 -0500
@@ -10,7 +10,7 @@
  *	   2 of the License, or (at your option) any later version.
  *
  * FILE		: megaraid_sas.c
- * Version     : v00.00.04.31-rc1
+ * Version     : v00.00.04.37-rc1
  *
  * Authors:
  *	(email-id : megaraidlinux@lsi.com)
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-17 15:09:12.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-18 05:00:41.000000000 -0500
@@ -18,9 +18,9 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION			"00.00.04.31-rc1"
-#define MEGASAS_RELDATE			"May 3, 2010"
-#define MEGASAS_EXT_VERSION		"Mon. May 3, 11:41:51 PST 2010"
+#define MEGASAS_VERSION			"00.00.04.38-rc1"
+#define MEGASAS_RELDATE			"Nov. 18, 2010"
+#define MEGASAS_EXT_VERSION		"Thur. Nov. 18, 11:41:51 PST 2010"
 
 /*
  * Device IDs

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

* [PATCH 9/9] scsi: megaraid_sas - Documentation and driver version update
@ 2010-11-19 17:50           ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-19 17:50 UTC (permalink / raw)
  To: Yang, Bo, 'James.Bottomley@HansenPartnership.com',
	'James.Bottomley@suse.de'
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl, Karlikova, Lenka, Nielson, Mike,
	Jablonski, Charles

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

Documentation and driver version update

Signed-off-by Bo Yang<bo.yang@lsi.com>

---
Documentation/scsi/ChangeLog.megaraid_sas |   30 ++++++++++++++++++++++++++++++
drivers/scsi/megaraid/megaraid_sas.c      |    2 +-
drivers/scsi/megaraid/megaraid_sas.h      |    6 +++---
 3 files changed, 34 insertions(+), 4 deletions(-)

[-- Attachment #2: megasas-p9-version.patch --]
[-- Type: application/octet-stream, Size: 2405 bytes --]

diff -rupN old/Documentation/scsi/ChangeLog.megaraid_sas new/Documentation/scsi/ChangeLog.megaraid_sas
--- old/Documentation/scsi/ChangeLog.megaraid_sas	2010-11-17 15:09:12.000000000 -0500
+++ new/Documentation/scsi/ChangeLog.megaraid_sas	2010-11-17 15:09:12.000000000 -0500
@@ -1,3 +1,33 @@
+1 Release Date    : Thur.  Nov.18, 2010 09:12:45 PST 2010 -
+			(emaild-id:megaraidlinux@lsi.com)
+			Bo Yang
+
+2 Current Version : 00.00.04.38-rc1
+3 Older Version   : 00.00.04.31-rc1
+
+1.	Changed the sleep to ssleep when driver waiting for
+	FW change the state from fail to ready.  Also increase
+	the wait time if fw infailed state.
+
+2.	Driver made the changes to only support JBOD, TYPE device
+	and VDs.
+
+3.	Driver will scan the device after receive the event code:
+	MR_EVT_LD_STATE_CHANGE from FW.
+
+4.	Driver added the changes to provide the version to FW.
+
+5.	If driver support ieee sge, driver will report the 256 K
+	max_sectors to OS
+
+6.	Add the online support for our iMR controller.
+
+7.	Create megasas work_queue to handle the online controller
+	reset thread.
+
+8.	To increase performance, iMR fw will assign some read cmds to driver.
+
+
 1 Release Date    : Thur.  May 03, 2010 09:12:45 PST 2009 -
 			(emaild-id:megaraidlinux@lsi.com)
 			Bo Yang
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c
--- old/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 15:09:12.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.c	2010-11-17 15:09:12.000000000 -0500
@@ -10,7 +10,7 @@
  *	   2 of the License, or (at your option) any later version.
  *
  * FILE		: megaraid_sas.c
- * Version     : v00.00.04.31-rc1
+ * Version     : v00.00.04.37-rc1
  *
  * Authors:
  *	(email-id : megaraidlinux@lsi.com)
diff -rupN old/drivers/scsi/megaraid/megaraid_sas.h new/drivers/scsi/megaraid/megaraid_sas.h
--- old/drivers/scsi/megaraid/megaraid_sas.h	2010-11-17 15:09:12.000000000 -0500
+++ new/drivers/scsi/megaraid/megaraid_sas.h	2010-11-18 05:00:41.000000000 -0500
@@ -18,9 +18,9 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION			"00.00.04.31-rc1"
-#define MEGASAS_RELDATE			"May 3, 2010"
-#define MEGASAS_EXT_VERSION		"Mon. May 3, 11:41:51 PST 2010"
+#define MEGASAS_VERSION			"00.00.04.38-rc1"
+#define MEGASAS_RELDATE			"Nov. 18, 2010"
+#define MEGASAS_EXT_VERSION		"Thur. Nov. 18, 11:41:51 PST 2010"
 
 /*
  * Device IDs

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

* Re: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
  2010-11-19 17:43                   ` Yang, Bo
  (?)
@ 2010-11-19 17:53                   ` James Bottomley
  2010-11-24 15:22                       ` Yang, Bo
  -1 siblings, 1 reply; 70+ messages in thread
From: James Bottomley @ 2010-11-19 17:53 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl

On Fri, 2010-11-19 at 10:43 -0700, Yang, Bo wrote:
> Driver added the new feature to take some of the workloads from FW to increase
> performance of the iMR controller.  FW assigns the read cmds back to driver
> which will increase the performance for megaraid sas iMR controller.

Just on a process note: you don't have to cc me at every known
address ... I do read linux-scsi ...

My first take on this patch is that you're basically passing data back
to the kernel for RAID-N parity calculations.  This effectively makes
your RAID one of those pseudo HW ones.  In which case, why not simply
abandon the HW raid piece and have it all done by DM/MD, which are well
optimised for all types of RAID?  The reason for asking is that we're
trying to reduce the number of in-kernel raid implementations and this
is going in the wrong direction.

James



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

* RE: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
  2010-11-19 17:53                   ` James Bottomley
@ 2010-11-24 15:22                       ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-24 15:22 UTC (permalink / raw)
  To: James Bottomley
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl, Daftardar, Jayant, Prabhakaran, Rajesh

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1824 bytes --]

James,

Our megaraid sas driver only implemented the part of the XOR calculation and copy capability(moving data between 2 buffers) for the RAID5 cmds which FW asks driver to do.  When fw received very heavy I/Os and there are high pending cmds in FW, fw will ask the help from driver to finish some cmds and reduce the fw heavy load.  Driver will only do part of the RAID5 (not take the jobs) from FW.  Driver is not duplicating Parity calculation done on dm/md.

Thanks,

Bo Yang  



-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com] 
Sent: Friday, November 19, 2010 12:53 PM
To: Yang, Bo
Cc: 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'; Tomas Henzl
Subject: Re: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW

On Fri, 2010-11-19 at 10:43 -0700, Yang, Bo wrote:
> Driver added the new feature to take some of the workloads from FW to increase
> performance of the iMR controller.  FW assigns the read cmds back to driver
> which will increase the performance for megaraid sas iMR controller.

Just on a process note: you don't have to cc me at every known
address ... I do read linux-scsi ...

My first take on this patch is that you're basically passing data back
to the kernel for RAID-N parity calculations.  This effectively makes
your RAID one of those pseudo HW ones.  In which case, why not simply
abandon the HW raid piece and have it all done by DM/MD, which are well
optimised for all types of RAID?  The reason for asking is that we're
trying to reduce the number of in-kernel raid implementations and this
is going in the wrong direction.

James


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
@ 2010-11-24 15:22                       ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-24 15:22 UTC (permalink / raw)
  To: James Bottomley
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Tomas Henzl, Daftardar, Jayant, Prabhakaran, Rajesh

James,

Our megaraid sas driver only implemented the part of the XOR calculation and copy capability(moving data between 2 buffers) for the RAID5 cmds which FW asks driver to do.  When fw received very heavy I/Os and there are high pending cmds in FW, fw will ask the help from driver to finish some cmds and reduce the fw heavy load.  Driver will only do part of the RAID5 (not take the jobs) from FW.  Driver is not duplicating Parity calculation done on dm/md.

Thanks,

Bo Yang  



-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com] 
Sent: Friday, November 19, 2010 12:53 PM
To: Yang, Bo
Cc: 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'; Tomas Henzl
Subject: Re: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW

On Fri, 2010-11-19 at 10:43 -0700, Yang, Bo wrote:
> Driver added the new feature to take some of the workloads from FW to increase
> performance of the iMR controller.  FW assigns the read cmds back to driver
> which will increase the performance for megaraid sas iMR controller.

Just on a process note: you don't have to cc me at every known
address ... I do read linux-scsi ...

My first take on this patch is that you're basically passing data back
to the kernel for RAID-N parity calculations.  This effectively makes
your RAID one of those pseudo HW ones.  In which case, why not simply
abandon the HW raid piece and have it all done by DM/MD, which are well
optimised for all types of RAID?  The reason for asking is that we're
trying to reduce the number of in-kernel raid implementations and this
is going in the wrong direction.

James



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

* Re: [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset
  2010-11-19 16:33     ` Yang, Bo
@ 2010-11-30 15:21       ` Tomas Henzl
  -1 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 15:21 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant

On 11/19/2010 05:33 PM, Yang, Bo wrote:
> Change the 30 seconds wait in OCR routine to ssleep and give more time to FW come out from failed status
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>   
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-10 04:39:48.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-14
> 15:32:31.000000000 -0500 @@ -2294,7 +2294,6 @@
> process_fw_state_change_wq(struct work_s { struct megasas_instance
> *instance = container_of(work, struct megasas_instance, work_init); -
> u32 wait; unsigned long flags; if (instance->adprecovery !=
> MEGASAS_ADPRESET_SM_INFAULT) { @@ -2320,10 +2319,8 @@
> process_fw_state_change_wq(struct work_s printk(KERN_NOTICE
> "megaraid_sas: HBA recovery state machine," "state 2 starting...\n");
> - /*waitting for about 20 second before start the second init*/ - for
> (wait = 0; wait < 30; wait++) { - msleep(1000); - } + /*waitting for
> about 30 second before start the second init*/ + ssleep(30); if
> (megasas_transition_to_ready(instance)) { printk(KERN_NOTICE
> "megaraid_sas:adapter not ready\n"); 
> @@ -2487,7 +2484,9 @@ megasas_transition_to_ready(struct megas case
> MFI_STATE_FAULT: printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
> - return -ENODEV; + max_wait = MEGASAS_RESET_WAIT_TIME; + cur_state =
> MFI_STATE_FAULT; + break; case MFI_STATE_WAIT_HANDSHAKE: /* 
the line 'max_wait = MEGASAS_RESET_WAIT_TIME;' is in every 'case' statement
the same, I'd suggest to remove it to save some lines, I hope also
this improves readability.
The change to ssleep is OK, I'd suggest to do the same in other cases too.
See an untested patch below (no functional change I hope).

Tomas

Signed-off-by Tomas Henzl<thenzl@redhat.com>

diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index eb29d50..9dc5ff0 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -264,12 +264,10 @@ static int
 megasas_adp_reset_xscale(struct megasas_instance *instance,
 	struct megasas_register_set __iomem *regs)
 {
-	u32 i;
 	u32 pcidata;
-	writel(MFI_ADP_RESET, &regs->inbound_doorbell);
 
-	for (i = 0; i < 3; i++)
-		msleep(1000); /* sleep for 3 secs */
+	writel(MFI_ADP_RESET, &regs->inbound_doorbell);
+	ssleep(3); /* sleep for 3 secs */
 	pcidata  = 0;
 	pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, &pcidata);
 	printk(KERN_NOTICE "pcidata = %x\n", pcidata);
@@ -279,9 +277,7 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
 		pci_write_config_dword(instance->pdev,
 				MFI_1068_PCSR_OFFSET, pcidata);
 
-		for (i = 0; i < 2; i++)
-			msleep(1000); /* need to wait 2 secs again */
-
+		ssleep(2); /* need to wait 2 secs again */
 		pcidata  = 0;
 		pci_read_config_dword(instance->pdev,
 				MFI_1068_FW_HANDSHAKE_OFFSET, &pcidata);
@@ -2294,7 +2290,6 @@ process_fw_state_change_wq(struct work_struct *work)
 {
 	struct megasas_instance *instance =
 		container_of(work, struct megasas_instance, work_init);
-	u32 wait;
 	unsigned long flags;
 
 	if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
@@ -2320,10 +2315,8 @@ process_fw_state_change_wq(struct work_struct *work)
 		printk(KERN_NOTICE "megaraid_sas: HBA recovery state machine,"
 					"state 2 starting...\n");
 
-		/*waitting for about 20 second before start the second init*/
-		for (wait = 0; wait < 30; wait++) {
-			msleep(1000);
-		}
+		/* wait for about 30 second before the second init start */
+		ssleep(30);
 
 		if (megasas_transition_to_ready(instance)) {
 			printk(KERN_NOTICE "megaraid_sas:adapter not ready\n");
@@ -2466,7 +2459,6 @@ static int
 megasas_transition_to_ready(struct megasas_instance* instance)
 {
 	int i;
-	u8 max_wait;
 	u32 fw_state;
 	u32 cur_state;
 	u32 abs_state, curr_abs_state;
@@ -2487,7 +2479,8 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 		case MFI_STATE_FAULT:
 
 			printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
-			return -ENODEV;
+			cur_state = MFI_STATE_FAULT;
+			break;
 
 		case MFI_STATE_WAIT_HANDSHAKE:
 			/*
@@ -2507,7 +2500,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 					&instance->reg_set->inbound_doorbell);
 			}
 
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_WAIT_HANDSHAKE;
 			break;
 
@@ -2522,7 +2514,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 				writel(MFI_INIT_HOTPLUG,
 					&instance->reg_set->inbound_doorbell);
 
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_BOOT_MESSAGE_PENDING;
 			break;
 
@@ -2541,7 +2532,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 				writel(MFI_RESET_FLAGS,
 					&instance->reg_set->inbound_doorbell);
 
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_OPERATIONAL;
 			break;
 
@@ -2549,32 +2539,26 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 			/*
 			 * This state should not last for more than 2 seconds
 			 */
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_UNDEFINED;
 			break;
 
 		case MFI_STATE_BB_INIT:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_BB_INIT;
 			break;
 
 		case MFI_STATE_FW_INIT:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_FW_INIT;
 			break;
 
 		case MFI_STATE_FW_INIT_2:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_FW_INIT_2;
 			break;
 
 		case MFI_STATE_DEVICE_SCAN:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_DEVICE_SCAN;
 			break;
 
 		case MFI_STATE_FLUSH_CACHE:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_FLUSH_CACHE;
 			break;
 
@@ -2585,9 +2569,10 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 		}
 
 		/*
-		 * The cur_state should not last for more than max_wait secs
+		 * The cur_state should not last for more than
+		 * MEGASAS_RESET_WAIT_TIME secs
 		 */
-		for (i = 0; i < (max_wait * 1000); i++) {
+		for (i = 0; i < (MEGASAS_RESET_WAIT_TIME*1000); i++) {
 			fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) &  
 					MFI_STATE_MASK ;
 		curr_abs_state =
@@ -2600,11 +2585,13 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 		}
 
 		/*
-		 * Return error if fw_state hasn't changed after max_wait
+		 * Return error if fw_state hasn't changed
+		 * after MEGASAS_RESET_WAIT_TIME
 		 */
 		if (curr_abs_state == abs_state) {
 			printk(KERN_DEBUG "FW state [%d] hasn't changed "
-			       "in %d secs\n", fw_state, max_wait);
+			       "in %d secs\n", fw_state,
+			       MEGASAS_RESET_WAIT_TIME);
 			return -ENODEV;
 		}
 	}






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

* Re: [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset
@ 2010-11-30 15:21       ` Tomas Henzl
  0 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 15:21 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant

On 11/19/2010 05:33 PM, Yang, Bo wrote:
> Change the 30 seconds wait in OCR routine to ssleep and give more time to FW come out from failed status
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>   
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-10 04:39:48.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-14
> 15:32:31.000000000 -0500 @@ -2294,7 +2294,6 @@
> process_fw_state_change_wq(struct work_s { struct megasas_instance
> *instance = container_of(work, struct megasas_instance, work_init); -
> u32 wait; unsigned long flags; if (instance->adprecovery !=
> MEGASAS_ADPRESET_SM_INFAULT) { @@ -2320,10 +2319,8 @@
> process_fw_state_change_wq(struct work_s printk(KERN_NOTICE
> "megaraid_sas: HBA recovery state machine," "state 2 starting...\n");
> - /*waitting for about 20 second before start the second init*/ - for
> (wait = 0; wait < 30; wait++) { - msleep(1000); - } + /*waitting for
> about 30 second before start the second init*/ + ssleep(30); if
> (megasas_transition_to_ready(instance)) { printk(KERN_NOTICE
> "megaraid_sas:adapter not ready\n"); 
> @@ -2487,7 +2484,9 @@ megasas_transition_to_ready(struct megas case
> MFI_STATE_FAULT: printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
> - return -ENODEV; + max_wait = MEGASAS_RESET_WAIT_TIME; + cur_state =
> MFI_STATE_FAULT; + break; case MFI_STATE_WAIT_HANDSHAKE: /* 
the line 'max_wait = MEGASAS_RESET_WAIT_TIME;' is in every 'case' statement
the same, I'd suggest to remove it to save some lines, I hope also
this improves readability.
The change to ssleep is OK, I'd suggest to do the same in other cases too.
See an untested patch below (no functional change I hope).

Tomas

Signed-off-by Tomas Henzl<thenzl@redhat.com>

diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index eb29d50..9dc5ff0 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -264,12 +264,10 @@ static int
 megasas_adp_reset_xscale(struct megasas_instance *instance,
 	struct megasas_register_set __iomem *regs)
 {
-	u32 i;
 	u32 pcidata;
-	writel(MFI_ADP_RESET, &regs->inbound_doorbell);
 
-	for (i = 0; i < 3; i++)
-		msleep(1000); /* sleep for 3 secs */
+	writel(MFI_ADP_RESET, &regs->inbound_doorbell);
+	ssleep(3); /* sleep for 3 secs */
 	pcidata  = 0;
 	pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, &pcidata);
 	printk(KERN_NOTICE "pcidata = %x\n", pcidata);
@@ -279,9 +277,7 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
 		pci_write_config_dword(instance->pdev,
 				MFI_1068_PCSR_OFFSET, pcidata);
 
-		for (i = 0; i < 2; i++)
-			msleep(1000); /* need to wait 2 secs again */
-
+		ssleep(2); /* need to wait 2 secs again */
 		pcidata  = 0;
 		pci_read_config_dword(instance->pdev,
 				MFI_1068_FW_HANDSHAKE_OFFSET, &pcidata);
@@ -2294,7 +2290,6 @@ process_fw_state_change_wq(struct work_struct *work)
 {
 	struct megasas_instance *instance =
 		container_of(work, struct megasas_instance, work_init);
-	u32 wait;
 	unsigned long flags;
 
 	if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
@@ -2320,10 +2315,8 @@ process_fw_state_change_wq(struct work_struct *work)
 		printk(KERN_NOTICE "megaraid_sas: HBA recovery state machine,"
 					"state 2 starting...\n");
 
-		/*waitting for about 20 second before start the second init*/
-		for (wait = 0; wait < 30; wait++) {
-			msleep(1000);
-		}
+		/* wait for about 30 second before the second init start */
+		ssleep(30);
 
 		if (megasas_transition_to_ready(instance)) {
 			printk(KERN_NOTICE "megaraid_sas:adapter not ready\n");
@@ -2466,7 +2459,6 @@ static int
 megasas_transition_to_ready(struct megasas_instance* instance)
 {
 	int i;
-	u8 max_wait;
 	u32 fw_state;
 	u32 cur_state;
 	u32 abs_state, curr_abs_state;
@@ -2487,7 +2479,8 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 		case MFI_STATE_FAULT:
 
 			printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
-			return -ENODEV;
+			cur_state = MFI_STATE_FAULT;
+			break;
 
 		case MFI_STATE_WAIT_HANDSHAKE:
 			/*
@@ -2507,7 +2500,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 					&instance->reg_set->inbound_doorbell);
 			}
 
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_WAIT_HANDSHAKE;
 			break;
 
@@ -2522,7 +2514,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 				writel(MFI_INIT_HOTPLUG,
 					&instance->reg_set->inbound_doorbell);
 
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_BOOT_MESSAGE_PENDING;
 			break;
 
@@ -2541,7 +2532,6 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 				writel(MFI_RESET_FLAGS,
 					&instance->reg_set->inbound_doorbell);
 
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_OPERATIONAL;
 			break;
 
@@ -2549,32 +2539,26 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 			/*
 			 * This state should not last for more than 2 seconds
 			 */
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_UNDEFINED;
 			break;
 
 		case MFI_STATE_BB_INIT:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_BB_INIT;
 			break;
 
 		case MFI_STATE_FW_INIT:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_FW_INIT;
 			break;
 
 		case MFI_STATE_FW_INIT_2:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_FW_INIT_2;
 			break;
 
 		case MFI_STATE_DEVICE_SCAN:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_DEVICE_SCAN;
 			break;
 
 		case MFI_STATE_FLUSH_CACHE:
-			max_wait = MEGASAS_RESET_WAIT_TIME;
 			cur_state = MFI_STATE_FLUSH_CACHE;
 			break;
 
@@ -2585,9 +2569,10 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 		}
 
 		/*
-		 * The cur_state should not last for more than max_wait secs
+		 * The cur_state should not last for more than
+		 * MEGASAS_RESET_WAIT_TIME secs
 		 */
-		for (i = 0; i < (max_wait * 1000); i++) {
+		for (i = 0; i < (MEGASAS_RESET_WAIT_TIME*1000); i++) {
 			fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) &  
 					MFI_STATE_MASK ;
 		curr_abs_state =
@@ -2600,11 +2585,13 @@ megasas_transition_to_ready(struct megasas_instance* instance)
 		}
 
 		/*
-		 * Return error if fw_state hasn't changed after max_wait
+		 * Return error if fw_state hasn't changed
+		 * after MEGASAS_RESET_WAIT_TIME
 		 */
 		if (curr_abs_state == abs_state) {
 			printk(KERN_DEBUG "FW state [%d] hasn't changed "
-			       "in %d secs\n", fw_state, max_wait);
+			       "in %d secs\n", fw_state,
+			       MEGASAS_RESET_WAIT_TIME);
 			return -ENODEV;
 		}
 	}






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

* Re: [PATCH 6/9] scsi: megaraid_sas -  Add the online reset to iMR chip
  2010-11-19 17:29               ` Yang, Bo
@ 2010-11-30 15:36                 ` Tomas Henzl
  -1 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 15:36 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

On 11/19/2010 06:29 PM, Yang, Bo wrote:
> Driver added the OCR (online controller reset) support to megaraid sas iMR chip.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   74 ++++++++++++++++++++---------------
> drivers/scsi/megaraid/megaraid_sas.h |    5 +-
>  2 files changed, 47 insertions(+), 32 deletions(-)
>   
> @@ -497,6 +503,8 @@ static int megasas_clear_intr_skinny(struct
> megasas_register_set __iomem *regs) { u32 status; + u32 mfiStatus = 0;
> + /* * Check if it is our interrupt */ @@ -507,6 +515,15 @@
> megasas_clear_intr_skinny(struct megasas } /* + * Check if it is our
> interrupt + */ + if ((megasas_read_fw_status_reg_gen2( regs) &
> MFI_STATE_MASK ) == + MFI_STATE_FAULT ) { + mfiStatus |=
> MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE; + } else + mfiStatus |=
> MFI_INTR_FLAG_REPLY_MESSAGE; + + /* * Clear the interrupt by writing
> back the same value */ writel(status, &regs->outbound_intr_status); 
In the hunk above you use the '|=' which is not needed, a simple
assignment is more readable, see below.

Tomas

@@ -493,6 +499,8 @@ static int
 megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus;
+
 	/*
 	 * Check if it is our interrupt
 	 */
@@ -503,6 +511,15 @@ megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 	}
 
 	/*
+	 * Check if it is our interrupt
+	 */
+	if ((megasas_read_fw_status_reg_gen2( regs) & MFI_STATE_MASK) ==
+						MFI_STATE_FAULT)
+		mfiStatus = MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	else
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+
+	/*
 	 * Clear the interrupt by writing back the same value
 	 */
 	writel(status, &regs->outbound_intr_status);



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

* Re: [PATCH 6/9] scsi: megaraid_sas -  Add the online reset to iMR chip
@ 2010-11-30 15:36                 ` Tomas Henzl
  0 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 15:36 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

On 11/19/2010 06:29 PM, Yang, Bo wrote:
> Driver added the OCR (online controller reset) support to megaraid sas iMR chip.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   74 ++++++++++++++++++++---------------
> drivers/scsi/megaraid/megaraid_sas.h |    5 +-
>  2 files changed, 47 insertions(+), 32 deletions(-)
>   
> @@ -497,6 +503,8 @@ static int megasas_clear_intr_skinny(struct
> megasas_register_set __iomem *regs) { u32 status; + u32 mfiStatus = 0;
> + /* * Check if it is our interrupt */ @@ -507,6 +515,15 @@
> megasas_clear_intr_skinny(struct megasas } /* + * Check if it is our
> interrupt + */ + if ((megasas_read_fw_status_reg_gen2( regs) &
> MFI_STATE_MASK ) == + MFI_STATE_FAULT ) { + mfiStatus |=
> MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE; + } else + mfiStatus |=
> MFI_INTR_FLAG_REPLY_MESSAGE; + + /* * Clear the interrupt by writing
> back the same value */ writel(status, &regs->outbound_intr_status); 
In the hunk above you use the '|=' which is not needed, a simple
assignment is more readable, see below.

Tomas

@@ -493,6 +499,8 @@ static int
 megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
+	u32 mfiStatus;
+
 	/*
 	 * Check if it is our interrupt
 	 */
@@ -503,6 +511,15 @@ megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 	}
 
 	/*
+	 * Check if it is our interrupt
+	 */
+	if ((megasas_read_fw_status_reg_gen2( regs) & MFI_STATE_MASK) ==
+						MFI_STATE_FAULT)
+		mfiStatus = MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
+	else
+		mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
+
+	/*
 	 * Clear the interrupt by writing back the same value
 	 */
 	writel(status, &regs->outbound_intr_status);

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

* Re: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
  2010-11-24 15:22                       ` Yang, Bo
  (?)
@ 2010-11-30 15:57                       ` Tomas Henzl
  -1 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 15:57 UTC (permalink / raw)
  To: Yang, Bo
  Cc: James Bottomley, 'linux-scsi@vger.kernel.org',
	'akpm@osdl.org', 'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Prabhakaran, Rajesh

On 11/24/2010 04:22 PM, Yang, Bo wrote:
> James,
>
> Our megaraid sas driver only implemented the part of the XOR calculation and copy capability(moving data between 2 buffers) for the RAID5 cmds which FW asks driver to do.  When fw received very heavy I/Os and there are high pending cmds in FW, fw will ask the help from driver to finish some cmds and reduce the fw heavy load.  Driver will only do part of the RAID5 (not take the jobs) from FW.  Driver is not duplicating Parity calculation done on dm/md.
>   
Do I understand it right - it means that the computation is done sometimes in the firmware and
sometimes in the driver depending on the load? I think it is not good having two complicated
computations on two different places. Wouldn't it better to compute it always in the driver?
Could we get a module option for choosing this computation - a)automatic, b)only in fw
c)only in driver?

Tomas


> Thanks,
>
> Bo Yang  
>
>
>
> -----Original Message-----
> From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com] 
> Sent: Friday, November 19, 2010 12:53 PM
> To: Yang, Bo
> Cc: 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'; Tomas Henzl
> Subject: Re: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW
>
> On Fri, 2010-11-19 at 10:43 -0700, Yang, Bo wrote:
>   
>> Driver added the new feature to take some of the workloads from FW to increase
>> performance of the iMR controller.  FW assigns the read cmds back to driver
>> which will increase the performance for megaraid sas iMR controller.
>>     
> Just on a process note: you don't have to cc me at every known
> address ... I do read linux-scsi ...
>
> My first take on this patch is that you're basically passing data back
> to the kernel for RAID-N parity calculations.  This effectively makes
> your RAID one of those pseudo HW ones.  In which case, why not simply
> abandon the HW raid piece and have it all done by DM/MD, which are well
> optimised for all types of RAID?  The reason for asking is that we're
> trying to reduce the number of in-kernel raid implementations and this
> is going in the wrong direction.
>
> James
>
>
> N�����r��y���b�X��ǧv�^�)޺{.n�+����{���"�{ay�\x1dʇڙ�,j\a��f���h���z�\x1e�w���\f���j:+v���w�j�m����\a����zZ+��ݢj"��!tml=


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

* Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
  2010-11-19 17:37                 ` Yang, Bo
@ 2010-11-30 16:11                   ` Tomas Henzl
  -1 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 16:11 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

On 11/19/2010 06:37 PM, Yang, Bo wrote:
> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>   
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
> megasas_mgmt_info megasas_ static struct fasync_struct
> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
> +static struct workqueue_struct *megasas_ocr_wq; static int
> megasas_poll_wait_aen; static
> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
> support_poll_for_event; @@ -2435,7 +2436,7 @@
> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
> workqueue.\n"); + 
What happens later, when you pass the null pointer to the queue_work ?
I'm not sure this will work.

> rval = driver_create_file(&megasas_pci_driver.driver,
> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
> __exit megasas_exit(void) &driver_attr_release_date);
> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
> megasas_ocr_wq = NULL; + } +
> pci_unregister_driver(&megasas_pci_driver);
> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 


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

* Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
@ 2010-11-30 16:11                   ` Tomas Henzl
  0 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-11-30 16:11 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

On 11/19/2010 06:37 PM, Yang, Bo wrote:
> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>   
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
> megasas_mgmt_info megasas_ static struct fasync_struct
> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
> +static struct workqueue_struct *megasas_ocr_wq; static int
> megasas_poll_wait_aen; static
> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
> support_poll_for_event; @@ -2435,7 +2436,7 @@
> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
> workqueue.\n"); + 
What happens later, when you pass the null pointer to the queue_work ?
I'm not sure this will work.

> rval = driver_create_file(&megasas_pci_driver.driver,
> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
> __exit megasas_exit(void) &driver_attr_release_date);
> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
> megasas_ocr_wq = NULL; + } +
> pci_unregister_driver(&megasas_pci_driver);
> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 


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

* RE: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
  2010-11-30 16:11                   ` Tomas Henzl
@ 2010-11-30 18:05                     ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-30 18:05 UTC (permalink / raw)
  To: Tomas Henzl
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

Tomas,

In which case megasas_ocr_wq will hit NULL if create_workqueue create work queue success? If create_workqueue failed, OCR may have the problem.  But do you know if create_workqueue has the number limitation for creating work queues (how many work queue can it created? 10 or 20)?

Thanks,

Bo Yang

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com]
Sent: Tuesday, November 30, 2010 11:11 AM 
To: Yang, Bo
Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

On 11/19/2010 06:37 PM, Yang, Bo wrote:
> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>   
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
> megasas_mgmt_info megasas_ static struct fasync_struct
> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
> +static struct workqueue_struct *megasas_ocr_wq; static int
> megasas_poll_wait_aen; static
> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
> support_poll_for_event; @@ -2435,7 +2436,7 @@
> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
> workqueue.\n"); + 
What happens later, when you pass the null pointer to the queue_work ?
I'm not sure this will work.

> rval = driver_create_file(&megasas_pci_driver.driver,
> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
> __exit megasas_exit(void) &driver_attr_release_date);
> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
> megasas_ocr_wq = NULL; + } +
> pci_unregister_driver(&megasas_pci_driver);
> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 


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

* RE: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
@ 2010-11-30 18:05                     ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-11-30 18:05 UTC (permalink / raw)
  To: Tomas Henzl
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

Tomas,

In which case megasas_ocr_wq will hit NULL if create_workqueue create work queue success? If create_workqueue failed, OCR may have the problem.  But do you know if create_workqueue has the number limitation for creating work queues (how many work queue can it created? 10 or 20)?

Thanks,

Bo Yang

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com]
Sent: Tuesday, November 30, 2010 11:11 AM 
To: Yang, Bo
Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

On 11/19/2010 06:37 PM, Yang, Bo wrote:
> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>
> Signed-off-by Bo Yang<bo.yang@lsi.com>
>
> ---
> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>   
> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
> new/drivers/scsi/megaraid/megaraid_sas.c ---
> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
> megasas_mgmt_info megasas_ static struct fasync_struct
> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
> +static struct workqueue_struct *megasas_ocr_wq; static int
> megasas_poll_wait_aen; static
> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
> support_poll_for_event; @@ -2435,7 +2436,7 @@
> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
> workqueue.\n"); + 
What happens later, when you pass the null pointer to the queue_work ?
I'm not sure this will work.

> rval = driver_create_file(&megasas_pci_driver.driver,
> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
> __exit megasas_exit(void) &driver_attr_release_date);
> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
> megasas_ocr_wq = NULL; + } +
> pci_unregister_driver(&megasas_pci_driver);
> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 

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

* Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
  2010-11-30 18:05                     ` Yang, Bo
@ 2010-12-01 12:19                       ` Tomas Henzl
  -1 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-12-01 12:19 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

On 11/30/2010 07:05 PM, Yang, Bo wrote:
> Tomas,
>
> In which case megasas_ocr_wq will hit NULL if create_workqueue create work queue success? If create_workqueue failed, OCR may have the problem.  But do you know if create_workqueue has the number limitation for creating work queues (how many work queue can it created? 10 or 20)?
>   
+	megasas_ocr_wq = create_workqueue("megasas_ocr");
+
+	if ( !megasas_ocr_wq )
+		printk(KERN_DEBUG "megasas: Failed to create workqueue.\n");

Then why do you check the return value if it can not fail?

You are allocating a lot of resources in the init function and when some of them is not 
available (which is unlikely) you return with an error value. Why don't you want that for 
create_workqueue too?

Is it safe enter the suspend mode with the workqueue still doing some job?
Shouldn't be the workqueue flushed in the suspend function?
 

> Thanks,
>
> Bo Yang
>
> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com]
> Sent: Tuesday, November 30, 2010 11:11 AM 
> To: Yang, Bo
> Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
> Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
>
> On 11/19/2010 06:37 PM, Yang, Bo wrote:
>   
>> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>>
>> Signed-off-by Bo Yang<bo.yang@lsi.com>
>>
>> ---
>> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>   
>> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
>> new/drivers/scsi/megaraid/megaraid_sas.c ---
>> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
>> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
>> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
>> megasas_mgmt_info megasas_ static struct fasync_struct
>> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
>> +static struct workqueue_struct *megasas_ocr_wq; static int
>> megasas_poll_wait_aen; static
>> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
>> support_poll_for_event; @@ -2435,7 +2436,7 @@
>> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
>> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
>> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
>> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
>> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
>> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
>> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
>> workqueue.\n"); + 
>>     
> What happens later, when you pass the null pointer to the queue_work ?
> I'm not sure this will work.
>
>   
>> rval = driver_create_file(&megasas_pci_driver.driver,
>> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
>> __exit megasas_exit(void) &driver_attr_release_date);
>> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
>> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
>> megasas_ocr_wq = NULL; + } +
>> pci_unregister_driver(&megasas_pci_driver);
>> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 
>>     
> --
> 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] 70+ messages in thread

* Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
@ 2010-12-01 12:19                       ` Tomas Henzl
  0 siblings, 0 replies; 70+ messages in thread
From: Tomas Henzl @ 2010-12-01 12:19 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

On 11/30/2010 07:05 PM, Yang, Bo wrote:
> Tomas,
>
> In which case megasas_ocr_wq will hit NULL if create_workqueue create work queue success? If create_workqueue failed, OCR may have the problem.  But do you know if create_workqueue has the number limitation for creating work queues (how many work queue can it created? 10 or 20)?
>   
+	megasas_ocr_wq = create_workqueue("megasas_ocr");
+
+	if ( !megasas_ocr_wq )
+		printk(KERN_DEBUG "megasas: Failed to create workqueue.\n");

Then why do you check the return value if it can not fail?

You are allocating a lot of resources in the init function and when some of them is not 
available (which is unlikely) you return with an error value. Why don't you want that for 
create_workqueue too?

Is it safe enter the suspend mode with the workqueue still doing some job?
Shouldn't be the workqueue flushed in the suspend function?
 

> Thanks,
>
> Bo Yang
>
> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com]
> Sent: Tuesday, November 30, 2010 11:11 AM 
> To: Yang, Bo
> Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
> Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
>
> On 11/19/2010 06:37 PM, Yang, Bo wrote:
>   
>> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>>
>> Signed-off-by Bo Yang<bo.yang@lsi.com>
>>
>> ---
>> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>   
>> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
>> new/drivers/scsi/megaraid/megaraid_sas.c ---
>> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
>> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
>> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
>> megasas_mgmt_info megasas_ static struct fasync_struct
>> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
>> +static struct workqueue_struct *megasas_ocr_wq; static int
>> megasas_poll_wait_aen; static
>> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
>> support_poll_for_event; @@ -2435,7 +2436,7 @@
>> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
>> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
>> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
>> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
>> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
>> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
>> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
>> workqueue.\n"); + 
>>     
> What happens later, when you pass the null pointer to the queue_work ?
> I'm not sure this will work.
>
>   
>> rval = driver_create_file(&megasas_pci_driver.driver,
>> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
>> __exit megasas_exit(void) &driver_attr_release_date);
>> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
>> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
>> megasas_ocr_wq = NULL; + } +
>> pci_unregister_driver(&megasas_pci_driver);
>> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 
>>     
> --
> 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] 70+ messages in thread

* RE: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
  2010-12-01 12:19                       ` Tomas Henzl
@ 2010-12-01 15:55                         ` Yang, Bo
  -1 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-12-01 15:55 UTC (permalink / raw)
  To: Tomas Henzl
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

Tomas,

The megasas_ocr_wq only used by online controller reset.  Driver can either do return error or continue load by disabling the Online controller reset bit.  I will discuss internally and post back today for the changes.

Regards,

Bo Yang   

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com] 
Sent: Wednesday, December 01, 2010 7:19 AM
To: Yang, Bo
Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

On 11/30/2010 07:05 PM, Yang, Bo wrote:
> Tomas,
>
> In which case megasas_ocr_wq will hit NULL if create_workqueue create work queue success? If create_workqueue failed, OCR may have the problem.  But do you know if create_workqueue has the number limitation for creating work queues (how many work queue can it created? 10 or 20)?
>   
+	megasas_ocr_wq = create_workqueue("megasas_ocr");
+
+	if ( !megasas_ocr_wq )
+		printk(KERN_DEBUG "megasas: Failed to create workqueue.\n");

Then why do you check the return value if it can not fail?

You are allocating a lot of resources in the init function and when some of them is not 
available (which is unlikely) you return with an error value. Why don't you want that for 
create_workqueue too?

Is it safe enter the suspend mode with the workqueue still doing some job?
Shouldn't be the workqueue flushed in the suspend function?
 

> Thanks,
>
> Bo Yang
>
> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com]
> Sent: Tuesday, November 30, 2010 11:11 AM 
> To: Yang, Bo
> Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
> Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
>
> On 11/19/2010 06:37 PM, Yang, Bo wrote:
>   
>> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>>
>> Signed-off-by Bo Yang<bo.yang@lsi.com>
>>
>> ---
>> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>   
>> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
>> new/drivers/scsi/megaraid/megaraid_sas.c ---
>> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
>> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
>> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
>> megasas_mgmt_info megasas_ static struct fasync_struct
>> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
>> +static struct workqueue_struct *megasas_ocr_wq; static int
>> megasas_poll_wait_aen; static
>> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
>> support_poll_for_event; @@ -2435,7 +2436,7 @@
>> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
>> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
>> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
>> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
>> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
>> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
>> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
>> workqueue.\n"); + 
>>     
> What happens later, when you pass the null pointer to the queue_work ?
> I'm not sure this will work.
>
>   
>> rval = driver_create_file(&megasas_pci_driver.driver,
>> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
>> __exit megasas_exit(void) &driver_attr_release_date);
>> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
>> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
>> megasas_ocr_wq = NULL; + } +
>> pci_unregister_driver(&megasas_pci_driver);
>> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 
>>     
> --
> 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] 70+ messages in thread

* RE: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
@ 2010-12-01 15:55                         ` Yang, Bo
  0 siblings, 0 replies; 70+ messages in thread
From: Yang, Bo @ 2010-12-01 15:55 UTC (permalink / raw)
  To: Tomas Henzl
  Cc: 'James.Bottomley@HansenPartnership.com',
	'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org'

Tomas,

The megasas_ocr_wq only used by online controller reset.  Driver can either do return error or continue load by disabling the Online controller reset bit.  I will discuss internally and post back today for the changes.

Regards,

Bo Yang   

-----Original Message-----
From: Tomas Henzl [mailto:thenzl@redhat.com] 
Sent: Wednesday, December 01, 2010 7:19 AM
To: Yang, Bo
Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

On 11/30/2010 07:05 PM, Yang, Bo wrote:
> Tomas,
>
> In which case megasas_ocr_wq will hit NULL if create_workqueue create work queue success? If create_workqueue failed, OCR may have the problem.  But do you know if create_workqueue has the number limitation for creating work queues (how many work queue can it created? 10 or 20)?
>   
+	megasas_ocr_wq = create_workqueue("megasas_ocr");
+
+	if ( !megasas_ocr_wq )
+		printk(KERN_DEBUG "megasas: Failed to create workqueue.\n");

Then why do you check the return value if it can not fail?

You are allocating a lot of resources in the init function and when some of them is not 
available (which is unlikely) you return with an error value. Why don't you want that for 
create_workqueue too?

Is it safe enter the suspend mode with the workqueue still doing some job?
Shouldn't be the workqueue flushed in the suspend function?
 

> Thanks,
>
> Bo Yang
>
> -----Original Message-----
> From: Tomas Henzl [mailto:thenzl@redhat.com]
> Sent: Tuesday, November 30, 2010 11:11 AM 
> To: Yang, Bo
> Cc: 'James.Bottomley@HansenPartnership.com'; 'linux-scsi@vger.kernel.org'; 'akpm@osdl.org'; 'linux-kernel@vger.kernel.org'
> Subject: Re: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR
>
> On 11/19/2010 06:37 PM, Yang, Bo wrote:
>   
>> Driver created the owner work queue (don't use global work queue). This queue will be used for online controller reset routine.
>>
>> Signed-off-by Bo Yang<bo.yang@lsi.com>
>>
>> ---
>> drivers/scsi/megaraid/megaraid_sas.c |   13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>   
>> diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c
>> new/drivers/scsi/megaraid/megaraid_sas.c ---
>> old/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17 13:46:11.000000000
>> -0500 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-11-17
>> 13:47:46.000000000 -0500 @@ -108,6 +108,7 @@ static struct
>> megasas_mgmt_info megasas_ static struct fasync_struct
>> *megasas_async_queue; static DEFINE_MUTEX(megasas_async_queue_mutex);
>> +static struct workqueue_struct *megasas_ocr_wq; static int
>> megasas_poll_wait_aen; static
>> DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); static u32
>> support_poll_for_event; @@ -2435,7 +2436,7 @@
>> megasas_deplete_reply_queue(struct megas printk(KERN_NOTICE "megasas:
>> fwState=%x, stage:%d\n", fw_state, instance->adprecovery); -
>> schedule_work(&instance->work_init); + queue_work(megasas_ocr_wq,
>> &instance->work_init); return IRQ_HANDLED; } else { @@ -5157,6
>> +5158,11 @@ static int __init megasas_init(void) goto err_pcidrv; } +
>> megasas_ocr_wq = create_workqueue("megasas_ocr"); + + if (
>> !megasas_ocr_wq ) + printk(KERN_DEBUG "megasas: Failed to create
>> workqueue.\n"); + 
>>     
> What happens later, when you pass the null pointer to the queue_work ?
> I'm not sure this will work.
>
>   
>> rval = driver_create_file(&megasas_pci_driver.driver,
>> &driver_attr_version); if (rval) @@ -5228,6 +5234,11 @@ static void
>> __exit megasas_exit(void) &driver_attr_release_date);
>> driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
>> + if (megasas_ocr_wq) { + destroy_workqueue(megasas_ocr_wq); +
>> megasas_ocr_wq = NULL; + } +
>> pci_unregister_driver(&megasas_pci_driver);
>> unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); } 
>>     
> --
> 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] 70+ messages in thread

* Re: [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives
  2010-11-19 16:53       ` Yang, Bo
  (?)
  (?)
@ 2010-12-09 17:07       ` James Bottomley
  -1 siblings, 0 replies; 70+ messages in thread
From: James Bottomley @ 2010-12-09 17:07 UTC (permalink / raw)
  To: Yang, Bo
  Cc: 'linux-scsi@vger.kernel.org', 'akpm@osdl.org',
	'linux-kernel@vger.kernel.org',
	Daftardar, Jayant, Tomas Henzl

On Fri, 2010-11-19 at 09:53 -0700, Yang, Bo wrote:
> Driver only report tape drive, JBOD and logic drives to OS

Could you explain the point of this further?  As far as I can see, it
would prevent the driver from reporting enclosures, which it is
currently doing.

James



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

end of thread, other threads:[~2010-12-09 17:07 UTC | newest]

Thread overview: 70+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-10  2:34 [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions Yang, Bo
2010-06-10  2:34 ` Yang, Bo
2010-06-18 21:18 ` Yinghai Lu
2010-06-18 21:18   ` Yinghai Lu
2010-06-18 21:21   ` Yang, Bo
2010-06-18 21:21     ` Yang, Bo
2010-06-18 21:37     ` Yinghai Lu
2010-06-18 21:37       ` Yinghai Lu
2010-06-18 21:56       ` Yang, Bo
2010-06-18 21:56         ` Yang, Bo
2010-06-20 14:54         ` James Bottomley
2010-06-20 15:01   ` James Bottomley
2010-06-20 19:27     ` Yang, Bo
2010-06-20 19:27       ` Yang, Bo
2010-06-20 19:47       ` James Bottomley
2010-06-20 20:19         ` Yang, Bo
2010-06-20 20:19           ` Yang, Bo
2010-06-20 20:48           ` James Bottomley
2010-06-21 15:35             ` Yang, Bo
2010-06-21 15:35               ` Yang, Bo
2010-07-20 13:08             ` Yang, Bo
2010-07-20 13:08               ` Yang, Bo
2010-07-30 18:53             ` Yang, Bo
2010-07-30 18:53               ` Yang, Bo
2010-07-31 17:46               ` James Bottomley
2010-08-05 20:44                 ` Yang, Bo
2010-08-05 20:44                   ` Yang, Bo
2010-08-06  0:36                   ` James Bottomley
2010-08-12 15:20                 ` Yang, Bo
2010-08-12 15:20                   ` Yang, Bo
2010-08-16 14:22                 ` Yang, Bo
2010-08-16 14:22                   ` Yang, Bo
2010-08-16 15:06                   ` James Bottomley
2010-08-05 19:47 ` Yang, Bo
2010-08-05 19:47   ` Yang, Bo
2010-11-19 16:33   ` [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset Yang, Bo
2010-11-19 16:33     ` Yang, Bo
2010-11-19 16:53     ` [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives Yang, Bo
2010-11-19 16:53       ` Yang, Bo
2010-11-19 17:03       ` [PATCH 3/9] scsi: megaraid_sas - Driver will scan device after receive event MR_EVT_LD_STATE_CHANGE Yang, Bo
2010-11-19 17:03         ` Yang, Bo
2010-11-19 17:08         ` [PATCH 4/9] scsi: megaraid_sas - Driver provide the version to FW Yang, Bo
2010-11-19 17:08           ` Yang, Bo
2010-11-19 17:23           ` [PATCH 5/9] scsi: megaraid_sas - report different io sectors for ieee support Yang, Bo
2010-11-19 17:23             ` Yang, Bo
2010-11-19 17:29             ` [PATCH 6/9] scsi: megaraid_sas - Add the online reset to iMR chip Yang, Bo
2010-11-19 17:29               ` Yang, Bo
2010-11-19 17:37               ` [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR Yang, Bo
2010-11-19 17:37                 ` Yang, Bo
2010-11-19 17:43                 ` [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW Yang, Bo
2010-11-19 17:43                   ` Yang, Bo
2010-11-19 17:53                   ` James Bottomley
2010-11-24 15:22                     ` Yang, Bo
2010-11-24 15:22                       ` Yang, Bo
2010-11-30 15:57                       ` Tomas Henzl
2010-11-30 16:11                 ` [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR Tomas Henzl
2010-11-30 16:11                   ` Tomas Henzl
2010-11-30 18:05                   ` Yang, Bo
2010-11-30 18:05                     ` Yang, Bo
2010-12-01 12:19                     ` Tomas Henzl
2010-12-01 12:19                       ` Tomas Henzl
2010-12-01 15:55                       ` Yang, Bo
2010-12-01 15:55                         ` Yang, Bo
2010-11-30 15:36               ` [PATCH 6/9] scsi: megaraid_sas - Add the online reset to iMR chip Tomas Henzl
2010-11-30 15:36                 ` Tomas Henzl
2010-11-19 17:50         ` [PATCH 9/9] scsi: megaraid_sas - Documentation and driver version update Yang, Bo
2010-11-19 17:50           ` Yang, Bo
2010-12-09 17:07       ` [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives James Bottomley
2010-11-30 15:21     ` [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset Tomas Henzl
2010-11-30 15:21       ` Tomas Henzl

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.