2010-06-10 02:35:05

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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<[email protected]>

---
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;


2010-06-18 21:19:00

by Yinghai Lu

[permalink] [raw]
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 <[email protected]> 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<[email protected]>

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

2010-06-18 21:21:18

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

Yinghai,

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

Regards,

Bo Yang

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yinghai Lu
Sent: Friday, June 18, 2010 5:19 PM
To: Yang, Bo
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
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 <[email protected]> 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<[email protected]>

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

2010-06-18 21:37:21

by Yinghai Lu

[permalink] [raw]
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 <[email protected]> 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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

2010-06-18 21:56:36

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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

Regards,

Bo Yang

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yinghai Lu
Sent: Friday, June 18, 2010 5:37 PM
To: Yang, Bo
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
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 <[email protected]> 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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

2010-06-20 14:54:41

by James Bottomley

[permalink] [raw]
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 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

2010-06-20 15:01:08

by James Bottomley

[permalink] [raw]
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 <[email protected]> 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<[email protected]>
>
> 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

2010-06-20 19:27:20

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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:[email protected]]
Sent: Sunday, June 20, 2010 11:01 AM
To: Yinghai Lu
Cc: Yang, Bo; [email protected]; [email protected]; [email protected]
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 <[email protected]> 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<[email protected]>
>
> 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-06-20 19:47:43

by James Bottomley

[permalink] [raw]
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

2010-06-20 20:19:50

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

James,

Yes.

Regards,

Bo Yang

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, June 20, 2010 3:48 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]
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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-06-20 20:48:54

by James Bottomley

[permalink] [raw]
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

2010-06-21 15:35:44

by Yang, Bo

[permalink] [raw]
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<[email protected]>

---
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:[email protected])
+ 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:[email protected])
Bo Yang


-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]
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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-07-20 13:08:55

by Yang, Bo

[permalink] [raw]
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; [email protected]; [email protected]; [email protected]
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<[email protected]>

---
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:[email protected])
+ 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:[email protected])
Bo Yang


-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]
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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-07-30 18:53:41

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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'; '[email protected]'; '[email protected]'; '[email protected]'
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; [email protected]; [email protected]; [email protected]
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<[email protected]>

---
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:[email protected])
+ 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:[email protected])
Bo Yang


-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, June 20, 2010 4:49 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]
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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-07-31 17:46:22

by James Bottomley

[permalink] [raw]
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

2010-08-05 19:47:57

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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<[email protected]>

---
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;

2010-08-05 20:44:36

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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:[email protected]]
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]; 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-08-06 00:36:24

by James Bottomley

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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

2010-08-12 15:21:01

by Yang, Bo

[permalink] [raw]
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:[email protected]]
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]; 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-08-16 14:23:13

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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; [email protected]; [email protected]; [email protected]; 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:[email protected]]
Sent: Saturday, July 31, 2010 1:46 PM
To: Yang, Bo
Cc: Yinghai Lu; [email protected]; [email protected]; [email protected]; 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-08-16 15:23:26

by James Bottomley

[permalink] [raw]
Subject: RE: [PATCH 1/12] scsi: megaraid_sas - Online Controller Reset - I: Enable Online Controller Reset Bit in register related functions

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

2010-11-19 16:33:39

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset

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<[email protected]>

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


Attachments:
megasas-p1-timechange.patch (1.26 kB)
megasas-p1-timechange.patch

2010-11-19 16:54:15

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives

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

Signed-off-by Bo Yang<[email protected]>

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


Attachments:
megasas-p2-enclusure.patch (1.23 kB)
megasas-p2-enclusure.patch

2010-11-19 17:03:08

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 3/9] scsi: megaraid_sas - Driver will scan device after receive event MR_EVT_LD_STATE_CHANGE

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

Signed-off-by Bo Yang<[email protected]>

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


Attachments:
megasas-p3.patch (482.00 B)
megasas-p3.patch

2010-11-19 17:09:27

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 4/9] scsi: megaraid_sas - Driver provide the version to FW

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

Signed-off-by Bo Yang<[email protected]>

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


Attachments:
megasas-p4-version.patch (2.41 kB)
megasas-p4-version.patch

2010-11-19 17:23:44

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 5/9] scsi: megaraid_sas - report different io sectors for ieee support

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

Signed-off-by Bo Yang<[email protected]>

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


Attachments:
megasas-p5-ieee.patch (1.11 kB)
megasas-p5-ieee.patch

2010-11-19 17:29:49

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 6/9] scsi: megaraid_sas - Add the online reset to iMR chip

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

Signed-off-by Bo Yang<[email protected]>

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


Attachments:
megasas-p6-imrocr.patch (5.99 kB)
megasas-p6-imrocr.patch

2010-11-19 17:37:17

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

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<[email protected]>

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


Attachments:
megasas-p7-workqueue.patch (1.56 kB)
megasas-p7-workqueue.patch

2010-11-19 17:43:24

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW

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<[email protected]>

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


Attachments:
megasas-p8-cpx.patch (38.67 kB)
megasas-p8-cpx.patch

2010-11-19 17:50:27

by Yang, Bo

[permalink] [raw]
Subject: [PATCH 9/9] scsi: megaraid_sas - Documentation and driver version update

Documentation and driver version update

Signed-off-by Bo Yang<[email protected]>

---
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(-)


Attachments:
megasas-p9-version.patch (2.35 kB)
megasas-p9-version.patch

2010-11-19 17:53:08

by James Bottomley

[permalink] [raw]
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

2010-11-24 15:22:13

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW

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:[email protected]]
Sent: Friday, November 19, 2010 12:53 PM
To: Yang, Bo
Cc: '[email protected]'; '[email protected]'; '[email protected]'; 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?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-11-30 15:22:12

by Tomas Henzl

[permalink] [raw]
Subject: Re: [PATCH 1/9] scsi: megaraid_sas - Change the time format during the driver online controller reset

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<[email protected]>
>
> ---
> 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<[email protected]>

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;
}
}




2010-11-30 15:36:14

by Tomas Henzl

[permalink] [raw]
Subject: Re: [PATCH 6/9] scsi: megaraid_sas - Add the online reset to iMR chip

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<[email protected]>
>
> ---
> 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);

2010-11-30 15:57:47

by Tomas Henzl

[permalink] [raw]
Subject: Re: [PATCH 8/9] scsi: megaraid_sas - Driver take some workloads from FW

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:[email protected]]
> Sent: Friday, November 19, 2010 12:53 PM
> To: Yang, Bo
> Cc: '[email protected]'; '[email protected]'; '[email protected]'; 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�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�m��������zZ+��ݢj"��!tml=

2010-11-30 16:12:16

by Tomas Henzl

[permalink] [raw]
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<[email protected]>
>
> ---
> 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"); }

2010-11-30 18:05:22

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

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:[email protected]]
Sent: Tuesday, November 30, 2010 11:11 AM
To: Yang, Bo
Cc: '[email protected]'; '[email protected]'; '[email protected]'; '[email protected]'
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<[email protected]>
>
> ---
> 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"); }

2010-12-01 12:19:26

by Tomas Henzl

[permalink] [raw]
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:[email protected]]
> Sent: Tuesday, November 30, 2010 11:11 AM
> To: Yang, Bo
> Cc: '[email protected]'; '[email protected]'; '[email protected]'; '[email protected]'
> 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<[email protected]>
>>
>> ---
>> 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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2010-12-01 15:54:47

by Yang, Bo

[permalink] [raw]
Subject: RE: [PATCH 7/9] scsi: megaraid_sas - Driver created the self work queue for OCR

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:[email protected]]
Sent: Wednesday, December 01, 2010 7:19 AM
To: Yang, Bo
Cc: '[email protected]'; '[email protected]'; '[email protected]'; '[email protected]'
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:[email protected]]
> Sent: Tuesday, November 30, 2010 11:11 AM
> To: Yang, Bo
> Cc: '[email protected]'; '[email protected]'; '[email protected]'; '[email protected]'
> 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<[email protected]>
>>
>> ---
>> 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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2010-12-09 17:07:29

by James Bottomley

[permalink] [raw]
Subject: Re: [PATCH 2/9] scsi: megaraid_sas - Driver only report tape drive, JBOD and logic drives

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