Re: [PATCH v3 2/4] cxlflash: Base error recovery support
Hi Daniel, Thanks for reviewing. Comments inline below. -matt > On Aug 7, 2015, at 12:12 AM, Daniel Axtens wrote: > > Hi, > >> @@ -1857,9 +1884,18 @@ static int cxlflash_eh_device_reset_handler(struct >> scsi_cmnd *scp) >> get_unaligned_be32(&((u32 *)scp->cmnd)[2]), >> get_unaligned_be32(&((u32 *)scp->cmnd)[3])); >> >> -rcr = send_tmf(afu, scp, TMF_LUN_RESET); >> -if (unlikely(rcr)) >> -rc = FAILED; >> +switch (cfg->eeh_active) { >> +case EEH_STATE_NONE: >> +rcr = send_tmf(afu, scp, TMF_LUN_RESET); >> +if (unlikely(rcr)) >> +rc = FAILED; >> +break; >> +case EEH_STATE_ACTIVE: >> +wait_event(cfg->eeh_waitq, cfg->eeh_active != EEH_STATE_ACTIVE); >> +break; >> +case EEH_STATE_FAILED: >> +break; >> +} >> > > Looking at the context here, it looks like rc gets initalised to > SUCCESS. In that case, in the EEH failed case, you'll return SUCCESS. > I'm not particularly clear on the semantics here: does that make sense? > > Likewise, in the EEH active state, when you finish the wait_event, > should you check if the EEH state went to NONE or FAILED before you > break? > > There’s a similar case below in host_reset. Good catch, this is a bug we had previously identified. Look for a fix in v4. > >> pr_debug("%s: returning rc=%d\n", __func__, rc); >> return rc; >> @@ -1889,11 +1925,23 @@ static int cxlflash_eh_host_reset_handler(struct >> scsi_cmnd *scp) >> get_unaligned_be32(&((u32 *)scp->cmnd)[2]), >> get_unaligned_be32(&((u32 *)scp->cmnd)[3])); >> >> -rcr = afu_reset(cfg); >> -if (rcr == 0) >> -rc = SUCCESS; >> -else >> -rc = FAILED; >> +switch (cfg->eeh_active) { >> +case EEH_STATE_NONE: >> +cfg->eeh_active = EEH_STATE_FAILED; >> +rcr = afu_reset(cfg); >> +if (rcr == 0) >> +rc = SUCCESS; >> +else >> +rc = FAILED; >> +cfg->eeh_active = EEH_STATE_NONE; >> +wake_up_all(&cfg->eeh_waitq); >> +break; >> +case EEH_STATE_ACTIVE: >> +wait_event(cfg->eeh_waitq, cfg->eeh_active != EEH_STATE_ACTIVE); >> +break; >> +case EEH_STATE_FAILED: >> +break; >> +} >> >> pr_debug("%s: returning rc=%d\n", __func__, rc); >> return rc; >> @@ -2145,6 +2193,11 @@ static void cxlflash_worker_thread(struct work_struct >> *work) >> int port; >> ulong lock_flags; >> >> +/* Avoid MMIO if the device has failed */ >> + >> +if (cfg->eeh_active == EEH_STATE_FAILED) >> +return; >> + > Should this check be != EEH_STATE_NONE? Or is this called within the > error recovery process? Yes, we have already swapped the logic around as you pointed out. You’ll see it in v4. > >> spin_lock_irqsave(cfg->host->host_lock, lock_flags); >> >> if (cfg->lr_state == LINK_RESET_REQUIRED) { >> @@ -2226,6 +2279,8 @@ static int cxlflash_probe(struct pci_dev *pdev, >> >> cfg->init_state = INIT_STATE_NONE; >> cfg->dev = pdev; >> + >> +cfg->eeh_active = EEH_STATE_NONE; >> cfg->dev_id = (struct pci_device_id *)dev_id; >> >> >> @@ -2286,6 +2341,85 @@ out_remove: >> goto out; >> } >> >> +/** >> + * cxlflash_pci_error_detected() - called when a PCI error is detected >> + * @pdev: PCI device struct. >> + * @state: PCI channel state. >> + * >> + * Return: PCI_ERS_RESULT_NEED_RESET or PCI_ERS_RESULT_DISCONNECT >> + */ >> +static pci_ers_result_t cxlflash_pci_error_detected(struct pci_dev *pdev, >> +pci_channel_state_t state) >> +{ >> +struct cxlflash_cfg *cfg = pci_get_drvdata(pdev); >> + >> +pr_debug("%s: pdev=%p state=%u\n", __func__, pdev, state); >> + >> +switch (state) { >> +case pci_channel_io_frozen: >> +cfg->eeh_active = EEH_STATE_ACTIVE; >> +udelay(100); >> + >> +term_mc(cfg, UNDO_START); >> +stop_afu(cfg); >> + >> +return PCI_ERS_RESULT_CAN_RECOVER; > > I think that should PCI_ERS_RESULT_NEED_RESET. Agreed. Will change for v4. > > Apart from that, it’s looking pretty good from an EEH perspective. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi: storvsc: Fix a bug in copy_from_bounce_buffer()
Commit 8de580742fee ("scsi: storvsc: Fix a bug in copy_from_bounce_buffer()"), actually modified the function copy_to_bounce_buffer(). Is the commit message wrong, or was the patch applied to the wrong function? Ben. -- Ben Hutchings Computers are not intelligent. They only think they are. signature.asc Description: This is a digitally signed message part
[PATCH v3 0/9] Use correctly the Xen memory terminologies
Hi all, This patch series aims to use the memory terminologies described in include/xen/mm.h [1] for Linux xen code. The differences from v2 is minor but I resent it because my 64K series depends on this series. Linux is using mistakenly MFN when GFN is meant, I suspect this is because the first support of Xen was for PV. This has brought some misimplementation of memory helpers on ARM and make the developper confused about the expected behavior. For instance, with pfn_to_mfn, we expect to get a MFN based on the name. Although, if we look at the implementation on x86, it's returning a GFN. Most of the callers are also using it this way. The first 2 patches of this series is ARM related in order to remove PV specific helpers which should not be used and fixing the implementation of pfn_to_mfn. The rest of the series is here rename most of the usage in the common code of MFN to GFN. I also took the opportunity to replace most of the call to pfn_to_gfn in the common code by page_to_gfn avoid construction such as pfn_to_gfn(page_to_pfn(...). Note the one xen-blkfront will be dropped by 64K series [2], I can include here if necessary. Major changes in v3: - More typoes - Rename page_to_gfn to xen_page_to_gfn to avoid confusing with the KVM function gfn_to_page Major changes in v2: - Use bfn rather than dfn for the DMA address - Re-introduced pfn_to_mfn for PV guests only - Typoes For all the changes see in each patch. This series is based on xentip for-linus-4.3 branch. A branch with all the patches can be found here: git://xenbits.xen.org/people/julieng/linux-arm.git branch page-renaming-v3 It has been boot tested on ARM64 and ARM32 and only built for x86. I would be happy if someone can give a try on x86 as I don't have a x86 box setup with Xen. Sincerely yours, [1] http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=e758ed14f390342513405dd766e874934573e6cb [2] https://lkml.org/lkml/2015/7/9/628 Cc: Boris Ostrovsky Cc: David Vrabel Cc: Dmitry Torokhov Cc: Greg Kroah-Hartman Cc: "H. Peter Anvin" Cc: Ian Campbell Cc: Ingo Molnar Cc: "James E.J. Bottomley" Cc: Jean-Christophe Plagniol-Villard Cc: Jiri Slaby Cc: Juergen Gross Cc: Konrad Rzeszutek Wilk Cc: linux-...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-fb...@vger.kernel.org Cc: linux-in...@vger.kernel.org Cc: linuxppc-...@lists.ozlabs.org Cc: linux-scsi@vger.kernel.org Cc: net...@vger.kernel.org Cc: "Roger Pau Monné" Cc: Russell King Cc: Stefano Stabellini Cc: Thomas Gleixner Cc: Tomi Valkeinen Cc: Wei Liu Cc: x...@kernel.org Julien Grall (9): arm/xen: Remove helpers which are PV specific xen: Make clear that swiotlb and biomerge are dealing with DMA address arm/xen: implement correctly pfn_to_mfn xen: Use correctly the Xen memory terminologies xen/tmem: Use xen_page_to_gfn rather than pfn_to_gfn video/xen-fbfront: Further s/MFN/GFN clean-up hvc/xen: Further s/MFN/GFN clean-up xen/privcmd: Further s/MFN/GFN/ clean-up xen/xenbus: Rename the variable xen_store_mfn to xen_store_gfn arch/arm/include/asm/xen/page.h | 44 - arch/arm/xen/enlighten.c| 18 +++--- arch/arm/xen/mm.c | 4 +-- arch/x86/include/asm/xen/page.h | 35 +- arch/x86/xen/mmu.c | 32 arch/x86/xen/smp.c | 2 +- drivers/block/xen-blkfront.c| 6 ++--- drivers/input/misc/xen-kbdfront.c | 4 +-- drivers/net/xen-netback/netback.c | 4 +-- drivers/net/xen-netfront.c | 12 + drivers/scsi/xen-scsifront.c| 10 drivers/tty/hvc/hvc_xen.c | 18 ++ drivers/video/fbdev/xen-fbfront.c | 20 +++ drivers/xen/balloon.c | 2 +- drivers/xen/biomerge.c | 6 ++--- drivers/xen/events/events_base.c| 2 +- drivers/xen/events/events_fifo.c| 4 +-- drivers/xen/gntalloc.c | 3 ++- drivers/xen/manage.c| 2 +- drivers/xen/privcmd.c | 44 - drivers/xen/swiotlb-xen.c | 16 ++-- drivers/xen/tmem.c | 21 ++-- drivers/xen/xenbus/xenbus_client.c | 2 +- drivers/xen/xenbus/xenbus_dev_backend.c | 2 +- drivers/xen/xenbus/xenbus_probe.c | 16 ++-- drivers/xen/xlate_mmu.c | 18 +++--- include/uapi/xen/privcmd.h | 4 +++ include/xen/page.h | 4 +-- include/xen/xen-ops.h | 10 29 files changed, 191 insertions(+), 174 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/9] xen: Use correctly the Xen memory terminologies
Based on include/xen/mm.h [1], Linux is mistakenly using MFN when GFN is meant, I suspect this is because the first support for Xen was for PV. This resulted in some misimplementation of helpers on ARM and confused developers about the expected behavior. For instance, with pfn_to_mfn, we expect to get an MFN based on the name. Although, if we look at the implementation on x86, it's returning a GFN. For clarity and avoid new confusion, replace any reference to mfn with gfn in any helpers used by PV drivers. The x86 code will still keep some reference of pfn_to_mfn but exclusively for PV (a BUG_ON has been added to ensure this). No changes as been made in the hypercall field, even though they may be invalid, in order to keep the same as the defintion in xen repo. Note that page_to_mfn has been renamed to xen_page_to_gfn to avoid a name to close to the KVM function gfn_to_page. Take also the opportunity to simplify simple construction such as pfn_to_mfn(page_to_pfn(page)) into xen_page_to_gfn. More complex clean up will come in follow-up patches. [1] http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=e758ed14f390342513405dd766e874934573e6cb Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini Acked-by: Dmitry Torokhov Acked-by: Wei Liu --- Cc: Russell King Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: "Roger Pau Monné" Cc: Ian Campbell Cc: Juergen Gross Cc: "James E.J. Bottomley" Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-in...@vger.kernel.org Cc: net...@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: linuxppc-...@lists.ozlabs.org Cc: linux-fb...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Note that I've re-introduced in v2 mfn_to_pfn & co only for x86 PV code. The helpers contain a BUG_ON to ensure that it's never called for auto-translated guests. I did as best as my can to determine whether mfn or gfn helpers should be used. Although, I haven't tried to boot it. It may be possible to do further cleanup in the mmu.c where I found some check to auto-translated. I'm not sure why given that the pvmmu callback are only used for non-auto translated guest. Changes in v3: - Add Stefano's reviewed-by (except for the x86 bits) - Add Wei (netback) and Dmitry's (input) acked-by - Keep the VIRT <-> MACHINE macro in the same order as before in arch/x86/include/asm/xen/page.h - Rename page_to_gfn to xen_page_to_gfn to avoid confusion with the KVM function gfn_to_page. - Typoes in the commit title Changes in v2: - Give directly the URL to the commit rather than the commit ID - xenstored_local_init: keep the cast to void * - Typoes - Keep pfn_to_mfn for x86 and PV-only. The *mfn* helpers are used in arch/x86/xen for enlighten.c, mmu.c, p2m.c, setup.c, smp.c and mm.c --- arch/arm/include/asm/xen/page.h | 13 +++-- arch/x86/include/asm/xen/page.h | 31 +-- arch/x86/xen/smp.c | 2 +- drivers/block/xen-blkfront.c| 6 +++--- drivers/input/misc/xen-kbdfront.c | 4 ++-- drivers/net/xen-netback/netback.c | 4 ++-- drivers/net/xen-netfront.c | 12 +++- drivers/scsi/xen-scsifront.c| 10 +- drivers/tty/hvc/hvc_xen.c | 5 +++-- drivers/video/fbdev/xen-fbfront.c | 4 ++-- drivers/xen/balloon.c | 2 +- drivers/xen/events/events_base.c| 2 +- drivers/xen/events/events_fifo.c| 4 ++-- drivers/xen/gntalloc.c | 3 ++- drivers/xen/manage.c| 2 +- drivers/xen/tmem.c | 4 ++-- drivers/xen/xenbus/xenbus_client.c | 2 +- drivers/xen/xenbus/xenbus_dev_backend.c | 2 +- drivers/xen/xenbus/xenbus_probe.c | 8 +++- include/xen/page.h | 4 ++-- 20 files changed, 73 insertions(+), 51 deletions(-) diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 911d62b..1279563 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h @@ -34,14 +34,15 @@ typedef struct xpaddr { unsigned long __pfn_to_mfn(unsigned long pfn); extern struct rb_root phys_to_mach; -static inline unsigned long pfn_to_mfn(unsigned long pfn) +/* Pseudo-physical <-> Guest conversion */ +static inline unsigned long pfn_to_gfn(unsigned long pfn) { return pfn; } -static inline unsigned long mfn_to_pfn(unsigned long mfn) +static inline unsigned long gfn_to_pfn(unsigned long gfn) { - return mfn; + return gfn; } /* Pseudo-physical <-> BUS conversion */ @@ -65,9 +66,9 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn) #define bfn_to_local_pfn
[PATCH 5/7] megaraid_sas : Fix validHandles check in io path
Syncro firmware support round robin IO switch on dual path. For this driver use validHandles as a check for dual path. This check suppose to be > 1 (not > 2) Without this patch, earlier driver code does not use dual path functionality. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas_fusion.c b/megaraid_sas_fusion.c index c31750a..568813d 100644 --- a/megaraid_sas_fusion.c +++ b/megaraid_sas_fusion.c @@ -1684,7 +1684,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, scp->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG; if ((raidLUN[0] == 1) && - (local_map_ptr->raidMap.devHndlInfo[io_info.pd_after_lb].validHandles > 2)) { + (local_map_ptr->raidMap.devHndlInfo[io_info.pd_after_lb].validHandles > 1)) { instance->dev_handle = !(instance->dev_handle); io_info.devHandle = local_map_ptr->raidMap.devHndlInfo[io_info.pd_after_lb].devHandle[instance->dev_handle]; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/7] megaraid_sas : Chip reset if driver fail to bring ioc ready
Patch which fix the issue reported as below. http://marc.info/?l=linux-scsi&m=143694494104544&w=2 This patch will try to do chip reset from driver load time. Driver load time, if firmware is not comming to ready state, driver try chip reset calling adp_reset() callback. For fusion adapter, that call back was void, so it will not do any chip reset. Now, using this patch megasas_adp_reset_fusion() will have chip reset logic for Fusion adapter. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas_fusion.c b/megaraid_sas_fusion.c index a065da7..c31750a 100644 --- a/megaraid_sas_fusion.c +++ b/megaraid_sas_fusion.c @@ -2509,6 +2509,70 @@ static int megasas_adp_reset_fusion(struct megasas_instance *instance, struct megasas_register_set __iomem *regs) { + u32 host_diag, abs_state, retry; + + /* Now try to reset the chip */ + writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + writel(MPI2_WRSEQ_1ST_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + writel(MPI2_WRSEQ_2ND_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + writel(MPI2_WRSEQ_3RD_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + writel(MPI2_WRSEQ_4TH_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + writel(MPI2_WRSEQ_5TH_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + writel(MPI2_WRSEQ_6TH_KEY_VALUE, &instance->reg_set->fusion_seq_offset); + + /* Check that the diag write enable (DRWE) bit is on */ + host_diag = readl(&instance->reg_set->fusion_host_diag); + retry = 0; + while (!(host_diag & HOST_DIAG_WRITE_ENABLE)) { + msleep(100); + host_diag = readl(&instance->reg_set->fusion_host_diag); + if (retry++ == 100) { + dev_warn(&instance->pdev->dev, + "Host diag unlock failed from %s %d\n", + __func__, __LINE__); + break; + } + } + if (!(host_diag & HOST_DIAG_WRITE_ENABLE)) + return -1; + + /* Send chip reset command */ + writel(host_diag | HOST_DIAG_RESET_ADAPTER, + &instance->reg_set->fusion_host_diag); + msleep(3000); + + /* Make sure reset adapter bit is cleared */ + host_diag = readl(&instance->reg_set->fusion_host_diag); + retry = 0; + while (host_diag & HOST_DIAG_RESET_ADAPTER) { + msleep(100); + host_diag = readl(&instance->reg_set->fusion_host_diag); + if (retry++ == 1000) { + dev_warn(&instance->pdev->dev, + "Diag reset adapter never cleared %s %d\n", + __func__, __LINE__); + break; + } + } + if (host_diag & HOST_DIAG_RESET_ADAPTER) + return -1; + + abs_state = instance->instancet->read_fw_status_reg(instance->reg_set) + & MFI_STATE_MASK; + retry = 0; + + while ((abs_state <= MFI_STATE_FW_INIT) && (retry++ < 1000)) { + msleep(100); + abs_state = instance->instancet-> + read_fw_status_reg(instance->reg_set) & MFI_STATE_MASK; + } + if (abs_state <= MFI_STATE_FW_INIT) { + dev_warn(&instance->pdev->dev, + "fw state < MFI_STATE_FW_INIT, state = 0x%x %s %d\n", + abs_state, __func__, __LINE__); + return -1; + } + return 0; } @@ -2674,11 +2738,11 @@ out: /* Core fusion reset function */ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout) { - int retval = SUCCESS, i, retry = 0, convert = 0; + int retval = SUCCESS, i, convert = 0; struct megasas_instance *instance; struct megasas_cmd_fusion *cmd_fusion; struct fusion_context *fusion; - u32 host_diag, abs_state, status_reg, reset_adapter; + u32 abs_state, status_reg, reset_adapter; u32 io_timeout_in_crash_mode = 0; struct scsi_cmnd *scmd_local = NULL; @@ -2832,81 +2896,10 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout) /* Now try to reset the chip */ for (i = 0; i < MEGASAS_FUSION_MAX_RESET_TRIES; i++) { - writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, - &instance->reg_set->fusion_seq_offset); - writel(MPI2_WRSEQ_1ST_KEY_VALUE, - &instance->reg_set->fusion_seq_offset); - writel(MPI2_WRSEQ_2ND_KEY_VALUE, - &instance->reg_set->fusion_seq_offset); - writel(MPI2_WRSEQ_3RD_KEY_VALUE, - &instance->reg_set->fusion_seq_offset); - writel(MPI2_WRSEQ_4TH_KEY_VALUE, -
[PATCH 0/7] megaraid_sas : Updates for scsi for-next
MegaRaid driver changes. Please consider this patch set for next kernel release. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- [PATCH 00/07] megaraid_sas : Updates for scsi for-next [PATCH 01/07] megaraid_sas : Jbod sequence number support [PATCH 02/07] megaraid_sas : Support for max_io_size 1MB [PATCH 03/07] megaraid_sas : Chip reset if driver fail to bring ioc ready [PATCH 04/07] megaraid_sas : Print critical fw event message [PATCH 05/07] megaraid_sas : Fix validHandles check in io path [PATCH 06/07] megaraid_sas : Code refactor for use of requestorId [PATCH 07/07] megaraid_sas : Version upgrade -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/7] megaraid_sas : Support for max_io_size 1MB
Driver will expose max sge = 256 (earlier it was 64), if firmware support extended IO size upto 1M. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas.h b/megaraid_sas.h index 45500ba..5db31c6 100644 --- a/megaraid_sas.h +++ b/megaraid_sas.h @@ -1239,7 +1239,9 @@ union megasas_sgl_frame { typedef union _MFI_CAPABILITIES { struct { #if defined(__BIG_ENDIAN_BITFIELD) - u32 reserved:25; + u32 reserved:23; + u32 support_ext_io_size:1; + u32 support_ext_queue_depth:1; u32 security_protocol_cmds_fw:1; u32 support_core_affinity:1; u32 support_ndrive_r1_lb:1; @@ -1255,7 +1257,9 @@ typedef union _MFI_CAPABILITIES { u32 support_ndrive_r1_lb:1; u32 support_core_affinity:1; u32 security_protocol_cmds_fw:1; - u32 reserved:25; + u32 support_ext_queue_depth:1; + u32 support_ext_io_size:1; + u32 reserved:23; #endif } mfi_capabilities; __le32 reg; @@ -1793,6 +1797,7 @@ struct megasas_instance { char mpio; u16 throttlequeuedepth; u8 mask_interrupts; + u16 max_chain_frame_sz; u8 is_imr; bool dev_handle; }; diff --git a/megaraid_sas_fusion.c b/megaraid_sas_fusion.c index 5e023a6..a065da7 100644 --- a/megaraid_sas_fusion.c +++ b/megaraid_sas_fusion.c @@ -316,27 +316,24 @@ static int megasas_create_frame_pool_fusion(struct megasas_instance *instance) u32 max_cmd; struct fusion_context *fusion; struct megasas_cmd_fusion *cmd; - u32 total_sz_chain_frame; fusion = instance->ctrl_context; max_cmd = instance->max_fw_cmds; - total_sz_chain_frame = MEGASAS_MAX_SZ_CHAIN_FRAME; - /* * Use DMA pool facility provided by PCI layer */ - fusion->sg_dma_pool = pci_pool_create("megasas sg pool fusion", - instance->pdev, - total_sz_chain_frame, 4, - 0); + fusion->sg_dma_pool = pci_pool_create("sg_pool_fusion", instance->pdev, + instance->max_chain_frame_sz, + 4, 0); + if (!fusion->sg_dma_pool) { printk(KERN_DEBUG "megasas: failed to setup request pool " "fusion\n"); return -ENOMEM; } - fusion->sense_dma_pool = pci_pool_create("megasas sense pool fusion", + fusion->sense_dma_pool = pci_pool_create("sense_pool_fusion", instance->pdev, SCSI_SENSE_BUFFERSIZE, 64, 0); @@ -607,6 +604,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) int i; struct megasas_header *frame_hdr; const char *sys_info; + MFI_CAPABILITIES *drv_ops; fusion = instance->ctrl_context; @@ -654,20 +652,19 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) init_frame->cmd = MFI_CMD_INIT; init_frame->cmd_status = 0xFF; + drv_ops = (MFI_CAPABILITIES *) &(init_frame->driver_operations); /* driver support Extended MSIX */ if ((instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) || (instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) - init_frame->driver_operations. - mfi_capabilities.support_additional_msix = 1; + drv_ops->mfi_capabilities.support_additional_msix = 1; /* driver supports HA / Remote LUN over Fast Path interface */ - init_frame->driver_operations.mfi_capabilities.support_fp_remote_lun - = 1; - init_frame->driver_operations.mfi_capabilities.support_max_255lds - = 1; - init_frame->driver_operations.mfi_capabilities.support_ndrive_r1_lb - = 1; - init_frame->driver_operations.mfi_capabilities.security_protocol_cmds_fw - = 1; + drv_ops->mfi_capabilities.support_max_255lds = 1; + drv_ops->mfi_capabilities.support_fp_remote_lun = 1; + drv_ops->mfi_capabilities.support_ndrive_r1_lb = 1; + drv_ops->mfi_capabilities.security_protocol_cmds_fw = 1; + if (instance->max_chain_frame_sz > MEGASAS_CHAIN_FRAME_SZ_MIN) + drv_ops->mfi_capabilities.support_ext_io_size = 1; + /* Convert capability to LE32 */ cpu_to_le32s((u32 *)&init_frame->driver_operations.mfi_capabilities); @@ -1057,7 +1054,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance) { struct megasas_register_set __iomem *reg_set; struct fusion_context *fusion; - u32 max_cmd; + u32 max_cmd, scr
[PATCH 6/7] megaraid_sas : Code refactor for use of requestorId
Some of the code changes was proposed by David Binderman Removed redudant check of requestorId. Redundant condition: instance.requestorId. Check for plasma firmware 1.11 or new restructured to support only for specific device id Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas_base.c b/megaraid_sas_base.c index 1994c2a..70e74f4 100644 --- a/megaraid_sas_base.c +++ b/megaraid_sas_base.c @@ -4844,18 +4844,22 @@ static int megasas_init_fw(struct megasas_instance *instance) } if (ctrl_info->host_interface.SRIOV) { - if (!ctrl_info->adapterOperations2.activePassive) - instance->PlasmaFW111 = 1; - - if (!instance->PlasmaFW111) - instance->requestorId = - ctrl_info->iov.requestorId; - else { - iovPtr = (struct IOV_111 *)((unsigned char *)ctrl_info + IOV_111_OFFSET); - instance->requestorId = iovPtr->requestorId; + instance->requestorId = ctrl_info->iov.requestorId; + if (instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA) { + if (!ctrl_info->adapterOperations2.activePassive) + instance->PlasmaFW111 = 1; + + dev_info(&instance->pdev->dev, "SR-IOV: firmware type: %s\n", + instance->PlasmaFW111 ? "1.11" : "new"); + + if (instance->PlasmaFW111) { + iovPtr = (struct IOV_111 *) + ((unsigned char *)ctrl_info + IOV_111_OFFSET); + instance->requestorId = iovPtr->requestorId; + } } - dev_warn(&instance->pdev->dev, "I am VF " - "requestorId %d\n", instance->requestorId); + dev_info(&instance->pdev->dev, "SRIOV: VF requestorId %d\n", + instance->requestorId); } instance->crash_dump_fw_support = @@ -6738,8 +6742,7 @@ megasas_aen_polling(struct work_struct *work) case MR_EVT_CFG_CLEARED: case MR_EVT_LD_DELETED: if (!instance->requestorId || - (instance->requestorId && -megasas_get_ld_vf_affiliation(instance, 0))) { + megasas_get_ld_vf_affiliation(instance, 0)) { if (megasas_ld_list_query(instance, MR_LD_QUERY_TYPE_EXPOSED_TO_HOST)) megasas_get_ld_list(instance); @@ -6770,8 +6773,7 @@ megasas_aen_polling(struct work_struct *work) break; case MR_EVT_LD_CREATED: if (!instance->requestorId || - (instance->requestorId && -megasas_get_ld_vf_affiliation(instance, 0))) { + megasas_get_ld_vf_affiliation(instance, 0)) { if (megasas_ld_list_query(instance, MR_LD_QUERY_TYPE_EXPOSED_TO_HOST)) megasas_get_ld_list(instance); @@ -6837,8 +6839,7 @@ megasas_aen_polling(struct work_struct *work) } if (!instance->requestorId || - (instance->requestorId && -megasas_get_ld_vf_affiliation(instance, 0))) { + megasas_get_ld_vf_affiliation(instance, 0)) { if (megasas_ld_list_query(instance, MR_LD_QUERY_TYPE_EXPOSED_TO_HOST)) megasas_get_ld_list(instance); -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/7] megaraid_sas : Version upgrade
Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas.h b/megaraid_sas.h index ccda60d..b1c605f 100644 --- a/megaraid_sas.h +++ b/megaraid_sas.h @@ -35,8 +35,8 @@ /* * MegaRAID SAS Driver meta data */ -#define MEGASAS_VERSION"06.807.10.00-rc1" -#define MEGASAS_RELDATE"March 6, 2015" +#define MEGASAS_VERSION"06.808.14.00-rc1" +#define MEGASAS_RELDATE"Jul 31, 2015" /* * Device IDs -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/7] megaraid_sas : Jbod sequence number support
Implemented JBOD map which will provide quick access for JBOD path and also provide sequence number. This will help hardware to fail command to the FW in case of any sequence mismatch. Fast Path IO for JBOD will refer JBOD map (which has sequence number per JBOD devices) instead of Raid map. Earlier, driver use Raid map to get device handle for fast path IO, which does not have sequence number information. Now, driver will use JBOD map for the same purpose. As part of error handling, if JBOD map is failed/not supported by firmware; driver will continue legacy behavior. Now there will be three IO path for JBOD (syspd) JBOD map with sequence number (Fast Path) Raid map without sequence number (Fast Path) FW path via h/w exceptional queue deliberately setup devhandle 0x (FW path). Driver send new DCMD MR_DCMD_SYSTEM_PD_MAP_GET_INFO for this purpose. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas.h b/megaraid_sas.h index 20c3754..45500ba 100644 --- a/megaraid_sas.h +++ b/megaraid_sas.h @@ -973,7 +973,12 @@ struct megasas_ctrl_info { struct { #if defined(__BIG_ENDIAN_BITFIELD) - u32 reserved:12; + u32 reserved:7; + u32 useSeqNumJbodFP:1; + u32 supportExtendedSSCSize:1; + u32 supportDiskCacheSettingForSysPDs:1; + u32 supportCPLDUpdate:1; + u32 supportTTYLogCompression:1; u32 discardCacheDuringLDDelete:1; u32 supportSecurityonJBOD:1; u32 supportCacheBypassModes:1; @@ -1013,7 +1018,12 @@ struct megasas_ctrl_info { u32 supportCacheBypassModes:1; u32 supportSecurityonJBOD:1; u32 discardCacheDuringLDDelete:1; - u32 reserved:12; + u32 supportTTYLogCompression:1; + u32 supportCPLDUpdate:1; + u32 supportDiskCacheSettingForSysPDs:1; + u32 supportExtendedSSCSize:1; + u32 useSeqNumJbodFP:1; + u32 reserved:7; #endif } adapterOperations3; @@ -1690,6 +1700,7 @@ struct megasas_instance { u32 crash_dump_drv_support; u32 crash_dump_app_support; u32 secure_jbod_support; + bool use_seqnum_jbod_fp; /* Added for PD sequence */ spinlock_t crashdump_lock; struct megasas_register_set __iomem *reg_set; @@ -1769,7 +1780,9 @@ struct megasas_instance { struct msix_entry msixentry[MEGASAS_MAX_MSIX_QUEUES]; struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES]; u64 map_id; + u64 pd_seq_map_id; struct megasas_cmd *map_update_cmd; + struct megasas_cmd *jbod_seq_cmd; unsigned long bar; long reset_flags; struct mutex reset_mutex; @@ -1985,6 +1998,9 @@ __le16 get_updated_dev_handle(struct megasas_instance *instance, void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map, struct LD_LOAD_BALANCE_INFO *lbInfo); int megasas_get_ctrl_info(struct megasas_instance *instance); +/* PD sequence */ +int +megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend); int megasas_set_crash_dump_params(struct megasas_instance *instance, u8 crash_buf_state); void megasas_free_host_crash_buffer(struct megasas_instance *instance); @@ -2000,5 +2016,6 @@ void __megasas_return_cmd(struct megasas_instance *instance, void megasas_return_mfi_mpt_pthr(struct megasas_instance *instance, struct megasas_cmd *cmd_mfi, struct megasas_cmd_fusion *cmd_fusion); int megasas_cmd_type(struct scsi_cmnd *cmd); +void megasas_setup_jbod_map(struct megasas_instance *instance); #endif /*LSI_MEGARAID_SAS_H */ diff --git a/megaraid_sas_base.c b/megaraid_sas_base.c index 71b884d..1843a50 100644 --- a/megaraid_sas_base.c +++ b/megaraid_sas_base.c @@ -2833,7 +2833,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, struct megasas_header *hdr = &cmd->frame->hdr; unsigned long flags; struct fusion_context *fusion = instance->ctrl_context; - u32 opcode; + u32 opcode, status; /* flag for the retry reset */ cmd->retry_for_fw_reset = 0; @@ -2941,6 +2941,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, && (cmd->frame->dcmd.mbox.b[1] == 1)) { fusion->fast_path_io = 0; spin_lock_irqsave(instance->host->host_lock, flags); + instance->map_update_cmd = NULL; if (cmd->frame->hdr.cmd_status != 0) { if (cmd->frame->hdr.cmd_status != MFI_STAT_NOT_FOUND) @@ -2979,6 +2980,27 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *
[PATCH 4/7] megaraid_sas : Print critical fw event message
Print firmware event in readable format. This will help user to track any critical firmware event without any application support. sample syslogd output - megaraid_sas :02:00.0: 8619 (491648347s/0x0020/WARN) - Controller temperature threshold exceeded. This may indicate inadequate system cooling. Switching to low performance mode Format of print is - ": (//) - " Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- diff --git a/megaraid_sas.h b/megaraid_sas.h index 5db31c6..ccda60d 100644 --- a/megaraid_sas.h +++ b/megaraid_sas.h @@ -273,6 +273,16 @@ enum MFI_STAT { MFI_STAT_INVALID_STATUS = 0xFF }; +enum mfi_evt_class { + MFI_EVT_CLASS_DEBUG = -2, + MFI_EVT_CLASS_PROGRESS =-1, + MFI_EVT_CLASS_INFO =0, + MFI_EVT_CLASS_WARNING = 1, + MFI_EVT_CLASS_CRITICAL =2, + MFI_EVT_CLASS_FATAL = 3, + MFI_EVT_CLASS_DEAD =4 +}; + /* * Crash dump related defines */ diff --git a/megaraid_sas_base.c b/megaraid_sas_base.c index 1843a50..1994c2a 100644 --- a/megaraid_sas_base.c +++ b/megaraid_sas_base.c @@ -260,6 +260,66 @@ megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) } +static const char * +format_timestamp(uint32_t timestamp) +{ + static char buffer[32]; + + if ((timestamp & 0xff00) == 0xff00) + snprintf(buffer, sizeof(buffer), "boot + %us", timestamp & + 0x00ff); + else + snprintf(buffer, sizeof(buffer), "%us", timestamp); + return buffer; +} + +static const char * +format_class(int8_t class) +{ + static char buffer[6]; + + switch (class) { + case MFI_EVT_CLASS_DEBUG: + return "debug"; + case MFI_EVT_CLASS_PROGRESS: + return "progress"; + case MFI_EVT_CLASS_INFO: + return "info"; + case MFI_EVT_CLASS_WARNING: + return "WARN"; + case MFI_EVT_CLASS_CRITICAL: + return "CRIT"; + case MFI_EVT_CLASS_FATAL: + return "FATAL"; + case MFI_EVT_CLASS_DEAD: + return "DEAD"; + default: + snprintf(buffer, sizeof(buffer), "%d", class); + return buffer; + } +} + +/** + * megasas_decode_evt: Decode FW AEN event and print critical event + * for information. + * @instance: Adapter soft state + */ +static void +megasas_decode_evt(struct megasas_instance *instance) +{ + struct megasas_evt_detail *evt_detail = instance->evt_detail; + union megasas_evt_class_locale class_locale; + class_locale.word = le32_to_cpu(evt_detail->cl.word); + + if (class_locale.members.class >= MFI_EVT_CLASS_CRITICAL) + dev_info(&instance->pdev->dev, "%d (%s/0x%04x/%s) - %s\n", + le32_to_cpu(evt_detail->seq_num), + format_timestamp(le32_to_cpu(evt_detail->time_stamp)), + (class_locale.members.locale), + format_class(class_locale.members.class), + evt_detail->description); +} + /** * The following functions are defined for xscale * (deviceid : 1064R, PERC5) controllers @@ -6613,6 +6673,7 @@ megasas_aen_polling(struct work_struct *work) instance->ev = NULL; host = instance->host; if (instance->evt_detail) { + megasas_decode_evt(instance); switch (le32_to_cpu(instance->evt_detail->code)) { case MR_EVT_PD_INSERTED: -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi/be2iscsi: Fix logical-not-parentheses compilation warning
Tomer Barletz writes: > This fixes the following warning seen with GCC v5.1: > warning: logical not is only applied to the left hand side of > comparison [-Wlogical-not-parentheses]. > > Signed-off-by: Tomer Barletz > --- > drivers/scsi/be2iscsi/be_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c > index 7a6dbfb..cf1908e 100644 > --- a/drivers/scsi/be2iscsi/be_main.c > +++ b/drivers/scsi/be2iscsi/be_main.c > @@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address, > { > WARN_ON(!virtual_address); > WARN_ON(!physical_address); > - WARN_ON(!length > 0); > + WARN_ON(length == 0); > WARN_ON(!sgl); > > sgl->va = virtual_address; Looks good. Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/31] message/fusion: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- drivers/message/fusion/mptbase.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 5dcc031..1551f51 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -5971,13 +5971,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) if (mpt_config(ioc, &cfg) != 0) goto out; - mem = kmalloc(iocpage2sz, GFP_KERNEL); + mem = kmemdup((u8 *)pIoc2, iocpage2sz, GFP_KERNEL); if (!mem) { rc = -ENOMEM; goto out; } - memcpy(mem, (u8 *)pIoc2, iocpage2sz); ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; mpt_read_ioc_pg_3(ioc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/31] scsi/aacraid: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- drivers/scsi/aacraid/commctrl.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 54195a1..d2ed626 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -635,15 +635,14 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) } } else { struct user_sgmap* usg; - usg = kmalloc(actual_fibsize - sizeof(struct aac_srb) - + sizeof(struct sgmap), GFP_KERNEL); + usg = kmemdup(upsg, + actual_fibsize - sizeof(struct aac_srb) + sizeof(struct sgmap), + GFP_KERNEL); if (!usg) { dprintk((KERN_DEBUG"aacraid: Allocation error in Raw SRB command\n")); rcode = -ENOMEM; goto cleanup; } - memcpy (usg, upsg, actual_fibsize - sizeof(struct aac_srb) - + sizeof(struct sgmap)); actual_fibsize = actual_fibsize64; for (i = 0; i < usg->count; i++) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/31] scsi/aic7xxx: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda --- drivers/scsi/aic7xxx/aic79xx_core.c | 4 ++-- drivers/scsi/aic7xxx/aic7xxx_core.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 109e2c9..8592448 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -9494,10 +9494,10 @@ ahd_loadseq(struct ahd_softc *ahd) if (cs_count != 0) { cs_count *= sizeof(struct cs); - ahd->critical_sections = kmalloc(cs_count, GFP_ATOMIC); + ahd->critical_sections = kmemdup(cs_table, cs_count, +GFP_ATOMIC); if (ahd->critical_sections == NULL) panic("ahd_loadseq: Could not malloc"); - memcpy(ahd->critical_sections, cs_table, cs_count); } ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS|FASTMODE); diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index c4829d8..3178730 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -6940,10 +6940,10 @@ ahc_loadseq(struct ahc_softc *ahc) if (cs_count != 0) { cs_count *= sizeof(struct cs); - ahc->critical_sections = kmalloc(cs_count, GFP_ATOMIC); + ahc->critical_sections = kmemdup(cs_table, cs_count, +GFP_ATOMIC); if (ahc->critical_sections == NULL) panic("ahc_loadseq: Could not malloc"); - memcpy(ahc->critical_sections, cs_table, cs_count); } ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html