Re: [PATCH -next] scsi: megaraid_sas: Use DEFINE_SPINLOCK() for spinlock

2021-04-14 Thread Sumit Saxena
On Mon, Mar 29, 2021 at 2:45 PM Shixin Liu  wrote:
>
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().
Acked-by: Sumit Saxena 
>
> Signed-off-by: Shixin Liu 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 4d4e9dbe5193..8ed347eebf07 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -213,7 +213,7 @@ static bool support_nvme_encapsulation;
>  static bool support_pci_lane_margining;
>
>  /* define lock for aen poll */
> -static spinlock_t poll_aen_lock;
> +static DEFINE_SPINLOCK(poll_aen_lock);
>
>  extern struct dentry *megasas_debugfs_root;
>  extern int megasas_blk_mq_poll(struct Scsi_Host *shost, unsigned int 
> queue_num);
> @@ -8934,8 +8934,6 @@ static int __init megasas_init(void)
>  */
> pr_info("megasas: %s\n", MEGASAS_VERSION);
>
> -   spin_lock_init(_aen_lock);
> -
> support_poll_for_event = 2;
> support_device_change = 1;
> support_nvme_encapsulation = true;
> --
> 2.25.1
>


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PATCH v8 17/18] scsi: megaraid_sas: Added support for shared host tagset for cpuhotplug

2020-11-11 Thread Sumit Saxena
>
> Can this issue disappear by applying the following change?
This change fixes the issue for me.

Qian,
Please try after applying changes suggested by Ming.

Thanks,
Sumit
>
> diff --git a/block/blk-flush.c b/block/blk-flush.c
> index e32958f0b687..b1fe6176d77f 100644
> --- a/block/blk-flush.c
> +++ b/block/blk-flush.c
> @@ -469,9 +469,6 @@ struct blk_flush_queue *blk_alloc_flush_queue(int node, 
> int cmd_size,
> INIT_LIST_HEAD(>flush_queue[1]);
> INIT_LIST_HEAD(>flush_data_in_flight);
>
> -   lockdep_register_key(>key);
> -   lockdep_set_class(>mq_flush_lock, >key);
> -
> return fq;
>
>   fail_rq:
> @@ -486,7 +483,6 @@ void blk_free_flush_queue(struct blk_flush_queue *fq)
> if (!fq)
> return;
>
> -   lockdep_unregister_key(>key);
> kfree(fq->flush_rq);
> kfree(fq);
>  }
>
>
> Thanks,
> Ming
>


Re: [PATCH v8 17/18] scsi: megaraid_sas: Added support for shared host tagset for cpuhotplug

2020-11-10 Thread Sumit Saxena
On Tue, Nov 10, 2020 at 11:12 PM John Garry  wrote:
>
> On 09/11/2020 14:05, John Garry wrote:
> > On 09/11/2020 13:39, Qian Cai wrote:
> >>> I suppose I could try do this myself also, but an authentic version
> >>> would be nicer.
> >> The closest one I have here is:
> >> https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config
> >>
> >> but it only selects the Thunder X2 platform and needs to manually select
> >> CONFIG_MEGARAID_SAS=m to start with, but none of arm64 systems here have
> >> megaraid_sas.
> >
> > Thanks, I'm confident I can fix it up to get it going on my Huawei arm64
> > D06CS.
> >
> > So that board has a megaraid sas card. In addition, it also has hisi_sas
> > HW, which is another storage controller which we enabled this same
> > feature which is causing the problem.
> >
> > I'll report back when I can.
>
> So I had to hack that arm64 config a bit to get it booting:
> https://github.com/hisilicon/kernel-dev/commits/private-topic-sas-5.10-megaraid-hang
>
> Boot is ok on my board without the megaraid sas card, but includes
> hisi_sas HW (which enables the equivalent option which is exposing the
> problem).
>
> But the board with the megaraid sas boots very slowly, specifically
> around the megaraid sas probe:
>
> : ttyS0 at MMIO 0x3f2f8 (irq = 17, base_baud = 115200) is a 16550A
> [   50.023726][T1] printk: console [ttyS0] enabled
> [   50.412597][T1] megasas: 07.714.04.00-rc1
> [   50.436614][T5] megaraid_sas :08:00.0: FW now in Ready state
> [   50.450079][T5] megaraid_sas :08:00.0: 63 bit DMA mask and 63
> bit consistent mask
> [   50.467811][T5] megaraid_sas :08:00.0: firmware supports msix
> : (128)
> [   50.845995][T5] megaraid_sas :08:00.0: requested/available
> msix 128/128
> [   50.861476][T5] megaraid_sas :08:00.0: current msix/online
> cpus  : (128/128)
> [   50.877616][T5] megaraid_sas :08:00.0: RDPQ mode : (enabled)
> [   50.891018][T5] megaraid_sas :08:00.0: Current firmware
> supports maximum commands: 4077   LDIO threshold: 0
> [   51.262942][T5] megaraid_sas :08:00.0: Performance mode
> :Latency (latency index = 1)
> [   51.280749][T5] megaraid_sas :08:00.0: FW supports sync cache
> : Yes
> [   51.295451][T5] megaraid_sas :08:00.0:
> megasas_disable_intr_fusion is called outbound_intr_mask:0x4009
> [   51.387474][T5] megaraid_sas :08:00.0: FW provided
> supportMaxExtLDs: 1   max_lds: 64
> [   51.404931][T5] megaraid_sas :08:00.0: controller type
> : MR(2048MB)
> [   51.419616][T5] megaraid_sas :08:00.0: Online Controller
> Reset(OCR)  : Enabled
> [   51.436132][T5] megaraid_sas :08:00.0: Secure JBOD support
> : Yes
> [   51.450265][T5] megaraid_sas :08:00.0: NVMe passthru support
> : Yes
> [   51.464757][T5] megaraid_sas :08:00.0: FW provided TM
> TaskAbort/Reset timeout: 6 secs/60 secs
> [   51.484379][T5] megaraid_sas :08:00.0: JBOD sequence map
> support : Yes
> [   51.499607][T5] megaraid_sas :08:00.0: PCI Lane Margining
> support: No
> [   51.547610][T5] megaraid_sas :08:00.0: NVME page size
> : (4096)
> [   51.608635][T5] megaraid_sas :08:00.0:
> megasas_enable_intr_fusion is called outbound_intr_mask:0x4000
> [   51.630285][T5] megaraid_sas :08:00.0: INIT adapter done
> [   51.649854][T5] megaraid_sas :08:00.0: pci id
> : (0x1000)/(0x0016)/(0x19e5)/(0xd215)
> [   51.667873][T5] megaraid_sas :08:00.0: unevenspan support: no
> [   51.681646][T5] megaraid_sas :08:00.0: firmware crash dump   : no
> [   51.695596][T5] megaraid_sas :08:00.0: JBOD sequence map
> : enabled
> [   51.711521][T5] megaraid_sas :08:00.0: Max firmware commands:
> 4076 shared with nr_hw_queues = 127
> [   51.733056][T5] scsi host0: Avago SAS based MegaRAID driver
> [   65.304363][T5] scsi 0:0:0:0: Direct-Access ATA  SAMSUNG
> MZ7KH1T9 404Q PQ: 0 ANSI: 6
> [   65.392401][T5] scsi 0:0:1:0: Direct-Access ATA  SAMSUNG
> MZ7KH1T9 404Q PQ: 0 ANSI: 6
> [   79.508307][T5] scsi 0:0:65:0: Enclosure HUAWEI
> Expander 12Gx16  131  PQ: 0 ANSI: 6
> [  183.965109][   C14] random: fast init done
>
> Notice the 14 and 104 second delays.
>
> But does boot fully to get to the console. I'll wait for further issues,
> which you guys seem to experience after a while.
>
> Thanks,
> John
"megaraid_sas" driver calls “scsi_scan_host()” to discover SCSI
devices. In this failure case, scsi_scan_host() is taking a long time
to complete, hence causing delay in system boot.
With "host_tagset" enabled, scsi_scan_host() takes around 20 mins.
With "host_tagset" disabled, scsi_scan_host() takes upto 5-8 mins.

The scan time depends upon the number of scsi channels and devices per
scsi channel is exposed by LLD.
megaraid_sas driver exposes 4 channels and 128 drives per channel.

Each target scan takes 2 

Re: [PATCH v8 17/18] scsi: megaraid_sas: Added support for shared host tagset for cpuhotplug

2020-11-06 Thread Sumit Saxena
On Wed, Nov 4, 2020 at 11:38 PM John Garry  wrote:
>
> On 04/11/2020 16:07, Kashyap Desai wrote:
> >>>
> >>> v5.10-rc2 is also broken here.
> >>
> >> John, Kashyap, any update on this? If this is going to take a while to fix
> >> it
> >> proper, should I send a patch to revert this or at least disable the
> >> feature by
> >> default for megaraid_sas in the meantime, so it no longer breaks the
> >> existing
> >> systems out there?
> >
> > I am trying to get similar h/w to try out. All my current h/w works fine.
> > Give me couple of days' time.
> > If this is not obviously common issue and need time, we will go with module
> > parameter disable method.
> > I will let you know.
>
> Hi Kashyap,
>
> Please also consider just disabling for this card, so any other possible
> issues are unearthed on other cards. I don't have this card or any x86
> machine to test it unfortunately to assist.
>
> BTW, just to be clear, did you try the same .config as Qian Cai?
>
> Thanks,
> John
I am able to hit the boot hang and similar kind of stack traces as
reported by Qian with shared .config on x86 machine.
In my case the system boots after a hang of 40-45 mins. Qian, is it
true for you as well ?
With module parameter -"host_tagset_enable=0", the issue is not seen.
Below is snippet of the dmesg logs/traces which are observed during
system bootup and after wait of 40-45 mins
drives attached to megaraid_sas adapter are discovered:


[ 1969.502913] INFO: task systemd-udevd:906 can't die for more than
1720 seconds.
[ 1969.597725] task:systemd-udevd   state:D stack:13456 pid:  906
ppid:   858 flags:0x0324
[ 1969.597730] Call Trace:
[ 1969.597734]  __schedule+0x263/0x7f0
[ 1969.597737]  ? __lock_acquire+0x576/0xaf0
[ 1969.597739]  ? wait_for_completion+0x7b/0x110
[ 1969.597741]  schedule+0x4c/0xc0
[ 1969.597743]  schedule_timeout+0x244/0x2e0
[ 1969.597745]  ? find_held_lock+0x2d/0x90
[ 1969.597748]  ? wait_for_completion+0xa6/0x110
[ 1969.597750]  ? wait_for_completion+0x7b/0x110
[ 1969.597752]  ? lockdep_hardirqs_on_prepare+0xd4/0x170
[ 1969.597753]  ? wait_for_completion+0x7b/0x110
[ 1969.597755]  wait_for_completion+0xae/0x110
[ 1969.597757]  __flush_work+0x269/0x4b0
[ 1969.597760]  ? init_pwq+0xf0/0xf0
[ 1969.597763]  work_on_cpu+0x9c/0xd0
[ 1969.597765]  ? work_is_static_object+0x10/0x10
[ 1969.597768]  ? pci_device_shutdown+0x30/0x30
[ 1969.597770]  pci_device_probe+0x197/0x1b0
[ 1969.597773]  really_probe+0xda/0x410
[ 1969.597776]  driver_probe_device+0xd9/0x140
[ 1969.597778]  device_driver_attach+0x4a/0x50
[ 1969.597780]  __driver_attach+0x83/0x140
[ 1969.597782]  ? device_driver_attach+0x50/0x50
[ 1969.597784]  ? device_driver_attach+0x50/0x50
[ 1969.597787]  bus_for_each_dev+0x74/0xc0
[ 1969.597789]  bus_add_driver+0x14b/0x1f0
[ 1969.597791]  ? 0xc04fb000
[ 1969.597793]  driver_register+0x66/0xb0
[ 1969.597795]  ? 0xc04fb000
[ 1969.597801]  megasas_init+0xe7/0x1000 [megaraid_sas]
[ 1969.597803]  do_one_initcall+0x62/0x300
[ 1969.597806]  ? do_init_module+0x1d/0x200
[ 1969.597808]  ? kmem_cache_alloc_trace+0x296/0x2d0
[ 1969.597811]  do_init_module+0x55/0x200
[ 1969.597813]  load_module+0x15f2/0x17b0
[ 1969.597816]  ? __do_sys_finit_module+0xad/0x110
[ 1969.597818]  __do_sys_finit_module+0xad/0x110
[ 1969.597820]  do_syscall_64+0x33/0x40
[ 1969.597823]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 1969.597825] RIP: 0033:0x7f66340262bd
[ 1969.597827] Code: Unable to access opcode bytes at RIP 0x7f6634026293.
[ 1969.597828] RSP: 002b:7ffca1011f48 EFLAGS: 0246 ORIG_RAX:
0139
[ 1969.597831] RAX: ffda RBX: 55f6720cf370 RCX: 7f66340262bd
[ 1969.597833] RDX:  RSI: 7f6634b9880d RDI: 0006
[ 1969.597835] RBP: 7f6634b9880d R08:  R09: 7ffca1012070
[ 1969.597836] R10: 0006 R11: 0246 R12: 
[ 1969.597838] R13: 55f6720cce70 R14: 0002 R15: 
[ 1969.597859]
   Showing all locks held in the system:
[ 1969.597862] 2 locks held by kworker/0:0/5:
[ 1969.597863]  #0: 9af800194b38
((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x1e6/0x5e0
[ 1969.597872]  #1: bf3bc01f3e70
((kfence_timer).work){+.+.}-{0:0}, at: process_one_work+0x1e6/0x5e0
[ 1969.597890] 3 locks held by kworker/0:1/7:
[ 1969.597960] 1 lock held by khungtaskd/643:
[ 1969.597962]  #0: a624cb60 (rcu_read_lock){}-{1:2}, at:
rcu_lock_acquire.constprop.54+0x0/0x30
[ 1969.597982] 1 lock held by systemd-udevd/906:
[ 1969.597983]  #0: 9af984a1c218 (>mutex){}-{3:3}, at:
device_driver_attach+0x18/0x50

[ 1969.598010] =

[ 1983.242512] random: fast init done
[ 2071.928411] sd 0:2:0:0: [sda] 1951399936 512-byte logical blocks:
(999 GB/931 GiB)
[ 2071.928480] sd 0:2:2:0: [sdc] 1756889088 512-byte logical blocks:
(900 GB/838 GiB)
[ 2071.928537] sd 0:2:1:0: [sdb] 285474816 

Re: [PATCH] MAINTAINERS: Drop megaraidlinux....@broadcom.com from MEGARAID SCSI/SAS DRIVERS

2020-09-11 Thread Sumit Saxena
On Wed, Sep 9, 2020 at 10:14 PM Bjorn Helgaas  wrote:
>
> From: Bjorn Helgaas 
>
> Every post to megaraidlinux@broadcom.com seems to generate a bounce, so
> I think the list is defunct.  Remove it from MAINTAINERS.
This PDL is active again. Please let me know if you face any issues.
>
> Signed-off-by: Bjorn Helgaas 
> ---
>  MAINTAINERS | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index deaafb617361..a92d1517e865 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11042,7 +11042,6 @@ MEGARAID SCSI/SAS DRIVERS
>  M: Kashyap Desai 
>  M: Sumit Saxena 
>  M: Shivasharan S 
> -L: megaraidlinux@broadcom.com
>  L: linux-s...@vger.kernel.org
>  S: Maintained
>  W: http://www.avagotech.com/support/
> --
> 2.25.1
>


Re: [PATCH -next] scsi: megaraid_sas: Make a bunch of functions static

2019-08-06 Thread Sumit Saxena
On Fri, Jul 26, 2019 at 7:26 PM YueHaibing  wrote:
>
> Fix sparse warnings:
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3369:1: warning: symbol 
> 'complete_cmd_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3535:6: warning: symbol 
> 'megasas_sync_irqs' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3554:1: warning: symbol 
> 'megasas_complete_cmd_dpc_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3573:13: warning: symbol 
> 'megasas_isr_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3604:1: warning: symbol 
> 'build_mpt_mfi_pass_thru' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3661:40: warning: symbol 
> 'build_mpt_cmd' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3688:1: warning: symbol 
> 'megasas_issue_dcmd_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3881:5: warning: symbol 
> 'megasas_wait_for_outstanding_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:4005:6: warning: symbol 
> 'megasas_refire_mgmt_cmd' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:4525:25: warning: symbol 
> 'megasas_get_peer_instance' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:4825:7: warning: symbol 
> 'megasas_fusion_crash_dump' was not declared. Should it be static?
>
> Reported-by: Hulk Robot 
> Signed-off-by: YueHaibing 
Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 26 ++
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 120e3c4..10ef99e 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -3511,7 +3511,7 @@ megasas_complete_r1_command(struct megasas_instance 
> *instance,
>   * @instance:  Adapter soft state
>   * Completes all commands that is in reply descriptor queue
>   */
> -int
> +static int
>  complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
> struct megasas_irq_context *irq_context)
>  {
> @@ -3702,7 +3702,7 @@ static void megasas_enable_irq_poll(struct 
> megasas_instance *instance)
>   * megasas_sync_irqs - Synchronizes all IRQs owned by adapter
>   * @instance:  Adapter soft state
>   */
> -void megasas_sync_irqs(unsigned long instance_addr)
> +static void megasas_sync_irqs(unsigned long instance_addr)
>  {
> u32 count, i;
> struct megasas_instance *instance =
> @@ -3760,7 +3760,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int 
> budget)
>   *
>   * Tasklet to complete cmds
>   */
> -void
> +static void
>  megasas_complete_cmd_dpc_fusion(unsigned long instance_addr)
>  {
> struct megasas_instance *instance =
> @@ -3780,7 +3780,7 @@ megasas_complete_cmd_dpc_fusion(unsigned long 
> instance_addr)
>  /**
>   * megasas_isr_fusion - isr entry point
>   */
> -irqreturn_t megasas_isr_fusion(int irq, void *devp)
> +static irqreturn_t megasas_isr_fusion(int irq, void *devp)
>  {
> struct megasas_irq_context *irq_context = devp;
> struct megasas_instance *instance = irq_context->instance;
> @@ -3816,7 +3816,7 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
>   * mfi_cmd:megasas_cmd pointer
>   *
>   */
> -void
> +static void
>  build_mpt_mfi_pass_thru(struct megasas_instance *instance,
> struct megasas_cmd *mfi_cmd)
>  {
> @@ -3874,7 +3874,7 @@ build_mpt_mfi_pass_thru(struct megasas_instance 
> *instance,
>   * @cmd:   mfi cmd to build
>   *
>   */
> -union MEGASAS_REQUEST_DESCRIPTOR_UNION *
> +static union MEGASAS_REQUEST_DESCRIPTOR_UNION *
>  build_mpt_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
>  {
> union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc = NULL;
> @@ -3900,7 +3900,7 @@ build_mpt_cmd(struct megasas_instance *instance, struct 
> megasas_cmd *cmd)
>   * @cmd:   mfi cmd pointer
>   *
>   */
> -void
> +static void
>  megasas_issue_dcmd_fusion(struct megasas_instance *instance,
>   struct megasas_cmd *cmd)
>  {
> @@ -4096,8 +4096,9 @@ static inline void megasas_trigger_snap_dump(struct 
> megasas_instance *instance)
>  }
>
>  /* This function waits for outsta

Re: [PATCH] scsi/megaraid_sas: fix a compilation warning

2019-08-06 Thread Sumit Saxena
On Fri, Jul 26, 2019 at 7:55 PM Qian Cai  wrote:
>
> The commit de516379e85f ("scsi: megaraid_sas: changes to function
> prototypes") introduced a comilation warning due to it changed the
> function prototype of read_fw_status_reg() to take an instance pointer
> instead, but forgot to remove an unused variable.
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
> 'megasas_fusion_update_can_queue':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:326:39: warning: variable
> 'reg_set' set but not used [-Wunused-but-set-variable]
>   struct megasas_register_set __iomem *reg_set;
>^~~
> Fixes: de516379e85f ("scsi: megaraid_sas: changes to function prototypes")
> Signed-off-by: Qian Cai 
Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index a32b3f0fcd15..e8092d59d575 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -323,9 +323,6 @@ inline void megasas_return_cmd_fusion(struct 
> megasas_instance *instance,
>  {
> u16 cur_max_fw_cmds = 0;
> u16 ldio_threshold = 0;
> -   struct megasas_register_set __iomem *reg_set;
> -
> -   reg_set = instance->reg_set;
>
> /* ventura FW does not fill outbound_scratch_pad_2 with queue depth */
> if (instance->adapter_type < VENTURA_SERIES)
> --
> 1.8.3.1
>


Re: [PATCH -next] scsi: megaraid_sas: Make some functions static

2019-07-23 Thread Sumit Saxena
On Tue, Jul 23, 2019 at 8:05 PM YueHaibing  wrote:
>
> Fix sparse warnings:
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c:541:1: warning: symbol 
> 'megasas_alloc_cmdlist_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:580:1: warning: symbol 
> 'megasas_alloc_request_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:661:1: warning: symbol 
> 'megasas_alloc_reply_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:738:1: warning: symbol 
> 'megasas_alloc_rdpq_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:920:1: warning: symbol 
> 'megasas_alloc_cmds_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:1740:1: warning: symbol 
> 'megasas_init_adapter_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:1966:1: warning: symbol 
> 'map_cmd_status' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:2379:1: warning: symbol 
> 'megasas_set_pd_lba' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:2718:1: warning: symbol 
> 'megasas_build_ldio_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3215:1: warning: symbol 
> 'megasas_build_io_fusion' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3328:6: warning: symbol 
> 'megasas_prepare_secondRaid1_IO' was not declared. Should it be static?
>
> Reported-by: Hulk Robot 
> Signed-off-by: YueHaibing 
Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 27 ++-
>  1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index a32b3f0..120e3c4 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -537,7 +537,7 @@ static int megasas_create_sg_sense_fusion(struct 
> megasas_instance *instance)
> return 0;
>  }
>
> -int
> +static int
>  megasas_alloc_cmdlist_fusion(struct megasas_instance *instance)
>  {
> u32 max_mpt_cmd, i, j;
> @@ -576,7 +576,8 @@ megasas_alloc_cmdlist_fusion(struct megasas_instance 
> *instance)
>
> return 0;
>  }
> -int
> +
> +static int
>  megasas_alloc_request_fusion(struct megasas_instance *instance)
>  {
> struct fusion_context *fusion;
> @@ -657,7 +658,7 @@ megasas_alloc_request_fusion(struct megasas_instance 
> *instance)
> return 0;
>  }
>
> -int
> +static int
>  megasas_alloc_reply_fusion(struct megasas_instance *instance)
>  {
> int i, count;
> @@ -734,7 +735,7 @@ megasas_alloc_reply_fusion(struct megasas_instance 
> *instance)
> return 0;
>  }
>
> -int
> +static int
>  megasas_alloc_rdpq_fusion(struct megasas_instance *instance)
>  {
> int i, j, k, msix_count;
> @@ -916,7 +917,7 @@ megasas_free_reply_fusion(struct megasas_instance 
> *instance) {
>   * and is used as SMID of the cmd.
>   * SMID value range is from 1 to max_fw_cmds.
>   */
> -int
> +static int
>  megasas_alloc_cmds_fusion(struct megasas_instance *instance)
>  {
> int i;
> @@ -1736,7 +1737,7 @@ static inline void megasas_free_ioc_init_cmd(struct 
> megasas_instance *instance)
>   *
>   * This is the main function for initializing firmware.
>   */
> -u32
> +static u32
>  megasas_init_adapter_fusion(struct megasas_instance *instance)
>  {
> struct fusion_context *fusion;
> @@ -1962,7 +1963,7 @@ megasas_fusion_stop_watchdog(struct megasas_instance 
> *instance)
>   * @ext_status :   ext status of cmd returned by FW
>   */
>
> -void
> +static void
>  map_cmd_status(struct fusion_context *fusion,
> struct scsi_cmnd *scmd, u8 status, u8 ext_status,
> u32 data_length, u8 *sense)
> @@ -2375,7 +2376,7 @@ int megasas_make_sgl(struct megasas_instance *instance, 
> struct scsi_cmnd *scp,
>   *
>   * Used to set the PD LBA in CDB for FP IOs
>   */
> -void
> +static void
>  megasas_set_pd_lba(struct MPI2_RAID_SCSI_IO_REQUEST *io_request, u8 cdb_len,
>struct IO_REQUEST_INFO *io_info, struct scsi_cmnd *scp,
>struct MR_DRV_RAID_MAP_ALL *local_map_ptr, u32 ref_tag)
> @@ -2714,7 +2715,7 @@ megasas_set_raidflag_cpu_affinity(struct fusion_context 
> *fusion,
>   * Prepares the io_request and chain elements (sg_frame) for IO
>   * The IO can be for PD (Fast Path) or LD
> 

Re: [PATCH][next] scsi: megaraid_sas: fix spelling mistake "megarid_sas" -> "megaraid_sas"

2019-07-23 Thread Sumit Saxena
On Sun, Jul 21, 2019 at 3:28 AM Colin King  wrote:
>
> From: Colin Ian King 
>
> Fix spelling mistake in kernel warning message and replace
> printk with with pr_warn.
>
> Signed-off-by: Colin Ian King 
Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index b2339d04a700..2590746c81e3 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -8763,7 +8763,7 @@ static int __init megasas_init(void)
>
> if ((event_log_level < MFI_EVT_CLASS_DEBUG) ||
> (event_log_level > MFI_EVT_CLASS_DEAD)) {
> -   printk(KERN_WARNING "megarid_sas: provided event log level is 
> out of range, setting it to default 2(CLASS_CRITICAL), permissible range is: 
> -2 to 4\n");
> +   pr_warn("megaraid_sas: provided event log level is out of 
> range, setting it to default 2(CLASS_CRITICAL), permissible range is: -2 to 
> 4\n");
> event_log_level = MFI_EVT_CLASS_CRITICAL;
> }
>
> --
> 2.20.1
>


Re: [PATCH RESEND] scsi: megaraid_sas: fix panic on loading firmware crashdump

2019-07-23 Thread Sumit Saxena
On Mon, Jul 22, 2019 at 9:45 PM Junxiao Bi  wrote:
>
> While loading fw crashdump in function fw_crash_buffer_show(),
> left bytes in one dma chunk was not checked, if copying size
> over it, overflow access will cause kernel panic.
>
> Signed-off-by: Junxiao Bi 
Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 80ab9700f1de..3eef0858fa8e 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3153,6 +3153,7 @@ fw_crash_buffer_show(struct device *cdev,
> (struct megasas_instance *) shost->hostdata;
> u32 size;
> unsigned long dmachunk = CRASH_DMA_BUF_SIZE;
> +   unsigned long chunk_left_bytes;
> unsigned long src_addr;
> unsigned long flags;
> u32 buff_offset;
> @@ -3176,6 +3177,8 @@ fw_crash_buffer_show(struct device *cdev,
> }
>
> size = (instance->fw_crash_buffer_size * dmachunk) - buff_offset;
> +   chunk_left_bytes = dmachunk - (buff_offset % dmachunk);
> +   size = (size > chunk_left_bytes) ? chunk_left_bytes : size;
> size = (size >= PAGE_SIZE) ? (PAGE_SIZE - 1) : size;
>
> src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk] 
> +
> --
> 2.17.1
>


Re: [PATCH -next] scsi: megaraid_sas: Make some symbols static

2019-07-04 Thread Sumit Saxena
On Tue, Jul 2, 2019 at 6:34 PM YueHaibing  wrote:
>
> Fix sparse warnings:
>
> drivers/scsi/megaraid/megaraid_sas_base.c:271:1: warning: symbol 
> 'megasas_issue_dcmd' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_base.c:2227:6: warning: symbol 
> 'megasas_do_ocr' was not declared. Should it be static?
> drivers/scsi/megaraid/megaraid_sas_base.c:3194:25: warning: symbol 
> 'megaraid_host_attrs' was not declared. Should it be static?
>
> Reported-by: Hulk Robot 
> Signed-off-by: YueHaibing 

Acked-by: Sumit Saxena 

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 80ab970..49e0f3d 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -280,7 +280,7 @@ void megasas_set_dma_settings(struct megasas_instance 
> *instance,
> }
>  }
>
> -void
> +static void
>  megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd 
> *cmd)
>  {
> instance->instancet->fire_cmd(instance,
> @@ -2237,7 +2237,7 @@ megasas_internal_reset_defer_cmds(struct 
> megasas_instance *instance);
>  static void
>  process_fw_state_change_wq(struct work_struct *work);
>
> -void megasas_do_ocr(struct megasas_instance *instance)
> +static void megasas_do_ocr(struct megasas_instance *instance)
>  {
> if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) ||
> (instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) ||
> @@ -3303,7 +3303,7 @@ static DEVICE_ATTR_RO(fw_cmds_outstanding);
>  static DEVICE_ATTR_RO(dump_system_regs);
>  static DEVICE_ATTR_RO(raid_map_id);
>
> -struct device_attribute *megaraid_host_attrs[] = {
> +static struct device_attribute *megaraid_host_attrs[] = {
> _attr_fw_crash_buffer_size,
> _attr_fw_crash_buffer,
> _attr_fw_crash_state,
> --
> 2.7.4
>
>


Re: [PATCH] scsi: megaraid_sas: Use struct_size() helper

2019-06-13 Thread Sumit Saxena
On Sat, Jun 8, 2019 at 12:10 AM Gustavo A. R. Silva
 wrote:
>
> One of the more common cases of allocation size calculations is finding
> the size of a structure that has a zero-sized array at the end, along
> with memory for some number of elements for that array. For example:
>
> struct MR_PD_CFG_SEQ_NUM_SYNC {
> ...
> struct MR_PD_CFG_SEQ seq[1];
> } __packed;
>
> Make use of the struct_size() helper instead of an open-coded version
> in order to avoid any potential type mistakes.
>
> So, replace the following form:
>
> sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + (sizeof(struct MR_PD_CFG_SEQ) * 
> (MAX_PHYSICAL_DEVICES - 1))
>
> with:
>
> struct_size(pd_sync, seq, MAX_PHYSICAL_DEVICES - 1)
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva 
Acked-by: Sumit Saxena 

> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index a25b6b4b6548..56bd524dddbf 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -1191,7 +1191,7 @@ megasas_ioc_init_fusion(struct megasas_instance 
> *instance)
>  int
>  megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend) {
> int ret = 0;
> -   u32 pd_seq_map_sz;
> +   size_t pd_seq_map_sz;
> struct megasas_cmd *cmd;
> struct megasas_dcmd_frame *dcmd;
> struct fusion_context *fusion = instance->ctrl_context;
> @@ -1200,9 +1200,7 @@ megasas_sync_pd_seq_num(struct megasas_instance 
> *instance, bool pend) {
>
> pd_sync = (void *)fusion->pd_seq_sync[(instance->pd_seq_map_id & 1)];
> pd_seq_h = fusion->pd_seq_phys[(instance->pd_seq_map_id & 1)];
> -   pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
> -   (sizeof(struct MR_PD_CFG_SEQ) *
> -   (MAX_PHYSICAL_DEVICES - 1));
> +   pd_seq_map_sz = struct_size(pd_sync, seq, MAX_PHYSICAL_DEVICES - 1);
>
> cmd = megasas_get_cmd(instance);
> if (!cmd) {
> --
> 2.21.0
>


Re: [PATCH -next] scsi: megaraid_sas: remove set but not used variables 'buff_addr' and 'ci_h'

2019-06-07 Thread Sumit Saxena
On Sat, May 25, 2019 at 6:10 PM YueHaibing  wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warnings:
>
> drivers/scsi/megaraid/megaraid_sas_base.c: In function 
> megasas_fw_crash_buffer_show:
> drivers/scsi/megaraid/megaraid_sas_base.c:3138:16: warning: variable 
> buff_addr set but not used [-Wunused-but-set-variable]
> drivers/scsi/megaraid/megaraid_sas_base.c: In function megasas_get_pd_list:
> drivers/scsi/megaraid/megaraid_sas_base.c:4426:13: warning: variable ci_h set 
> but not used [-Wunused-but-set-variable]
>
> 'buff_addr' is never used since inroduction in
> commit fc62b3fc9021 ("megaraid_sas : Firmware crash dump feature support")
>
> 'ci_h' is not used since commit 9b3d028f3468 ("scsi: megaraid_sas:
> Pre-allocate frequently used DMA buffers")
>
> Signed-off-by: YueHaibing 
Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 5 -
>  1 file changed, 5 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 39d173ed5b69..92e576228d5f 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3135,7 +3135,6 @@ megasas_fw_crash_buffer_show(struct device *cdev,
> struct megasas_instance *instance =
> (struct megasas_instance *) shost->hostdata;
> u32 size;
> -   unsigned long buff_addr;
> unsigned long dmachunk = CRASH_DMA_BUF_SIZE;
> unsigned long src_addr;
> unsigned long flags;
> @@ -3152,8 +3151,6 @@ megasas_fw_crash_buffer_show(struct device *cdev,
> return -EINVAL;
> }
>
> -   buff_addr = (unsigned long) buf;
> -
> if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) {
> dev_err(>pdev->dev,
> "Firmware crash dump offset is out of range\n");
> @@ -4401,7 +4398,6 @@ megasas_get_pd_list(struct megasas_instance *instance)
> struct megasas_dcmd_frame *dcmd;
> struct MR_PD_LIST *ci;
> struct MR_PD_ADDRESS *pd_addr;
> -   dma_addr_t ci_h = 0;
>
> if (instance->pd_list_not_supported) {
> dev_info(>pdev->dev, "MR_DCMD_PD_LIST_QUERY "
> @@ -4410,7 +4406,6 @@ megasas_get_pd_list(struct megasas_instance *instance)
> }
>
> ci = instance->pd_list_buf;
> -   ci_h = instance->pd_list_buf_h;
>
> cmd = megasas_get_cmd(instance);
>
> --
> 2.17.1
>
>


Re: [PATCH -next] scsi: megaraid_sas: remove set but not used variable 'sge_sz'

2019-06-07 Thread Sumit Saxena
On Sat, May 25, 2019 at 6:07 PM YueHaibing  wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/scsi/megaraid/megaraid_sas_base.c: In function 
> megasas_create_frame_pool:
> drivers/scsi/megaraid/megaraid_sas_base.c:4124:6: warning: variable sge_sz 
> set but not used [-Wunused-but-set-variable]
>
> It's not used any more since
> commit 200aed582d61 ("megaraid_sas: endianness related bug fixes and code 
> optimization")
>
> Signed-off-by: YueHaibing 
Acked-by: Sumit Saxena 

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 11 ---
>  1 file changed, 11 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index b26991dcf137..25281a2eb424 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -4121,22 +4121,11 @@ static int megasas_create_frame_pool(struct 
> megasas_instance *instance)
>  {
> int i;
> u16 max_cmd;
> -   u32 sge_sz;
> u32 frame_count;
> struct megasas_cmd *cmd;
>
> max_cmd = instance->max_mfi_cmds;
>
> -   /*
> -* Size of our frame is 64 bytes for MFI frame, followed by max SG
> -* elements and finally SCSI_SENSE_BUFFERSIZE bytes for sense buffer
> -*/
> -   sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
> -   sizeof(struct megasas_sge32);
> -
> -   if (instance->flag_ieee)
> -   sge_sz = sizeof(struct megasas_sge_skinny);
> -
> /*
>  * For MFI controllers.
>  * max_num_sge = 60
> --
> 2.17.1
>
>


Re: [PATCH -next] scsi: megaraid_sas: remove set but not used variables 'host' and 'wait_time'

2019-05-27 Thread Sumit Saxena
On Sat, May 25, 2019 at 6:14 PM YueHaibing  wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warnings:
>
> drivers/scsi/megaraid/megaraid_sas_base.c: In function megasas_suspend:
> drivers/scsi/megaraid/megaraid_sas_base.c:7269:20: warning: variable host set 
> but not used [-Wunused-but-set-variable]
> drivers/scsi/megaraid/megaraid_sas_base.c: In function megasas_aen_polling:
> drivers/scsi/megaraid/megaraid_sas_base.c:8397:15: warning: variable 
> wait_time set but not used [-Wunused-but-set-variable]
>
> 'host' is never used since introduction in
> commit 31ea7088974c ("[SCSI] megaraid_sas: add hibernation support")
>
> 'wait_time' is not used since commit
> 11c71cb4ab7c ("megaraid_sas: Do not allow PCI access during OCR")
>
> Signed-off-by: YueHaibing 
Acked-by: Sumit Saxena 

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 92e576228d5f..ed0f6ca578e5 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -7239,11 +7239,9 @@ static void megasas_shutdown_controller(struct 
> megasas_instance *instance,
>  static int
>  megasas_suspend(struct pci_dev *pdev, pm_message_t state)
>  {
> -   struct Scsi_Host *host;
> struct megasas_instance *instance;
>
> instance = pci_get_drvdata(pdev);
> -   host = instance->host;
> instance->unload = 1;
>
> dev_info(>dev, "%s is called\n", __func__);
> @@ -8367,7 +8365,7 @@ megasas_aen_polling(struct work_struct *work)
> struct megasas_instance *instance = ev->instance;
> union megasas_evt_class_locale class_locale;
> int event_type = 0;
> -   u32 seq_num, wait_time = MEGASAS_RESET_WAIT_TIME;
> +   u32 seq_num;
> int error;
> u8  dcmd_ret = DCMD_SUCCESS;
>
> @@ -8377,10 +8375,6 @@ megasas_aen_polling(struct work_struct *work)
> return;
> }
>
> -   /* Adjust event workqueue thread wait time for VF mode */
> -   if (instance->requestorId)
> -   wait_time = MEGASAS_ROUTINE_WAIT_TIME_VF;
> -
> /* Don't run the event workqueue thread if OCR is running */
> mutex_lock(>reset_mutex);
>
> --
> 2.17.1
>
>


Re: [PATCH -next] scsi: megaraid_sas: remove set but not used variable 'cur_state'

2019-05-27 Thread Sumit Saxena
On Sat, May 25, 2019 at 6:08 PM YueHaibing  wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/scsi/megaraid/megaraid_sas_base.c: In function 
> megasas_transition_to_ready:
> drivers/scsi/megaraid/megaraid_sas_base.c:3900:6: warning: variable cur_state 
> set but not used [-Wunused-but-set-variable]
>
> It's not used any more since commit 7218df69e360 ("[SCSI]
> megaraid_sas: use the firmware boot timeout when waiting for commands")
>
> Signed-off-by: YueHaibing 
Acked-by: Sumit Saxena 

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 11 ---
>  1 file changed, 11 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 25281a2eb424..39d173ed5b69 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3897,7 +3897,6 @@ megasas_transition_to_ready(struct megasas_instance 
> *instance, int ocr)
> int i;
> u8 max_wait;
> u32 fw_state;
> -   u32 cur_state;
> u32 abs_state, curr_abs_state;
>
> abs_state = instance->instancet->read_fw_status_reg(instance);
> @@ -3918,7 +3917,6 @@ megasas_transition_to_ready(struct megasas_instance 
> *instance, int ocr)
>abs_state & MFI_STATE_FAULT_SUBCODE, 
> __func__);
> if (ocr) {
> max_wait = MEGASAS_RESET_WAIT_TIME;
> -   cur_state = MFI_STATE_FAULT;
> break;
> } else {
> dev_printk(KERN_DEBUG, >pdev->dev, 
> "System Register set:\n");
> @@ -3944,7 +3942,6 @@ megasas_transition_to_ready(struct megasas_instance 
> *instance, int ocr)
> >reg_set->inbound_doorbell);
>
> max_wait = MEGASAS_RESET_WAIT_TIME;
> -   cur_state = MFI_STATE_WAIT_HANDSHAKE;
> break;
>
> case MFI_STATE_BOOT_MESSAGE_PENDING:
> @@ -3960,7 +3957,6 @@ megasas_transition_to_ready(struct megasas_instance 
> *instance, int ocr)
> >reg_set->inbound_doorbell);
>
> max_wait = MEGASAS_RESET_WAIT_TIME;
> -   cur_state = MFI_STATE_BOOT_MESSAGE_PENDING;
> break;
>
> case MFI_STATE_OPERATIONAL:
> @@ -3993,7 +3989,6 @@ megasas_transition_to_ready(struct megasas_instance 
> *instance, int ocr)
> >reg_set->inbound_doorbell);
>
> max_wait = MEGASAS_RESET_WAIT_TIME;
> -   cur_state = MFI_STATE_OPERATIONAL;
> break;
>
> case MFI_STATE_UNDEFINED:
> @@ -4001,32 +3996,26 @@ megasas_transition_to_ready(struct megasas_instance 
> *instance, int ocr)
>  * 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;
>
> default:
> --
> 2.17.1
>
>


Re: [PATCH -next] scsi: megaraid_sas: Remove a bunch of set but not used variables

2019-02-22 Thread Sumit Saxena
On Fri, Feb 22, 2019 at 7:30 AM Yue Haibing  wrote:
>
> From: YueHaibing 
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 'wait_and_poll':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:936:25: warning:
>  variable 'fusion' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_sync_map_info':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:1329:6: warning:
>  variable 'size_sync_info' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_init_adapter_fusion':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:1639:39: warning:
>  variable 'reg_set' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_is_prp_possible':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:1925:25: warning:
>  variable 'fusion' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_make_prp_nvme':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:2047:25: warning:
>  variable 'fusion' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_build_ldio_fusion':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:2620:42: warning:
>  variable 'req_desc' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_build_and_issue_cmd_fusion':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:3245:25: warning:
>  variable 'fusion' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_task_abort_fusion':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:4398:25: warning:
>  variable 'fusion' set but not used [-Wunused-but-set-variable]
>
> drivers/scsi/megaraid/megaraid_sas_fusion.c: In function 
> 'megasas_reset_target_fusion':
> drivers/scsi/megaraid/megaraid_sas_fusion.c:4484:25: warning:
>  variable 'fusion' set but not used [-Wunused-but-set-variable]
>
> They're not used anymore and can be removed.
>
> Signed-off-by: YueHaibing 

Acked-by: Sumit Saxena 

> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 26 --
>  1 file changed, 26 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index fd44e00..1d17128 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -937,11 +937,9 @@ wait_and_poll(struct megasas_instance *instance, struct 
> megasas_cmd *cmd,
>  {
> int i;
> struct megasas_header *frame_hdr = >frame->hdr;
> -   struct fusion_context *fusion;
>
> u32 msecs = seconds * 1000;
>
> -   fusion = instance->ctrl_context;
> /*
>  * Wait for cmd_status to change
>  */
> @@ -1331,7 +1329,6 @@ megasas_sync_map_info(struct megasas_instance *instance)
> struct megasas_cmd *cmd;
> struct megasas_dcmd_frame *dcmd;
> u16 num_lds;
> -   u32 size_sync_info;
> struct fusion_context *fusion;
> struct MR_LD_TARGET_SYNC *ci = NULL;
> struct MR_DRV_RAID_MAP_ALL *map;
> @@ -1360,8 +1357,6 @@ megasas_sync_map_info(struct megasas_instance *instance)
>
> dcmd = >frame->dcmd;
>
> -   size_sync_info = sizeof(struct MR_LD_TARGET_SYNC) *num_lds;
> -
> memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
>
> ci = (struct MR_LD_TARGET_SYNC *)
> @@ -1640,15 +1635,12 @@ static inline void megasas_free_ioc_init_cmd(struct 
> megasas_instance *instance)
>  u32
>  megasas_init_adapter_fusion(struct megasas_instance *instance)
>  {
> -   struct megasas_register_set __iomem *reg_set;
> struct fusion_context *fusion;
> u32 scratch_pad_1;
> int i = 0, count;
>
> fusion = instance->ctrl_context;
>
> -   reg_set = instance->reg_set;
> -
> megasas_fusion_update_can_queue(instance, PROBE_CONTEXT);
>
> /*
> @@ -1927,7 +1919,6 @@ static bool
>  megasas_is_prp_possible(struct megasas_instance *instance,
> struct scsi_cmnd *scmd, int sge_count)
>  {
> -   struct fusion_context *fusion;
> int i;
> u32 data_length = 0;
> struct scatterlist *sg_scmd;
> @@ -1936,7 +1927,6 @@ megasas_is_prp_possible(struct megasas_instance 
> *instance,
>
> mr_nvme_pg_size = max_t(u32, instance->nvme_page_size,
>

Re: [PATCH 0/3] irq/core: Fix and expand the irq affinity descriptor

2018-12-28 Thread Sumit Saxena
On Wed, Dec 19, 2018 at 6:25 PM Sumit Saxena  wrote:
>
> On Wed, Dec 19, 2018 at 4:23 PM Thomas Gleixner  wrote:
> >
> > On Tue, 4 Dec 2018, Dou Liyang wrote:
> >
> > > Now,  Spreading the interrupt affinity info by a cpumask pointer is not
> > > enough, meets a problem[1] and hard to expand in the future.
> > >
> > > Fix it by:
> > >
> > >  +---+
> > >  |   |
> > >  | struct cpumask *affinity  |
> > >  |   |
> > >  +---+
> > >|
> > > +--v---+
> > > |  |
> > > | struct irq_affinity_desc {   |
> > > | struct cpumask   mask;   |
> > > | unsigned int is_managed : 1; |
> > > | };   |
> > > |  |
> > > +--+
> > >
> >
> > So, I've applied that lot for 4.21 (or whatever number it will be). That's
> > only the first step for solving Kashyap's problem.
> >
> > IIRC, then Kashap wanted to get initial interrupt spreading for these extra
> > magic interrupts as well, but not have them marked managed.
> >
> > That's trivial to do now with the two queued changes in that area:
> >
> >   - The rework above
> >
> >   - The support for interrupt sets from Jens
> >
> > Just adding a small bitfield to struct irq_affinity which allows to tell
> > the core that a particular interrupt set is not managed does the trick.
> >
> > Untested patch below.
> >
> > Kashyap, is that what you were looking for and if so, does it work?
> Thomas,
> We could not test these patches as they did net get applied to latest
> linux-block tree cleanly.
>
> Our requirement is: 1. extra interrupts should be un-managed and 2.
> should be spread to CPUs of local NUMA node.
> If interrupts are un-managed but not spread as per our requirement,
> then still driver/userspace apps can manage by spreading
> them as required by calling API- irq_set_affinity_hint().
>
> Thanks,
> Sumit
I tested this patchset with some minor rework to apply it on latest
linux block tree(4.20-rc7).
It worked as our expectation. For "pre_vectors" IRQs(extra set of
interrupts), "is_managed" flag is set to 0
and later driver can affine these "pre_vectors" to CPUs of local NUMA
node through API- irq_set_affinity_hint().
Regular set of interrupts(not pre_vectors/post_vectors) are managed,
"is_managed" set to 1.

Below are some data from my test setup-

# numactl --hardware

available: 2 nodes (0-1)

node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 36 37 38 39
40 41 42 43 44 45 46 47 48 49 50 51 52 53

node 0 size: 31822 MB

node 0 free: 30241 MB

node 1 cpus: 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 54
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

node 1 size: 32248 MB

node 1 free: 31960 MB

node distances:

node   0   1

  0:  10  21

  1:  21  10

MegaRAID Controller(PCI device 86:00.0) is attached to node 1.
# find /sys -name *numa_node* | grep "86:00" | xargs cat
1

IRQ-CPU affinity of extra 16 interrupts for PCI  device 86:00.0:
irq 149, cpu list 18-35,54-71
irq 150, cpu list 18-35,54-71
irq 151, cpu list 18-35,54-71
irq 152, cpu list 18-35,54-71
irq 153, cpu list 18-35,54-71
irq 154, cpu list 18-35,54-71
irq 155, cpu list 18-35,54-71
irq 156, cpu list 18-35,54-71
irq 157, cpu list 18-35,54-71
irq 158, cpu list 18-35,54-71
irq 159, cpu list 18-35,54-71
irq 160, cpu list 18-35,54-71
irq 161, cpu list 18-35,54-71
irq 162, cpu list 18-35,54-71
irq 163, cpu list 18-35,54-71
irq 164, cpu list 18-35,54-71
---
# cat /sys/kernel/debug/irq/irqs/164 | grep is_managed
   is_managed:   0

Tested-by: Sumit Saxena 

> >
> > Thanks,
> >
> > tglx
> >
> > 8<-
> >
> > Subject: genirq/affinity: Add support for non-managed affinity sets
> > From: Thomas Gleixner 
> > Date: Tue, 18 Dec 2018 16:46:47 +0100
> >
> > Some drivers need an extra set of interrupts which are not marked managed,
> > but should get initial interrupt spreading.
> >
> > Add a bitmap to struct irq_affinity which allows the driver to mark a
> > particular set of interrupts as non managed. Check the bitmap during
> > spreading and use the result to mark the interrupts in the sets
> > accordingly.
> >
> > The unmanaged interrupts get initial spreading, b

Re: [RESEND PATCH v2] megaraid: fix out-of-bound array accesses

2018-12-19 Thread Sumit Saxena
On Thu, Dec 13, 2018 at 6:57 PM Qian Cai  wrote:
>
> UBSAN reported those with MegaRAID SAS-3 3108,
>
> [   77.467308] UBSAN: Undefined behaviour in 
> drivers/scsi/megaraid/megaraid_sas_fp.c:117:32
> [   77.475402] index 255 is out of range for type 'MR_LD_SPAN_MAP [1]'
> [   77.481677] CPU: 16 PID: 333 Comm: kworker/16:1 Not tainted 4.20.0-rc5+ #1
> [   77.488556] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.50 
> 06/01/2018
> [   77.495791] Workqueue: events work_for_cpu_fn
> [   77.500154] Call trace:
> [   77.502610]  dump_backtrace+0x0/0x2c8
> [   77.506279]  show_stack+0x24/0x30
> [   77.509604]  dump_stack+0x118/0x19c
> [   77.513098]  ubsan_epilogue+0x14/0x60
> [   77.516765]  __ubsan_handle_out_of_bounds+0xfc/0x13c
> [   77.521767]  mr_update_load_balance_params+0x150/0x158 [megaraid_sas]
> [   77.528230]  MR_ValidateMapInfo+0x2cc/0x10d0 [megaraid_sas]
> [   77.533825]  megasas_get_map_info+0x244/0x2f0 [megaraid_sas]
> [   77.539505]  megasas_init_adapter_fusion+0x9b0/0xf48 [megaraid_sas]
> [   77.545794]  megasas_init_fw+0x1ab4/0x3518 [megaraid_sas]
> [   77.551212]  megasas_probe_one+0x2c4/0xbe0 [megaraid_sas]
> [   77.556614]  local_pci_probe+0x7c/0xf0
> [   77.560365]  work_for_cpu_fn+0x34/0x50
> [   77.564118]  process_one_work+0x61c/0xf08
> [   77.568129]  worker_thread+0x534/0xa70
> [   77.571882]  kthread+0x1c8/0x1d0
> [   77.575114]  ret_from_fork+0x10/0x1c
>
> [   89.240332] UBSAN: Undefined behaviour in 
> drivers/scsi/megaraid/megaraid_sas_fp.c:117:32
> [   89.248426] index 255 is out of range for type 'MR_LD_SPAN_MAP [1]'
> [   89.254700] CPU: 16 PID: 95 Comm: kworker/u130:0 Not tainted 4.20.0-rc5+ #1
> [   89.261665] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.50 
> 06/01/2018
> [   89.268903] Workqueue: events_unbound async_run_entry_fn
> [   89.274222] Call trace:
> [   89.276680]  dump_backtrace+0x0/0x2c8
> [   89.280348]  show_stack+0x24/0x30
> [   89.283671]  dump_stack+0x118/0x19c
> [   89.287167]  ubsan_epilogue+0x14/0x60
> [   89.290835]  __ubsan_handle_out_of_bounds+0xfc/0x13c
> [   89.295828]  MR_LdRaidGet+0x50/0x58 [megaraid_sas]
> [   89.300638]  megasas_build_io_fusion+0xbb8/0xd90 [megaraid_sas]
> [   89.306576]  megasas_build_and_issue_cmd_fusion+0x138/0x460 [megaraid_sas]
> [   89.313468]  megasas_queue_command+0x398/0x3d0 [megaraid_sas]
> [   89.319222]  scsi_dispatch_cmd+0x1dc/0x8a8
> [   89.323321]  scsi_request_fn+0x8e8/0xdd0
> [   89.327249]  __blk_run_queue+0xc4/0x158
> [   89.331090]  blk_execute_rq_nowait+0xf4/0x158
> [   89.335449]  blk_execute_rq+0xdc/0x158
> [   89.339202]  __scsi_execute+0x130/0x258
> [   89.343041]  scsi_probe_and_add_lun+0x2fc/0x1488
> [   89.347661]  __scsi_scan_target+0x1cc/0x8c8
> [   89.351848]  scsi_scan_channel.part.3+0x8c/0xc0
> [   89.356382]  scsi_scan_host_selected+0x130/0x1f0
> [   89.361002]  do_scsi_scan_host+0xd8/0xf0
> [   89.364927]  do_scan_async+0x9c/0x320
> [   89.368594]  async_run_entry_fn+0x138/0x420
> [   89.372780]  process_one_work+0x61c/0xf08
> [   89.376793]  worker_thread+0x13c/0xa70
> [   89.380546]  kthread+0x1c8/0x1d0
> [   89.383778]  ret_from_fork+0x10/0x1c
>
> This is because when populating Driver Map using firmware raid map, all
> non-existing VDs set their ldTgtIdToLd to 0xff, so it can be skipped
> later.
>
> From drivers/scsi/megaraid/megaraid_sas_base.c ,
> memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
>
> From drivers/scsi/megaraid/megaraid_sas_fp.c ,
> /* For non existing VDs, iterate to next VD*/
> if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
> continue;
>
> However, there are a few places that failed to skip those non-existing
> VDs due to off-by-one errors. Then, those 0xff leaked into
> MR_LdRaidGet(0xff, map) and triggered the out-of-bound accesses.
>
> Fixes: 51087a8617fe (megaraid_sas : Extended VD support)
> Signed-off-by: Qian Cai 

Acked-by: Sumit Saxena 
> ---
>  drivers/scsi/megaraid/megaraid_sas_fp.c | 2 +-
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c 
> b/drivers/scsi/megaraid/megaraid_sas_fp.c
> index 59ecbb3b53b5..a33628550425 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fp.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
> @@ -1266,7 +1266,7 @@ void mr_update_load_balance_params(struct 
> MR_DRV_RAID_MAP_ALL *drv_map,
>
> for (ldCount = 0; ldCount < MAX_LOGICAL_DRIVES_EXT; ldCount++) {
> ld = MR_TargetIdToLdGet(ldCount, drv_map);
> -   if (ld >= MAX_LOGICAL_DRIVES_EXT) {
> +   if (ld >= MAX_LOGICAL_DRIVES_EXT - 1) {
> lbInfo[ld

Re: [PATCH 0/3] irq/core: Fix and expand the irq affinity descriptor

2018-12-19 Thread Sumit Saxena
On Wed, Dec 19, 2018 at 4:23 PM Thomas Gleixner  wrote:
>
> On Tue, 4 Dec 2018, Dou Liyang wrote:
>
> > Now,  Spreading the interrupt affinity info by a cpumask pointer is not
> > enough, meets a problem[1] and hard to expand in the future.
> >
> > Fix it by:
> >
> >  +---+
> >  |   |
> >  | struct cpumask *affinity  |
> >  |   |
> >  +---+
> >|
> > +--v---+
> > |  |
> > | struct irq_affinity_desc {   |
> > | struct cpumask   mask;   |
> > | unsigned int is_managed : 1; |
> > | };   |
> > |  |
> > +--+
> >
>
> So, I've applied that lot for 4.21 (or whatever number it will be). That's
> only the first step for solving Kashyap's problem.
>
> IIRC, then Kashap wanted to get initial interrupt spreading for these extra
> magic interrupts as well, but not have them marked managed.
>
> That's trivial to do now with the two queued changes in that area:
>
>   - The rework above
>
>   - The support for interrupt sets from Jens
>
> Just adding a small bitfield to struct irq_affinity which allows to tell
> the core that a particular interrupt set is not managed does the trick.
>
> Untested patch below.
>
> Kashyap, is that what you were looking for and if so, does it work?
Thomas,
We could not test these patches as they did net get applied to latest
linux-block tree cleanly.

Our requirement is: 1. extra interrupts should be un-managed and 2.
should be spread to CPUs of local NUMA node.
If interrupts are un-managed but not spread as per our requirement,
then still driver/userspace apps can manage by spreading
them as required by calling API- irq_set_affinity_hint().

Thanks,
Sumit
>
> Thanks,
>
> tglx
>
> 8<-
>
> Subject: genirq/affinity: Add support for non-managed affinity sets
> From: Thomas Gleixner 
> Date: Tue, 18 Dec 2018 16:46:47 +0100
>
> Some drivers need an extra set of interrupts which are not marked managed,
> but should get initial interrupt spreading.
>
> Add a bitmap to struct irq_affinity which allows the driver to mark a
> particular set of interrupts as non managed. Check the bitmap during
> spreading and use the result to mark the interrupts in the sets
> accordingly.
>
> The unmanaged interrupts get initial spreading, but user space can change
> their affinity later on.
>
> Usage example:
>
>   struct irq_affinity affd = { .pre_vectors = 2 };
>   int sets[2];
>
>   /* Fill in sets[] */
>
>   affd.nr_sets = 2;
>   affd.sets = 
>   affd.unmanaged_sets = 0x02;
>
>   ..
>
> So both sets are properly spread out, but the second set is not marked
> managed.
>
> Signed-off-by: Thomas Gleixner 
> ---
>  include/linux/interrupt.h |   10 ++
>  kernel/irq/affinity.c |   24 ++--
>  2 files changed, 20 insertions(+), 14 deletions(-)
>
> --- a/kernel/irq/affinity.c
> +++ b/kernel/irq/affinity.c
> @@ -99,7 +99,8 @@ static int __irq_build_affinity_masks(co
>   cpumask_var_t *node_to_cpumask,
>   const struct cpumask *cpu_mask,
>   struct cpumask *nmsk,
> - struct irq_affinity_desc *masks)
> + struct irq_affinity_desc *masks,
> + bool managed)
>  {
> int n, nodes, cpus_per_vec, extra_vecs, done = 0;
> int last_affv = firstvec + numvecs;
> @@ -154,6 +155,7 @@ static int __irq_build_affinity_masks(co
> }
> irq_spread_init_one([curvec].mask, nmsk,
> cpus_per_vec);
> +   masks[curvec].is_managed = managed;
> }
>
> done += v;
> @@ -176,7 +178,8 @@ static int __irq_build_affinity_masks(co
>  static int irq_build_affinity_masks(const struct irq_affinity *affd,
> int startvec, int numvecs, int firstvec,
> cpumask_var_t *node_to_cpumask,
> -   struct irq_affinity_desc *masks)
> +   struct irq_affinity_desc *masks,
> +   bool managed)
>  {
> int curvec = startvec, nr_present, nr_others;
> int ret = -ENOMEM;
> @@ -196,7 +199,8 @@ static int irq_build_affinity_masks(cons
> /* Spread on present CPUs starting from affd->pre_vectors */
> nr_present = __irq_build_affinity_masks(affd, curvec, numvecs,
> firstvec, 

Re: [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed

2018-12-02 Thread Sumit Saxena
On Wed, Nov 28, 2018 at 1:36 PM Wen Yang  wrote:
>
> dma_pool_destroy(NULL) is safe, so removes NULL check before freeing
> the mem. This patch also fix the ifnullfree.cocci warnings.
>
> Signed-off-by: Wen Yang 

Acked-by: Sumit Saxena 

> CC: Julia Lawall 
> CC: Kashyap Desai 
> CC: Sumit Saxena 
> CC: Shivasharan S 
> CC: linux-kernel@vger.kernel.org
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index f74b5ea24f0f..aa477f09a7a5 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_instance 
> *instance) {
>
> }
>
> -   if (fusion->reply_frames_desc_pool)
> -   dma_pool_destroy(fusion->reply_frames_desc_pool);
> -   if (fusion->reply_frames_desc_pool_align)
> -   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
> +   dma_pool_destroy(fusion->reply_frames_desc_pool);
> +   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
>
> if (fusion->rdpq_virt)
> dma_free_coherent(>pdev->dev,
> @@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas_instance 
> *instance) {
> fusion->reply_frames_desc[0],
> fusion->reply_frames_desc_phys[0]);
>
> -   if (fusion->reply_frames_desc_pool)
> -   dma_pool_destroy(fusion->reply_frames_desc_pool);
> +   dma_pool_destroy(fusion->reply_frames_desc_pool);
>
>  }
>
> @@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init_cmd(struct 
> megasas_instance *instance)
>   fusion->ioc_init_cmd->frame,
>   fusion->ioc_init_cmd->frame_phys_addr);
>
> -   if (fusion->ioc_init_cmd)
> -   kfree(fusion->ioc_init_cmd);
> +   kfree(fusion->ioc_init_cmd);
>  }
>
>  /**
> --
> 2.19.1
>


Re: [PATCH] scsi: megaraid_sas: NULL check before some freeing functions is not needed

2018-12-02 Thread Sumit Saxena
On Wed, Nov 28, 2018 at 1:36 PM Wen Yang  wrote:
>
> dma_pool_destroy(NULL) is safe, so removes NULL check before freeing
> the mem. This patch also fix the ifnullfree.cocci warnings.
>
> Signed-off-by: Wen Yang 

Acked-by: Sumit Saxena 

> CC: Julia Lawall 
> CC: Kashyap Desai 
> CC: Sumit Saxena 
> CC: Shivasharan S 
> CC: linux-kernel@vger.kernel.org
> ---
>  drivers/scsi/megaraid/megaraid_sas_fusion.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index f74b5ea24f0f..aa477f09a7a5 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -807,10 +807,8 @@ megasas_free_rdpq_fusion(struct megasas_instance 
> *instance) {
>
> }
>
> -   if (fusion->reply_frames_desc_pool)
> -   dma_pool_destroy(fusion->reply_frames_desc_pool);
> -   if (fusion->reply_frames_desc_pool_align)
> -   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
> +   dma_pool_destroy(fusion->reply_frames_desc_pool);
> +   dma_pool_destroy(fusion->reply_frames_desc_pool_align);
>
> if (fusion->rdpq_virt)
> dma_free_coherent(>pdev->dev,
> @@ -830,8 +828,7 @@ megasas_free_reply_fusion(struct megasas_instance 
> *instance) {
> fusion->reply_frames_desc[0],
> fusion->reply_frames_desc_phys[0]);
>
> -   if (fusion->reply_frames_desc_pool)
> -   dma_pool_destroy(fusion->reply_frames_desc_pool);
> +   dma_pool_destroy(fusion->reply_frames_desc_pool);
>
>  }
>
> @@ -1627,8 +1624,7 @@ static inline void megasas_free_ioc_init_cmd(struct 
> megasas_instance *instance)
>   fusion->ioc_init_cmd->frame,
>   fusion->ioc_init_cmd->frame_phys_addr);
>
> -   if (fusion->ioc_init_cmd)
> -   kfree(fusion->ioc_init_cmd);
> +   kfree(fusion->ioc_init_cmd);
>  }
>
>  /**
> --
> 2.19.1
>


RE: Affinity managed interrupts vs non-managed interrupts

2018-08-29 Thread Sumit Saxena
> -Original Message-
> From: Ming Lei [mailto:ming@redhat.com]
> Sent: Wednesday, August 29, 2018 2:16 PM
> To: Sumit Saxena 
> Cc: t...@linutronix.de; h...@lst.de; linux-kernel@vger.kernel.org
> Subject: Re: Affinity managed interrupts vs non-managed interrupts
>
> Hello Sumit,
Hi Ming,
Thanks for response.
>
> On Tue, Aug 28, 2018 at 12:04:52PM +0530, Sumit Saxena wrote:
> >  Affinity managed interrupts vs non-managed interrupts
> >
> > Hi Thomas,
> >
> > We are working on next generation MegaRAID product where requirement
> > is- to allocate additional 16 MSI-x vectors in addition to number of
> > MSI-x vectors megaraid_sas driver usually allocates.  MegaRAID adapter
> > supports 128 MSI-x vectors.
> >
> > To explain the requirement and solution, consider that we have 2
> > socket system (each socket having 36 logical CPUs). Current driver
> > will allocate total 72 MSI-x vectors by calling API-
> > pci_alloc_irq_vectors(with flag- PCI_IRQ_AFFINITY).  All 72 MSI-x
> > vectors will have affinity across NUMA node s and interrupts are
affinity
> managed.
> >
> > If driver calls- pci_alloc_irq_vectors_affinity() with pre_vectors =
> > 16 and, driver can allocate 16 + 72 MSI-x vectors.
>
> Could you explain a bit what the specific use case the extra 16 vectors
is?
We are trying to avoid the penalty due to one interrupt per IO completion
and decided to coalesce interrupts on these extra 16 reply queues.
For regular 72 reply queues, we will not coalesce interrupts as for low IO
workload, interrupt coalescing may take more time due to less IO
completions.
In IO submission path, driver will decide which set of reply queues
(either extra 16 reply queues or regular 72 reply queues) to be picked
based on IO workload.
>
> >
> > All pre_vectors (16) will be mapped to all available online CPUs but e
> > ffective affinity of each vector is to CPU 0. Our requirement is to
> > have pre _vectors 16 reply queues to be mapped to local NUMA node with
> > effective CPU should be spread within local node cpu mask. Without
> > changing kernel code, we can
>
> If all CPUs in one NUMA node is offline, can this use case work as
expected?
> Seems we have to understand what the use case is and how it works.

Yes, if all CPUs of the NUMA node is offlined, IRQ-CPU affinity will be
broken and irqbalancer takes care of migrating affected IRQs to online
CPUs of different NUMA node.
When offline CPUs are onlined again, irqbalancer restores affinity.
>
>
> Thanks,
> Ming


RE: Affinity managed interrupts vs non-managed interrupts

2018-08-29 Thread Sumit Saxena
> -Original Message-
> From: Ming Lei [mailto:ming@redhat.com]
> Sent: Wednesday, August 29, 2018 2:16 PM
> To: Sumit Saxena 
> Cc: t...@linutronix.de; h...@lst.de; linux-kernel@vger.kernel.org
> Subject: Re: Affinity managed interrupts vs non-managed interrupts
>
> Hello Sumit,
Hi Ming,
Thanks for response.
>
> On Tue, Aug 28, 2018 at 12:04:52PM +0530, Sumit Saxena wrote:
> >  Affinity managed interrupts vs non-managed interrupts
> >
> > Hi Thomas,
> >
> > We are working on next generation MegaRAID product where requirement
> > is- to allocate additional 16 MSI-x vectors in addition to number of
> > MSI-x vectors megaraid_sas driver usually allocates.  MegaRAID adapter
> > supports 128 MSI-x vectors.
> >
> > To explain the requirement and solution, consider that we have 2
> > socket system (each socket having 36 logical CPUs). Current driver
> > will allocate total 72 MSI-x vectors by calling API-
> > pci_alloc_irq_vectors(with flag- PCI_IRQ_AFFINITY).  All 72 MSI-x
> > vectors will have affinity across NUMA node s and interrupts are
affinity
> managed.
> >
> > If driver calls- pci_alloc_irq_vectors_affinity() with pre_vectors =
> > 16 and, driver can allocate 16 + 72 MSI-x vectors.
>
> Could you explain a bit what the specific use case the extra 16 vectors
is?
We are trying to avoid the penalty due to one interrupt per IO completion
and decided to coalesce interrupts on these extra 16 reply queues.
For regular 72 reply queues, we will not coalesce interrupts as for low IO
workload, interrupt coalescing may take more time due to less IO
completions.
In IO submission path, driver will decide which set of reply queues
(either extra 16 reply queues or regular 72 reply queues) to be picked
based on IO workload.
>
> >
> > All pre_vectors (16) will be mapped to all available online CPUs but e
> > ffective affinity of each vector is to CPU 0. Our requirement is to
> > have pre _vectors 16 reply queues to be mapped to local NUMA node with
> > effective CPU should be spread within local node cpu mask. Without
> > changing kernel code, we can
>
> If all CPUs in one NUMA node is offline, can this use case work as
expected?
> Seems we have to understand what the use case is and how it works.

Yes, if all CPUs of the NUMA node is offlined, IRQ-CPU affinity will be
broken and irqbalancer takes care of migrating affected IRQs to online
CPUs of different NUMA node.
When offline CPUs are onlined again, irqbalancer restores affinity.
>
>
> Thanks,
> Ming


Affinity managed interrupts vs non-managed interrupts

2018-08-28 Thread Sumit Saxena
Hi Thomas,

We are working on next generation MegaRAID product where requirement is-
to allocate additional 16 MSI-x vectors in addition to number of MSI-x
vectors megaraid_sas driver usually allocates.  MegaRAID adapter supports
128 MSI-x vectors.

To explain the requirement and solution, consider that we have 2 socket
system (each socket having 36 logical CPUs). Current driver will allocate
total 72 MSI-x vectors by calling API- pci_alloc_irq_vectors(with flag-
PCI_IRQ_AFFINITY).  All 72 MSI-x vectors will have affinity across NUMA
nodes and interrupts are affinity managed.

If driver calls- pci_alloc_irq_vectors_affinity() with pre_vectors = 16
and, driver can allocate 16 + 72 MSI-x vectors.
All pre_vectors (16) will be mapped to all available online CPUs but
effective affinity of each vector is to CPU 0. Our requirement is to have
pre_vectors 16 reply queues to be mapped to local NUMA node with effective
CPU should be spread within local node cpu mask. Without changing kernel
code, we can achieve this by driver calling pci_enable_msix_range()
(requesting to allocate 16 + 72 MSI-x vectors) instead of
pci_alloc_irq_vectors() API. If we use pci_enable_msix_range(), it also
requires MSI-x to CPU affinity handled by driver and these interrupts will
be non-managed.

Question is-
Is there any restriction or preference of using
pci_alloc_irq_vectors{/_affinity} vs pci_enable_msix_range in low level
driver?
If driver uses non-managed interrupt, all cases are handled correctly
through irqbalancer. Is there any plan in future to migrate to managed
interrupts entirely or it is a choice based call for driver maintainers?

Thanks,
Sumit


Affinity managed interrupts vs non-managed interrupts

2018-08-28 Thread Sumit Saxena
Hi Thomas,

We are working on next generation MegaRAID product where requirement is-
to allocate additional 16 MSI-x vectors in addition to number of MSI-x
vectors megaraid_sas driver usually allocates.  MegaRAID adapter supports
128 MSI-x vectors.

To explain the requirement and solution, consider that we have 2 socket
system (each socket having 36 logical CPUs). Current driver will allocate
total 72 MSI-x vectors by calling API- pci_alloc_irq_vectors(with flag-
PCI_IRQ_AFFINITY).  All 72 MSI-x vectors will have affinity across NUMA
nodes and interrupts are affinity managed.

If driver calls- pci_alloc_irq_vectors_affinity() with pre_vectors = 16
and, driver can allocate 16 + 72 MSI-x vectors.
All pre_vectors (16) will be mapped to all available online CPUs but
effective affinity of each vector is to CPU 0. Our requirement is to have
pre_vectors 16 reply queues to be mapped to local NUMA node with effective
CPU should be spread within local node cpu mask. Without changing kernel
code, we can achieve this by driver calling pci_enable_msix_range()
(requesting to allocate 16 + 72 MSI-x vectors) instead of
pci_alloc_irq_vectors() API. If we use pci_enable_msix_range(), it also
requires MSI-x to CPU affinity handled by driver and these interrupts will
be non-managed.

Question is-
Is there any restriction or preference of using
pci_alloc_irq_vectors{/_affinity} vs pci_enable_msix_range in low level
driver?
If driver uses non-managed interrupt, all cases are handled correctly
through irqbalancer. Is there any plan in future to migrate to managed
interrupts entirely or it is a choice based call for driver maintainers?

Thanks,
Sumit


RE: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time

2018-01-18 Thread Sumit Saxena
-Original Message-
From: Arnd Bergmann [mailto:a...@arndb.de]
Sent: Wednesday, January 17, 2018 8:19 PM
To: Kashyap Desai; Sumit Saxena; Shivasharan S; James E.J. Bottomley;
Martin K. Petersen
Cc: Arnd Bergmann; Tomas Henzl; Hannes Reinecke;
megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time

do_gettimeofday() overflows in 2038 on 32-bit architectures and is
deprecated, so convert this driver to call ktime_get_real() directly. This
also simplifies the calculation.

Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
Sent originally in Nov 2017, no comments. Please apply
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 0a85f3c48ef6..97fae28c8374 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -983,7 +983,7 @@ megasas_ioc_init_fusion(struct megasas_instance
*instance)
MFI_CAPABILITIES *drv_ops;
u32 scratch_pad_2;
unsigned long flags;
-   struct timeval tv;
+   ktime_t time;
bool cur_fw_64bit_dma_capable;

fusion = instance->ctrl_context;
@@ -1042,10 +1042,9 @@ megasas_ioc_init_fusion(struct megasas_instance
*instance)
IOCInitMessage->HostMSIxVectors = instance->msix_vectors;
IOCInitMessage->HostPageSize = MR_DEFAULT_NVME_PAGE_SHIFT;

-   do_gettimeofday();
+   time = ktime_get_real();
/* Convert to milliseconds as per FW requirement */
-   IOCInitMessage->TimeStamp = cpu_to_le64((tv.tv_sec * 1000) +
-   (tv.tv_usec / 1000));
+   IOCInitMessage->TimeStamp = cpu_to_le64(ktime_to_ms(time));

init_frame = (struct megasas_init_frame *)cmd->frame;
memset(init_frame, 0, IOC_INIT_FRAME_SIZE);
Looks good to me.

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

--
2.9.0


RE: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time

2018-01-18 Thread Sumit Saxena
-Original Message-
From: Arnd Bergmann [mailto:a...@arndb.de]
Sent: Wednesday, January 17, 2018 8:19 PM
To: Kashyap Desai; Sumit Saxena; Shivasharan S; James E.J. Bottomley;
Martin K. Petersen
Cc: Arnd Bergmann; Tomas Henzl; Hannes Reinecke;
megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time

do_gettimeofday() overflows in 2038 on 32-bit architectures and is
deprecated, so convert this driver to call ktime_get_real() directly. This
also simplifies the calculation.

Signed-off-by: Arnd Bergmann 
---
Sent originally in Nov 2017, no comments. Please apply
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 0a85f3c48ef6..97fae28c8374 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -983,7 +983,7 @@ megasas_ioc_init_fusion(struct megasas_instance
*instance)
MFI_CAPABILITIES *drv_ops;
u32 scratch_pad_2;
unsigned long flags;
-   struct timeval tv;
+   ktime_t time;
bool cur_fw_64bit_dma_capable;

fusion = instance->ctrl_context;
@@ -1042,10 +1042,9 @@ megasas_ioc_init_fusion(struct megasas_instance
*instance)
IOCInitMessage->HostMSIxVectors = instance->msix_vectors;
IOCInitMessage->HostPageSize = MR_DEFAULT_NVME_PAGE_SHIFT;

-   do_gettimeofday();
+   time = ktime_get_real();
/* Convert to milliseconds as per FW requirement */
-   IOCInitMessage->TimeStamp = cpu_to_le64((tv.tv_sec * 1000) +
-   (tv.tv_usec / 1000));
+   IOCInitMessage->TimeStamp = cpu_to_le64(ktime_to_ms(time));

init_frame = (struct megasas_init_frame *)cmd->frame;
memset(init_frame, 0, IOC_INIT_FRAME_SIZE);
Looks good to me.

Acked-by: Sumit Saxena 

--
2.9.0


RE: [PATCH] scsi: megaraid: Convert timers to use timer_setup()

2017-10-31 Thread Sumit Saxena
-Original Message-
From: Kees Cook [mailto:keesc...@chromium.org]
Sent: Wednesday, October 25, 2017 3:37 PM
To: Martin K. Petersen
Cc: Kashyap Desai; Sumit Saxena; Shivasharan S; James E.J. Bottomley;
megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: megaraid: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch to using the new timer_setup() and
from_timer() to pass the timer pointer explicitly. Also consolidates the
timer setup functions arguments, which are all identical, and corrects
on-stack timer usage.

Cc: Kashyap Desai <kashyap.de...@broadcom.com>
Cc: Sumit Saxena <sumit.sax...@broadcom.com>
Cc: Shivasharan S <shivasharan.srikanteshw...@broadcom.com>
Cc: "James E.J. Bottomley" <j...@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.peter...@oracle.com>
Cc: megaraidlinux@broadcom.com
Cc: linux-s...@vger.kernel.org
Signed-off-by: Kees Cook <keesc...@chromium.org>
---
 drivers/scsi/megaraid/megaraid_ioctl.h  |  6 +
 drivers/scsi/megaraid/megaraid_mbox.c   | 26 ++---
 drivers/scsi/megaraid/megaraid_mm.c | 27 +++---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 35
+++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 15 +++--
 5 files changed, 47 insertions(+), 62 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_ioctl.h
b/drivers/scsi/megaraid/megaraid_ioctl.h
index 05f6e4ec3453..eedcbde46459 100644
--- a/drivers/scsi/megaraid/megaraid_ioctl.h
+++ b/drivers/scsi/megaraid/megaraid_ioctl.h
@@ -19,6 +19,7 @@

 #include 
 #include 
+#include 

 #include "mbox_defs.h"

@@ -153,6 +154,11 @@ typedef struct uioc {

 } __attribute__ ((aligned(1024),packed)) uioc_t;

+/* For on-stack uioc timers. */
+struct uioc_timeout {
+   struct timer_list timer;
+   uioc_t*uioc;
+};

 /**
  * struct mraid_hba_info - information about the controller diff --git
a/drivers/scsi/megaraid/megaraid_mbox.c
b/drivers/scsi/megaraid/megaraid_mbox.c
index ec3c43854978..530358cdcb39 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3904,19 +3904,19 @@ megaraid_sysfs_get_ldmap_done(uioc_t *uioc)
wake_up(_dev->sysfs_wait_q);
 }

-
 /**
  * megaraid_sysfs_get_ldmap_timeout - timeout handling for get ldmap
- * @data   : timed out packet
+ * @t  : timed out timer
  *
  * Timeout routine to recover and return to application, in case the
adapter
  * has stopped responding. A timeout of 60 seconds for this command seems
like
  * a good value.
  */
 static void
-megaraid_sysfs_get_ldmap_timeout(unsigned long data)
+megaraid_sysfs_get_ldmap_timeout(struct timer_list *t)
 {
-   uioc_t  *uioc = (uioc_t *)data;
+   struct uioc_timeout *timeout = from_timer(timeout, t, timer);
+   uioc_t  *uioc = timeout->uioc;
adapter_t   *adapter = (adapter_t *)uioc->buf_vaddr;
mraid_device_t  *raid_dev = ADAP2RAIDDEV(adapter);

@@ -3951,8 +3951,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
mbox64_t*mbox64;
mbox_t  *mbox;
char*raw_mbox;
-   struct timer_list   sysfs_timer;
-   struct timer_list   *timerp;
+   struct uioc_timeout timeout;
caddr_t ldmap;
int rval = 0;

@@ -3988,14 +3987,12 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
/*
 * Setup a timer to recover from a non-responding controller
 */
-   timerp  = _timer;
-   init_timer(timerp);
-
-   timerp->function= megaraid_sysfs_get_ldmap_timeout;
-   timerp->data= (unsigned long)uioc;
-   timerp->expires = jiffies + 60 * HZ;
+   timeout.uioc = uioc;
+   timer_setup_on_stack(,
+megaraid_sysfs_get_ldmap_timeout, 0);

Kees,
Does calling "timer_setup_on_stack" instead of "timer_setup" intentional ?
If yes, please help me understand the reason.
Otherwise changes look good to me.

-   add_timer(timerp);
+   timeout.timer.expires   = jiffies + 60 * HZ;
+   add_timer();

/*
 * Send the command to the firmware
@@ -4033,7 +4030,8 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
}


-   del_timer_sync(timerp);
+   del_timer_sync();
+   destroy_timer_on_stack();

mutex_unlock(_dev->sysfs_mtx);

diff --git a/drivers/scsi/megaraid/megaraid_mm.c
b/drivers/scsi/megaraid/megaraid_mm.c
index 65b6f6ace3a5..bb802b0c12b8 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -35,7 +35,7 @@ static int kioc_to_mimd(uioc_t *, mimd_t __user *);
static int handle_drvrcmd(void __user *, ui

RE: [PATCH] scsi: megaraid: Convert timers to use timer_setup()

2017-10-31 Thread Sumit Saxena
-Original Message-
From: Kees Cook [mailto:keesc...@chromium.org]
Sent: Wednesday, October 25, 2017 3:37 PM
To: Martin K. Petersen
Cc: Kashyap Desai; Sumit Saxena; Shivasharan S; James E.J. Bottomley;
megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: megaraid: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch to using the new timer_setup() and
from_timer() to pass the timer pointer explicitly. Also consolidates the
timer setup functions arguments, which are all identical, and corrects
on-stack timer usage.

Cc: Kashyap Desai 
Cc: Sumit Saxena 
Cc: Shivasharan S 
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: megaraidlinux@broadcom.com
Cc: linux-s...@vger.kernel.org
Signed-off-by: Kees Cook 
---
 drivers/scsi/megaraid/megaraid_ioctl.h  |  6 +
 drivers/scsi/megaraid/megaraid_mbox.c   | 26 ++---
 drivers/scsi/megaraid/megaraid_mm.c | 27 +++---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 35
+++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 15 +++--
 5 files changed, 47 insertions(+), 62 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_ioctl.h
b/drivers/scsi/megaraid/megaraid_ioctl.h
index 05f6e4ec3453..eedcbde46459 100644
--- a/drivers/scsi/megaraid/megaraid_ioctl.h
+++ b/drivers/scsi/megaraid/megaraid_ioctl.h
@@ -19,6 +19,7 @@

 #include 
 #include 
+#include 

 #include "mbox_defs.h"

@@ -153,6 +154,11 @@ typedef struct uioc {

 } __attribute__ ((aligned(1024),packed)) uioc_t;

+/* For on-stack uioc timers. */
+struct uioc_timeout {
+   struct timer_list timer;
+   uioc_t*uioc;
+};

 /**
  * struct mraid_hba_info - information about the controller diff --git
a/drivers/scsi/megaraid/megaraid_mbox.c
b/drivers/scsi/megaraid/megaraid_mbox.c
index ec3c43854978..530358cdcb39 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3904,19 +3904,19 @@ megaraid_sysfs_get_ldmap_done(uioc_t *uioc)
wake_up(_dev->sysfs_wait_q);
 }

-
 /**
  * megaraid_sysfs_get_ldmap_timeout - timeout handling for get ldmap
- * @data   : timed out packet
+ * @t  : timed out timer
  *
  * Timeout routine to recover and return to application, in case the
adapter
  * has stopped responding. A timeout of 60 seconds for this command seems
like
  * a good value.
  */
 static void
-megaraid_sysfs_get_ldmap_timeout(unsigned long data)
+megaraid_sysfs_get_ldmap_timeout(struct timer_list *t)
 {
-   uioc_t  *uioc = (uioc_t *)data;
+   struct uioc_timeout *timeout = from_timer(timeout, t, timer);
+   uioc_t  *uioc = timeout->uioc;
adapter_t   *adapter = (adapter_t *)uioc->buf_vaddr;
mraid_device_t  *raid_dev = ADAP2RAIDDEV(adapter);

@@ -3951,8 +3951,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
mbox64_t*mbox64;
mbox_t  *mbox;
char*raw_mbox;
-   struct timer_list   sysfs_timer;
-   struct timer_list   *timerp;
+   struct uioc_timeout timeout;
caddr_t ldmap;
int rval = 0;

@@ -3988,14 +3987,12 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
/*
 * Setup a timer to recover from a non-responding controller
 */
-   timerp  = _timer;
-   init_timer(timerp);
-
-   timerp->function= megaraid_sysfs_get_ldmap_timeout;
-   timerp->data= (unsigned long)uioc;
-   timerp->expires = jiffies + 60 * HZ;
+   timeout.uioc = uioc;
+   timer_setup_on_stack(,
+megaraid_sysfs_get_ldmap_timeout, 0);

Kees,
Does calling "timer_setup_on_stack" instead of "timer_setup" intentional ?
If yes, please help me understand the reason.
Otherwise changes look good to me.

-   add_timer(timerp);
+   timeout.timer.expires   = jiffies + 60 * HZ;
+   add_timer();

/*
 * Send the command to the firmware
@@ -4033,7 +4030,8 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
}


-   del_timer_sync(timerp);
+   del_timer_sync();
+   destroy_timer_on_stack();

mutex_unlock(_dev->sysfs_mtx);

diff --git a/drivers/scsi/megaraid/megaraid_mm.c
b/drivers/scsi/megaraid/megaraid_mm.c
index 65b6f6ace3a5..bb802b0c12b8 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -35,7 +35,7 @@ static int kioc_to_mimd(uioc_t *, mimd_t __user *);
static int handle_drvrcmd(void __user *, uint8_t, int *);  static int
lld_ioctl(mraid_mmadp_t *, uioc_t *);  static void ioctl_done(uioc_t *);
-static void lld_timedout(unsigned long);
+static void lld_timedout(struct timer_list *);
 static void hin

RE: [PATCH 1/2] scsi: megaraid: Remove redundant code in megasas_alloc_cmds

2017-10-31 Thread Sumit Saxena
-Original Message-
From: Yisheng Xie [mailto:xieyishe...@huawei.com]
Sent: Wednesday, October 25, 2017 3:27 PM
To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
martin.peter...@oracle.com
Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org; Yisheng Xie
Subject: [PATCH 1/2] scsi: megaraid: Remove redundant code in
megasas_alloc_cmds

megasas_alloc_cmds is to alloc cmd_list of instance instead of fusion, and
fusion is useless in this function. Just remove it.

Signed-off-by: Yisheng Xie <xieyishe...@huawei.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index e518dad..0640168 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4033,9 +4033,7 @@ int megasas_alloc_cmds(struct megasas_instance
*instance)
int j;
u16 max_cmd;
struct megasas_cmd *cmd;
-   struct fusion_context *fusion;

-   fusion = instance->ctrl_context;
max_cmd = instance->max_mfi_cmds;

/*
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

--
1.7.12.4


RE: [PATCH 1/2] scsi: megaraid: Remove redundant code in megasas_alloc_cmds

2017-10-31 Thread Sumit Saxena
-Original Message-
From: Yisheng Xie [mailto:xieyishe...@huawei.com]
Sent: Wednesday, October 25, 2017 3:27 PM
To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
martin.peter...@oracle.com
Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org; Yisheng Xie
Subject: [PATCH 1/2] scsi: megaraid: Remove redundant code in
megasas_alloc_cmds

megasas_alloc_cmds is to alloc cmd_list of instance instead of fusion, and
fusion is useless in this function. Just remove it.

Signed-off-by: Yisheng Xie 
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index e518dad..0640168 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4033,9 +4033,7 @@ int megasas_alloc_cmds(struct megasas_instance
*instance)
int j;
u16 max_cmd;
struct megasas_cmd *cmd;
-   struct fusion_context *fusion;

-   fusion = instance->ctrl_context;
max_cmd = instance->max_mfi_cmds;

/*
Acked-by: Sumit Saxena 

--
1.7.12.4


RE: [PATCH] megaraid: kmemleak: Track page allocation for fusion

2017-09-14 Thread Sumit Saxena
-Original Message-
From: shuw...@redhat.com [mailto:shuw...@redhat.com]
Sent: Thursday, September 14, 2017 11:47 AM
To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
martin.peter...@oracle.com
Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org; catalin.mari...@arm.com; liw...@redhat.com;
ch...@redhat.com; Shu Wang
Subject: [PATCH] megaraid: kmemleak: Track page allocation for fusion

From: Shu Wang <shuw...@redhat.com>

Kmemleak reports about a thousand false positives for fusion-> cmd_list[].
Root casue is the cmd_list objects are allocated from slab allocator, and
stored its pointer in object allocated by page allocator. The fix will
tell kmemleak to track and scan fusion object.

Before patch:
kmemleak: 1004 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

unreferenced object 0x88042584e000 (size 8192):
  backtrace:
 kmemleak_alloc+0x4a/0xa0
 __kmalloc+0xec/0x220
 megasas_alloc_cmdlist_fusion+0x3e/0x140 [megaraid_sas]
 megasas_alloc_cmds_fusion+0x44/0x450 [megaraid_sas]
 megasas_init_adapter_fusion+0x21d/0x6e0 [megaraid_sas]
 megasas_init_fw+0x357/0xd30 [megaraid_sas]
 megasas_probe_one.part.34+0x5be/0x1040 [megaraid_sas]
 megasas_probe_one+0x46/0xc0 [megaraid_sas]
 local_pci_probe+0x45/0xa0
 work_for_cpu_fn+0x14/0x20
 process_one_work+0x149/0x360
 worker_thread+0x1d8/0x3c0
 kthread+0x109/0x140
 ret_from_fork+0x25/0x30

Signed-off-by: Shu Wang <shuw...@redhat.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 11bd2e698b84..621299edd8de 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -4512,7 +4513,9 @@ megasas_alloc_fusion_context(struct megasas_instance
*instance)
dev_err(>pdev->dev, "Failed from %s
%d\n", __func__, __LINE__);
return -ENOMEM;
}
-   }
+   } else
+   kmemleak_alloc(instance->ctrl_context,
+   sizeof(struct fusion_context), 1, GFP_KERNEL);

fusion = instance->ctrl_context;

@@ -4548,9 +4551,11 @@ megasas_free_fusion_context(struct megasas_instance
*instance)

if (is_vmalloc_addr(fusion))
vfree(fusion);
-   else
+   else {
free_pages((ulong)fusion,
instance->ctrl_context_pages);
+   kmemleak_free(fusion);
+   }
}
 }
Looks good. Thanks for catching this.

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

--
2.13.5


RE: [PATCH] megaraid: kmemleak: Track page allocation for fusion

2017-09-14 Thread Sumit Saxena
-Original Message-
From: shuw...@redhat.com [mailto:shuw...@redhat.com]
Sent: Thursday, September 14, 2017 11:47 AM
To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
martin.peter...@oracle.com
Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org; catalin.mari...@arm.com; liw...@redhat.com;
ch...@redhat.com; Shu Wang
Subject: [PATCH] megaraid: kmemleak: Track page allocation for fusion

From: Shu Wang 

Kmemleak reports about a thousand false positives for fusion-> cmd_list[].
Root casue is the cmd_list objects are allocated from slab allocator, and
stored its pointer in object allocated by page allocator. The fix will
tell kmemleak to track and scan fusion object.

Before patch:
kmemleak: 1004 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

unreferenced object 0x88042584e000 (size 8192):
  backtrace:
 kmemleak_alloc+0x4a/0xa0
 __kmalloc+0xec/0x220
 megasas_alloc_cmdlist_fusion+0x3e/0x140 [megaraid_sas]
 megasas_alloc_cmds_fusion+0x44/0x450 [megaraid_sas]
 megasas_init_adapter_fusion+0x21d/0x6e0 [megaraid_sas]
 megasas_init_fw+0x357/0xd30 [megaraid_sas]
 megasas_probe_one.part.34+0x5be/0x1040 [megaraid_sas]
 megasas_probe_one+0x46/0xc0 [megaraid_sas]
 local_pci_probe+0x45/0xa0
 work_for_cpu_fn+0x14/0x20
 process_one_work+0x149/0x360
 worker_thread+0x1d8/0x3c0
 kthread+0x109/0x140
 ret_from_fork+0x25/0x30

Signed-off-by: Shu Wang 
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 11bd2e698b84..621299edd8de 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -4512,7 +4513,9 @@ megasas_alloc_fusion_context(struct megasas_instance
*instance)
dev_err(>pdev->dev, "Failed from %s
%d\n", __func__, __LINE__);
return -ENOMEM;
}
-   }
+   } else
+   kmemleak_alloc(instance->ctrl_context,
+   sizeof(struct fusion_context), 1, GFP_KERNEL);

fusion = instance->ctrl_context;

@@ -4548,9 +4551,11 @@ megasas_free_fusion_context(struct megasas_instance
*instance)

if (is_vmalloc_addr(fusion))
vfree(fusion);
-   else
+   else {
free_pages((ulong)fusion,
instance->ctrl_context_pages);
+   kmemleak_free(fusion);
+   }
}
 }
Looks good. Thanks for catching this.

Acked-by: Sumit Saxena 

--
2.13.5


RE: [PATCH] scsi: megaraid_sas: fix memleak in megasas_alloc_cmdlist_fusion

2017-07-21 Thread Sumit Saxena
>-Original Message-
>From: shuw...@redhat.com [mailto:shuw...@redhat.com]
>Sent: Friday, July 21, 2017 4:24 PM
>To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
>shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; ch...@redhat.com; liw...@redhat.com; Shu Wang
>Subject: [PATCH] scsi: megaraid_sas: fix memleak in
>megasas_alloc_cmdlist_fusion
>
>From: Shu Wang <shuw...@redhat.com>
>
>Found this issue by kmemleak, a few kb mem was leaked in
>megasas_alloc_cmdlist_fusion when kzalloc failed for one
>megasas_cmd_fusion allocation.
>
>unreferenced object 0x88045dbd2000 (size 8192):
>  comm "systemd-udevd", pid 323, jiffies 4294671759 (age 49.008s)
>  backtrace:
>[] kmemleak_alloc+0x4a/0xa0
>[] __kmalloc+0xe8/0x220
>[] megasas_alloc_cmdlist_fusion+0x34/0xe0
>[megaraid_sas]
>(gdb) list *megasas_alloc_cmdlist_fusion+0x34
>0xd5c4 is in megasas_alloc_cmdlist_fusion
>   (drivers/scsi/megaraid/megaraid_sas_fusion.c:443).
>[] megasas_alloc_cmds_fusion+0x25/0x410
>[megaraid_sas]
>[] megasas_init_adapter_fusion+0x21f/0x640
>[megaraid_sas]
>[] megasas_init_fw+0x357/0xd30 [megaraid_sas]
>[] megasas_probe_one.part.33+0x636/0x1100
>[megaraid_sas]
>[] megasas_probe_one+0x46/0xc0 [megaraid_sas]
>[] local_pci_probe+0x45/0xa0
>[] pci_device_probe+0x192/0x1b0
>[] driver_probe_device+0x2a8/0x460
>[] __driver_attach+0xdd/0xe0
>[] bus_for_each_dev+0x6c/0xc0
>[] driver_attach+0x1e/0x20
>[] bus_add_driver+0x45/0x270
>[] driver_register+0x60/0xe0 unreferenced object
>0x880454ce3600 (size 192):
>  backtrace:
>[] kmemleak_alloc+0x4a/0xa0
>[] kmem_cache_alloc_trace+0xca/0x1d0
>[] megasas_alloc_cmdlist_fusion+0x77/0xe0
>[megaraid_sas]
>(gdb) list *megasas_alloc_cmdlist_fusion+0x77
>0xd607 is in megasas_alloc_cmdlist_fusion
>(drivers/scsi/megaraid/megaraid_sas_fusion.c:450).
>[] megasas_alloc_cmds_fusion+0x25/0x410
>[megaraid_sas]
>[] megasas_init_adapter_fusion+0x21f/0x640
>[megaraid_sas]
>[] megasas_init_fw+0x357/0xd30 [megaraid_sas]
>[] megasas_probe_one.part.33+0x636/0x1100
>[megaraid_sas]
>[] megasas_probe_one+0x46/0xc0 [megaraid_sas]
>[] local_pci_probe+0x45/0xa0
>[] pci_device_probe+0x192/0x1b0
>[] driver_probe_device+0x2a8/0x460
>[] __driver_attach+0xdd/0xe0
>[] bus_for_each_dev+0x6c/0xc0
>[] driver_attach+0x1e/0x20
>[] bus_add_driver+0x45/0x270
>[] driver_register+0x60/0xe0
>
>Signed-off-by: Shu Wang <shuw...@redhat.com>
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index f990ab4d..9855106 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -425,7 +425,7 @@ static int megasas_create_sg_sense_fusion(struct
>megasas_instance *instance)  int  megasas_alloc_cmdlist_fusion(struct
>megasas_instance *instance)  {
>-  u32 max_mpt_cmd, i;
>+  u32 max_mpt_cmd, i, j;
>   struct fusion_context *fusion;
>
>   fusion = instance->ctrl_context;
>@@ -450,11 +450,15 @@ megasas_alloc_cmdlist_fusion(struct
>megasas_instance *instance)
>   fusion->cmd_list[i] = kzalloc(sizeof(struct
>megasas_cmd_fusion),
> GFP_KERNEL);
>   if (!fusion->cmd_list[i]) {
>+  for (j = 0; j < i; j++)
>+      kfree(fusion->cmd_list[j]);
>+  kfree(fusion->cmd_list);
>   dev_err(>pdev->dev,
>   "Failed from %s %d\n",  __func__,
__LINE__);
>   return -ENOMEM;
>   }
>   }
>+
>   return 0;
> }
> int
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.5.0


RE: [PATCH] scsi: megaraid_sas: fix memleak in megasas_alloc_cmdlist_fusion

2017-07-21 Thread Sumit Saxena
>-Original Message-
>From: shuw...@redhat.com [mailto:shuw...@redhat.com]
>Sent: Friday, July 21, 2017 4:24 PM
>To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
>shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; ch...@redhat.com; liw...@redhat.com; Shu Wang
>Subject: [PATCH] scsi: megaraid_sas: fix memleak in
>megasas_alloc_cmdlist_fusion
>
>From: Shu Wang 
>
>Found this issue by kmemleak, a few kb mem was leaked in
>megasas_alloc_cmdlist_fusion when kzalloc failed for one
>megasas_cmd_fusion allocation.
>
>unreferenced object 0x88045dbd2000 (size 8192):
>  comm "systemd-udevd", pid 323, jiffies 4294671759 (age 49.008s)
>  backtrace:
>[] kmemleak_alloc+0x4a/0xa0
>[] __kmalloc+0xe8/0x220
>[] megasas_alloc_cmdlist_fusion+0x34/0xe0
>[megaraid_sas]
>(gdb) list *megasas_alloc_cmdlist_fusion+0x34
>0xd5c4 is in megasas_alloc_cmdlist_fusion
>   (drivers/scsi/megaraid/megaraid_sas_fusion.c:443).
>[] megasas_alloc_cmds_fusion+0x25/0x410
>[megaraid_sas]
>[] megasas_init_adapter_fusion+0x21f/0x640
>[megaraid_sas]
>[] megasas_init_fw+0x357/0xd30 [megaraid_sas]
>[] megasas_probe_one.part.33+0x636/0x1100
>[megaraid_sas]
>[] megasas_probe_one+0x46/0xc0 [megaraid_sas]
>[] local_pci_probe+0x45/0xa0
>[] pci_device_probe+0x192/0x1b0
>[] driver_probe_device+0x2a8/0x460
>[] __driver_attach+0xdd/0xe0
>[] bus_for_each_dev+0x6c/0xc0
>[] driver_attach+0x1e/0x20
>[] bus_add_driver+0x45/0x270
>[] driver_register+0x60/0xe0 unreferenced object
>0x880454ce3600 (size 192):
>  backtrace:
>[] kmemleak_alloc+0x4a/0xa0
>[] kmem_cache_alloc_trace+0xca/0x1d0
>[] megasas_alloc_cmdlist_fusion+0x77/0xe0
>[megaraid_sas]
>(gdb) list *megasas_alloc_cmdlist_fusion+0x77
>0xd607 is in megasas_alloc_cmdlist_fusion
>(drivers/scsi/megaraid/megaraid_sas_fusion.c:450).
>[] megasas_alloc_cmds_fusion+0x25/0x410
>[megaraid_sas]
>[] megasas_init_adapter_fusion+0x21f/0x640
>[megaraid_sas]
>[] megasas_init_fw+0x357/0xd30 [megaraid_sas]
>[] megasas_probe_one.part.33+0x636/0x1100
>[megaraid_sas]
>[] megasas_probe_one+0x46/0xc0 [megaraid_sas]
>[] local_pci_probe+0x45/0xa0
>[] pci_device_probe+0x192/0x1b0
>[] driver_probe_device+0x2a8/0x460
>[] __driver_attach+0xdd/0xe0
>[] bus_for_each_dev+0x6c/0xc0
>[] driver_attach+0x1e/0x20
>[] bus_add_driver+0x45/0x270
>[] driver_register+0x60/0xe0
>
>Signed-off-by: Shu Wang 
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 6 +-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index f990ab4d..9855106 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -425,7 +425,7 @@ static int megasas_create_sg_sense_fusion(struct
>megasas_instance *instance)  int  megasas_alloc_cmdlist_fusion(struct
>megasas_instance *instance)  {
>-  u32 max_mpt_cmd, i;
>+  u32 max_mpt_cmd, i, j;
>   struct fusion_context *fusion;
>
>   fusion = instance->ctrl_context;
>@@ -450,11 +450,15 @@ megasas_alloc_cmdlist_fusion(struct
>megasas_instance *instance)
>   fusion->cmd_list[i] = kzalloc(sizeof(struct
>megasas_cmd_fusion),
> GFP_KERNEL);
>   if (!fusion->cmd_list[i]) {
>+  for (j = 0; j < i; j++)
>+  kfree(fusion->cmd_list[j]);
>+  kfree(fusion->cmd_list);
>   dev_err(>pdev->dev,
>   "Failed from %s %d\n",  __func__,
__LINE__);
>   return -ENOMEM;
>   }
>   }
>+
>   return 0;
> }
> int
Acked-by: Sumit Saxena 

>--
>2.5.0


RE: [PATCH] megaraid: Fix a sleep-in-atomic bug

2017-05-31 Thread Sumit Saxena
>-Original Message-
>From: Jia-Ju Bai [mailto:baijiaju1...@163.com]
>Sent: Wednesday, May 31, 2017 8:27 AM
>To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
>shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; Jia-Ju Bai
>Subject: [PATCH] megaraid: Fix a sleep-in-atomic bug
>
>The driver may sleep under a spin lock, and the function call path is:
>mraid_mm_attach_buf (acquire the lock by spin_lock_irqsave)
>  pci_pool_alloc(GFP_KERNEL) --> may sleep
>
>To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".
>
>Signed-off-by: Jia-Ju Bai <baijiaju1...@163.com>
>---
> drivers/scsi/megaraid/megaraid_mm.c |2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_mm.c
>b/drivers/scsi/megaraid/megaraid_mm.c
>index 4cf9ed9..c43afb8 100644
>--- a/drivers/scsi/megaraid/megaraid_mm.c
>+++ b/drivers/scsi/megaraid/megaraid_mm.c
>@@ -574,7 +574,7 @@
>
>   kioc->pool_index= right_pool;
>   kioc->free_buf  = 1;
>-  kioc->buf_vaddr = pci_pool_alloc(pool->handle, GFP_KERNEL,
>+  kioc->buf_vaddr = pci_pool_alloc(pool->handle, GFP_ATOMIC,
>   >buf_paddr);
>   spin_unlock_irqrestore(>lock, flags);

This is very old driver and reached EOL. Did you face any issue because of
this bug or discover this through code review?
Anyways patch looks good to me.

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>
>--
>1.7.9.5
>


RE: [PATCH] megaraid: Fix a sleep-in-atomic bug

2017-05-31 Thread Sumit Saxena
>-Original Message-
>From: Jia-Ju Bai [mailto:baijiaju1...@163.com]
>Sent: Wednesday, May 31, 2017 8:27 AM
>To: kashyap.de...@broadcom.com; sumit.sax...@broadcom.com;
>shivasharan.srikanteshw...@broadcom.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; Jia-Ju Bai
>Subject: [PATCH] megaraid: Fix a sleep-in-atomic bug
>
>The driver may sleep under a spin lock, and the function call path is:
>mraid_mm_attach_buf (acquire the lock by spin_lock_irqsave)
>  pci_pool_alloc(GFP_KERNEL) --> may sleep
>
>To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".
>
>Signed-off-by: Jia-Ju Bai 
>---
> drivers/scsi/megaraid/megaraid_mm.c |2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_mm.c
>b/drivers/scsi/megaraid/megaraid_mm.c
>index 4cf9ed9..c43afb8 100644
>--- a/drivers/scsi/megaraid/megaraid_mm.c
>+++ b/drivers/scsi/megaraid/megaraid_mm.c
>@@ -574,7 +574,7 @@
>
>   kioc->pool_index= right_pool;
>   kioc->free_buf  = 1;
>-  kioc->buf_vaddr = pci_pool_alloc(pool->handle, GFP_KERNEL,
>+  kioc->buf_vaddr = pci_pool_alloc(pool->handle, GFP_ATOMIC,
>   >buf_paddr);
>   spin_unlock_irqrestore(>lock, flags);

This is very old driver and reached EOL. Did you face any issue because of
this bug or discover this through code review?
Anyways patch looks good to me.

Acked-by: Sumit Saxena 

>
>--
>1.7.9.5
>


RE: [PATCH][V2] scsi: megaraid_sas: fix spelling mistakes: "oustanding" -> "outstanding"

2017-05-04 Thread Sumit Saxena
>-Original Message-
>From: Colin King [mailto:colin.k...@canonical.com]
>Sent: Sunday, April 30, 2017 3:41 AM
>To: Kashyap Desai; Sumit Saxena; Shivasharan S; James E . J . Bottomley;
>Martin K . Petersen; megaraidlinux@broadcom.com
>Cc: linux-kernel@vger.kernel.org
>Subject: [PATCH][V2] scsi: megaraid_sas: fix spelling mistakes:
"oustanding"
>-> "outstanding"
>
>From: Colin Ian King <colin.k...@canonical.com>
>
>trivial fix to spelling mistakes in dev_info and scmd_printk messages.
Also
>join lines on split literal string to clean up checkpatch warning.
>
>Signed-off-by: Colin Ian King <colin.k...@canonical.com>
>---
> drivers/scsi/megaraid/megaraid_sas_base.c   | 2 +-
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +--
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 316c3df0c3fd..0a9478fdb58b 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -2638,7 +2638,7 @@ static int megasas_wait_for_outstanding(struct
>megasas_instance *instance)
>   do {
>   if ((fw_state == MFI_STATE_FAULT) ||
>atomic_read(>fw_outstanding)) {
>   dev_info(>pdev->dev,
>-  "%s:%d waiting_for_outstanding: before
>issue OCR. FW state = 0x%x, oustanding 0x%x\n",
>+  "%s:%d waiting_for_outstanding: before
>issue OCR. FW state = 0x%x,
>+outstanding 0x%x\n",
>   __func__, __LINE__, fw_state,
>atomic_read(>fw_outstanding));
>   if (i == 3)
>   goto kill_hba_and_failed;
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index f990ab4d45e1..adba9f450dec 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -3975,8 +3975,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd
>*scmd)
>
>   if (!smid) {
>   ret = SUCCESS;
>-  scmd_printk(KERN_NOTICE, scmd, "Command for which
>abort is"
>-  " issued is not found in oustanding commands\n");
>+  scmd_printk(KERN_NOTICE, scmd, "Command for which
>abort is issued is
>+not found in outstanding commands\n");
>   mutex_unlock(>reset_mutex);
>   goto out;
>   }
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.11.0


RE: [PATCH][V2] scsi: megaraid_sas: fix spelling mistakes: "oustanding" -> "outstanding"

2017-05-04 Thread Sumit Saxena
>-Original Message-
>From: Colin King [mailto:colin.k...@canonical.com]
>Sent: Sunday, April 30, 2017 3:41 AM
>To: Kashyap Desai; Sumit Saxena; Shivasharan S; James E . J . Bottomley;
>Martin K . Petersen; megaraidlinux@broadcom.com
>Cc: linux-kernel@vger.kernel.org
>Subject: [PATCH][V2] scsi: megaraid_sas: fix spelling mistakes:
"oustanding"
>-> "outstanding"
>
>From: Colin Ian King 
>
>trivial fix to spelling mistakes in dev_info and scmd_printk messages.
Also
>join lines on split literal string to clean up checkpatch warning.
>
>Signed-off-by: Colin Ian King 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c   | 2 +-
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 +--
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 316c3df0c3fd..0a9478fdb58b 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -2638,7 +2638,7 @@ static int megasas_wait_for_outstanding(struct
>megasas_instance *instance)
>   do {
>   if ((fw_state == MFI_STATE_FAULT) ||
>atomic_read(>fw_outstanding)) {
>   dev_info(>pdev->dev,
>-  "%s:%d waiting_for_outstanding: before
>issue OCR. FW state = 0x%x, oustanding 0x%x\n",
>+  "%s:%d waiting_for_outstanding: before
>issue OCR. FW state = 0x%x,
>+outstanding 0x%x\n",
>   __func__, __LINE__, fw_state,
>atomic_read(>fw_outstanding));
>   if (i == 3)
>   goto kill_hba_and_failed;
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index f990ab4d45e1..adba9f450dec 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -3975,8 +3975,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd
>*scmd)
>
>   if (!smid) {
>   ret = SUCCESS;
>-  scmd_printk(KERN_NOTICE, scmd, "Command for which
>abort is"
>-  " issued is not found in oustanding commands\n");
>+  scmd_printk(KERN_NOTICE, scmd, "Command for which
>abort is issued is
>+not found in outstanding commands\n");
>   mutex_unlock(>reset_mutex);
>   goto out;
>   }
Acked-by: Sumit Saxena 

>--
>2.11.0


RE: [PATCH 6/7] megasas: Remove expensive inline from megasas_return_cmd

2017-03-15 Thread Sumit Saxena
>-Original Message-
>From: megaraidlinux@broadcom.com
>[mailto:megaraidlinux@broadcom.com] On Behalf Of Andi Kleen
>Sent: Wednesday, March 15, 2017 7:45 AM
>To: a...@linux-foundation.org
>Cc: linux-kernel@vger.kernel.org; Andi Kleen;
>megaraidlinux@broadcom.com
>Subject: [PATCH 6/7] megasas: Remove expensive inline from
>megasas_return_cmd
>
>From: Andi Kleen <a...@linux.intel.com>
>
>Remove an inline from a fairly big function that is used often.
>It's unlikely that calling or not calling it makes a lot of difference.
>
>Saves around 8k text in my kernel.
>
>   textdata bss dec hex filename
>9047801 5367568 6544255319131859609
>vmlinux-before-megasas
>9039417 5367568 6544255235291857549 vmlinux-megasas
>
>Cc: megaraidlinux@broadcom.com
>Signed-off-by: Andi Kleen <a...@linux.intel.com>
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 7ac9a9ee9bd4..55b71de3fb1f 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -244,7 +244,7 @@ struct megasas_cmd *megasas_get_cmd(struct
>megasas_instance
>  * @instance: Adapter soft state
>  * @cmd:  Command packet to be returned to free command pool
>  */
>-inline void
>+void
> megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd
>*cmd)  {
>   unsigned long flags;

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.9.3
>


RE: [PATCH 6/7] megasas: Remove expensive inline from megasas_return_cmd

2017-03-15 Thread Sumit Saxena
>-Original Message-
>From: megaraidlinux@broadcom.com
>[mailto:megaraidlinux@broadcom.com] On Behalf Of Andi Kleen
>Sent: Wednesday, March 15, 2017 7:45 AM
>To: a...@linux-foundation.org
>Cc: linux-kernel@vger.kernel.org; Andi Kleen;
>megaraidlinux@broadcom.com
>Subject: [PATCH 6/7] megasas: Remove expensive inline from
>megasas_return_cmd
>
>From: Andi Kleen 
>
>Remove an inline from a fairly big function that is used often.
>It's unlikely that calling or not calling it makes a lot of difference.
>
>Saves around 8k text in my kernel.
>
>   textdata bss dec hex filename
>9047801 5367568 6544255319131859609
>vmlinux-before-megasas
>9039417 5367568 6544255235291857549 vmlinux-megasas
>
>Cc: megaraidlinux@broadcom.com
>Signed-off-by: Andi Kleen 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 7ac9a9ee9bd4..55b71de3fb1f 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -244,7 +244,7 @@ struct megasas_cmd *megasas_get_cmd(struct
>megasas_instance
>  * @instance: Adapter soft state
>  * @cmd:  Command packet to be returned to free command pool
>  */
>-inline void
>+void
> megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd
>*cmd)  {
>   unsigned long flags;

Acked-by: Sumit Saxena 

>--
>2.9.3
>


RE: [PATCH v4 11/19] scsi: megaraid: Replace PCI pool old API

2017-03-01 Thread Sumit Saxena
VME_PAGE_SIZE, 0);
>   /* SCSI_SENSE_BUFFERSIZE  = 96 bytes */
>   fusion->sense_dma_pool =
>-  pci_pool_create("mr_sense", instance->pdev,
>+  dma_pool_create("mr_sense", >pdev->dev,
>   SCSI_SENSE_BUFFERSIZE, 64, 0);
>
>   if (!fusion->sense_dma_pool || !fusion->sg_dma_pool) { @@ -395,10
>+389,10 @@ static int megasas_create_sg_sense_fusion(struct
>megasas_instance *instance)
>*/
>   for (i = 0; i < max_cmd; i++) {
>   cmd = fusion->cmd_list[i];
>-  cmd->sg_frame = pci_pool_alloc(fusion->sg_dma_pool,
>+  cmd->sg_frame = dma_pool_alloc(fusion->sg_dma_pool,
>   GFP_KERNEL, 
>>sg_frame_phys_addr);
>
>-  cmd->sense = pci_pool_alloc(fusion->sense_dma_pool,
>+  cmd->sense = dma_pool_alloc(fusion->sense_dma_pool,
>   GFP_KERNEL,
>sense_phys_addr);
>   if (!cmd->sg_frame || !cmd->sense) {
>   dev_err(>pdev->dev,
>@@ -410,7 +404,7 @@ static int megasas_create_sg_sense_fusion(struct
>megasas_instance *instance)
>   /* create sense buffer for the raid 1/10 fp */
>   for (i = max_cmd; i < instance->max_mpt_cmds; i++) {
>   cmd = fusion->cmd_list[i];
>-  cmd->sense = pci_pool_alloc(fusion->sense_dma_pool,
>+  cmd->sense = dma_pool_alloc(fusion->sense_dma_pool,
>   GFP_KERNEL, >sense_phys_addr);
>   if (!cmd->sense) {
>   dev_err(>pdev->dev,
>@@ -475,7 +469,7 @@ megasas_alloc_request_fusion(struct megasas_instance
>*instance)
>   }
>
>   fusion->io_request_frames_pool =
>-  pci_pool_create("mr_ioreq", instance->pdev,
>+  dma_pool_create("mr_ioreq", >pdev->dev,
>   fusion->io_frames_alloc_sz, 16, 0);
>
>   if (!fusion->io_request_frames_pool) { @@ -485,7 +479,7 @@
>megasas_alloc_request_fusion(struct megasas_instance *instance)
>   }
>
>   fusion->io_request_frames =
>-  pci_pool_alloc(fusion->io_request_frames_pool,
>+  dma_pool_alloc(fusion->io_request_frames_pool,
>   GFP_KERNEL, 
>>io_request_frames_phys);
>   if (!fusion->io_request_frames) {
>   dev_err(>pdev->dev,
>@@ -505,7 +499,7 @@ megasas_alloc_reply_fusion(struct megasas_instance
>*instance)
>
>   count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
>   fusion->reply_frames_desc_pool =
>-  pci_pool_create("mr_reply", instance->pdev,
>+  dma_pool_create("mr_reply", >pdev->dev,
>   fusion->reply_alloc_sz * count, 16, 0);
>
>   if (!fusion->reply_frames_desc_pool) { @@ -515,7 +509,7 @@
>megasas_alloc_reply_fusion(struct megasas_instance *instance)
>   }
>
>   fusion->reply_frames_desc[0] =
>-  pci_pool_alloc(fusion->reply_frames_desc_pool,
>+  dma_pool_alloc(fusion->reply_frames_desc_pool,
>   GFP_KERNEL, >reply_frames_desc_phys[0]);
>   if (!fusion->reply_frames_desc[0]) {
>   dev_err(>pdev->dev,
>@@ -558,8 +552,10 @@ megasas_alloc_rdpq_fusion(struct megasas_instance
>*instance)
>   memset(fusion->rdpq_virt, 0,
>   sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
>MAX_MSIX_QUEUES_FUSION);
>   count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
>-  fusion->reply_frames_desc_pool = pci_pool_create("mr_rdpq",
>-   instance->pdev,
fusion-
>>reply_alloc_sz, 16, 0);
>+  fusion->reply_frames_desc_pool = dma_pool_create("mr_rdpq",
>+
>pdev->dev,
>+
fusion->reply_alloc_sz,
>+   16, 0);
>
>   if (!fusion->reply_frames_desc_pool) {
>   dev_err(>pdev->dev,
>@@ -569,7 +565,7 @@ megasas_alloc_rdpq_fusion(struct megasas_instance
>*instance)
>
>   for (i = 0; i < count; i++) {
>   fusion->reply_frames_desc[i] =
>-  pci_pool_alloc(fusion-
>>reply_frames_desc_pool,
>+  dma_pool_alloc(fusion-
>>reply_frames_desc_pool,
>   GFP_KERNEL, 
>>reply_frames_desc_phys[i]);
>   if (!fusion->reply_frames_desc[i]) {
>   dev_err(>pdev->dev,
>@@ -597,13 +593,12 @@ megasas_free_rdpq_fusion(struct megasas_instance
>*instance) {
>
>   for (i = 0; i < MAX_MSIX_QUEUES_FUSION; i++) {
>   if (fusion->reply_frames_desc[i])
>-  pci_pool_free(fusion->reply_frames_desc_pool,
>+  dma_pool_free(fusion->reply_frames_desc_pool,
>   fusion->reply_frames_desc[i],
>   fusion->reply_frames_desc_phys[i]);
>   }
>
>-  if (fusion->reply_frames_desc_pool)
>-  pci_pool_destroy(fusion->reply_frames_desc_pool);
>+  dma_pool_destroy(fusion->reply_frames_desc_pool);
>
>   if (fusion->rdpq_virt)
>   pci_free_consistent(instance->pdev,
>@@ -619,12 +614,11 @@ megasas_free_reply_fusion(struct megasas_instance
>*instance) {
>   fusion = instance->ctrl_context;
>
>   if (fusion->reply_frames_desc[0])
>-  pci_pool_free(fusion->reply_frames_desc_pool,
>+  dma_pool_free(fusion->reply_frames_desc_pool,
>   fusion->reply_frames_desc[0],
>   fusion->reply_frames_desc_phys[0]);
>
>-  if (fusion->reply_frames_desc_pool)
>-  pci_pool_destroy(fusion->reply_frames_desc_pool);
>+  dma_pool_destroy(fusion->reply_frames_desc_pool);
>
> }

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>
>--
>2.9.3


RE: [PATCH v4 11/19] scsi: megaraid: Replace PCI pool old API

2017-03-01 Thread Sumit Saxena
sion->sense_dma_pool =
>-  pci_pool_create("mr_sense", instance->pdev,
>+  dma_pool_create("mr_sense", >pdev->dev,
>   SCSI_SENSE_BUFFERSIZE, 64, 0);
>
>   if (!fusion->sense_dma_pool || !fusion->sg_dma_pool) { @@ -395,10
>+389,10 @@ static int megasas_create_sg_sense_fusion(struct
>megasas_instance *instance)
>*/
>   for (i = 0; i < max_cmd; i++) {
>   cmd = fusion->cmd_list[i];
>-  cmd->sg_frame = pci_pool_alloc(fusion->sg_dma_pool,
>+  cmd->sg_frame = dma_pool_alloc(fusion->sg_dma_pool,
>   GFP_KERNEL, 
>>sg_frame_phys_addr);
>
>-  cmd->sense = pci_pool_alloc(fusion->sense_dma_pool,
>+  cmd->sense = dma_pool_alloc(fusion->sense_dma_pool,
>   GFP_KERNEL,
>sense_phys_addr);
>   if (!cmd->sg_frame || !cmd->sense) {
>   dev_err(>pdev->dev,
>@@ -410,7 +404,7 @@ static int megasas_create_sg_sense_fusion(struct
>megasas_instance *instance)
>   /* create sense buffer for the raid 1/10 fp */
>   for (i = max_cmd; i < instance->max_mpt_cmds; i++) {
>   cmd = fusion->cmd_list[i];
>-  cmd->sense = pci_pool_alloc(fusion->sense_dma_pool,
>+  cmd->sense = dma_pool_alloc(fusion->sense_dma_pool,
>   GFP_KERNEL, >sense_phys_addr);
>   if (!cmd->sense) {
>   dev_err(>pdev->dev,
>@@ -475,7 +469,7 @@ megasas_alloc_request_fusion(struct megasas_instance
>*instance)
>   }
>
>   fusion->io_request_frames_pool =
>-  pci_pool_create("mr_ioreq", instance->pdev,
>+  dma_pool_create("mr_ioreq", >pdev->dev,
>   fusion->io_frames_alloc_sz, 16, 0);
>
>   if (!fusion->io_request_frames_pool) { @@ -485,7 +479,7 @@
>megasas_alloc_request_fusion(struct megasas_instance *instance)
>   }
>
>   fusion->io_request_frames =
>-  pci_pool_alloc(fusion->io_request_frames_pool,
>+  dma_pool_alloc(fusion->io_request_frames_pool,
>   GFP_KERNEL, 
>>io_request_frames_phys);
>   if (!fusion->io_request_frames) {
>   dev_err(>pdev->dev,
>@@ -505,7 +499,7 @@ megasas_alloc_reply_fusion(struct megasas_instance
>*instance)
>
>   count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
>   fusion->reply_frames_desc_pool =
>-  pci_pool_create("mr_reply", instance->pdev,
>+  dma_pool_create("mr_reply", >pdev->dev,
>   fusion->reply_alloc_sz * count, 16, 0);
>
>   if (!fusion->reply_frames_desc_pool) { @@ -515,7 +509,7 @@
>megasas_alloc_reply_fusion(struct megasas_instance *instance)
>   }
>
>   fusion->reply_frames_desc[0] =
>-  pci_pool_alloc(fusion->reply_frames_desc_pool,
>+  dma_pool_alloc(fusion->reply_frames_desc_pool,
>   GFP_KERNEL, >reply_frames_desc_phys[0]);
>   if (!fusion->reply_frames_desc[0]) {
>   dev_err(>pdev->dev,
>@@ -558,8 +552,10 @@ megasas_alloc_rdpq_fusion(struct megasas_instance
>*instance)
>   memset(fusion->rdpq_virt, 0,
>   sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
>MAX_MSIX_QUEUES_FUSION);
>   count = instance->msix_vectors > 0 ? instance->msix_vectors : 1;
>-  fusion->reply_frames_desc_pool = pci_pool_create("mr_rdpq",
>-   instance->pdev,
fusion-
>>reply_alloc_sz, 16, 0);
>+  fusion->reply_frames_desc_pool = dma_pool_create("mr_rdpq",
>+
>pdev->dev,
>+
fusion->reply_alloc_sz,
>+   16, 0);
>
>   if (!fusion->reply_frames_desc_pool) {
>   dev_err(>pdev->dev,
>@@ -569,7 +565,7 @@ megasas_alloc_rdpq_fusion(struct megasas_instance
>*instance)
>
>   for (i = 0; i < count; i++) {
>   fusion->reply_frames_desc[i] =
>-  pci_pool_alloc(fusion-
>>reply_frames_desc_pool,
>+  dma_pool_alloc(fusion-
>>reply_frames_desc_pool,
>   GFP_KERNEL, 
>>reply_frames_desc_phys[i]);
>   if (!fusion->reply_frames_desc[i]) {
>   dev_err(>pdev->dev,
>@@ -597,13 +593,12 @@ megasas_free_rdpq_fusion(struct megasas_instance
>*instance) {
>
>   for (i = 0; i < MAX_MSIX_QUEUES_FUSION; i++) {
>   if (fusion->reply_frames_desc[i])
>-  pci_pool_free(fusion->reply_frames_desc_pool,
>+  dma_pool_free(fusion->reply_frames_desc_pool,
>   fusion->reply_frames_desc[i],
>   fusion->reply_frames_desc_phys[i]);
>   }
>
>-  if (fusion->reply_frames_desc_pool)
>-  pci_pool_destroy(fusion->reply_frames_desc_pool);
>+  dma_pool_destroy(fusion->reply_frames_desc_pool);
>
>   if (fusion->rdpq_virt)
>   pci_free_consistent(instance->pdev,
>@@ -619,12 +614,11 @@ megasas_free_reply_fusion(struct megasas_instance
>*instance) {
>   fusion = instance->ctrl_context;
>
>   if (fusion->reply_frames_desc[0])
>-  pci_pool_free(fusion->reply_frames_desc_pool,
>+  dma_pool_free(fusion->reply_frames_desc_pool,
>   fusion->reply_frames_desc[0],
>   fusion->reply_frames_desc_phys[0]);
>
>-  if (fusion->reply_frames_desc_pool)
>-  pci_pool_destroy(fusion->reply_frames_desc_pool);
>+  dma_pool_destroy(fusion->reply_frames_desc_pool);
>
> }

Acked-by: Sumit Saxena 

>
>--
>2.9.3


RE: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit

2017-02-15 Thread Sumit Saxena
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Wednesday, February 15, 2017 2:52 AM
>To: James E.J. Bottomley; Martin K. Petersen
>Cc: Arnd Bergmann; Kashyap Desai; Sumit Saxena; Shivasharan S; Tomas
Henzl;
>Hannes Reinecke; Sasikumar Chandrasekaran;
>megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit
>
>When building with a dma_addr_t that is different from pointer size, we
get this
>warning:
>
>drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
>'megasas_make_prp_nvme':
>drivers/scsi/megaraid/megaraid_sas_fusion.c:1654:17: error: cast to
pointer
>from integer of different size [-Werror=int-to-pointer-cast]
>
>It's better to not pretend that the dma address is a pointer and instead
use a
>dma_addr_t consistently.
>
>Fixes: 33203bc4d61b ("scsi: megaraid_sas: NVME fast path io support")
>Signed-off-by: Arnd Bergmann <a...@arndb.de>
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 750090119f81..29650ba669da 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -1619,7 +1619,8 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,  {
>   int sge_len, offset, num_prp_in_chain = 0;
>   struct MPI25_IEEE_SGE_CHAIN64 *main_chain_element, *ptr_first_sgl;
>-  u64 *ptr_sgl, *ptr_sgl_phys;
>+  u64 *ptr_sgl;
>+  dma_addr_t ptr_sgl_phys;
>   u64 sge_addr;
>   u32 page_mask, page_mask_result;
>   struct scatterlist *sg_scmd;
>@@ -1651,14 +1652,14 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>*/
>   page_mask = mr_nvme_pg_size - 1;
>   ptr_sgl = (u64 *)cmd->sg_frame;
>-  ptr_sgl_phys = (u64 *)cmd->sg_frame_phys_addr;
>+  ptr_sgl_phys = cmd->sg_frame_phys_addr;
>   memset(ptr_sgl, 0, instance->max_chain_frame_sz);
>
>   /* Build chain frame element which holds all prps except first*/
>   main_chain_element = (struct MPI25_IEEE_SGE_CHAIN64 *)
>   ((u8 *)sgl_ptr + sizeof(struct MPI25_IEEE_SGE_CHAIN64));
>
>-  main_chain_element->Address =
cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  main_chain_element->Address = cpu_to_le64(ptr_sgl_phys);
>   main_chain_element->NextChainOffset = 0;
>   main_chain_element->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>   IEEE_SGE_FLAGS_SYSTEM_ADDR |
>@@ -1696,16 +1697,15 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>   scmd_printk(KERN_NOTICE,
>   scmd, "page boundary ptr_sgl: 0x%p\n",
>   ptr_sgl);
>-  ptr_sgl_phys++;
>-  *ptr_sgl =
>-  cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  ptr_sgl_phys += 8;
>+  *ptr_sgl = cpu_to_le64(ptr_sgl_phys);
>   ptr_sgl++;
>   num_prp_in_chain++;
>   }
>
>   *ptr_sgl = cpu_to_le64(sge_addr);
>   ptr_sgl++;
>-  ptr_sgl_phys++;
>+  ptr_sgl_phys += 8;
>   num_prp_in_chain++;
>
>   sge_addr += mr_nvme_pg_size;

Patch looks good. In last reply, Acked-by tag was not in proper format.
Fixing it now. Sorry for inconvenience.
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.9.0


RE: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit

2017-02-15 Thread Sumit Saxena
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Wednesday, February 15, 2017 2:52 AM
>To: James E.J. Bottomley; Martin K. Petersen
>Cc: Arnd Bergmann; Kashyap Desai; Sumit Saxena; Shivasharan S; Tomas
Henzl;
>Hannes Reinecke; Sasikumar Chandrasekaran;
>megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit
>
>When building with a dma_addr_t that is different from pointer size, we
get this
>warning:
>
>drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
>'megasas_make_prp_nvme':
>drivers/scsi/megaraid/megaraid_sas_fusion.c:1654:17: error: cast to
pointer
>from integer of different size [-Werror=int-to-pointer-cast]
>
>It's better to not pretend that the dma address is a pointer and instead
use a
>dma_addr_t consistently.
>
>Fixes: 33203bc4d61b ("scsi: megaraid_sas: NVME fast path io support")
>Signed-off-by: Arnd Bergmann 
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 750090119f81..29650ba669da 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -1619,7 +1619,8 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,  {
>   int sge_len, offset, num_prp_in_chain = 0;
>   struct MPI25_IEEE_SGE_CHAIN64 *main_chain_element, *ptr_first_sgl;
>-  u64 *ptr_sgl, *ptr_sgl_phys;
>+  u64 *ptr_sgl;
>+  dma_addr_t ptr_sgl_phys;
>   u64 sge_addr;
>   u32 page_mask, page_mask_result;
>   struct scatterlist *sg_scmd;
>@@ -1651,14 +1652,14 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>*/
>   page_mask = mr_nvme_pg_size - 1;
>   ptr_sgl = (u64 *)cmd->sg_frame;
>-  ptr_sgl_phys = (u64 *)cmd->sg_frame_phys_addr;
>+  ptr_sgl_phys = cmd->sg_frame_phys_addr;
>   memset(ptr_sgl, 0, instance->max_chain_frame_sz);
>
>   /* Build chain frame element which holds all prps except first*/
>   main_chain_element = (struct MPI25_IEEE_SGE_CHAIN64 *)
>   ((u8 *)sgl_ptr + sizeof(struct MPI25_IEEE_SGE_CHAIN64));
>
>-  main_chain_element->Address =
cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  main_chain_element->Address = cpu_to_le64(ptr_sgl_phys);
>   main_chain_element->NextChainOffset = 0;
>   main_chain_element->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>   IEEE_SGE_FLAGS_SYSTEM_ADDR |
>@@ -1696,16 +1697,15 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>   scmd_printk(KERN_NOTICE,
>   scmd, "page boundary ptr_sgl: 0x%p\n",
>   ptr_sgl);
>-  ptr_sgl_phys++;
>-  *ptr_sgl =
>-  cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  ptr_sgl_phys += 8;
>+  *ptr_sgl = cpu_to_le64(ptr_sgl_phys);
>   ptr_sgl++;
>   num_prp_in_chain++;
>   }
>
>   *ptr_sgl = cpu_to_le64(sge_addr);
>   ptr_sgl++;
>-      ptr_sgl_phys++;
>+  ptr_sgl_phys += 8;
>   num_prp_in_chain++;
>
>   sge_addr += mr_nvme_pg_size;

Patch looks good. In last reply, Acked-by tag was not in proper format.
Fixing it now. Sorry for inconvenience.
Acked-by: Sumit Saxena 

>--
>2.9.0


RE: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit

2017-02-15 Thread Sumit Saxena
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Wednesday, February 15, 2017 2:52 AM
>To: James E.J. Bottomley; Martin K. Petersen
>Cc: Arnd Bergmann; Kashyap Desai; Sumit Saxena; Shivasharan S; Tomas
Henzl;
>Hannes Reinecke; Sasikumar Chandrasekaran;
>megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit
>
>When building with a dma_addr_t that is different from pointer size, we
get this
>warning:
>
>drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
>'megasas_make_prp_nvme':
>drivers/scsi/megaraid/megaraid_sas_fusion.c:1654:17: error: cast to
pointer
>from integer of different size [-Werror=int-to-pointer-cast]
>
>It's better to not pretend that the dma address is a pointer and instead
use a
>dma_addr_t consistently.
>
>Fixes: 33203bc4d61b ("scsi: megaraid_sas: NVME fast path io support")
>Signed-off-by: Arnd Bergmann <a...@arndb.de>
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 750090119f81..29650ba669da 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -1619,7 +1619,8 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,  {
>   int sge_len, offset, num_prp_in_chain = 0;
>   struct MPI25_IEEE_SGE_CHAIN64 *main_chain_element, *ptr_first_sgl;
>-  u64 *ptr_sgl, *ptr_sgl_phys;
>+  u64 *ptr_sgl;
>+  dma_addr_t ptr_sgl_phys;
>   u64 sge_addr;
>   u32 page_mask, page_mask_result;
>   struct scatterlist *sg_scmd;
>@@ -1651,14 +1652,14 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>*/
>   page_mask = mr_nvme_pg_size - 1;
>   ptr_sgl = (u64 *)cmd->sg_frame;
>-  ptr_sgl_phys = (u64 *)cmd->sg_frame_phys_addr;
>+  ptr_sgl_phys = cmd->sg_frame_phys_addr;
>   memset(ptr_sgl, 0, instance->max_chain_frame_sz);
>
>   /* Build chain frame element which holds all prps except first*/
>   main_chain_element = (struct MPI25_IEEE_SGE_CHAIN64 *)
>   ((u8 *)sgl_ptr + sizeof(struct MPI25_IEEE_SGE_CHAIN64));
>
>-  main_chain_element->Address =
cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  main_chain_element->Address = cpu_to_le64(ptr_sgl_phys);
>   main_chain_element->NextChainOffset = 0;
>   main_chain_element->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>   IEEE_SGE_FLAGS_SYSTEM_ADDR |
>@@ -1696,16 +1697,15 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>   scmd_printk(KERN_NOTICE,
>   scmd, "page boundary ptr_sgl: 0x%p\n",
>   ptr_sgl);
>-  ptr_sgl_phys++;
>-  *ptr_sgl =
>-  cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  ptr_sgl_phys += 8;
>+  *ptr_sgl = cpu_to_le64(ptr_sgl_phys);
>   ptr_sgl++;
>   num_prp_in_chain++;
>   }
>
>       *ptr_sgl = cpu_to_le64(sge_addr);
>   ptr_sgl++;
>-  ptr_sgl_phys++;
>+  ptr_sgl_phys += 8;
>   num_prp_in_chain++;
>
>   sge_addr += mr_nvme_pg_size;

Looks good. Tested and it works as expected.
Acked-by: Sumit Saxena<sumit.sax...@broadcom.com>

>--
>2.9.0


RE: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit

2017-02-15 Thread Sumit Saxena
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Wednesday, February 15, 2017 2:52 AM
>To: James E.J. Bottomley; Martin K. Petersen
>Cc: Arnd Bergmann; Kashyap Desai; Sumit Saxena; Shivasharan S; Tomas
Henzl;
>Hannes Reinecke; Sasikumar Chandrasekaran;
>megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit
>
>When building with a dma_addr_t that is different from pointer size, we
get this
>warning:
>
>drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
>'megasas_make_prp_nvme':
>drivers/scsi/megaraid/megaraid_sas_fusion.c:1654:17: error: cast to
pointer
>from integer of different size [-Werror=int-to-pointer-cast]
>
>It's better to not pretend that the dma address is a pointer and instead
use a
>dma_addr_t consistently.
>
>Fixes: 33203bc4d61b ("scsi: megaraid_sas: NVME fast path io support")
>Signed-off-by: Arnd Bergmann 
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 750090119f81..29650ba669da 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -1619,7 +1619,8 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,  {
>   int sge_len, offset, num_prp_in_chain = 0;
>   struct MPI25_IEEE_SGE_CHAIN64 *main_chain_element, *ptr_first_sgl;
>-  u64 *ptr_sgl, *ptr_sgl_phys;
>+  u64 *ptr_sgl;
>+  dma_addr_t ptr_sgl_phys;
>   u64 sge_addr;
>   u32 page_mask, page_mask_result;
>   struct scatterlist *sg_scmd;
>@@ -1651,14 +1652,14 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>*/
>   page_mask = mr_nvme_pg_size - 1;
>   ptr_sgl = (u64 *)cmd->sg_frame;
>-  ptr_sgl_phys = (u64 *)cmd->sg_frame_phys_addr;
>+  ptr_sgl_phys = cmd->sg_frame_phys_addr;
>   memset(ptr_sgl, 0, instance->max_chain_frame_sz);
>
>   /* Build chain frame element which holds all prps except first*/
>   main_chain_element = (struct MPI25_IEEE_SGE_CHAIN64 *)
>   ((u8 *)sgl_ptr + sizeof(struct MPI25_IEEE_SGE_CHAIN64));
>
>-  main_chain_element->Address =
cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  main_chain_element->Address = cpu_to_le64(ptr_sgl_phys);
>   main_chain_element->NextChainOffset = 0;
>   main_chain_element->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>   IEEE_SGE_FLAGS_SYSTEM_ADDR |
>@@ -1696,16 +1697,15 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>   scmd_printk(KERN_NOTICE,
>   scmd, "page boundary ptr_sgl: 0x%p\n",
>   ptr_sgl);
>-  ptr_sgl_phys++;
>-  *ptr_sgl =
>-  cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  ptr_sgl_phys += 8;
>+  *ptr_sgl = cpu_to_le64(ptr_sgl_phys);
>   ptr_sgl++;
>   num_prp_in_chain++;
>   }
>
>   *ptr_sgl = cpu_to_le64(sge_addr);
>   ptr_sgl++;
>-  ptr_sgl_phys++;
>+  ptr_sgl_phys += 8;
>   num_prp_in_chain++;
>
>   sge_addr += mr_nvme_pg_size;

Looks good. Tested and it works as expected.
Acked-by: Sumit Saxena

>--
>2.9.0


RE: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit

2017-02-14 Thread Sumit Saxena
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Wednesday, February 15, 2017 2:52 AM
>To: James E.J. Bottomley; Martin K. Petersen
>Cc: Arnd Bergmann; Kashyap Desai; Sumit Saxena; Shivasharan S; Tomas
Henzl;
>Hannes Reinecke; Sasikumar Chandrasekaran;
>megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit
>
>When building with a dma_addr_t that is different from pointer size, we
get this
>warning:
>
>drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
>'megasas_make_prp_nvme':
>drivers/scsi/megaraid/megaraid_sas_fusion.c:1654:17: error: cast to
pointer
>from integer of different size [-Werror=int-to-pointer-cast]
>
>It's better to not pretend that the dma address is a pointer and instead
use a
>dma_addr_t consistently.

Patch looks good from review but we need to have some test runs before
acking this.
I will get back after some test runs.

Thanks,
Sumit
>
>Fixes: 33203bc4d61b ("scsi: megaraid_sas: NVME fast path io support")
>Signed-off-by: Arnd Bergmann <a...@arndb.de>
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 750090119f81..29650ba669da 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -1619,7 +1619,8 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,  {
>   int sge_len, offset, num_prp_in_chain = 0;
>   struct MPI25_IEEE_SGE_CHAIN64 *main_chain_element, *ptr_first_sgl;
>-  u64 *ptr_sgl, *ptr_sgl_phys;
>+  u64 *ptr_sgl;
>+  dma_addr_t ptr_sgl_phys;
>   u64 sge_addr;
>   u32 page_mask, page_mask_result;
>   struct scatterlist *sg_scmd;
>@@ -1651,14 +1652,14 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>*/
>   page_mask = mr_nvme_pg_size - 1;
>   ptr_sgl = (u64 *)cmd->sg_frame;
>-  ptr_sgl_phys = (u64 *)cmd->sg_frame_phys_addr;
>+  ptr_sgl_phys = cmd->sg_frame_phys_addr;
>   memset(ptr_sgl, 0, instance->max_chain_frame_sz);
>
>   /* Build chain frame element which holds all prps except first*/
>   main_chain_element = (struct MPI25_IEEE_SGE_CHAIN64 *)
>   ((u8 *)sgl_ptr + sizeof(struct MPI25_IEEE_SGE_CHAIN64));
>
>-  main_chain_element->Address =
cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  main_chain_element->Address = cpu_to_le64(ptr_sgl_phys);
>   main_chain_element->NextChainOffset = 0;
>   main_chain_element->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>   IEEE_SGE_FLAGS_SYSTEM_ADDR |
>@@ -1696,16 +1697,15 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>   scmd_printk(KERN_NOTICE,
>   scmd, "page boundary ptr_sgl: 0x%p\n",
>   ptr_sgl);
>-  ptr_sgl_phys++;
>-  *ptr_sgl =
>-  cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  ptr_sgl_phys += 8;
>+  *ptr_sgl = cpu_to_le64(ptr_sgl_phys);
>   ptr_sgl++;
>   num_prp_in_chain++;
>   }
>
>   *ptr_sgl = cpu_to_le64(sge_addr);
>   ptr_sgl++;
>-  ptr_sgl_phys++;
>+  ptr_sgl_phys += 8;
>   num_prp_in_chain++;
>
>   sge_addr += mr_nvme_pg_size;
>--
>2.9.0


RE: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit

2017-02-14 Thread Sumit Saxena
>-Original Message-
>From: Arnd Bergmann [mailto:a...@arndb.de]
>Sent: Wednesday, February 15, 2017 2:52 AM
>To: James E.J. Bottomley; Martin K. Petersen
>Cc: Arnd Bergmann; Kashyap Desai; Sumit Saxena; Shivasharan S; Tomas
Henzl;
>Hannes Reinecke; Sasikumar Chandrasekaran;
>megaraidlinux@broadcom.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: handle dma_addr_t right on 32-bit
>
>When building with a dma_addr_t that is different from pointer size, we
get this
>warning:
>
>drivers/scsi/megaraid/megaraid_sas_fusion.c: In function
>'megasas_make_prp_nvme':
>drivers/scsi/megaraid/megaraid_sas_fusion.c:1654:17: error: cast to
pointer
>from integer of different size [-Werror=int-to-pointer-cast]
>
>It's better to not pretend that the dma address is a pointer and instead
use a
>dma_addr_t consistently.

Patch looks good from review but we need to have some test runs before
acking this.
I will get back after some test runs.

Thanks,
Sumit
>
>Fixes: 33203bc4d61b ("scsi: megaraid_sas: NVME fast path io support")
>Signed-off-by: Arnd Bergmann 
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 750090119f81..29650ba669da 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -1619,7 +1619,8 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,  {
>   int sge_len, offset, num_prp_in_chain = 0;
>   struct MPI25_IEEE_SGE_CHAIN64 *main_chain_element, *ptr_first_sgl;
>-  u64 *ptr_sgl, *ptr_sgl_phys;
>+  u64 *ptr_sgl;
>+  dma_addr_t ptr_sgl_phys;
>   u64 sge_addr;
>   u32 page_mask, page_mask_result;
>   struct scatterlist *sg_scmd;
>@@ -1651,14 +1652,14 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>*/
>   page_mask = mr_nvme_pg_size - 1;
>   ptr_sgl = (u64 *)cmd->sg_frame;
>-  ptr_sgl_phys = (u64 *)cmd->sg_frame_phys_addr;
>+  ptr_sgl_phys = cmd->sg_frame_phys_addr;
>   memset(ptr_sgl, 0, instance->max_chain_frame_sz);
>
>   /* Build chain frame element which holds all prps except first*/
>   main_chain_element = (struct MPI25_IEEE_SGE_CHAIN64 *)
>   ((u8 *)sgl_ptr + sizeof(struct MPI25_IEEE_SGE_CHAIN64));
>
>-  main_chain_element->Address =
cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  main_chain_element->Address = cpu_to_le64(ptr_sgl_phys);
>   main_chain_element->NextChainOffset = 0;
>   main_chain_element->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
>   IEEE_SGE_FLAGS_SYSTEM_ADDR |
>@@ -1696,16 +1697,15 @@ megasas_make_prp_nvme(struct megasas_instance
>*instance, struct scsi_cmnd *scmd,
>   scmd_printk(KERN_NOTICE,
>   scmd, "page boundary ptr_sgl: 0x%p\n",
>   ptr_sgl);
>-  ptr_sgl_phys++;
>-  *ptr_sgl =
>-  cpu_to_le64((uintptr_t)ptr_sgl_phys);
>+  ptr_sgl_phys += 8;
>+  *ptr_sgl = cpu_to_le64(ptr_sgl_phys);
>   ptr_sgl++;
>   num_prp_in_chain++;
>   }
>
>   *ptr_sgl = cpu_to_le64(sge_addr);
>   ptr_sgl++;
>-  ptr_sgl_phys++;
>+  ptr_sgl_phys += 8;
>   num_prp_in_chain++;
>
>   sge_addr += mr_nvme_pg_size;
>--
>2.9.0


RE: [PATCH 1/3] megaraid_sas: mark symbols static where possible

2016-09-25 Thread Sumit Saxena
 @@ build_mpt_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd)
>  * @cmd:  mfi cmd pointer
>  *
>  */
>-int
>+static int
> megasas_issue_dcmd_fusion(struct megasas_instance *instance,
> struct megasas_cmd *cmd)
> {
>@@ -2748,8 +2748,9 @@ megasas_check_reset_fusion(struct megasas_instance
>*instance,  }
>
> /* This function waits for outstanding commands on fusion to complete */
-int
>megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
>-  int reason, int *convert)
>+static int
>+megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
>+  int reason, int *convert)
> {
>   int i, outstanding, retval = 0, hb_seconds_missed = 0;
>   u32 fw_state;
>@@ -2849,7 +2850,7 @@ void  megasas_reset_reply_desc(struct
>megasas_instance *instance)
>  * megasas_refire_mgmt_cmd :  Re-fire management commands
>  * @instance: Controller's soft instance
> */
>-void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
>+static void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
> {
>   int j;
>   struct megasas_cmd_fusion *cmd_fusion; @@ -3332,7 +,8 @@ int
>megasas_reset_target_fusion(struct scsi_cmnd *scmd)  }
>
> /*SRIOV get other instance in cluster if any*/ -struct megasas_instance
>*megasas_get_peer_instance(struct megasas_instance *instance)
>+static struct megasas_instance *
>+megasas_get_peer_instance(struct megasas_instance *instance)
> {
>   int i;
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>
 >
>--
>2.7.4


RE: [PATCH 1/3] megaraid_sas: mark symbols static where possible

2016-09-25 Thread Sumit Saxena
ance *instance, struct
>megasas_cmd *cmd)
>  * @cmd:  mfi cmd pointer
>  *
>  */
>-int
>+static int
> megasas_issue_dcmd_fusion(struct megasas_instance *instance,
> struct megasas_cmd *cmd)
> {
>@@ -2748,8 +2748,9 @@ megasas_check_reset_fusion(struct megasas_instance
>*instance,  }
>
> /* This function waits for outstanding commands on fusion to complete */
-int
>megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
>-  int reason, int *convert)
>+static int
>+megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
>+  int reason, int *convert)
> {
>   int i, outstanding, retval = 0, hb_seconds_missed = 0;
>   u32 fw_state;
>@@ -2849,7 +2850,7 @@ void  megasas_reset_reply_desc(struct
>megasas_instance *instance)
>  * megasas_refire_mgmt_cmd :  Re-fire management commands
>  * @instance: Controller's soft instance
> */
>-void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
>+static void megasas_refire_mgmt_cmd(struct megasas_instance *instance)
> {
>   int j;
>   struct megasas_cmd_fusion *cmd_fusion; @@ -3332,7 +,8 @@ int
>megasas_reset_target_fusion(struct scsi_cmnd *scmd)  }
>
> /*SRIOV get other instance in cluster if any*/ -struct megasas_instance
>*megasas_get_peer_instance(struct megasas_instance *instance)
>+static struct megasas_instance *
>+megasas_get_peer_instance(struct megasas_instance *instance)
> {
>   int i;
Acked-by: Sumit Saxena 
 >
>--
>2.7.4


RE: [PATCH] megaraid_sas: clean function declarations in megaraid_sas_base.c up

2016-09-19 Thread Sumit Saxena
>-Original Message-
>From: Baoyou Xie [mailto:baoyou@linaro.org]
>Sent: Sunday, September 18, 2016 5:38 PM
>To: kashyap.de...@avagotech.com; sumit.sax...@avagotech.com;
>uday.ling...@avagotech.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; a...@arndb.de; baoyou@linaro.org;
>xie.bao...@zte.com.cn
>Subject: [PATCH] megaraid_sas: clean function declarations in
>megaraid_sas_base.c up
>
>We get a few warnings when building kernel with W=1:
>drivers/scsi/megaraid/megaraid_sas_fusion.c:281:1: warning: no previous
>prototype for 'megasas_free_cmds_fusion' [-Wmissing-prototypes]
>drivers/scsi/megaraid/megaraid_sas_fusion.c:714:1: warning: no previous
>prototype for 'megasas_ioc_init_fusion' [-Wmissing-prototypes] 
>
>In fact, these functions are declared in
>drivers/scsi/megaraid/megaraid_sas_base.c, but should be declared in a
header
>file, thus can be recognized in other file.
>
>So this patch adds the declarations into
>drivers/scsi/megaraid/megaraid_sas_fusion.h.
>
>Signed-off-by: Baoyou Xie <baoyou@linaro.org>
>---
> drivers/scsi/megaraid/megaraid_sas_base.c   | 13 -
> drivers/scsi/megaraid/megaraid_sas_fusion.h |  9 +
> 2 files changed, 9 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 2d62d71..b73b6f3 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -189,25 +189,12 @@ u32
> megasas_build_and_issue_cmd(struct megasas_instance *instance,
>   struct scsi_cmnd *scmd);
> static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
-
>megasas_release_fusion(struct megasas_instance *instance); -int -
>megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
>megasas_free_cmds_fusion(struct megasas_instance *instance);
>-u8
>-megasas_get_map_info(struct megasas_instance *instance); -int -
>megasas_sync_map_info(struct megasas_instance *instance);  int
>wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd,
>   int seconds);
>-void megasas_reset_reply_desc(struct megasas_instance *instance);  void
>megasas_fusion_ocr_wq(struct work_struct *work);  static int
>megasas_get_ld_vf_affiliation(struct megasas_instance *instance,
>int initial);
>-int megasas_check_mpio_paths(struct megasas_instance *instance,
>-   struct scsi_cmnd *scmd);
>
> int
> megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd
>*cmd) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h
>b/drivers/scsi/megaraid/megaraid_sas_fusion.h
>index 80eaee2..3fe730a 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h
>@@ -991,5 +991,14 @@ union desc_value {
>   } u;
> };
>
>+void megasas_free_cmds_fusion(struct megasas_instance *instance); int
>+megasas_ioc_init_fusion(struct megasas_instance *instance);
>+u8 megasas_get_map_info(struct megasas_instance *instance); int
>+megasas_sync_map_info(struct megasas_instance *instance); void
>+megasas_release_fusion(struct megasas_instance *instance); void
>+megasas_reset_reply_desc(struct megasas_instance *instance); int
>+megasas_check_mpio_paths(struct megasas_instance *instance,
>+struct scsi_cmnd *scmd);
>+void megasas_fusion_ocr_wq(struct work_struct *work);
>
> #endif /* _MEGARAID_SAS_FUSION_H_ */
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.7.4


RE: [PATCH] megaraid_sas: clean function declarations in megaraid_sas_base.c up

2016-09-19 Thread Sumit Saxena
>-Original Message-
>From: Baoyou Xie [mailto:baoyou@linaro.org]
>Sent: Sunday, September 18, 2016 5:38 PM
>To: kashyap.de...@avagotech.com; sumit.sax...@avagotech.com;
>uday.ling...@avagotech.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; a...@arndb.de; baoyou@linaro.org;
>xie.bao...@zte.com.cn
>Subject: [PATCH] megaraid_sas: clean function declarations in
>megaraid_sas_base.c up
>
>We get a few warnings when building kernel with W=1:
>drivers/scsi/megaraid/megaraid_sas_fusion.c:281:1: warning: no previous
>prototype for 'megasas_free_cmds_fusion' [-Wmissing-prototypes]
>drivers/scsi/megaraid/megaraid_sas_fusion.c:714:1: warning: no previous
>prototype for 'megasas_ioc_init_fusion' [-Wmissing-prototypes] 
>
>In fact, these functions are declared in
>drivers/scsi/megaraid/megaraid_sas_base.c, but should be declared in a
header
>file, thus can be recognized in other file.
>
>So this patch adds the declarations into
>drivers/scsi/megaraid/megaraid_sas_fusion.h.
>
>Signed-off-by: Baoyou Xie 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c   | 13 -
> drivers/scsi/megaraid/megaraid_sas_fusion.h |  9 +
> 2 files changed, 9 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 2d62d71..b73b6f3 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -189,25 +189,12 @@ u32
> megasas_build_and_issue_cmd(struct megasas_instance *instance,
>   struct scsi_cmnd *scmd);
> static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
-
>megasas_release_fusion(struct megasas_instance *instance); -int -
>megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
>megasas_free_cmds_fusion(struct megasas_instance *instance);
>-u8
>-megasas_get_map_info(struct megasas_instance *instance); -int -
>megasas_sync_map_info(struct megasas_instance *instance);  int
>wait_and_poll(struct megasas_instance *instance, struct megasas_cmd *cmd,
>   int seconds);
>-void megasas_reset_reply_desc(struct megasas_instance *instance);  void
>megasas_fusion_ocr_wq(struct work_struct *work);  static int
>megasas_get_ld_vf_affiliation(struct megasas_instance *instance,
>int initial);
>-int megasas_check_mpio_paths(struct megasas_instance *instance,
>-   struct scsi_cmnd *scmd);
>
> int
> megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd
>*cmd) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h
>b/drivers/scsi/megaraid/megaraid_sas_fusion.h
>index 80eaee2..3fe730a 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h
>@@ -991,5 +991,14 @@ union desc_value {
>   } u;
> };
>
>+void megasas_free_cmds_fusion(struct megasas_instance *instance); int
>+megasas_ioc_init_fusion(struct megasas_instance *instance);
>+u8 megasas_get_map_info(struct megasas_instance *instance); int
>+megasas_sync_map_info(struct megasas_instance *instance); void
>+megasas_release_fusion(struct megasas_instance *instance); void
>+megasas_reset_reply_desc(struct megasas_instance *instance); int
>+megasas_check_mpio_paths(struct megasas_instance *instance,
>+struct scsi_cmnd *scmd);
>+void megasas_fusion_ocr_wq(struct work_struct *work);
>
> #endif /* _MEGARAID_SAS_FUSION_H_ */
Acked-by: Sumit Saxena 

>--
>2.7.4


RE: [PATCH] scsi: megaraid_sas: add in missing white space in error message text

2016-09-13 Thread Sumit Saxena
>-Original Message-
>From: Colin King [mailto:colin.k...@canonical.com]
>Sent: Monday, September 12, 2016 6:12 PM
>To: Kashyap Desai; Sumit Saxena; Uday Lingala; James E . J . Bottomley;
>Martin K
>. Petersen; megaraidlinux@avagotech.com; linux-s...@vger.kernel.org
>Cc: linux-kernel@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: add in missing white space in error
>message
>text
>
>From: Colin Ian King <colin.k...@canonical.com>
>
>A dev_printk message spans two lines and the literal string is missing a
>white
>space between words. Add the white space.
>
>Signed-off-by: Colin Ian King <colin.k...@canonical.com>
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 2d62d71..c236c4d 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -5782,7 +5782,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>>consumer_h);
>
>   if (!instance->producer || !instance->consumer) {
>-  dev_printk(KERN_DEBUG, >dev, "Failed to
>allocate"
>+  dev_printk(KERN_DEBUG, >dev, "Failed to
>allocate "
>  "memory for producer, consumer\n");
>   goto fail_alloc_dma_buf;
>   }
Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>
>--
>2.9.3


RE: [PATCH] scsi: megaraid_sas: add in missing white space in error message text

2016-09-13 Thread Sumit Saxena
>-Original Message-
>From: Colin King [mailto:colin.k...@canonical.com]
>Sent: Monday, September 12, 2016 6:12 PM
>To: Kashyap Desai; Sumit Saxena; Uday Lingala; James E . J . Bottomley;
>Martin K
>. Petersen; megaraidlinux@avagotech.com; linux-s...@vger.kernel.org
>Cc: linux-kernel@vger.kernel.org
>Subject: [PATCH] scsi: megaraid_sas: add in missing white space in error
>message
>text
>
>From: Colin Ian King 
>
>A dev_printk message spans two lines and the literal string is missing a
>white
>space between words. Add the white space.
>
>Signed-off-by: Colin Ian King 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 2d62d71..c236c4d 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -5782,7 +5782,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>>consumer_h);
>
>   if (!instance->producer || !instance->consumer) {
>-  dev_printk(KERN_DEBUG, >dev, "Failed to
>allocate"
>+  dev_printk(KERN_DEBUG, >dev, "Failed to
>allocate "
>      "memory for producer, consumer\n");
>   goto fail_alloc_dma_buf;
>   }
Acked-by: Sumit Saxena 
>--
>2.9.3


RE: [PATCH] megaraid_sas: Fix the search of first memory bar

2016-08-25 Thread Sumit Saxena
>-Original Message-
>From: Christophe JAILLET [mailto:christophe.jail...@wanadoo.fr]
>Sent: Sunday, August 21, 2016 1:58 PM
>To: kashyap.de...@avagotech.com; sumit.sax...@avagotech.com;
>uday.ling...@avagotech.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; kernel-janit...@vger.kernel.org; Christophe JAILLET
>Subject: [PATCH] megaraid_sas: Fix the search of first memory bar
>
>The 2nd parameter of 'find_first_bit' is the number of bits to search.
>In this case, we are passing 'sizeof(unsigned long)' which is likely to be
>4.
>
>It is likely that the number of bits in a long was expected here, so use
>BITS_PER_LONG instead.
>
>Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr>
>---
>Other options are possible:
>  - 'bar_list' being a 'unsigned long', use __ffs to reduce code verbosity
>  - PCI_NUM_RESOURCES, which is the maximum number of bits that can be set
>by 'pci_select_bars()'
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25adb17e..7d3de811d33c 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -5036,7 +5036,7 @@ static int megasas_init_fw(struct megasas_instance
>*instance)
>
>   /* Find first memory bar */
>   bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
>-  instance->bar = find_first_bit(_list, sizeof(unsigned long));
>+  instance->bar = find_first_bit(_list, BITS_PER_LONG);
>   if (pci_request_selected_regions(instance->pdev, 1<bar,
>        "megasas: LSI")) {
>   dev_printk(KERN_DEBUG, >pdev->dev, "IO memory
>region busy!\n");

Acked by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.7.4
>
>
>---
>L'absence de virus dans ce courrier électronique a été vérifiée par le
>logiciel
>antivirus Avast.
>https://www.avast.com/antivirus


RE: [PATCH] megaraid_sas: Fix the search of first memory bar

2016-08-25 Thread Sumit Saxena
>-Original Message-
>From: Christophe JAILLET [mailto:christophe.jail...@wanadoo.fr]
>Sent: Sunday, August 21, 2016 1:58 PM
>To: kashyap.de...@avagotech.com; sumit.sax...@avagotech.com;
>uday.ling...@avagotech.com; j...@linux.vnet.ibm.com;
>martin.peter...@oracle.com
>Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org; kernel-janit...@vger.kernel.org; Christophe JAILLET
>Subject: [PATCH] megaraid_sas: Fix the search of first memory bar
>
>The 2nd parameter of 'find_first_bit' is the number of bits to search.
>In this case, we are passing 'sizeof(unsigned long)' which is likely to be
>4.
>
>It is likely that the number of bits in a long was expected here, so use
>BITS_PER_LONG instead.
>
>Signed-off-by: Christophe JAILLET 
>---
>Other options are possible:
>  - 'bar_list' being a 'unsigned long', use __ffs to reduce code verbosity
>  - PCI_NUM_RESOURCES, which is the maximum number of bits that can be set
>by 'pci_select_bars()'
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25adb17e..7d3de811d33c 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -5036,7 +5036,7 @@ static int megasas_init_fw(struct megasas_instance
>*instance)
>
>   /* Find first memory bar */
>   bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
>-  instance->bar = find_first_bit(_list, sizeof(unsigned long));
>+  instance->bar = find_first_bit(_list, BITS_PER_LONG);
>   if (pci_request_selected_regions(instance->pdev, 1<bar,
>        "megasas: LSI")) {
>   dev_printk(KERN_DEBUG, >pdev->dev, "IO memory
>region busy!\n");

Acked by: Sumit Saxena 

>--
>2.7.4
>
>
>---
>L'absence de virus dans ce courrier électronique a été vérifiée par le
>logiciel
>antivirus Avast.
>https://www.avast.com/antivirus


RE: [PATCH] megaraid_sas: Use memdup_user() rather than duplicating its implementation

2016-08-22 Thread Sumit Saxena
>-Original Message-
>From: SF Markus Elfring [mailto:elfr...@users.sourceforge.net]
>Sent: Sunday, August 21, 2016 2:19 PM
>To: linux-s...@vger.kernel.org; megaraidlinux@avagotech.com; James E.
>J.
>Bottomley; Kashyap Desai; Martin K. Petersen; Sumit Saxena; Uday Lingala
>Cc: LKML; kernel-janit...@vger.kernel.org; Julia Lawall
>Subject: [PATCH] megaraid_sas: Use memdup_user() rather than duplicating
>its
>implementation
>
>From: Markus Elfring <elfr...@users.sourceforge.net>
>Date: Sun, 21 Aug 2016 10:39:04 +0200
>
>Reuse existing functionality from memdup_user() instead of keeping
>duplicate
>source code.
>
>This issue was detected by using the Coccinelle software.
>
>Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 11 +++
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25a..9a2fe4e 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -6711,14 +6711,9 @@ static int megasas_mgmt_ioctl_fw(struct file *file,
>unsigned long arg)
>   unsigned long flags;
>   u32 wait_time = MEGASAS_RESET_WAIT_TIME;
>
>-  ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
>-  if (!ioc)
>-  return -ENOMEM;
>-
>-  if (copy_from_user(ioc, user_ioc, sizeof(*ioc))) {
>-  error = -EFAULT;
>-  goto out_kfree_ioc;
>-  }
>+  ioc = memdup_user(user_ioc, sizeof(*ioc));
>+  if (IS_ERR(ioc))
>+  return PTR_ERR(ioc);
>
>   instance = megasas_lookup_instance(ioc->host_no);
>   if (!instance) {

Acked by: Sumit Saxena <sumit.sax...@broadcom.com>

>--
>2.9.3


RE: [PATCH] megaraid_sas: Use memdup_user() rather than duplicating its implementation

2016-08-22 Thread Sumit Saxena
>-Original Message-
>From: SF Markus Elfring [mailto:elfr...@users.sourceforge.net]
>Sent: Sunday, August 21, 2016 2:19 PM
>To: linux-s...@vger.kernel.org; megaraidlinux@avagotech.com; James E.
>J.
>Bottomley; Kashyap Desai; Martin K. Petersen; Sumit Saxena; Uday Lingala
>Cc: LKML; kernel-janit...@vger.kernel.org; Julia Lawall
>Subject: [PATCH] megaraid_sas: Use memdup_user() rather than duplicating
>its
>implementation
>
>From: Markus Elfring 
>Date: Sun, 21 Aug 2016 10:39:04 +0200
>
>Reuse existing functionality from memdup_user() instead of keeping
>duplicate
>source code.
>
>This issue was detected by using the Coccinelle software.
>
>Signed-off-by: Markus Elfring 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 11 +++
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index c1ed25a..9a2fe4e 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -6711,14 +6711,9 @@ static int megasas_mgmt_ioctl_fw(struct file *file,
>unsigned long arg)
>   unsigned long flags;
>   u32 wait_time = MEGASAS_RESET_WAIT_TIME;
>
>-  ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
>-  if (!ioc)
>-  return -ENOMEM;
>-
>-  if (copy_from_user(ioc, user_ioc, sizeof(*ioc))) {
>-  error = -EFAULT;
>-  goto out_kfree_ioc;
>-  }
>+  ioc = memdup_user(user_ioc, sizeof(*ioc));
>+  if (IS_ERR(ioc))
>+  return PTR_ERR(ioc);
>
>   instance = megasas_lookup_instance(ioc->host_no);
>   if (!instance) {

Acked by: Sumit Saxena 

>--
>2.9.3


RE: [PATCH] megaraid_sas: fix missing { }, nullify kbuff_arr[i] only when necessary

2016-03-22 Thread Sumit Saxena
> -Original Message-
> From: Colin King [mailto:colin.k...@canonical.com]
> Sent: Sunday, March 20, 2016 10:34 PM
> To: Kashyap Desai; Sumit Saxena; James Bottomley; Martin K . Petersen;
> megaraidlinux@avagotech.com; linux-s...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH] megaraid_sas: fix missing { }, nullify kbuff_arr[i]
only when
> necessary
>
> From: Colin Ian King <colin.k...@canonical.com>
>
> Fix missing { } on if statement, this change will nullify kbuff_arr[i]
only where
> necessary as the code intended.
>
> detected using static analysis with smatch
>
> Signed-off-by: Colin Ian King <colin.k...@canonical.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 69d375b..e6ebc7a 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -6656,12 +6656,13 @@ out:
>   }
>
>   for (i = 0; i < ioc->sge_count; i++) {
> - if (kbuff_arr[i])
> + if (kbuff_arr[i]) {
>   dma_free_coherent(>pdev->dev,
>
le32_to_cpu(kern_sge32[i].length),
> kbuff_arr[i],
>
> le32_to_cpu(kern_sge32[i].phys_addr));
>   kbuff_arr[i] = NULL;
> + }
>   }
>
>   megasas_return_cmd(instance, cmd);

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

> --
> 2.7.3


RE: [PATCH] megaraid_sas: fix missing { }, nullify kbuff_arr[i] only when necessary

2016-03-22 Thread Sumit Saxena
> -Original Message-
> From: Colin King [mailto:colin.k...@canonical.com]
> Sent: Sunday, March 20, 2016 10:34 PM
> To: Kashyap Desai; Sumit Saxena; James Bottomley; Martin K . Petersen;
> megaraidlinux@avagotech.com; linux-s...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH] megaraid_sas: fix missing { }, nullify kbuff_arr[i]
only when
> necessary
>
> From: Colin Ian King 
>
> Fix missing { } on if statement, this change will nullify kbuff_arr[i]
only where
> necessary as the code intended.
>
> detected using static analysis with smatch
>
> Signed-off-by: Colin Ian King 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 69d375b..e6ebc7a 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -6656,12 +6656,13 @@ out:
>   }
>
>   for (i = 0; i < ioc->sge_count; i++) {
> - if (kbuff_arr[i])
> + if (kbuff_arr[i]) {
>   dma_free_coherent(>pdev->dev,
>
le32_to_cpu(kern_sge32[i].length),
> kbuff_arr[i],
>
> le32_to_cpu(kern_sge32[i].phys_addr));
>       kbuff_arr[i] = NULL;
> + }
>   }
>
>   megasas_return_cmd(instance, cmd);

Acked-by: Sumit Saxena 

> --
> 2.7.3


RE: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl handler

2016-03-15 Thread Sumit Saxena
> -Original Message-
> From: Arnd Bergmann [mailto:a...@arndb.de]
> Sent: Monday, March 14, 2016 8:00 PM
> To: martin.peter...@oracle.com; james.bottom...@hansenpartnership.com;
> Kashyap Desai; Sumit Saxena; Uday Lingala; James E.J. Bottomley
> Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; Arnd
Bergmann;
> Tomas Henzl; Bjorn Helgaas; megaraidlinux@avagotech.com
> Subject: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl
handler
>
> gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl
> function:
>
> drivers/scsi/megaraid/megaraid_sas_base.c: In function
> 'megasas_mgmt_fw_ioctl':
> drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is
> indented as if it were guarded by... [-Wmisleading-indentation]
> kbuff_arr[i] = NULL;
> ^
> drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if'
clause, but
> it is not
>if (kbuff_arr[i])
>^~
>
> The code is actually correct, as there is no downside in clearing a NULL
pointer
> again.
>
> This clarifies the code and avoids the warning by adding extra curly
braces.
>
> Signed-off-by: Arnd Bergmann <a...@arndb.de>
> Fixes: 90dc9d98f01b ("megaraid_sas : MFI MPT linked list corruption
fix")
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 5c08568ccfbf..2627200d4f82 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -6650,12 +6650,13 @@ out:
>   }
>
>   for (i = 0; i < ioc->sge_count; i++) {
> - if (kbuff_arr[i])
> + if (kbuff_arr[i]) {
>   dma_free_coherent(>pdev->dev,
>
le32_to_cpu(kern_sge32[i].length),
> kbuff_arr[i],
>
> le32_to_cpu(kern_sge32[i].phys_addr));
>   kbuff_arr[i] = NULL;
> + }
>   }
>
>   megasas_return_cmd(instance, cmd);

Acked-by: Sumit Saxena <sumit.sax...@broadcom.com>

> --
> 2.7.0


RE: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl handler

2016-03-15 Thread Sumit Saxena
> -Original Message-
> From: Arnd Bergmann [mailto:a...@arndb.de]
> Sent: Monday, March 14, 2016 8:00 PM
> To: martin.peter...@oracle.com; james.bottom...@hansenpartnership.com;
> Kashyap Desai; Sumit Saxena; Uday Lingala; James E.J. Bottomley
> Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; Arnd
Bergmann;
> Tomas Henzl; Bjorn Helgaas; megaraidlinux@avagotech.com
> Subject: [PATCH 3/3] megaraid_sas: add missing curly braces in ioctl
handler
>
> gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl
> function:
>
> drivers/scsi/megaraid/megaraid_sas_base.c: In function
> 'megasas_mgmt_fw_ioctl':
> drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is
> indented as if it were guarded by... [-Wmisleading-indentation]
> kbuff_arr[i] = NULL;
> ^
> drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if'
clause, but
> it is not
>if (kbuff_arr[i])
>^~
>
> The code is actually correct, as there is no downside in clearing a NULL
pointer
> again.
>
> This clarifies the code and avoids the warning by adding extra curly
braces.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: 90dc9d98f01b ("megaraid_sas : MFI MPT linked list corruption
fix")
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 5c08568ccfbf..2627200d4f82 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -6650,12 +6650,13 @@ out:
>   }
>
>   for (i = 0; i < ioc->sge_count; i++) {
> - if (kbuff_arr[i])
> + if (kbuff_arr[i]) {
>   dma_free_coherent(>pdev->dev,
>
le32_to_cpu(kern_sge32[i].length),
> kbuff_arr[i],
>
> le32_to_cpu(kern_sge32[i].phys_addr));
>   kbuff_arr[i] = NULL;
> + }
>   }
>
>   megasas_return_cmd(instance, cmd);

Acked-by: Sumit Saxena 

> --
> 2.7.0


RE: [PATCH RESEND] megaraid:Fix for loop termination statment in the function process_fw_state_change_wq

2016-01-03 Thread Sumit Saxena
> -Original Message-
> From: Nicholas Krause [mailto:xerofo...@gmail.com]
> Sent: Friday, January 01, 2016 12:06 PM
> To: kashyap.de...@avagotech.com
> Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
> jbottom...@odin.com; martin.peter...@oracle.com;
> megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: [PATCH RESEND] megaraid:Fix for loop termination statment in
the
> function process_fw_state_change_wq
>
> This fixes the for loop terimation for the waiting period between the
first and
> second init to make the variable wait terminate at the value of 20
rather then 30
> in other to follow the comments about this for loop of waiting for about
20
> seconds rather then
> 30 in the function fw_state_change_wq between initializations.
>
> Signed-off-by: Nicholas Krause 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 71b884d..22fd333 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3168,9 +3168,8 @@ process_fw_state_change_wq(struct work_struct
> *work)
>   "state 2 starting...\n");
>
>   /*waitting for about 20 second before start the second
init*/
> - for (wait = 0; wait < 30; wait++) {
> + for (wait = 0; wait < 20; wait++)
>   msleep(1000);
> - }
>
>   if (megasas_transition_to_ready(instance, 1)) {
>   printk(KERN_NOTICE "megaraid_sas:adapter not
> ready\n");

There should be 30 seconds delay here, comments needs to be rectified
here. I will take care of this in next patch set.
> --
> 2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RESEND] megaraid:Fix for loop termination statment in the function process_fw_state_change_wq

2016-01-03 Thread Sumit Saxena
> -Original Message-
> From: Nicholas Krause [mailto:xerofo...@gmail.com]
> Sent: Friday, January 01, 2016 12:06 PM
> To: kashyap.de...@avagotech.com
> Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
> jbottom...@odin.com; martin.peter...@oracle.com;
> megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: [PATCH RESEND] megaraid:Fix for loop termination statment in
the
> function process_fw_state_change_wq
>
> This fixes the for loop terimation for the waiting period between the
first and
> second init to make the variable wait terminate at the value of 20
rather then 30
> in other to follow the comments about this for loop of waiting for about
20
> seconds rather then
> 30 in the function fw_state_change_wq between initializations.
>
> Signed-off-by: Nicholas Krause 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 71b884d..22fd333 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3168,9 +3168,8 @@ process_fw_state_change_wq(struct work_struct
> *work)
>   "state 2 starting...\n");
>
>   /*waitting for about 20 second before start the second
init*/
> - for (wait = 0; wait < 30; wait++) {
> + for (wait = 0; wait < 20; wait++)
>   msleep(1000);
> - }
>
>   if (megasas_transition_to_ready(instance, 1)) {
>   printk(KERN_NOTICE "megaraid_sas:adapter not
> ready\n");

There should be 30 seconds delay here, comments needs to be rectified
here. I will take care of this in next patch set.
> --
> 2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally

2015-12-02 Thread Sumit Saxena
patch- "aed335e megaraid_sas: Make tape drives visible on PERC5
controllers" is must along with current patch. Please consider.

> -Original Message-
> From: Kamal Mostafa [mailto:ka...@canonical.com]
> Sent: Wednesday, December 02, 2015 10:29 PM
> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; kernel-
> t...@lists.ubuntu.com
> Cc: Sumit Saxena; Kashyap Desai; Martin K. Petersen; Kamal Mostafa
> Subject: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives
> unconditionally
>
> 3.19.8-ckt11 -stable review patch.  If anyone has any objections, please
let me
> know.
>
> --
>
> From: "sumit.sax...@avagotech.com" 
>
> commit 0d5b47a724bab0ebaaa933d6ff5e584957aaa188 upstream.
>
> Expose non-disk (TAPE drive, CD-ROM) unconditionally.
>
> Signed-off-by: Sumit Saxena 
> Signed-off-by: Kashyap Desai 
> Reviewed-by: Tomas Henzl 
> Reviewed-by: Martin K. Petersen 
> Signed-off-by: Martin K. Petersen 
> Signed-off-by: Kamal Mostafa 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index e541c6c..70cf60a 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device
> *sdev)
>   pd_index =
>   (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL)
> +
>   sdev->id;
> - if (instance->pd_list[pd_index].driveState ==
> - MR_PD_STATE_SYSTEM) {
> + if ((instance->pd_list[pd_index].driveState ==
> + MR_PD_STATE_SYSTEM) ||
> + (instance->pd_list[pd_index].driveType !=
TYPE_DISK)) {
>   return 0;
>   }
>   return -ENXIO;
> --
> 1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally

2015-12-02 Thread Sumit Saxena
patch- "aed335e megaraid_sas: Make tape drives visible on PERC5
controllers" is must along with current patch. Please consider.

> -Original Message-
> From: Kamal Mostafa [mailto:ka...@canonical.com]
> Sent: Wednesday, December 02, 2015 10:29 PM
> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; kernel-
> t...@lists.ubuntu.com
> Cc: Sumit Saxena; Kashyap Desai; Martin K. Petersen; Kamal Mostafa
> Subject: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives
> unconditionally
>
> 3.19.8-ckt11 -stable review patch.  If anyone has any objections, please
let me
> know.
>
> --
>
> From: "sumit.sax...@avagotech.com" <sumit.sax...@avagotech.com>
>
> commit 0d5b47a724bab0ebaaa933d6ff5e584957aaa188 upstream.
>
> Expose non-disk (TAPE drive, CD-ROM) unconditionally.
>
> Signed-off-by: Sumit Saxena <sumit.sax...@avagotech.com>
> Signed-off-by: Kashyap Desai <kashyap.de...@avagotech.com>
> Reviewed-by: Tomas Henzl <the...@redhat.com>
> Reviewed-by: Martin K. Petersen <martin.peter...@oracle.com>
> Signed-off-by: Martin K. Petersen <martin.peter...@oracle.com>
> Signed-off-by: Kamal Mostafa <ka...@canonical.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index e541c6c..70cf60a 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device
> *sdev)
>   pd_index =
>   (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL)
> +
>   sdev->id;
> - if (instance->pd_list[pd_index].driveState ==
> - MR_PD_STATE_SYSTEM) {
> + if ((instance->pd_list[pd_index].driveState ==
> + MR_PD_STATE_SYSTEM) ||
> + (instance->pd_list[pd_index].driveType !=
TYPE_DISK)) {
>   return 0;
>   }
>   return -ENXIO;
> --
> 1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v3 3/3] megaraid_sas : fix whitespace errors

2015-07-08 Thread Sumit Saxena
> -Original Message-
> From: Bjorn Helgaas [mailto:bhelg...@google.com]
> Sent: Wednesday, July 08, 2015 2:23 AM
> To: Kashyap Desai; Uday Lingala; Sumit Saxena
> Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; James
> E.J.
> Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
> Subject: [PATCH v3 3/3] megaraid_sas : fix whitespace errors
>
> Fix whitespace and indentation errors.  No code change.
>
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c |  244
> ++--
> -
>  1 file changed, 118 insertions(+), 126 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index a9bd592..5156faa 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -273,6 +273,7 @@ static inline void
>  megasas_enable_intr_xscale(struct megasas_instance *instance)  {
>   struct megasas_register_set __iomem *regs;
> +
>   regs = instance->reg_set;
>   writel(0, &(regs)->outbound_intr_mask);
>
> @@ -289,6 +290,7 @@ megasas_disable_intr_xscale(struct megasas_instance
> *instance)  {
>   struct megasas_register_set __iomem *regs;
>   u32 mask = 0x1f;
> +
>   regs = instance->reg_set;
>   writel(mask, >outbound_intr_mask);
>   /* Dummy readl to force pci flush */
> @@ -313,6 +315,7 @@ megasas_clear_intr_xscale(struct megasas_register_set
> __iomem * regs)  {
>   u32 status;
>   u32 mfiStatus = 0;
> +
>   /*
>* Check if it is our interrupt
>*/
> @@ -348,6 +351,7 @@ megasas_fire_cmd_xscale(struct megasas_instance
> *instance,
>   struct megasas_register_set __iomem *regs)  {
>   unsigned long flags;
> +
>   spin_lock_irqsave(>hba_lock, flags);
>   writel((frame_phys_addr >> 3)|(frame_count),
>  &(regs)->inbound_queue_port);
> @@ -364,6 +368,7 @@ megasas_adp_reset_xscale(struct megasas_instance
> *instance,  {
>   u32 i;
>   u32 pcidata;
> +
>   writel(MFI_ADP_RESET, >inbound_doorbell);
>
>   for (i = 0; i < 3; i++)
> @@ -402,7 +407,6 @@ static int
>  megasas_check_reset_xscale(struct megasas_instance *instance,
>   struct megasas_register_set __iomem *regs)  {
> -
>   if ((instance->adprecovery != MEGASAS_HBA_OPERATIONAL) &&
>   (le32_to_cpu(*instance->consumer) ==
>   MEGASAS_ADPRESET_INPROG_SIGN))
> @@ -433,7 +437,7 @@ static struct megasas_instance_template
> megasas_instance_template_xscale = {
>
>  /**
>  *The following functions are defined for ppc (deviceid : 0x60)
> -*controllers
> +*controllers
>  */
>
>  /**
> @@ -444,6 +448,7 @@ static inline void
>  megasas_enable_intr_ppc(struct megasas_instance *instance)  {
>   struct megasas_register_set __iomem *regs;
> +
>   regs = instance->reg_set;
>   writel(0x, &(regs)->outbound_doorbell_clear);
>
> @@ -462,6 +467,7 @@ megasas_disable_intr_ppc(struct megasas_instance
> *instance)  {
>   struct megasas_register_set __iomem *regs;
>   u32 mask = 0x;
> +
>   regs = instance->reg_set;
>   writel(mask, >outbound_intr_mask);
>   /* Dummy readl to force pci flush */
> @@ -522,6 +528,7 @@ megasas_fire_cmd_ppc(struct megasas_instance
> *instance,
>   struct megasas_register_set __iomem *regs)  {
>   unsigned long flags;
> +
>   spin_lock_irqsave(>hba_lock, flags);
>   writel((frame_phys_addr | (frame_count<<1))|1,
>   &(regs)->inbound_queue_port);
> @@ -566,6 +573,7 @@ static inline void
>  megasas_enable_intr_skinny(struct megasas_instance *instance)  {
>   struct megasas_register_set __iomem *regs;
> +
>   regs = instance->reg_set;
>   writel(0x, &(regs)->outbound_intr_mask);
>
> @@ -584,6 +592,7 @@ megasas_disable_intr_skinny(struct megasas_instance
> *instance)  {
>   struct megasas_register_set __iomem *regs;
>   u32 mask = 0x;
> +
>   regs = instance->reg_set;
>   writel(mask, >outbound_intr_mask);
>   /* Dummy readl to force pci flush */
> @@ -634,8 +643,8 @@ megasas_clear_intr_skinny(struct megasas_register_set
> __iomem *regs)
>   writel(status, >outbound_intr_status);
>
>   /*
> - * dummy read to flush PCI
> - */
> +  * dummy read to flush PCI
> +  */
>   readl(>outbound_intr_status);
>
>   return mfiStatus;
> @@ -654,6 +663,7 @@ megasas_fire_cmd_ski

RE: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible

2015-07-08 Thread Sumit Saxena
> -Original Message-
> From: Bjorn Helgaas [mailto:bhelg...@google.com]
> Sent: Wednesday, July 08, 2015 2:23 AM
> To: Kashyap Desai; Uday Lingala; Sumit Saxena
> Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; James
> E.J.
> Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
> Subject: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
>
> Use dev_printk() when possible to make messages more useful.
>
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c   |  304
> +--
>  drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 
>  2 files changed, 196 insertions(+), 203 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 71b884d..a9bd592 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -216,7 +216,7 @@ struct megasas_cmd *megasas_get_cmd(struct
> megasas_instance
>struct megasas_cmd, list);
>   list_del_init(>list);
>   } else {
> - printk(KERN_ERR "megasas: Command pool empty!\n");
> + dev_err(>pdev->dev, "Command pool empty!\n");
>   }
>
>   spin_unlock_irqrestore(>mfi_pool_lock, flags);
> @@ -370,9 +370,9 @@ megasas_adp_reset_xscale(struct megasas_instance
> *instance,
>   msleep(1000); /* sleep for 3 secs */
>   pcidata  = 0;
>   pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET,
> );
> - printk(KERN_NOTICE "pcidata = %x\n", pcidata);
> + dev_notice(>pdev->dev, "pcidata = %x\n", pcidata);
>   if (pcidata & 0x2) {
> - printk(KERN_NOTICE "mfi 1068 offset read=%x\n", pcidata);
> + dev_notice(>pdev->dev, "mfi 1068 offset
> read=%x\n", pcidata);
>   pcidata &= ~0x2;
>   pci_write_config_dword(instance->pdev,
>   MFI_1068_PCSR_OFFSET, pcidata);
> @@ -383,9 +383,9 @@ megasas_adp_reset_xscale(struct megasas_instance
> *instance,
>   pcidata  = 0;
>   pci_read_config_dword(instance->pdev,
>   MFI_1068_FW_HANDSHAKE_OFFSET,
> );
> - printk(KERN_NOTICE "1068 offset handshake read=%x\n",
> pcidata);
> + dev_notice(>pdev->dev, "1068 offset handshake
> read=%x\n", pcidata);
>   if ((pcidata & 0x) == MFI_1068_FW_READY) {
> - printk(KERN_NOTICE "1068 offset pcidt=%x\n",
> pcidata);
> + dev_notice(>pdev->dev, "1068 offset
> pcidt=%x\n", pcidata);
>   pcidata = 0;
>   pci_write_config_dword(instance->pdev,
>   MFI_1068_FW_HANDSHAKE_OFFSET, pcidata);
> @@ -824,7 +824,7 @@ megasas_adp_reset_gen2(struct megasas_instance
> *instance,
>   while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
>   msleep(100);
>   HostDiag = (u32)readl(hostdiag_offset);
> - printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n",
> + dev_notice(>pdev->dev, "RESETGEN2: retry=%x,
> hostdiag=%x\n",
>   retry, HostDiag);
>
>   if (retry++ >= 100)
> @@ -832,7 +832,7 @@ megasas_adp_reset_gen2(struct megasas_instance
> *instance,
>
>   }
>
> - printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
> + dev_notice(>pdev->dev, "ADP_RESET_GEN2:
> HostDiag=%x\n", HostDiag);
>
>   writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);
>
> @@ -842,7 +842,7 @@ megasas_adp_reset_gen2(struct megasas_instance
> *instance,
>   while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
>   msleep(100);
>   HostDiag = (u32)readl(hostdiag_offset);
> - printk(KERN_NOTICE "RESET_GEN2: retry=%x, hostdiag=%x\n",
> + dev_notice(>pdev->dev, "RESET_GEN2: retry=%x,
> hostdiag=%x\n",
>   retry, HostDiag);
>
>   if (retry++ >= 1000)
> @@ -1241,7 +1241,7 @@ megasas_build_dcdb(struct megasas_instance
> *instance, struct scsi_cmnd *scp,
> >sgl);
>
>   if (pthru->sge_count > instance->max_num_sge) {
> - printk(KERN_ERR "megasas: DCDB two many SGE NUM=%x\n",
> + dev_err(>pdev->d

RE: [PATCH v3 1/3] megaraid : use dev_printk when possible

2015-07-08 Thread Sumit Saxena
> -Original Message-
> From: Bjorn Helgaas [mailto:bhelg...@google.com]
> Sent: Wednesday, July 08, 2015 2:22 AM
> To: Kashyap Desai; Uday Lingala; Sumit Saxena
> Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; James
> E.J.
> Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
> Subject: [PATCH v3 1/3] megaraid : use dev_printk when possible
>
> Use dev_printk() when possible to make messages more useful.
>
> Signed-off-by: Bjorn Helgaas 
> ---
>  drivers/scsi/megaraid.c |  140
> ++-
>  1 file changed, 66 insertions(+), 74 deletions(-)
>
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index
> bc7b34c..9d05302 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -268,8 +268,8 @@ mega_query_adapter(adapter_t *adapter)
>   raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;/* i.e. 0x0E */
>
>   if ((retval = issue_scb_block(adapter, raw_mbox)))
> - printk(KERN_WARNING
> - "megaraid: Product_info cmd failed with error: %d\n",
> + dev_warn(>dev->dev,
> + "Product_info cmd failed with error: %d\n",
>   retval);
>
>   pci_unmap_single(adapter->dev, prod_info_dma_handle, @@ -
> 334,7 +334,7 @@ mega_query_adapter(adapter_t *adapter)
>   adapter->bios_version[4] = 0;
>   }
>
> - printk(KERN_NOTICE "megaraid: [%s:%s] detected %d logical drives.\n",
> + dev_notice(>dev->dev, "[%s:%s] detected %d logical
> drives\n",
>   adapter->fw_version, adapter->bios_version, adapter-
> >numldrv);
>
>   /*
> @@ -342,7 +342,7 @@ mega_query_adapter(adapter_t *adapter)
>*/
>   adapter->support_ext_cdb = mega_support_ext_cdb(adapter);
>   if (adapter->support_ext_cdb)
> - printk(KERN_NOTICE "megaraid: supports extended CDBs.\n");
> + dev_notice(>dev->dev, "supports extended CDBs\n");
>
>
>   return 0;
> @@ -678,11 +678,11 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd
> *cmd, int *busy)
>
>   if(!(adapter->flag & (1L << cmd->device->channel))) {
>
> - printk(KERN_NOTICE
> - "scsi%d: scanning scsi channel %d ",
> + dev_notice(>dev->dev,
> + "scsi%d: scanning scsi channel %d "
> + "for logical drives\n",
>   adapter->host->host_no,
>   cmd->device->channel);
> - printk("for logical drives.\n");
>
>   adapter->flag |= (1L << cmd->device->channel);
>   }
> @@ -983,11 +983,11 @@ mega_prepare_passthru(adapter_t *adapter, scb_t
> *scb, Scsi_Cmnd *cmd,
>   case READ_CAPACITY:
>   if(!(adapter->flag & (1L << cmd->device->channel))) {
>
> - printk(KERN_NOTICE
> - "scsi%d: scanning scsi channel %d [P%d] ",
> + dev_notice(>dev->dev,
> + "scsi%d: scanning scsi channel %d [P%d] "
> + "for physical devices\n",
>   adapter->host->host_no,
>   cmd->device->channel, channel);
> - printk("for physical devices.\n");
>
>   adapter->flag |= (1L << cmd->device->channel);
>   }
> @@ -1045,11 +1045,11 @@ mega_prepare_extpassthru(adapter_t *adapter,
> scb_t *scb, Scsi_Cmnd *cmd,
>   case READ_CAPACITY:
>   if(!(adapter->flag & (1L << cmd->device->channel))) {
>
> - printk(KERN_NOTICE
> - "scsi%d: scanning scsi channel %d [P%d] ",
> + dev_notice(>dev->dev,
> + "scsi%d: scanning scsi channel %d [P%d] "
> + "for physical devices\n",
>   adapter->host->host_no,
>   cmd->device->channel, channel);
> - printk("for physical devices.\n");
>
> 

RE: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible

2015-07-08 Thread Sumit Saxena
 -Original Message-
 From: Bjorn Helgaas [mailto:bhelg...@google.com]
 Sent: Wednesday, July 08, 2015 2:23 AM
 To: Kashyap Desai; Uday Lingala; Sumit Saxena
 Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; James
 E.J.
 Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
 Subject: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible

 Use dev_printk() when possible to make messages more useful.

 Signed-off-by: Bjorn Helgaas bhelg...@google.com
 ---
  drivers/scsi/megaraid/megaraid_sas_base.c   |  304
 +--
  drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 
  2 files changed, 196 insertions(+), 203 deletions(-)

 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
 b/drivers/scsi/megaraid/megaraid_sas_base.c
 index 71b884d..a9bd592 100644
 --- a/drivers/scsi/megaraid/megaraid_sas_base.c
 +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
 @@ -216,7 +216,7 @@ struct megasas_cmd *megasas_get_cmd(struct
 megasas_instance
struct megasas_cmd, list);
   list_del_init(cmd-list);
   } else {
 - printk(KERN_ERR megasas: Command pool empty!\n);
 + dev_err(instance-pdev-dev, Command pool empty!\n);
   }

   spin_unlock_irqrestore(instance-mfi_pool_lock, flags);
 @@ -370,9 +370,9 @@ megasas_adp_reset_xscale(struct megasas_instance
 *instance,
   msleep(1000); /* sleep for 3 secs */
   pcidata  = 0;
   pci_read_config_dword(instance-pdev, MFI_1068_PCSR_OFFSET,
 pcidata);
 - printk(KERN_NOTICE pcidata = %x\n, pcidata);
 + dev_notice(instance-pdev-dev, pcidata = %x\n, pcidata);
   if (pcidata  0x2) {
 - printk(KERN_NOTICE mfi 1068 offset read=%x\n, pcidata);
 + dev_notice(instance-pdev-dev, mfi 1068 offset
 read=%x\n, pcidata);
   pcidata = ~0x2;
   pci_write_config_dword(instance-pdev,
   MFI_1068_PCSR_OFFSET, pcidata);
 @@ -383,9 +383,9 @@ megasas_adp_reset_xscale(struct megasas_instance
 *instance,
   pcidata  = 0;
   pci_read_config_dword(instance-pdev,
   MFI_1068_FW_HANDSHAKE_OFFSET,
 pcidata);
 - printk(KERN_NOTICE 1068 offset handshake read=%x\n,
 pcidata);
 + dev_notice(instance-pdev-dev, 1068 offset handshake
 read=%x\n, pcidata);
   if ((pcidata  0x) == MFI_1068_FW_READY) {
 - printk(KERN_NOTICE 1068 offset pcidt=%x\n,
 pcidata);
 + dev_notice(instance-pdev-dev, 1068 offset
 pcidt=%x\n, pcidata);
   pcidata = 0;
   pci_write_config_dword(instance-pdev,
   MFI_1068_FW_HANDSHAKE_OFFSET, pcidata);
 @@ -824,7 +824,7 @@ megasas_adp_reset_gen2(struct megasas_instance
 *instance,
   while ( !( HostDiag  DIAG_WRITE_ENABLE) ) {
   msleep(100);
   HostDiag = (u32)readl(hostdiag_offset);
 - printk(KERN_NOTICE RESETGEN2: retry=%x, hostdiag=%x\n,
 + dev_notice(instance-pdev-dev, RESETGEN2: retry=%x,
 hostdiag=%x\n,
   retry, HostDiag);

   if (retry++ = 100)
 @@ -832,7 +832,7 @@ megasas_adp_reset_gen2(struct megasas_instance
 *instance,

   }

 - printk(KERN_NOTICE ADP_RESET_GEN2: HostDiag=%x\n, HostDiag);
 + dev_notice(instance-pdev-dev, ADP_RESET_GEN2:
 HostDiag=%x\n, HostDiag);

   writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);

 @@ -842,7 +842,7 @@ megasas_adp_reset_gen2(struct megasas_instance
 *instance,
   while ( ( HostDiag  DIAG_RESET_ADAPTER) ) {
   msleep(100);
   HostDiag = (u32)readl(hostdiag_offset);
 - printk(KERN_NOTICE RESET_GEN2: retry=%x, hostdiag=%x\n,
 + dev_notice(instance-pdev-dev, RESET_GEN2: retry=%x,
 hostdiag=%x\n,
   retry, HostDiag);

   if (retry++ = 1000)
 @@ -1241,7 +1241,7 @@ megasas_build_dcdb(struct megasas_instance
 *instance, struct scsi_cmnd *scp,
 pthru-sgl);

   if (pthru-sge_count  instance-max_num_sge) {
 - printk(KERN_ERR megasas: DCDB two many SGE NUM=%x\n,
 + dev_err(instance-pdev-dev, DCDB too many SGE
 NUM=%x\n,
   pthru-sge_count);
   return 0;
   }
 @@ -1382,7 +1382,7 @@ megasas_build_ldio(struct megasas_instance
 *instance, struct scsi_cmnd *scp,
   ldio-sge_count = megasas_make_sgl32(instance, scp, ldio-
 sgl);

   if (ldio-sge_count  instance-max_num_sge) {
 - printk(KERN_ERR megasas: build_ld_io: sge_count = %x\n,
 + dev_err(instance-pdev-dev, build_ld_io: sge_count =
 %x\n,
   ldio-sge_count);
   return 0;
   }
 @@ -1449,24 +1449,24 @@ megasas_dump_pending_frames(struct
 megasas_instance *instance

RE: [PATCH v3 3/3] megaraid_sas : fix whitespace errors

2015-07-08 Thread Sumit Saxena
 -Original Message-
 From: Bjorn Helgaas [mailto:bhelg...@google.com]
 Sent: Wednesday, July 08, 2015 2:23 AM
 To: Kashyap Desai; Uday Lingala; Sumit Saxena
 Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; James
 E.J.
 Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
 Subject: [PATCH v3 3/3] megaraid_sas : fix whitespace errors

 Fix whitespace and indentation errors.  No code change.

 Signed-off-by: Bjorn Helgaas bhelg...@google.com
 ---
  drivers/scsi/megaraid/megaraid_sas_base.c |  244
 ++--
 -
  1 file changed, 118 insertions(+), 126 deletions(-)

 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
 b/drivers/scsi/megaraid/megaraid_sas_base.c
 index a9bd592..5156faa 100644
 --- a/drivers/scsi/megaraid/megaraid_sas_base.c
 +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
 @@ -273,6 +273,7 @@ static inline void
  megasas_enable_intr_xscale(struct megasas_instance *instance)  {
   struct megasas_register_set __iomem *regs;
 +
   regs = instance-reg_set;
   writel(0, (regs)-outbound_intr_mask);

 @@ -289,6 +290,7 @@ megasas_disable_intr_xscale(struct megasas_instance
 *instance)  {
   struct megasas_register_set __iomem *regs;
   u32 mask = 0x1f;
 +
   regs = instance-reg_set;
   writel(mask, regs-outbound_intr_mask);
   /* Dummy readl to force pci flush */
 @@ -313,6 +315,7 @@ megasas_clear_intr_xscale(struct megasas_register_set
 __iomem * regs)  {
   u32 status;
   u32 mfiStatus = 0;
 +
   /*
* Check if it is our interrupt
*/
 @@ -348,6 +351,7 @@ megasas_fire_cmd_xscale(struct megasas_instance
 *instance,
   struct megasas_register_set __iomem *regs)  {
   unsigned long flags;
 +
   spin_lock_irqsave(instance-hba_lock, flags);
   writel((frame_phys_addr  3)|(frame_count),
  (regs)-inbound_queue_port);
 @@ -364,6 +368,7 @@ megasas_adp_reset_xscale(struct megasas_instance
 *instance,  {
   u32 i;
   u32 pcidata;
 +
   writel(MFI_ADP_RESET, regs-inbound_doorbell);

   for (i = 0; i  3; i++)
 @@ -402,7 +407,6 @@ static int
  megasas_check_reset_xscale(struct megasas_instance *instance,
   struct megasas_register_set __iomem *regs)  {
 -
   if ((instance-adprecovery != MEGASAS_HBA_OPERATIONAL) 
   (le32_to_cpu(*instance-consumer) ==
   MEGASAS_ADPRESET_INPROG_SIGN))
 @@ -433,7 +437,7 @@ static struct megasas_instance_template
 megasas_instance_template_xscale = {

  /**
  *The following functions are defined for ppc (deviceid : 0x60)
 -*controllers
 +*controllers
  */

  /**
 @@ -444,6 +448,7 @@ static inline void
  megasas_enable_intr_ppc(struct megasas_instance *instance)  {
   struct megasas_register_set __iomem *regs;
 +
   regs = instance-reg_set;
   writel(0x, (regs)-outbound_doorbell_clear);

 @@ -462,6 +467,7 @@ megasas_disable_intr_ppc(struct megasas_instance
 *instance)  {
   struct megasas_register_set __iomem *regs;
   u32 mask = 0x;
 +
   regs = instance-reg_set;
   writel(mask, regs-outbound_intr_mask);
   /* Dummy readl to force pci flush */
 @@ -522,6 +528,7 @@ megasas_fire_cmd_ppc(struct megasas_instance
 *instance,
   struct megasas_register_set __iomem *regs)  {
   unsigned long flags;
 +
   spin_lock_irqsave(instance-hba_lock, flags);
   writel((frame_phys_addr | (frame_count1))|1,
   (regs)-inbound_queue_port);
 @@ -566,6 +573,7 @@ static inline void
  megasas_enable_intr_skinny(struct megasas_instance *instance)  {
   struct megasas_register_set __iomem *regs;
 +
   regs = instance-reg_set;
   writel(0x, (regs)-outbound_intr_mask);

 @@ -584,6 +592,7 @@ megasas_disable_intr_skinny(struct megasas_instance
 *instance)  {
   struct megasas_register_set __iomem *regs;
   u32 mask = 0x;
 +
   regs = instance-reg_set;
   writel(mask, regs-outbound_intr_mask);
   /* Dummy readl to force pci flush */
 @@ -634,8 +643,8 @@ megasas_clear_intr_skinny(struct megasas_register_set
 __iomem *regs)
   writel(status, regs-outbound_intr_status);

   /*
 - * dummy read to flush PCI
 - */
 +  * dummy read to flush PCI
 +  */
   readl(regs-outbound_intr_status);

   return mfiStatus;
 @@ -654,6 +663,7 @@ megasas_fire_cmd_skinny(struct megasas_instance
 *instance,
   struct megasas_register_set __iomem *regs)  {
   unsigned long flags;
 +
   spin_lock_irqsave(instance-hba_lock, flags);
   writel(upper_32_bits(frame_phys_addr),
  (regs)-inbound_high_queue_port);
 @@ -706,6 +716,7 @@ static inline void
  megasas_enable_intr_gen2(struct megasas_instance *instance)  {
   struct megasas_register_set __iomem *regs;
 +
   regs = instance-reg_set;
   writel(0x, (regs)-outbound_doorbell_clear);

 @@ -725,6 +736,7 @@ megasas_disable_intr_gen2(struct

RE: [PATCH v3 1/3] megaraid : use dev_printk when possible

2015-07-08 Thread Sumit Saxena
 -Original Message-
 From: Bjorn Helgaas [mailto:bhelg...@google.com]
 Sent: Wednesday, July 08, 2015 2:22 AM
 To: Kashyap Desai; Uday Lingala; Sumit Saxena
 Cc: megaraidlinux@avagotech.com; linux-s...@vger.kernel.org; James
 E.J.
 Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
 Subject: [PATCH v3 1/3] megaraid : use dev_printk when possible

 Use dev_printk() when possible to make messages more useful.

 Signed-off-by: Bjorn Helgaas bhelg...@google.com
 ---
  drivers/scsi/megaraid.c |  140
 ++-
  1 file changed, 66 insertions(+), 74 deletions(-)

 diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index
 bc7b34c..9d05302 100644
 --- a/drivers/scsi/megaraid.c
 +++ b/drivers/scsi/megaraid.c
 @@ -268,8 +268,8 @@ mega_query_adapter(adapter_t *adapter)
   raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;/* i.e. 0x0E */

   if ((retval = issue_scb_block(adapter, raw_mbox)))
 - printk(KERN_WARNING
 - megaraid: Product_info cmd failed with error: %d\n,
 + dev_warn(adapter-dev-dev,
 + Product_info cmd failed with error: %d\n,
   retval);

   pci_unmap_single(adapter-dev, prod_info_dma_handle, @@ -
 334,7 +334,7 @@ mega_query_adapter(adapter_t *adapter)
   adapter-bios_version[4] = 0;
   }

 - printk(KERN_NOTICE megaraid: [%s:%s] detected %d logical drives.\n,
 + dev_notice(adapter-dev-dev, [%s:%s] detected %d logical
 drives\n,
   adapter-fw_version, adapter-bios_version, adapter-
 numldrv);

   /*
 @@ -342,7 +342,7 @@ mega_query_adapter(adapter_t *adapter)
*/
   adapter-support_ext_cdb = mega_support_ext_cdb(adapter);
   if (adapter-support_ext_cdb)
 - printk(KERN_NOTICE megaraid: supports extended CDBs.\n);
 + dev_notice(adapter-dev-dev, supports extended CDBs\n);


   return 0;
 @@ -678,11 +678,11 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd
 *cmd, int *busy)

   if(!(adapter-flag  (1L  cmd-device-channel))) {

 - printk(KERN_NOTICE
 - scsi%d: scanning scsi channel %d ,
 + dev_notice(adapter-dev-dev,
 + scsi%d: scanning scsi channel %d 
 + for logical drives\n,
   adapter-host-host_no,
   cmd-device-channel);
 - printk(for logical drives.\n);

   adapter-flag |= (1L  cmd-device-channel);
   }
 @@ -983,11 +983,11 @@ mega_prepare_passthru(adapter_t *adapter, scb_t
 *scb, Scsi_Cmnd *cmd,
   case READ_CAPACITY:
   if(!(adapter-flag  (1L  cmd-device-channel))) {

 - printk(KERN_NOTICE
 - scsi%d: scanning scsi channel %d [P%d] ,
 + dev_notice(adapter-dev-dev,
 + scsi%d: scanning scsi channel %d [P%d] 
 + for physical devices\n,
   adapter-host-host_no,
   cmd-device-channel, channel);
 - printk(for physical devices.\n);

   adapter-flag |= (1L  cmd-device-channel);
   }
 @@ -1045,11 +1045,11 @@ mega_prepare_extpassthru(adapter_t *adapter,
 scb_t *scb, Scsi_Cmnd *cmd,
   case READ_CAPACITY:
   if(!(adapter-flag  (1L  cmd-device-channel))) {

 - printk(KERN_NOTICE
 - scsi%d: scanning scsi channel %d [P%d] ,
 + dev_notice(adapter-dev-dev,
 + scsi%d: scanning scsi channel %d [P%d] 
 + for physical devices\n,
   adapter-host-host_no,
   cmd-device-channel, channel);
 - printk(for physical devices.\n);

   adapter-flag |= (1L  cmd-device-channel);
   }
 @@ -1241,7 +1241,7 @@ issue_scb_block(adapter_t *adapter, u_char
 *raw_mbox)
   return mbox-m_in.status;

  bug_blocked_mailbox:
 - printk(KERN_WARNING megaraid: Blocked mailbox..!!\n);
 + dev_warn(adapter-dev-dev, Blocked mailbox..!!\n);
   udelay (1000);
   return -1;
  }
 @@ -1454,9 +1454,8 @@ mega_cmd_done(adapter_t *adapter, u8
 completed[], int nstatus, int status)
* Make sure f/w has completed a valid command
*/
   if( !(scb-state  SCB_ISSUED) || scb-cmd == NULL ) {
 - printk(KERN_CRIT
 - megaraid: invalid command

RE: [PATCH] megaraid:Remove no longer required variable ret from the function megasas_sync_map_info

2015-07-07 Thread Sumit Saxena
> -Original Message-
> From: Frans Klaver [mailto:franskla...@gmail.com]
> Sent: Tuesday, July 07, 2015 3:37 PM
> To: Sumit Saxena
> Cc: Nicholas Krause; Kashyap Desai; Uday Lingala; jbottom...@odin.com;
> PDL,MEGARAIDLINUX; linux-s...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] megaraid:Remove no longer required variable ret from
> the
> function megasas_sync_map_info
>
> Can't seem to find the original, so here's a reply to the ack mail.
>
> On Tue, Jul 7, 2015 at 10:49 AM, Sumit Saxena 
> wrote:
> > -Original Message-
> > From: Nicholas Krause [mailto:xerofo...@gmail.com]
> > Sent: Monday, July 06, 2015 9:43 PM
> > To: kashyap.de...@avagotech.com
> > Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
> > jbottom...@odin.com; megaraidlinux@avagotech.com;
> > linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: [PATCH] megaraid:Remove no longer required variable ret from
> > the function megasas_sync_map_info
>
> Isn't something shorter like
>
>   [PATCH] megaraid: remove pointless variable
>
> much more readable?
>
>
> > This removes the no longer required variable ret due to this variable
> > only ever being used at the end of the function megasas_sync_map_info
> > without changing it's value from the orginal setting of its value to
> > zero due to this just remove the variable ret and just return the
> > value of zero directly here in order to indicate to the caller the
> > call to this function has run successfully without any non recoverable
> > issues.
>
> No interpunction?
>
>
> > Signed-off-by: Nicholas Krause 
> > ---
> >  drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > index 46a0f8f..b5a8c65 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> > @@ -836,7 +836,7 @@ megasas_get_map_info(struct megasas_instance
> > *instance)  int  megasas_sync_map_info(struct megasas_instance
> > *instance) {
> > -   int ret = 0, i;
> > +   int i;
> > struct megasas_cmd *cmd;
> > struct megasas_dcmd_frame *dcmd;
> > u32 size_sync_info, num_lds;
> > @@ -906,7 +906,7 @@ megasas_sync_map_info(struct megasas_instance
> > *instance)
> >
> > instance->instancet->issue_dcmd(instance, cmd);
> >
> > -   return ret;
> > +   return 0;
> >  }
> >
> > Acked-by: Sumit Saxena 
>
> This ack in an outlook-style response confused the hell out of me ;).
Sorry for confusion. I just got new laptop with default outlook settings so
last message sent was in outlook-style, configured it now.

Thanks,
Sumit
>
> Thanks,
> Frans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid:Remove no longer required variable ret from the function megasas_sync_map_info

2015-07-07 Thread Sumit Saxena
-Original Message-
From: Nicholas Krause [mailto:xerofo...@gmail.com]
Sent: Monday, July 06, 2015 9:43 PM
To: kashyap.de...@avagotech.com
Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
jbottom...@odin.com; megaraidlinux@avagotech.com;
linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid:Remove no longer required variable ret from the
function megasas_sync_map_info

This removes the no longer required variable ret due to this variable only
ever being used at the end of the function megasas_sync_map_info without
changing it's value from the orginal setting of its value to zero due to
this just remove the variable ret and just return the value of zero
directly here in order to indicate to the caller the call to this function
has run successfully without any non recoverable issues.

Signed-off-by: Nicholas Krause 
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 46a0f8f..b5a8c65 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -836,7 +836,7 @@ megasas_get_map_info(struct megasas_instance
*instance)  int  megasas_sync_map_info(struct megasas_instance *instance)
{
-   int ret = 0, i;
+   int i;
struct megasas_cmd *cmd;
struct megasas_dcmd_frame *dcmd;
u32 size_sync_info, num_lds;
@@ -906,7 +906,7 @@ megasas_sync_map_info(struct megasas_instance
*instance)

instance->instancet->issue_dcmd(instance, cmd);

-   return ret;
+   return 0;
 }

Acked-by: Sumit Saxena 

 /*
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid:Remove no longer required variable ret from the function megasas_sync_map_info

2015-07-07 Thread Sumit Saxena
-Original Message-
From: Nicholas Krause [mailto:xerofo...@gmail.com]
Sent: Monday, July 06, 2015 9:43 PM
To: kashyap.de...@avagotech.com
Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
jbottom...@odin.com; megaraidlinux@avagotech.com;
linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid:Remove no longer required variable ret from the
function megasas_sync_map_info

This removes the no longer required variable ret due to this variable only
ever being used at the end of the function megasas_sync_map_info without
changing it's value from the orginal setting of its value to zero due to
this just remove the variable ret and just return the value of zero
directly here in order to indicate to the caller the call to this function
has run successfully without any non recoverable issues.

Signed-off-by: Nicholas Krause xerofo...@gmail.com
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 46a0f8f..b5a8c65 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -836,7 +836,7 @@ megasas_get_map_info(struct megasas_instance
*instance)  int  megasas_sync_map_info(struct megasas_instance *instance)
{
-   int ret = 0, i;
+   int i;
struct megasas_cmd *cmd;
struct megasas_dcmd_frame *dcmd;
u32 size_sync_info, num_lds;
@@ -906,7 +906,7 @@ megasas_sync_map_info(struct megasas_instance
*instance)

instance-instancet-issue_dcmd(instance, cmd);

-   return ret;
+   return 0;
 }

Acked-by: Sumit Saxena sumit.sax...@avagotech.com

 /*
--
2.1.4
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid:Remove no longer required variable ret from the function megasas_sync_map_info

2015-07-07 Thread Sumit Saxena
 -Original Message-
 From: Frans Klaver [mailto:franskla...@gmail.com]
 Sent: Tuesday, July 07, 2015 3:37 PM
 To: Sumit Saxena
 Cc: Nicholas Krause; Kashyap Desai; Uday Lingala; jbottom...@odin.com;
 PDL,MEGARAIDLINUX; linux-s...@vger.kernel.org;
 linux-kernel@vger.kernel.org
 Subject: Re: [PATCH] megaraid:Remove no longer required variable ret from
 the
 function megasas_sync_map_info

 Can't seem to find the original, so here's a reply to the ack mail.

 On Tue, Jul 7, 2015 at 10:49 AM, Sumit Saxena sumit.sax...@avagotech.com
 wrote:
  -Original Message-
  From: Nicholas Krause [mailto:xerofo...@gmail.com]
  Sent: Monday, July 06, 2015 9:43 PM
  To: kashyap.de...@avagotech.com
  Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
  jbottom...@odin.com; megaraidlinux@avagotech.com;
  linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
  Subject: [PATCH] megaraid:Remove no longer required variable ret from
  the function megasas_sync_map_info

 Isn't something shorter like

   [PATCH] megaraid: remove pointless variable

 much more readable?


  This removes the no longer required variable ret due to this variable
  only ever being used at the end of the function megasas_sync_map_info
  without changing it's value from the orginal setting of its value to
  zero due to this just remove the variable ret and just return the
  value of zero directly here in order to indicate to the caller the
  call to this function has run successfully without any non recoverable
  issues.

 No interpunction?


  Signed-off-by: Nicholas Krause xerofo...@gmail.com
  ---
   drivers/scsi/megaraid/megaraid_sas_fusion.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
 
  diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
  b/drivers/scsi/megaraid/megaraid_sas_fusion.c
  index 46a0f8f..b5a8c65 100644
  --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
  +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
  @@ -836,7 +836,7 @@ megasas_get_map_info(struct megasas_instance
  *instance)  int  megasas_sync_map_info(struct megasas_instance
  *instance) {
  -   int ret = 0, i;
  +   int i;
  struct megasas_cmd *cmd;
  struct megasas_dcmd_frame *dcmd;
  u32 size_sync_info, num_lds;
  @@ -906,7 +906,7 @@ megasas_sync_map_info(struct megasas_instance
  *instance)
 
  instance-instancet-issue_dcmd(instance, cmd);
 
  -   return ret;
  +   return 0;
   }
 
  Acked-by: Sumit Saxena sumit.sax...@avagotech.com

 This ack in an outlook-style response confused the hell out of me ;).
Sorry for confusion. I just got new laptop with default outlook settings so
last message sent was in outlook-style, configured it now.

Thanks,
Sumit

 Thanks,
 Frans
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid:Make functions static in the file megaraid_sas_base.c

2015-06-23 Thread Sumit Saxena
-Original Message-
From: Nicholas Krause [mailto:xerofo...@gmail.com]
Sent: Wednesday, June 24, 2015 5:43 AM
To: kashyap.de...@avagotech.com
Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
jbottom...@odin.com; megaraidlinux@avagotech.com;
linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid:Make functions static in the file
megaraid_sas_base.c

This makes various functions that have no external callers outside their
definition/declaration in the file megaraid_sas_base.c to be declared as
static now.

Signed-off-by: Nicholas Krause 
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 4c3fc0e..dad2393 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -190,7 +190,7 @@ static int megasas_get_ld_vf_affiliation(struct
megasas_instance *instance,  int megasas_check_mpio_paths(struct
megasas_instance *instance,
 struct scsi_cmnd *scmd);

-void
+static void
 megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd
*cmd)  {
instance->instancet->fire_cmd(instance,
@@ -1698,7 +1698,7 @@ static int megasas_slave_alloc(struct scsi_device
*sdev)
 * @instance:   Adapter soft state
 *
 */
-void megasas_complete_outstanding_ioctls(struct megasas_instance
*instance)
+static void megasas_complete_outstanding_ioctls(struct megasas_instance
+*instance)
 {
int i;
struct megasas_cmd *cmd_mfi;
@@ -1856,7 +1856,7 @@ megasas_internal_reset_defer_cmds(struct
megasas_instance *instance);  static void
process_fw_state_change_wq(struct work_struct *work);

-void megasas_do_ocr(struct megasas_instance *instance)
+static void megasas_do_ocr(struct megasas_instance *instance)
 {
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) ||
(instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) ||

Acked-by: Sumit Saxena 

--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid:Make functions static in the file megaraid_sas_base.c

2015-06-23 Thread Sumit Saxena
-Original Message-
From: Nicholas Krause [mailto:xerofo...@gmail.com]
Sent: Wednesday, June 24, 2015 5:43 AM
To: kashyap.de...@avagotech.com
Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
jbottom...@odin.com; megaraidlinux@avagotech.com;
linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid:Make functions static in the file
megaraid_sas_base.c

This makes various functions that have no external callers outside their
definition/declaration in the file megaraid_sas_base.c to be declared as
static now.

Signed-off-by: Nicholas Krause xerofo...@gmail.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 4c3fc0e..dad2393 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -190,7 +190,7 @@ static int megasas_get_ld_vf_affiliation(struct
megasas_instance *instance,  int megasas_check_mpio_paths(struct
megasas_instance *instance,
 struct scsi_cmnd *scmd);

-void
+static void
 megasas_issue_dcmd(struct megasas_instance *instance, struct megasas_cmd
*cmd)  {
instance-instancet-fire_cmd(instance,
@@ -1698,7 +1698,7 @@ static int megasas_slave_alloc(struct scsi_device
*sdev)
 * @instance:   Adapter soft state
 *
 */
-void megasas_complete_outstanding_ioctls(struct megasas_instance
*instance)
+static void megasas_complete_outstanding_ioctls(struct megasas_instance
+*instance)
 {
int i;
struct megasas_cmd *cmd_mfi;
@@ -1856,7 +1856,7 @@ megasas_internal_reset_defer_cmds(struct
megasas_instance *instance);  static void
process_fw_state_change_wq(struct work_struct *work);

-void megasas_do_ocr(struct megasas_instance *instance)
+static void megasas_do_ocr(struct megasas_instance *instance)
 {
if ((instance-pdev-device == PCI_DEVICE_ID_LSI_SAS1064R) ||
(instance-pdev-device == PCI_DEVICE_ID_DELL_PERC5) ||

Acked-by: Sumit Saxena sumit.sax...@avagotech.com

--
2.1.4
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [V6 PATCH 6/7] megaraid_sas: fix TRUE and FALSE re-define build error

2015-06-12 Thread Sumit Saxena
>-Original Message-
>From: Suravee Suthikulpanit [mailto:suravee.suthikulpa...@amd.com]
>Sent: Wednesday, June 10, 2015 9:39 PM
>To: r...@rjwysocki.net; l...@kernel.org; catalin.mari...@arm.com;
>will.dea...@arm.com; thomas.lenda...@amd.com;
>herb...@gondor.apana.org.au; da...@davemloft.net; a...@arndb.de;
>kashyap.de...@avagotech.com; sumit.sax...@avagotech.com;
>uday.ling...@avagotech.com; vinholika...@gmail.com
>Cc: msal...@redhat.com; hanjun@linaro.org; al.st...@linaro.org;
>grant.lik...@linaro.org; leo.du...@amd.com; linux-arm-
>ker...@lists.infradead.org; linux-a...@vger.kernel.org; linux-
>ker...@vger.kernel.org; linaro-a...@lists.linaro.org;
net...@vger.kernel.org;
>linux-cry...@vger.kernel.org; Suravee Suthikulpanit
>Subject: [V6 PATCH 6/7] megaraid_sas: fix TRUE and FALSE re-define build
>error
>
>Signed-off-by: Suravee Suthikulpanit 
>Cc: Kashyap Desai 
>Cc: Sumit Saxena 
>Cc: Uday Lingala 
>---
> drivers/scsi/megaraid/megaraid_sas_fp.c | 8 
> 1 file changed, 8 insertions(+)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c
>b/drivers/scsi/megaraid/megaraid_sas_fp.c
>index 4f72287..e8b7a69 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
>@@ -66,7 +66,15 @@ MODULE_PARM_DESC(lb_pending_cmds, "Change
>raid-1 load balancing outstanding "
>
> #define ABS_DIFF(a, b)   (((a) > (b)) ? ((a) - (b)) : ((b) - (a)))
> #define MR_LD_STATE_OPTIMAL 3
>+
>+#ifdef FALSE
>+#undef FALSE
>+#endif
> #define FALSE 0
>+
>+#ifdef TRUE
>+#undef TRUE
>+#endif
> #define TRUE 1
>
> #define SPAN_DEBUG 0
Acked-by: Sumit Saxena 

>--
>2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [V6 PATCH 6/7] megaraid_sas: fix TRUE and FALSE re-define build error

2015-06-12 Thread Sumit Saxena
-Original Message-
From: Suravee Suthikulpanit [mailto:suravee.suthikulpa...@amd.com]
Sent: Wednesday, June 10, 2015 9:39 PM
To: r...@rjwysocki.net; l...@kernel.org; catalin.mari...@arm.com;
will.dea...@arm.com; thomas.lenda...@amd.com;
herb...@gondor.apana.org.au; da...@davemloft.net; a...@arndb.de;
kashyap.de...@avagotech.com; sumit.sax...@avagotech.com;
uday.ling...@avagotech.com; vinholika...@gmail.com
Cc: msal...@redhat.com; hanjun@linaro.org; al.st...@linaro.org;
grant.lik...@linaro.org; leo.du...@amd.com; linux-arm-
ker...@lists.infradead.org; linux-a...@vger.kernel.org; linux-
ker...@vger.kernel.org; linaro-a...@lists.linaro.org;
net...@vger.kernel.org;
linux-cry...@vger.kernel.org; Suravee Suthikulpanit
Subject: [V6 PATCH 6/7] megaraid_sas: fix TRUE and FALSE re-define build
error

Signed-off-by: Suravee Suthikulpanit suravee.suthikulpa...@amd.com
Cc: Kashyap Desai kashyap.de...@avagotech.com
Cc: Sumit Saxena sumit.sax...@avagotech.com
Cc: Uday Lingala uday.ling...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas_fp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c
b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 4f72287..e8b7a69 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -66,7 +66,15 @@ MODULE_PARM_DESC(lb_pending_cmds, Change
raid-1 load balancing outstanding 

 #define ABS_DIFF(a, b)   (((a)  (b)) ? ((a) - (b)) : ((b) - (a)))
 #define MR_LD_STATE_OPTIMAL 3
+
+#ifdef FALSE
+#undef FALSE
+#endif
 #define FALSE 0
+
+#ifdef TRUE
+#undef TRUE
+#endif
 #define TRUE 1

 #define SPAN_DEBUG 0
Acked-by: Sumit Saxena sumit.sax...@avagotech.com

--
2.1.0
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid_sas: insert missing space in kernel message

2015-06-10 Thread Sumit Saxena
>-Original Message-
>From: Colin King [mailto:colin.k...@canonical.com]
>Sent: Tuesday, June 09, 2015 9:24 PM
>To: Kashyap Desai; Sumit Saxena; Uday Lingala; James E.J. Bottomley;
>megaraidlinux@avagotech.com; linux-s...@vger.kernel.org
>Cc: linux-kernel@vger.kernel.org
>Subject: [PATCH] megaraid_sas: insert missing space in kernel message
>
>From: Colin Ian King 
>
>The printk format specifier string is missing a space between the %p
format
>specifier and the "on the defer" text. Minor fix, add the missing space.
>
>Signed-off-by: Colin Ian King 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 890637f..4889ef6 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -3148,7 +3148,7 @@ megasas_internal_reset_defer_cmds(struct
>megasas_instance *instance)
>   cmd = instance->cmd_list[i];
>   if (cmd->sync_cmd == 1 || cmd->scmd) {
>   printk(KERN_NOTICE "megasas: moving
>cmd[%d]:%p:%d:%p"
>-  "on the defer queue as
internal\n",
>+  " on the defer queue as
internal\n",
>   defer_index, cmd, cmd->sync_cmd, cmd-
>>scmd);
>
>   if (!list_empty(>list)) {
Acked-by: Sumit Saxena 

>--
>2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid_sas: insert missing space in kernel message

2015-06-10 Thread Sumit Saxena
-Original Message-
From: Colin King [mailto:colin.k...@canonical.com]
Sent: Tuesday, June 09, 2015 9:24 PM
To: Kashyap Desai; Sumit Saxena; Uday Lingala; James E.J. Bottomley;
megaraidlinux@avagotech.com; linux-s...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid_sas: insert missing space in kernel message

From: Colin Ian King colin.k...@canonical.com

The printk format specifier string is missing a space between the %p
format
specifier and the on the defer text. Minor fix, add the missing space.

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 890637f..4889ef6 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3148,7 +3148,7 @@ megasas_internal_reset_defer_cmds(struct
megasas_instance *instance)
   cmd = instance-cmd_list[i];
   if (cmd-sync_cmd == 1 || cmd-scmd) {
   printk(KERN_NOTICE megasas: moving
cmd[%d]:%p:%d:%p
-  on the defer queue as
internal\n,
+   on the defer queue as
internal\n,
   defer_index, cmd, cmd-sync_cmd, cmd-
scmd);

   if (!list_empty(cmd-list)) {
Acked-by: Sumit Saxena sumit.sax...@avagotech.com

--
2.1.4
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 3/3] megaraid_sas: use dev_printk when possible

2015-04-28 Thread Sumit Saxena
>-Original Message-
>From: Bjorn Helgaas [mailto:bhelg...@google.com]
>Sent: Wednesday, April 29, 2015 4:44 AM
>To: Kashyap Desai; Uday Lingala; Sumit Saxena
>Cc: megaraidlinux@avagotech.com; James E.J. Bottomley; linux-
>ker...@vger.kernel.org; linux-s...@vger.kernel.org
>Subject: [PATCH 3/3] megaraid_sas: use dev_printk when possible
>
>Use dev_printk() when possible to make messages more useful.
>
>Signed-off-by: Bjorn Helgaas 
>---
> drivers/scsi/megaraid/megaraid_sas_fusion.c |   96 ++-
>
> 1 file changed, 48 insertions(+), 48 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>index 5a0800d..0b20bd8 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
>@@ -173,7 +173,7 @@ struct megasas_cmd_fusion
>*megasas_get_cmd_fusion(struct megasas_instance
>struct megasas_cmd_fusion, list);
>   list_del_init(>list);
>   } else {
>-  printk(KERN_ERR "megasas: Command pool (fusion)
>empty!\n");
>+  dev_err(>pdev->dev, "Command pool (fusion)
>empty!\n");
>   }
>
>   spin_unlock_irqrestore(>mpt_pool_lock, flags); @@ -244,7
>+244,7 @@ static void megasas_teardown_frame_pool_fusion(
>   struct megasas_cmd_fusion *cmd;
>
>   if (!fusion->sg_dma_pool || !fusion->sense_dma_pool) {
>-  printk(KERN_ERR "megasas: dma pool is null. SG Pool %p, "
>+  dev_err(>pdev->dev, "dma pool is null. SG Pool
>%p, "
>  "sense pool : %p\n", fusion->sg_dma_pool,
>  fusion->sense_dma_pool);
>   return;
>@@ -356,7 +356,7 @@ static int megasas_create_frame_pool_fusion(struct
>megasas_instance *instance)
> total_sz_chain_frame, 4,
> 0);
>   if (!fusion->sg_dma_pool) {
>-  printk(KERN_DEBUG "megasas: failed to setup request pool "
>+  dev_printk(KERN_DEBUG, >pdev->dev, "failed to
>setup request pool "
>  "fusion\n");
>   return -ENOMEM;
>   }
>@@ -365,7 +365,7 @@ static int megasas_create_frame_pool_fusion(struct
>megasas_instance *instance)
>SCSI_SENSE_BUFFERSIZE, 64,
>0);
>
>   if (!fusion->sense_dma_pool) {
>-  printk(KERN_DEBUG "megasas: failed to setup sense pool "
>+  dev_printk(KERN_DEBUG, >pdev->dev, "failed to
>setup sense pool "
>  "fusion\n");
>   pci_pool_destroy(fusion->sg_dma_pool);
>   fusion->sg_dma_pool = NULL;
>@@ -390,7 +390,7 @@ static int megasas_create_frame_pool_fusion(struct
>megasas_instance *instance)
>* whatever has been allocated
>*/
>   if (!cmd->sg_frame || !cmd->sense) {
>-  printk(KERN_DEBUG "megasas: pci_pool_alloc
>failed\n");
>+  dev_printk(KERN_DEBUG, >pdev->dev,
>"pci_pool_alloc
>+failed\n");
>   megasas_teardown_frame_pool_fusion(instance);
>   return -ENOMEM;
>   }
>@@ -436,7 +436,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
>*instance)
>  >req_frames_desc_phys,
>GFP_KERNEL);
>
>   if (!fusion->req_frames_desc) {
>-  printk(KERN_ERR "megasas; Could not allocate memory for "
>+  dev_err(>pdev->dev, "Could not allocate memory
>for "
>  "request_frames\n");
>   goto fail_req_desc;
>   }
>@@ -447,7 +447,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
>*instance)
>   fusion->reply_alloc_sz * count, 16, 0);
>
>   if (!fusion->reply_frames_desc_pool) {
>-  printk(KERN_ERR "megasas; Could not allocate memory for "
>+  dev_err(>pdev->dev, "Could not allocate memory
>for "
>  "reply_frame pool\n");
>   goto fail_reply_desc;
>   }
>@@ -456,7 +456,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
>*instance)
>   pci_pool_alloc(fusion->reply_frames_desc_pool,
>GFP_KERNEL,
>  >reply_frames_desc_phys);
>   if (!fusion->reply_frames_desc) {
>- 

RE: [PATCH 2/3] megaraid_sas: use dev_printk when possible

2015-04-28 Thread Sumit Saxena
>-Original Message-
>From: Bjorn Helgaas [mailto:bhelg...@google.com]
>Sent: Wednesday, April 29, 2015 4:44 AM
>To: Kashyap Desai; Uday Lingala; Sumit Saxena
>Cc: megaraidlinux@avagotech.com; James E.J. Bottomley; linux-
>ker...@vger.kernel.org; linux-s...@vger.kernel.org
>Subject: [PATCH 2/3] megaraid_sas: use dev_printk when possible
>
>Use dev_printk() when possible to make messages more useful.
>
>Signed-off-by: Bjorn Helgaas 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c |  281 ++--
>-
> 1 file changed, 139 insertions(+), 142 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 890637f..9ef6631 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -217,7 +217,7 @@ struct megasas_cmd *megasas_get_cmd(struct
>megasas_instance
>   list_del_init(>list);
>   atomic_set(>mfi_mpt_pthr, MFI_MPT_DETACHED);
>   } else {
>-  printk(KERN_ERR "megasas: Command pool empty!\n");
>+  dev_err(>pdev->dev, "Command pool empty!\n");
>   }
>
>   spin_unlock_irqrestore(>mfi_pool_lock, flags); @@ -382,9
>+382,9 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
>   msleep(1000); /* sleep for 3 secs */
>   pcidata  = 0;
>   pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET,
>);
>-  printk(KERN_NOTICE "pcidata = %x\n", pcidata);
>+  dev_notice(>pdev->dev, "pcidata = %x\n", pcidata);
>   if (pcidata & 0x2) {
>-  printk(KERN_NOTICE "mfi 1068 offset read=%x\n", pcidata);
>+  dev_notice(>pdev->dev, "mfi 1068 offset
>read=%x\n",
>+pcidata);
>   pcidata &= ~0x2;
>   pci_write_config_dword(instance->pdev,
>   MFI_1068_PCSR_OFFSET, pcidata);
>@@ -395,9 +395,9 @@ megasas_adp_reset_xscale(struct megasas_instance
>*instance,
>   pcidata  = 0;
>   pci_read_config_dword(instance->pdev,
>   MFI_1068_FW_HANDSHAKE_OFFSET,
>);
>-  printk(KERN_NOTICE "1068 offset handshake read=%x\n",
>pcidata);
>+  dev_notice(>pdev->dev, "1068 offset handshake
>read=%x\n",
>+pcidata);
>   if ((pcidata & 0x) == MFI_1068_FW_READY) {
>-  printk(KERN_NOTICE "1068 offset pcidt=%x\n",
>pcidata);
>+  dev_notice(>pdev->dev, "1068 offset
>pcidt=%x\n", pcidata);
>   pcidata = 0;
>   pci_write_config_dword(instance->pdev,
>   MFI_1068_FW_HANDSHAKE_OFFSET,
>pcidata); @@ -836,7 +836,7 @@ megasas_adp_reset_gen2(struct
>megasas_instance *instance,
>   while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
>   msleep(100);
>   HostDiag = (u32)readl(hostdiag_offset);
>-  printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n",
>+  dev_notice(>pdev->dev, "RESETGEN2: retry=%x,
>+hostdiag=%x\n",
>   retry, HostDiag);
>
>   if (retry++ >= 100)
>@@ -844,7 +844,7 @@ megasas_adp_reset_gen2(struct megasas_instance
>*instance,
>
>   }
>
>-  printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
>+  dev_notice(>pdev->dev, "ADP_RESET_GEN2:
>HostDiag=%x\n",
>+HostDiag);
>
>   writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);
>
>@@ -854,7 +854,7 @@ megasas_adp_reset_gen2(struct megasas_instance
>*instance,
>   while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
>   msleep(100);
>   HostDiag = (u32)readl(hostdiag_offset);
>-  printk(KERN_NOTICE "RESET_GEN2: retry=%x,
>hostdiag=%x\n",
>+  dev_notice(>pdev->dev, "RESET_GEN2: retry=%x,
>+hostdiag=%x\n",
>   retry, HostDiag);
>
>   if (retry++ >= 1000)
>@@ -1253,7 +1253,7 @@ megasas_build_dcdb(struct megasas_instance
>*instance, struct scsi_cmnd *scp,
> >sgl);
>
>   if (pthru->sge_count > instance->max_num_sge) {
>-  printk(KERN_ERR "megasas: DCDB two many SGE
>NUM=%x\n",
>+  dev_err(>pdev->dev, "DCDB two many SGE
>NUM=%x\n",
>   pthru->sge_count);
>   r

RE: [PATCH 1/3] megaraid: use dev_printk when possible

2015-04-28 Thread Sumit Saxena
>-Original Message-
>From: Bjorn Helgaas [mailto:bhelg...@google.com]
>Sent: Wednesday, April 29, 2015 4:44 AM
>To: Kashyap Desai; Uday Lingala; Sumit Saxena
>Cc: megaraidlinux@avagotech.com; James E.J. Bottomley; linux-
>ker...@vger.kernel.org; linux-s...@vger.kernel.org
>Subject: [PATCH 1/3] megaraid: use dev_printk when possible
>
>Use dev_printk() when possible to make messages more useful.
>
>Signed-off-by: Bjorn Helgaas 
>---
> drivers/scsi/megaraid.c |   92
> ++---
>--
> 1 file changed, 43 insertions(+), 49 deletions(-)
>
>diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index
>bc7b34c..47cda02 100644
>--- a/drivers/scsi/megaraid.c
>+++ b/drivers/scsi/megaraid.c
>@@ -268,7 +268,7 @@ mega_query_adapter(adapter_t *adapter)
>   raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;/* i.e. 0x0E */
>
>   if ((retval = issue_scb_block(adapter, raw_mbox)))
>-  printk(KERN_WARNING
>+  dev_warn(>dev->dev,
>   "megaraid: Product_info cmd failed with error: %d\n",
>   retval);
>
>@@ -334,7 +334,7 @@ mega_query_adapter(adapter_t *adapter)
>   adapter->bios_version[4] = 0;
>   }
>
>-  printk(KERN_NOTICE "megaraid: [%s:%s] detected %d logical
>drives.\n",
>+  dev_notice(>dev->dev, "[%s:%s] detected %d logical
>+drives.\n",
>   adapter->fw_version, adapter->bios_version, adapter-
>>numldrv);
>
>   /*
>@@ -342,7 +342,7 @@ mega_query_adapter(adapter_t *adapter)
>*/
>   adapter->support_ext_cdb = mega_support_ext_cdb(adapter);
>   if (adapter->support_ext_cdb)
>-  printk(KERN_NOTICE "megaraid: supports extended
>CDBs.\n");
>+  dev_notice(>dev->dev, "supports extended
>CDBs.\n");
>
>
>   return 0;
>@@ -678,7 +678,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd
>*cmd, int *busy)
>
>   if(!(adapter->flag & (1L << cmd->device->channel))) {
>
>-  printk(KERN_NOTICE
>+  dev_notice(>dev->dev,
>   "scsi%d: scanning scsi channel %d ",
>   adapter->host->host_no,
>   cmd->device->channel);
>@@ -983,7 +983,7 @@ mega_prepare_passthru(adapter_t *adapter, scb_t
>*scb, Scsi_Cmnd *cmd,
>   case READ_CAPACITY:
>   if(!(adapter->flag & (1L << cmd->device->channel))) {
>
>-  printk(KERN_NOTICE
>+  dev_notice(>dev->dev,
>   "scsi%d: scanning scsi channel %d [P%d] ",
>   adapter->host->host_no,
>   cmd->device->channel, channel);
>@@ -1045,7 +1045,7 @@ mega_prepare_extpassthru(adapter_t *adapter,
>scb_t *scb, Scsi_Cmnd *cmd,
>   case READ_CAPACITY:
>   if(!(adapter->flag & (1L << cmd->device->channel))) {
>
>-  printk(KERN_NOTICE
>+  dev_notice(>dev->dev,
>   "scsi%d: scanning scsi channel %d [P%d] ",
>   adapter->host->host_no,
>   cmd->device->channel, channel);
>@@ -1241,7 +1241,7 @@ issue_scb_block(adapter_t *adapter, u_char
>*raw_mbox)
>   return mbox->m_in.status;
>
> bug_blocked_mailbox:
>-  printk(KERN_WARNING "megaraid: Blocked mailbox..!!\n");
>+  dev_warn(>dev->dev, "Blocked mailbox..!!\n");
>   udelay (1000);
>   return -1;
> }
>@@ -1454,7 +1454,7 @@ mega_cmd_done(adapter_t *adapter, u8
>completed[], int nstatus, int status)
>* Make sure f/w has completed a valid command
>*/
>   if( !(scb->state & SCB_ISSUED) || scb->cmd == NULL )
>{
>-  printk(KERN_CRIT
>+  dev_crit(>dev->dev,
>   "megaraid: invalid command ");
>   printk("Id %d, scb->state:%x, scsi cmd:%p\n",
>   cmdid, scb->state, scb->cmd);
>@@ -1467,7 +1467,7 @@ mega_cmd_done(adapter_t *adapter, u8
>completed[], int nstatus, int status)
>  

RE: [PATCH 1/3] megaraid: use dev_printk when possible

2015-04-28 Thread Sumit Saxena
-Original Message-
From: Bjorn Helgaas [mailto:bhelg...@google.com]
Sent: Wednesday, April 29, 2015 4:44 AM
To: Kashyap Desai; Uday Lingala; Sumit Saxena
Cc: megaraidlinux@avagotech.com; James E.J. Bottomley; linux-
ker...@vger.kernel.org; linux-s...@vger.kernel.org
Subject: [PATCH 1/3] megaraid: use dev_printk when possible

Use dev_printk() when possible to make messages more useful.

Signed-off-by: Bjorn Helgaas bhelg...@google.com
---
 drivers/scsi/megaraid.c |   92
 ++---
--
 1 file changed, 43 insertions(+), 49 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index
bc7b34c..47cda02 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -268,7 +268,7 @@ mega_query_adapter(adapter_t *adapter)
   raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;/* i.e. 0x0E */

   if ((retval = issue_scb_block(adapter, raw_mbox)))
-  printk(KERN_WARNING
+  dev_warn(adapter-dev-dev,
   megaraid: Product_info cmd failed with error: %d\n,
   retval);

@@ -334,7 +334,7 @@ mega_query_adapter(adapter_t *adapter)
   adapter-bios_version[4] = 0;
   }

-  printk(KERN_NOTICE megaraid: [%s:%s] detected %d logical
drives.\n,
+  dev_notice(adapter-dev-dev, [%s:%s] detected %d logical
+drives.\n,
   adapter-fw_version, adapter-bios_version, adapter-
numldrv);

   /*
@@ -342,7 +342,7 @@ mega_query_adapter(adapter_t *adapter)
*/
   adapter-support_ext_cdb = mega_support_ext_cdb(adapter);
   if (adapter-support_ext_cdb)
-  printk(KERN_NOTICE megaraid: supports extended
CDBs.\n);
+  dev_notice(adapter-dev-dev, supports extended
CDBs.\n);


   return 0;
@@ -678,7 +678,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd
*cmd, int *busy)

   if(!(adapter-flag  (1L  cmd-device-channel))) {

-  printk(KERN_NOTICE
+  dev_notice(adapter-dev-dev,
   scsi%d: scanning scsi channel %d ,
   adapter-host-host_no,
   cmd-device-channel);
@@ -983,7 +983,7 @@ mega_prepare_passthru(adapter_t *adapter, scb_t
*scb, Scsi_Cmnd *cmd,
   case READ_CAPACITY:
   if(!(adapter-flag  (1L  cmd-device-channel))) {

-  printk(KERN_NOTICE
+  dev_notice(adapter-dev-dev,
   scsi%d: scanning scsi channel %d [P%d] ,
   adapter-host-host_no,
   cmd-device-channel, channel);
@@ -1045,7 +1045,7 @@ mega_prepare_extpassthru(adapter_t *adapter,
scb_t *scb, Scsi_Cmnd *cmd,
   case READ_CAPACITY:
   if(!(adapter-flag  (1L  cmd-device-channel))) {

-  printk(KERN_NOTICE
+  dev_notice(adapter-dev-dev,
   scsi%d: scanning scsi channel %d [P%d] ,
   adapter-host-host_no,
   cmd-device-channel, channel);
@@ -1241,7 +1241,7 @@ issue_scb_block(adapter_t *adapter, u_char
*raw_mbox)
   return mbox-m_in.status;

 bug_blocked_mailbox:
-  printk(KERN_WARNING megaraid: Blocked mailbox..!!\n);
+  dev_warn(adapter-dev-dev, Blocked mailbox..!!\n);
   udelay (1000);
   return -1;
 }
@@ -1454,7 +1454,7 @@ mega_cmd_done(adapter_t *adapter, u8
completed[], int nstatus, int status)
* Make sure f/w has completed a valid command
*/
   if( !(scb-state  SCB_ISSUED) || scb-cmd == NULL )
{
-  printk(KERN_CRIT
+  dev_crit(adapter-dev-dev,
   megaraid: invalid command );
   printk(Id %d, scb-state:%x, scsi cmd:%p\n,
   cmdid, scb-state, scb-cmd);
@@ -1467,7 +1467,7 @@ mega_cmd_done(adapter_t *adapter, u8
completed[], int nstatus, int status)
*/
   if( scb-state  SCB_ABORT ) {

-  printk(KERN_WARNING
+  dev_warn(adapter-dev-dev,
   megaraid: aborted cmd [%x] complete.\n,
   scb-idx);

@@ -1486,7 +1486,7 @@ mega_cmd_done(adapter_t *adapter, u8
completed[], int nstatus, int status)
*/
   if( scb-state  SCB_RESET ) {

-  printk(KERN_WARNING
+  dev_warn(adapter-dev-dev,
   megaraid: reset cmd [%x] complete.\n,
   scb-idx);

@@ -1553,7 +1553,7 @@ mega_cmd_done

RE: [PATCH 2/3] megaraid_sas: use dev_printk when possible

2015-04-28 Thread Sumit Saxena
-Original Message-
From: Bjorn Helgaas [mailto:bhelg...@google.com]
Sent: Wednesday, April 29, 2015 4:44 AM
To: Kashyap Desai; Uday Lingala; Sumit Saxena
Cc: megaraidlinux@avagotech.com; James E.J. Bottomley; linux-
ker...@vger.kernel.org; linux-s...@vger.kernel.org
Subject: [PATCH 2/3] megaraid_sas: use dev_printk when possible

Use dev_printk() when possible to make messages more useful.

Signed-off-by: Bjorn Helgaas bhelg...@google.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c |  281 ++--
-
 1 file changed, 139 insertions(+), 142 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 890637f..9ef6631 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -217,7 +217,7 @@ struct megasas_cmd *megasas_get_cmd(struct
megasas_instance
   list_del_init(cmd-list);
   atomic_set(cmd-mfi_mpt_pthr, MFI_MPT_DETACHED);
   } else {
-  printk(KERN_ERR megasas: Command pool empty!\n);
+  dev_err(instance-pdev-dev, Command pool empty!\n);
   }

   spin_unlock_irqrestore(instance-mfi_pool_lock, flags); @@ -382,9
+382,9 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
   msleep(1000); /* sleep for 3 secs */
   pcidata  = 0;
   pci_read_config_dword(instance-pdev, MFI_1068_PCSR_OFFSET,
pcidata);
-  printk(KERN_NOTICE pcidata = %x\n, pcidata);
+  dev_notice(instance-pdev-dev, pcidata = %x\n, pcidata);
   if (pcidata  0x2) {
-  printk(KERN_NOTICE mfi 1068 offset read=%x\n, pcidata);
+  dev_notice(instance-pdev-dev, mfi 1068 offset
read=%x\n,
+pcidata);
   pcidata = ~0x2;
   pci_write_config_dword(instance-pdev,
   MFI_1068_PCSR_OFFSET, pcidata);
@@ -395,9 +395,9 @@ megasas_adp_reset_xscale(struct megasas_instance
*instance,
   pcidata  = 0;
   pci_read_config_dword(instance-pdev,
   MFI_1068_FW_HANDSHAKE_OFFSET,
pcidata);
-  printk(KERN_NOTICE 1068 offset handshake read=%x\n,
pcidata);
+  dev_notice(instance-pdev-dev, 1068 offset handshake
read=%x\n,
+pcidata);
   if ((pcidata  0x) == MFI_1068_FW_READY) {
-  printk(KERN_NOTICE 1068 offset pcidt=%x\n,
pcidata);
+  dev_notice(instance-pdev-dev, 1068 offset
pcidt=%x\n, pcidata);
   pcidata = 0;
   pci_write_config_dword(instance-pdev,
   MFI_1068_FW_HANDSHAKE_OFFSET,
pcidata); @@ -836,7 +836,7 @@ megasas_adp_reset_gen2(struct
megasas_instance *instance,
   while ( !( HostDiag  DIAG_WRITE_ENABLE) ) {
   msleep(100);
   HostDiag = (u32)readl(hostdiag_offset);
-  printk(KERN_NOTICE RESETGEN2: retry=%x, hostdiag=%x\n,
+  dev_notice(instance-pdev-dev, RESETGEN2: retry=%x,
+hostdiag=%x\n,
   retry, HostDiag);

   if (retry++ = 100)
@@ -844,7 +844,7 @@ megasas_adp_reset_gen2(struct megasas_instance
*instance,

   }

-  printk(KERN_NOTICE ADP_RESET_GEN2: HostDiag=%x\n, HostDiag);
+  dev_notice(instance-pdev-dev, ADP_RESET_GEN2:
HostDiag=%x\n,
+HostDiag);

   writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);

@@ -854,7 +854,7 @@ megasas_adp_reset_gen2(struct megasas_instance
*instance,
   while ( ( HostDiag  DIAG_RESET_ADAPTER) ) {
   msleep(100);
   HostDiag = (u32)readl(hostdiag_offset);
-  printk(KERN_NOTICE RESET_GEN2: retry=%x,
hostdiag=%x\n,
+  dev_notice(instance-pdev-dev, RESET_GEN2: retry=%x,
+hostdiag=%x\n,
   retry, HostDiag);

   if (retry++ = 1000)
@@ -1253,7 +1253,7 @@ megasas_build_dcdb(struct megasas_instance
*instance, struct scsi_cmnd *scp,
 pthru-sgl);

   if (pthru-sge_count  instance-max_num_sge) {
-  printk(KERN_ERR megasas: DCDB two many SGE
NUM=%x\n,
+  dev_err(instance-pdev-dev, DCDB two many SGE
NUM=%x\n,
   pthru-sge_count);
   return 0;
   }
@@ -1394,7 +1394,7 @@ megasas_build_ldio(struct megasas_instance
*instance, struct scsi_cmnd *scp,
   ldio-sge_count = megasas_make_sgl32(instance, scp, ldio-
sgl);

   if (ldio-sge_count  instance-max_num_sge) {
-  printk(KERN_ERR megasas: build_ld_io: sge_count = %x\n,
+  dev_err(instance-pdev-dev, build_ld_io: sge_count =
%x\n,
   ldio-sge_count);
   return 0;
   }
@@ -1461,24 +1461,24 @@ megasas_dump_pending_frames(struct
megasas_instance *instance)
   u32 sgcount;
   u32 max_cmd = instance-max_fw_cmds;

-  printk(KERN_ERR \nmegasas[%d]: Dumping Frame Phys Address of
all

RE: [PATCH 3/3] megaraid_sas: use dev_printk when possible

2015-04-28 Thread Sumit Saxena
-Original Message-
From: Bjorn Helgaas [mailto:bhelg...@google.com]
Sent: Wednesday, April 29, 2015 4:44 AM
To: Kashyap Desai; Uday Lingala; Sumit Saxena
Cc: megaraidlinux@avagotech.com; James E.J. Bottomley; linux-
ker...@vger.kernel.org; linux-s...@vger.kernel.org
Subject: [PATCH 3/3] megaraid_sas: use dev_printk when possible

Use dev_printk() when possible to make messages more useful.

Signed-off-by: Bjorn Helgaas bhelg...@google.com
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   96 ++-

 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 5a0800d..0b20bd8 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -173,7 +173,7 @@ struct megasas_cmd_fusion
*megasas_get_cmd_fusion(struct megasas_instance
struct megasas_cmd_fusion, list);
   list_del_init(cmd-list);
   } else {
-  printk(KERN_ERR megasas: Command pool (fusion)
empty!\n);
+  dev_err(instance-pdev-dev, Command pool (fusion)
empty!\n);
   }

   spin_unlock_irqrestore(fusion-mpt_pool_lock, flags); @@ -244,7
+244,7 @@ static void megasas_teardown_frame_pool_fusion(
   struct megasas_cmd_fusion *cmd;

   if (!fusion-sg_dma_pool || !fusion-sense_dma_pool) {
-  printk(KERN_ERR megasas: dma pool is null. SG Pool %p, 
+  dev_err(instance-pdev-dev, dma pool is null. SG Pool
%p, 
  sense pool : %p\n, fusion-sg_dma_pool,
  fusion-sense_dma_pool);
   return;
@@ -356,7 +356,7 @@ static int megasas_create_frame_pool_fusion(struct
megasas_instance *instance)
 total_sz_chain_frame, 4,
 0);
   if (!fusion-sg_dma_pool) {
-  printk(KERN_DEBUG megasas: failed to setup request pool 
+  dev_printk(KERN_DEBUG, instance-pdev-dev, failed to
setup request pool 
  fusion\n);
   return -ENOMEM;
   }
@@ -365,7 +365,7 @@ static int megasas_create_frame_pool_fusion(struct
megasas_instance *instance)
SCSI_SENSE_BUFFERSIZE, 64,
0);

   if (!fusion-sense_dma_pool) {
-  printk(KERN_DEBUG megasas: failed to setup sense pool 
+  dev_printk(KERN_DEBUG, instance-pdev-dev, failed to
setup sense pool 
  fusion\n);
   pci_pool_destroy(fusion-sg_dma_pool);
   fusion-sg_dma_pool = NULL;
@@ -390,7 +390,7 @@ static int megasas_create_frame_pool_fusion(struct
megasas_instance *instance)
* whatever has been allocated
*/
   if (!cmd-sg_frame || !cmd-sense) {
-  printk(KERN_DEBUG megasas: pci_pool_alloc
failed\n);
+  dev_printk(KERN_DEBUG, instance-pdev-dev,
pci_pool_alloc
+failed\n);
   megasas_teardown_frame_pool_fusion(instance);
   return -ENOMEM;
   }
@@ -436,7 +436,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
*instance)
  fusion-req_frames_desc_phys,
GFP_KERNEL);

   if (!fusion-req_frames_desc) {
-  printk(KERN_ERR megasas; Could not allocate memory for 
+  dev_err(instance-pdev-dev, Could not allocate memory
for 
  request_frames\n);
   goto fail_req_desc;
   }
@@ -447,7 +447,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
*instance)
   fusion-reply_alloc_sz * count, 16, 0);

   if (!fusion-reply_frames_desc_pool) {
-  printk(KERN_ERR megasas; Could not allocate memory for 
+  dev_err(instance-pdev-dev, Could not allocate memory
for 
  reply_frame pool\n);
   goto fail_reply_desc;
   }
@@ -456,7 +456,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
*instance)
   pci_pool_alloc(fusion-reply_frames_desc_pool,
GFP_KERNEL,
  fusion-reply_frames_desc_phys);
   if (!fusion-reply_frames_desc) {
-  printk(KERN_ERR megasas; Could not allocate memory for 
+  dev_err(instance-pdev-dev, Could not allocate memory
for 
  reply_frame pool\n);
   pci_pool_destroy(fusion-reply_frames_desc_pool);
   goto fail_reply_desc;
@@ -473,7 +473,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
*instance)
   fusion-io_frames_alloc_sz, 16, 0);

   if (!fusion-io_request_frames_pool) {
-  printk(KERN_ERR megasas: Could not allocate memory for 
+  dev_err(instance-pdev-dev, Could not allocate memory
for 
  io_request_frame pool\n);
   goto

RE: [PATCH v2] drivers: scsi: megaraid: Add "megaraid_sas_internal.h" for internal shared functions using

2014-12-15 Thread Sumit Saxena
>-Original Message-
>From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>Sent: Sunday, December 14, 2014 9:35 PM
>To: megaraidli...@lsi.com; jbottom...@parallels.com; Sumit Saxena
>Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [PATCH v2] drivers: scsi: megaraid: Add "megaraid_sas_internal.h"
>for internal shared functions using
>
>For shared inline functions crossed source files, better to let it as
>"static inline"
>in a header file. For extern functions, better to declare them in header
>file.
>
>Signed-off-by: Chen Gang 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c |  76 +
> drivers/scsi/megaraid/megaraid_sas_fusion.c   |  42 +-
> drivers/scsi/megaraid/megaraid_sas_internal.h | 116
>++
> 3 files changed, 118 insertions(+), 116 deletions(-)  create mode 100644
>drivers/scsi/megaraid/megaraid_sas_internal.h
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index dc27598..474c39b 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -57,6 +57,7 @@
> #include 
> #include "megaraid_sas_fusion.h"
> #include "megaraid_sas.h"
>+#include "megaraid_sas_internal.h"
>
> /*
>  * Number of sectors per IO command
>@@ -127,9 +128,6 @@ static u32 support_device_change;
> /* define lock for aen poll */
> spinlock_t poll_aen_lock;
>
>-void
>-megasas_complete_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd,
>-   u8 alt_status);
> static u32
> megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem
>*regs);  static int @@ -142,23 +140,6 @@ u32
>megasas_build_and_issue_cmd(struct megasas_instance *instance,
>   struct scsi_cmnd *scmd);
> static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
>-megasas_release_fusion(struct megasas_instance *instance); -int -
>megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
>megasas_free_cmds_fusion(struct megasas_instance *instance);
>-u8
>-megasas_get_map_info(struct megasas_instance *instance); -int -
>megasas_sync_map_info(struct megasas_instance *instance); -int -
>wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
>*cmd); -void megasas_reset_reply_desc(struct megasas_instance *instance);
>-u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map,
>-struct LD_LOAD_BALANCE_INFO *lbInfo);
>-int megasas_reset_fusion(struct Scsi_Host *shost); -void
>megasas_fusion_ocr_wq(struct work_struct *work);
>
> void
> megasas_issue_dcmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd) @@ -194,30 +175,6 @@ struct megasas_cmd
>*megasas_get_cmd(struct megasas_instance  }
>
> /**
>- * megasas_return_cmd -   Return a cmd to free command pool
>- * @instance: Adapter soft state
>- * @cmd:  Command packet to be returned to free command
>pool
>- */
>-inline void
>-megasas_return_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd) -{
>-  unsigned long flags;
>-
>-  spin_lock_irqsave(>cmd_pool_lock, flags);
>-
>-  cmd->scmd = NULL;
>-  cmd->frame_count = 0;
>-  if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) &&
>-  (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) &&
>-  (reset_devices))
>-  cmd->frame->hdr.cmd = MFI_CMD_INVALID;
>-  list_add_tail(>list, >cmd_pool);
>-
>-  spin_unlock_irqrestore(>cmd_pool_lock, flags);
>-}
>-
>-
>-/**
> * The following functions are defined for xscale
> * (deviceid : 1064R, PERC5) controllers
> */
>@@ -830,11 +787,6 @@ static struct megasas_instance_template
>megasas_instance_template_gen2 = {
> *   specific to gen2 (deviceid : 0x78, 0x79) controllers
> */
>
>-/*
>- * Template added for TB (Fusion)
>- */
>-extern struct megasas_instance_template
>megasas_instance_template_fusion;
>-
> /**
>  * megasas_issue_polled - Issues a polling command
>  * @instance: Adapter soft state
>@@ -1311,32 +1263,6 @@ megasas_build_ldio(struct megasas_instance
>*instance, struct scsi_cmnd *scp,  }
>
> /**
>- * megasas_is_ldio -  Checks if the cmd is for logical drive
>- * @scmd: SCSI command
>- *
>- * Called by megasas_queue_command to find out if the command to be
>queued
>- * is a logical drive command
>- */
>-inline int megasas_is_ldio(struct scsi_cmnd *cmd) -{
>-  if (!MEGASAS_IS_LOGICAL(cmd))
>

RE: [PATCH v2] drivers: scsi: megaraid: Add megaraid_sas_internal.h for internal shared functions using

2014-12-15 Thread Sumit Saxena
-Original Message-
From: Chen Gang [mailto:gang.chen.5...@gmail.com]
Sent: Sunday, December 14, 2014 9:35 PM
To: megaraidli...@lsi.com; jbottom...@parallels.com; Sumit Saxena
Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH v2] drivers: scsi: megaraid: Add megaraid_sas_internal.h
for internal shared functions using

For shared inline functions crossed source files, better to let it as
static inline
in a header file. For extern functions, better to declare them in header
file.

Signed-off-by: Chen Gang gang.chen.5...@gmail.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c |  76 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c   |  42 +-
 drivers/scsi/megaraid/megaraid_sas_internal.h | 116
++
 3 files changed, 118 insertions(+), 116 deletions(-)  create mode 100644
drivers/scsi/megaraid/megaraid_sas_internal.h

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index dc27598..474c39b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -57,6 +57,7 @@
 #include scsi/scsi_tcq.h
 #include megaraid_sas_fusion.h
 #include megaraid_sas.h
+#include megaraid_sas_internal.h

 /*
  * Number of sectors per IO command
@@ -127,9 +128,6 @@ static u32 support_device_change;
 /* define lock for aen poll */
 spinlock_t poll_aen_lock;

-void
-megasas_complete_cmd(struct megasas_instance *instance, struct
megasas_cmd *cmd,
-   u8 alt_status);
 static u32
 megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem
*regs);  static int @@ -142,23 +140,6 @@ u32
megasas_build_and_issue_cmd(struct megasas_instance *instance,
   struct scsi_cmnd *scmd);
 static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
-megasas_release_fusion(struct megasas_instance *instance); -int -
megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
megasas_free_cmds_fusion(struct megasas_instance *instance);
-u8
-megasas_get_map_info(struct megasas_instance *instance); -int -
megasas_sync_map_info(struct megasas_instance *instance); -int -
wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
*cmd); -void megasas_reset_reply_desc(struct megasas_instance *instance);
-u8 MR_ValidateMapInfo(struct MR_FW_RAID_MAP_ALL *map,
-struct LD_LOAD_BALANCE_INFO *lbInfo);
-int megasas_reset_fusion(struct Scsi_Host *shost); -void
megasas_fusion_ocr_wq(struct work_struct *work);

 void
 megasas_issue_dcmd(struct megasas_instance *instance, struct
megasas_cmd *cmd) @@ -194,30 +175,6 @@ struct megasas_cmd
*megasas_get_cmd(struct megasas_instance  }

 /**
- * megasas_return_cmd -   Return a cmd to free command pool
- * @instance: Adapter soft state
- * @cmd:  Command packet to be returned to free command
pool
- */
-inline void
-megasas_return_cmd(struct megasas_instance *instance, struct
megasas_cmd *cmd) -{
-  unsigned long flags;
-
-  spin_lock_irqsave(instance-cmd_pool_lock, flags);
-
-  cmd-scmd = NULL;
-  cmd-frame_count = 0;
-  if ((instance-pdev-device != PCI_DEVICE_ID_LSI_FUSION) 
-  (instance-pdev-device != PCI_DEVICE_ID_LSI_INVADER) 
-  (reset_devices))
-  cmd-frame-hdr.cmd = MFI_CMD_INVALID;
-  list_add_tail(cmd-list, instance-cmd_pool);
-
-  spin_unlock_irqrestore(instance-cmd_pool_lock, flags);
-}
-
-
-/**
 * The following functions are defined for xscale
 * (deviceid : 1064R, PERC5) controllers
 */
@@ -830,11 +787,6 @@ static struct megasas_instance_template
megasas_instance_template_gen2 = {
 *   specific to gen2 (deviceid : 0x78, 0x79) controllers
 */

-/*
- * Template added for TB (Fusion)
- */
-extern struct megasas_instance_template
megasas_instance_template_fusion;
-
 /**
  * megasas_issue_polled - Issues a polling command
  * @instance: Adapter soft state
@@ -1311,32 +1263,6 @@ megasas_build_ldio(struct megasas_instance
*instance, struct scsi_cmnd *scp,  }

 /**
- * megasas_is_ldio -  Checks if the cmd is for logical drive
- * @scmd: SCSI command
- *
- * Called by megasas_queue_command to find out if the command to be
queued
- * is a logical drive command
- */
-inline int megasas_is_ldio(struct scsi_cmnd *cmd) -{
-  if (!MEGASAS_IS_LOGICAL(cmd))
-  return 0;
-  switch (cmd-cmnd[0]) {
-  case READ_10:
-  case WRITE_10:
-  case READ_12:
-  case WRITE_12:
-  case READ_6:
-  case WRITE_6:
-  case READ_16:
-  case WRITE_16:
-  return 1;
-  default:
-  return 0;
-  }
-}
-
- /**
  * megasas_dump_pending_frames -  Dumps the frame address of all
pending cmds
  *in FW
  * @instance: Adapter soft state
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
b/drivers/scsi/megaraid

RE: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h" for internal shared functions using

2014-12-10 Thread Sumit Saxena
>-Original Message-
>From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>Sent: Sunday, November 30, 2014 8:37 AM
>To: Sumit Saxena
>Cc: megaraidli...@lsi.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: Re: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h"
>for internal shared functions using
>
>On 11/17/14 19:51, Sumit Saxena wrote:
>>> -Original Message-
>>> From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>>> Sent: Monday, November 17, 2014 5:17 PM
>>> To: Sumit Saxena
>>> Cc: megaraidli...@lsi.com; linux-s...@vger.kernel.org; linux-
>>> ker...@vger.kernel.org
>>> Subject: RE: [PATCH] drivers: scsi: megaraid: Add
>"megaraid_sas_internal.h"
>>> for internal shared functions using
>>>
>>>
>>> OK, I will send patch v2 for it.
>>>
>>> I sent this patch based on Linux next tree, please tell me the tree
>>> location (git
>>> address) which I shall base on for sending patch v2.
>>
>> I posted the patch series today, once the patches make it to scsi-next
>> tree, I will let you know.
>>
>
>Is it OK?  or if possible, please help rebase and send the patch for it
>based on
>the related branches and patches.
Sorry for delay in response, patch series sent by me is accepted at
upstream. Please rebase "for-next" branch of scsi.git, here is git address
of tree-
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git

Please sent out patch v2, I will ACK.

Thanks
Sumit

>
>Thanks.
>--
>Chen Gang
>
>Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h for internal shared functions using

2014-12-10 Thread Sumit Saxena
-Original Message-
From: Chen Gang [mailto:gang.chen.5...@gmail.com]
Sent: Sunday, November 30, 2014 8:37 AM
To: Sumit Saxena
Cc: megaraidli...@lsi.com; linux-s...@vger.kernel.org; linux-
ker...@vger.kernel.org
Subject: Re: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h
for internal shared functions using

On 11/17/14 19:51, Sumit Saxena wrote:
 -Original Message-
 From: Chen Gang [mailto:gang.chen.5...@gmail.com]
 Sent: Monday, November 17, 2014 5:17 PM
 To: Sumit Saxena
 Cc: megaraidli...@lsi.com; linux-s...@vger.kernel.org; linux-
 ker...@vger.kernel.org
 Subject: RE: [PATCH] drivers: scsi: megaraid: Add
megaraid_sas_internal.h
 for internal shared functions using


 OK, I will send patch v2 for it.

 I sent this patch based on Linux next tree, please tell me the tree
 location (git
 address) which I shall base on for sending patch v2.

 I posted the patch series today, once the patches make it to scsi-next
 tree, I will let you know.


Is it OK?  or if possible, please help rebase and send the patch for it
based on
the related branches and patches.
Sorry for delay in response, patch series sent by me is accepted at
upstream. Please rebase for-next branch of scsi.git, here is git address
of tree-
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git

Please sent out patch v2, I will ACK.

Thanks
Sumit


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h" for internal shared functions using

2014-11-17 Thread Sumit Saxena
>-Original Message-
>From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>Sent: Monday, November 17, 2014 5:17 PM
>To: Sumit Saxena
>Cc: megaraidli...@lsi.com; linux-s...@vger.kernel.org; linux-
>ker...@vger.kernel.org
>Subject: RE: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h"
>for internal shared functions using
>
>
>OK, I will send patch v2 for it.
>
>I sent this patch based on Linux next tree, please tell me the tree
>location (git
>address) which I shall base on for sending patch v2.

I posted the patch series today, once the patches make it to scsi-next tree,
I will let you know.

Thanks
Sumit
>
>Thanks.
>
>Send from Lenovo A788t.
>
>Sumit Saxena  wrote:
>
>>>-Original Message-
>>>From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>>>Sent: Sunday, November 09, 2014 3:47 PM
>>>To: megaraidli...@lsi.com; jbottom...@parallels.com
>>>Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
>>>Subject: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h"
>>for
>>>internal shared functions using
>>>
>>>For shared inline functions crossed source files, better to let it as
>>"static inline"
>>>in a header file. For extern functions, better to declare them in
>>>header
>>file.
>>>
>>>For the latest upstream gcc/binutiles (gcc 5 with ld 2.25.51), it will
>>cause
>>>building break (although it might be the gcc's or ld's issue), the
>>related error
>>>(with allmodconfig under tile):
>>>
>>>MODPOST 4002 modules
>>>  ERROR: "megasas_return_cmd" [drivers/scsi/megaraid/megaraid_sas.ko]
>>>undefined!
>>>  ERROR: "megasas_is_ldio" [drivers/scsi/megaraid/megaraid_sas.ko]
>>>undefined!
>>>
>>>
>>>Signed-off-by: Chen Gang 
>>>---
>>> drivers/scsi/megaraid/megaraid_sas_base.c |  65 +
>>> drivers/scsi/megaraid/megaraid_sas_fusion.c   |  38 +-
>>> drivers/scsi/megaraid/megaraid_sas_internal.h | 100
>>>++
>>> 3 files changed, 102 insertions(+), 101 deletions(-)  create mode
>>>100644 drivers/scsi/megaraid/megaraid_sas_internal.h
>>>
>>>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>>>b/drivers/scsi/megaraid/megaraid_sas_base.c
>>>index f6a69a3..4a71c04 100644
>>>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>>>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>>>@@ -57,6 +57,7 @@
>>> #include 
>>> #include "megaraid_sas_fusion.h"
>>> #include "megaraid_sas.h"
>>>+#include "megaraid_sas_internal.h"
>>>
>>> /*
>>>  * Number of sectors per IO command
>>>@@ -98,7 +99,6 @@ MODULE_VERSION(MEGASAS_VERSION);
>>>MODULE_AUTHOR("megaraidli...@lsi.com");
>>> MODULE_DESCRIPTION("LSI MegaRAID SAS Driver");
>>>
>>>-int megasas_transition_to_ready(struct megasas_instance *instance,
>>>int ocr);  static int megasas_get_pd_list(struct megasas_instance
>>>*instance); static int megasas_ld_list_query(struct megasas_instance
>*instance,
>>>  u8 query_type);
>>>@@ -155,9 +155,6 @@ static u32 support_device_change;
>>> /* define lock for aen poll */
>>> spinlock_t poll_aen_lock;
>>>
>>>-void
>>>-megasas_complete_cmd(struct megasas_instance *instance, struct
>>>megasas_cmd *cmd,
>>>- u8 alt_status);
>>> static u32
>>> megasas_read_fw_status_reg_gen2(struct megasas_register_set
>__iomem
>>>*regs);  static int @@ -170,26 +167,8 @@ u32
>>>megasas_build_and_issue_cmd(struct megasas_instance *instance,
>>> struct scsi_cmnd *scmd);
>>> static void megasas_complete_cmd_dpc(unsigned long instance_addr);
>>>-void -megasas_release_fusion(struct megasas_instance *instance); -int
>>>- megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
>>>megasas_free_cmds_fusion(struct megasas_instance *instance);
>>>-u8
>>>-megasas_get_map_info(struct megasas_instance *instance); -int -
>>>megasas_sync_map_info(struct megasas_instance *instance); -int -
>>>wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
>>>*cmd,
>>>-int seconds);
>>>-void megasas_reset_reply_desc(struct megasas_instance *instance);
>>>-int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)

RE: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h" for internal shared functions using

2014-11-17 Thread Sumit Saxena
>-Original Message-
>From: Chen Gang [mailto:gang.chen.5...@gmail.com]
>Sent: Sunday, November 09, 2014 3:47 PM
>To: megaraidli...@lsi.com; jbottom...@parallels.com
>Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [PATCH] drivers: scsi: megaraid: Add "megaraid_sas_internal.h"
for
>internal shared functions using
>
>For shared inline functions crossed source files, better to let it as
"static inline"
>in a header file. For extern functions, better to declare them in header
file.
>
>For the latest upstream gcc/binutiles (gcc 5 with ld 2.25.51), it will
cause
>building break (although it might be the gcc's or ld's issue), the
related error
>(with allmodconfig under tile):
>
>MODPOST 4002 modules
>  ERROR: "megasas_return_cmd" [drivers/scsi/megaraid/megaraid_sas.ko]
>undefined!
>  ERROR: "megasas_is_ldio" [drivers/scsi/megaraid/megaraid_sas.ko]
>undefined!
>
>
>Signed-off-by: Chen Gang 
>---
> drivers/scsi/megaraid/megaraid_sas_base.c |  65 +
> drivers/scsi/megaraid/megaraid_sas_fusion.c   |  38 +-
> drivers/scsi/megaraid/megaraid_sas_internal.h | 100
>++
> 3 files changed, 102 insertions(+), 101 deletions(-)  create mode 100644
>drivers/scsi/megaraid/megaraid_sas_internal.h
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index f6a69a3..4a71c04 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -57,6 +57,7 @@
> #include 
> #include "megaraid_sas_fusion.h"
> #include "megaraid_sas.h"
>+#include "megaraid_sas_internal.h"
>
> /*
>  * Number of sectors per IO command
>@@ -98,7 +99,6 @@ MODULE_VERSION(MEGASAS_VERSION);
>MODULE_AUTHOR("megaraidli...@lsi.com");
> MODULE_DESCRIPTION("LSI MegaRAID SAS Driver");
>
>-int megasas_transition_to_ready(struct megasas_instance *instance, int
>ocr);  static int megasas_get_pd_list(struct megasas_instance *instance);
>static int megasas_ld_list_query(struct megasas_instance *instance,
>u8 query_type);
>@@ -155,9 +155,6 @@ static u32 support_device_change;
> /* define lock for aen poll */
> spinlock_t poll_aen_lock;
>
>-void
>-megasas_complete_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd,
>-   u8 alt_status);
> static u32
> megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem
>*regs);  static int @@ -170,26 +167,8 @@ u32
>megasas_build_and_issue_cmd(struct megasas_instance *instance,
>   struct scsi_cmnd *scmd);
> static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
>-megasas_release_fusion(struct megasas_instance *instance); -int -
>megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
>megasas_free_cmds_fusion(struct megasas_instance *instance);
>-u8
>-megasas_get_map_info(struct megasas_instance *instance); -int -
>megasas_sync_map_info(struct megasas_instance *instance); -int -
>wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
>*cmd,
>-  int seconds);
>-void megasas_reset_reply_desc(struct megasas_instance *instance); -int
>megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout); -void
>megasas_fusion_ocr_wq(struct work_struct *work);  static int
>megasas_get_ld_vf_affiliation(struct megasas_instance *instance,
>int initial);
>-int megasas_check_mpio_paths(struct megasas_instance *instance,
>-   struct scsi_cmnd *scmd);
>
> void
> megasas_issue_dcmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd) @@ -258,22 +237,6 @@ __megasas_return_cmd(struct
>megasas_instance *instance, struct megasas_cmd *cmd)  }
>
> /**
>- * megasas_return_cmd -   Return a cmd to free command pool
>- * @instance: Adapter soft state
>- * @cmd:  Command packet to be returned to free command
>pool
>- */
>-inline void
>-megasas_return_cmd(struct megasas_instance *instance, struct
>megasas_cmd *cmd) -{
>-  unsigned long flags;
>-
>-  spin_lock_irqsave(>mfi_pool_lock, flags);
>-  __megasas_return_cmd(instance, cmd);
>-  spin_unlock_irqrestore(>mfi_pool_lock, flags);
>-}
>-
>-
>-/**
> * The following functions are defined for xscale
> * (deviceid : 1064R, PERC5) controllers
> */
>@@ -1417,32 +1380,6 @@ megasas_build_ldio(struct megasas_instance
>*instance, struct scsi_cmnd *scp,
>   return cmd->frame_count;
> }
>
>-/**
>- * megasas_is_ldio -  Checks if the cmd is for logical drive
>- * @scmd: SCSI command
>- *
>- * Called by megasas_queue_command to find out if the command to be
>queued
>- * is a logical drive command
>- */
>-inline int megasas_is_ldio(struct scsi_cmnd *cmd) -{
>-  if (!MEGASAS_IS_LOGICAL(cmd))
>-  return 0;
>-  switch (cmd->cmnd[0]) {
>-  case READ_10:
>-  case WRITE_10:
>-  case READ_12:
>-  case WRITE_12:
>-  case READ_6:
>-  case 

RE: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h for internal shared functions using

2014-11-17 Thread Sumit Saxena
-Original Message-
From: Chen Gang [mailto:gang.chen.5...@gmail.com]
Sent: Sunday, November 09, 2014 3:47 PM
To: megaraidli...@lsi.com; jbottom...@parallels.com
Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h
for
internal shared functions using

For shared inline functions crossed source files, better to let it as
static inline
in a header file. For extern functions, better to declare them in header
file.

For the latest upstream gcc/binutiles (gcc 5 with ld 2.25.51), it will
cause
building break (although it might be the gcc's or ld's issue), the
related error
(with allmodconfig under tile):

MODPOST 4002 modules
  ERROR: megasas_return_cmd [drivers/scsi/megaraid/megaraid_sas.ko]
undefined!
  ERROR: megasas_is_ldio [drivers/scsi/megaraid/megaraid_sas.ko]
undefined!


Signed-off-by: Chen Gang gang.chen.5...@gmail.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c |  65 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c   |  38 +-
 drivers/scsi/megaraid/megaraid_sas_internal.h | 100
++
 3 files changed, 102 insertions(+), 101 deletions(-)  create mode 100644
drivers/scsi/megaraid/megaraid_sas_internal.h

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index f6a69a3..4a71c04 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -57,6 +57,7 @@
 #include scsi/scsi_tcq.h
 #include megaraid_sas_fusion.h
 #include megaraid_sas.h
+#include megaraid_sas_internal.h

 /*
  * Number of sectors per IO command
@@ -98,7 +99,6 @@ MODULE_VERSION(MEGASAS_VERSION);
MODULE_AUTHOR(megaraidli...@lsi.com);
 MODULE_DESCRIPTION(LSI MegaRAID SAS Driver);

-int megasas_transition_to_ready(struct megasas_instance *instance, int
ocr);  static int megasas_get_pd_list(struct megasas_instance *instance);
static int megasas_ld_list_query(struct megasas_instance *instance,
u8 query_type);
@@ -155,9 +155,6 @@ static u32 support_device_change;
 /* define lock for aen poll */
 spinlock_t poll_aen_lock;

-void
-megasas_complete_cmd(struct megasas_instance *instance, struct
megasas_cmd *cmd,
-   u8 alt_status);
 static u32
 megasas_read_fw_status_reg_gen2(struct megasas_register_set __iomem
*regs);  static int @@ -170,26 +167,8 @@ u32
megasas_build_and_issue_cmd(struct megasas_instance *instance,
   struct scsi_cmnd *scmd);
 static void megasas_complete_cmd_dpc(unsigned long instance_addr); -void
-megasas_release_fusion(struct megasas_instance *instance); -int -
megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
megasas_free_cmds_fusion(struct megasas_instance *instance);
-u8
-megasas_get_map_info(struct megasas_instance *instance); -int -
megasas_sync_map_info(struct megasas_instance *instance); -int -
wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
*cmd,
-  int seconds);
-void megasas_reset_reply_desc(struct megasas_instance *instance); -int
megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout); -void
megasas_fusion_ocr_wq(struct work_struct *work);  static int
megasas_get_ld_vf_affiliation(struct megasas_instance *instance,
int initial);
-int megasas_check_mpio_paths(struct megasas_instance *instance,
-   struct scsi_cmnd *scmd);

 void
 megasas_issue_dcmd(struct megasas_instance *instance, struct
megasas_cmd *cmd) @@ -258,22 +237,6 @@ __megasas_return_cmd(struct
megasas_instance *instance, struct megasas_cmd *cmd)  }

 /**
- * megasas_return_cmd -   Return a cmd to free command pool
- * @instance: Adapter soft state
- * @cmd:  Command packet to be returned to free command
pool
- */
-inline void
-megasas_return_cmd(struct megasas_instance *instance, struct
megasas_cmd *cmd) -{
-  unsigned long flags;
-
-  spin_lock_irqsave(instance-mfi_pool_lock, flags);
-  __megasas_return_cmd(instance, cmd);
-  spin_unlock_irqrestore(instance-mfi_pool_lock, flags);
-}
-
-
-/**
 * The following functions are defined for xscale
 * (deviceid : 1064R, PERC5) controllers
 */
@@ -1417,32 +1380,6 @@ megasas_build_ldio(struct megasas_instance
*instance, struct scsi_cmnd *scp,
   return cmd-frame_count;
 }

-/**
- * megasas_is_ldio -  Checks if the cmd is for logical drive
- * @scmd: SCSI command
- *
- * Called by megasas_queue_command to find out if the command to be
queued
- * is a logical drive command
- */
-inline int megasas_is_ldio(struct scsi_cmnd *cmd) -{
-  if (!MEGASAS_IS_LOGICAL(cmd))
-  return 0;
-  switch (cmd-cmnd[0]) {
-  case READ_10:
-  case WRITE_10:
-  case READ_12:
-  case WRITE_12:
-  case READ_6:
-  case WRITE_6:
-  case READ_16:
-  case WRITE_16:
-  return 1;
-  default:
-   

RE: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h for internal shared functions using

2014-11-17 Thread Sumit Saxena
-Original Message-
From: Chen Gang [mailto:gang.chen.5...@gmail.com]
Sent: Monday, November 17, 2014 5:17 PM
To: Sumit Saxena
Cc: megaraidli...@lsi.com; linux-s...@vger.kernel.org; linux-
ker...@vger.kernel.org
Subject: RE: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h
for internal shared functions using


OK, I will send patch v2 for it.

I sent this patch based on Linux next tree, please tell me the tree
location (git
address) which I shall base on for sending patch v2.

I posted the patch series today, once the patches make it to scsi-next tree,
I will let you know.

Thanks
Sumit

Thanks.

Send from Lenovo A788t.

Sumit Saxena sumit.sax...@avagotech.com wrote:

-Original Message-
From: Chen Gang [mailto:gang.chen.5...@gmail.com]
Sent: Sunday, November 09, 2014 3:47 PM
To: megaraidli...@lsi.com; jbottom...@parallels.com
Cc: linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: scsi: megaraid: Add megaraid_sas_internal.h
for
internal shared functions using

For shared inline functions crossed source files, better to let it as
static inline
in a header file. For extern functions, better to declare them in
header
file.

For the latest upstream gcc/binutiles (gcc 5 with ld 2.25.51), it will
cause
building break (although it might be the gcc's or ld's issue), the
related error
(with allmodconfig under tile):

MODPOST 4002 modules
  ERROR: megasas_return_cmd [drivers/scsi/megaraid/megaraid_sas.ko]
undefined!
  ERROR: megasas_is_ldio [drivers/scsi/megaraid/megaraid_sas.ko]
undefined!


Signed-off-by: Chen Gang gang.chen.5...@gmail.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c |  65 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c   |  38 +-
 drivers/scsi/megaraid/megaraid_sas_internal.h | 100
++
 3 files changed, 102 insertions(+), 101 deletions(-)  create mode
100644 drivers/scsi/megaraid/megaraid_sas_internal.h

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index f6a69a3..4a71c04 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -57,6 +57,7 @@
 #include scsi/scsi_tcq.h
 #include megaraid_sas_fusion.h
 #include megaraid_sas.h
+#include megaraid_sas_internal.h

 /*
  * Number of sectors per IO command
@@ -98,7 +99,6 @@ MODULE_VERSION(MEGASAS_VERSION);
MODULE_AUTHOR(megaraidli...@lsi.com);
 MODULE_DESCRIPTION(LSI MegaRAID SAS Driver);

-int megasas_transition_to_ready(struct megasas_instance *instance,
int ocr);  static int megasas_get_pd_list(struct megasas_instance
*instance); static int megasas_ld_list_query(struct megasas_instance
*instance,
  u8 query_type);
@@ -155,9 +155,6 @@ static u32 support_device_change;
 /* define lock for aen poll */
 spinlock_t poll_aen_lock;

-void
-megasas_complete_cmd(struct megasas_instance *instance, struct
megasas_cmd *cmd,
- u8 alt_status);
 static u32
 megasas_read_fw_status_reg_gen2(struct megasas_register_set
__iomem
*regs);  static int @@ -170,26 +167,8 @@ u32
megasas_build_and_issue_cmd(struct megasas_instance *instance,
 struct scsi_cmnd *scmd);
 static void megasas_complete_cmd_dpc(unsigned long instance_addr);
-void -megasas_release_fusion(struct megasas_instance *instance); -int
- megasas_ioc_init_fusion(struct megasas_instance *instance); -void -
megasas_free_cmds_fusion(struct megasas_instance *instance);
-u8
-megasas_get_map_info(struct megasas_instance *instance); -int -
megasas_sync_map_info(struct megasas_instance *instance); -int -
wait_and_poll(struct megasas_instance *instance, struct megasas_cmd
*cmd,
-int seconds);
-void megasas_reset_reply_desc(struct megasas_instance *instance);
-int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout);
-void megasas_fusion_ocr_wq(struct work_struct *work);  static int
megasas_get_ld_vf_affiliation(struct megasas_instance *instance,
  int initial);
-int megasas_check_mpio_paths(struct megasas_instance *instance,
- struct scsi_cmnd *scmd);

 void
 megasas_issue_dcmd(struct megasas_instance *instance, struct
megasas_cmd *cmd) @@ -258,22 +237,6 @@
__megasas_return_cmd(struct
megasas_instance *instance, struct megasas_cmd *cmd)  }

 /**
- * megasas_return_cmd - Return a cmd to free command pool
- * @instance:   Adapter soft state
- * @cmd:Command packet to be returned to free command
pool
- */
-inline void
-megasas_return_cmd(struct megasas_instance *instance, struct
megasas_cmd *cmd) -{
-unsigned long flags;
-
-spin_lock_irqsave(instance-mfi_pool_lock, flags);
-__megasas_return_cmd(instance, cmd);
-spin_unlock_irqrestore(instance-mfi_pool_lock, flags);
-}
-
-
-/**
 *   The following functions are defined for xscale
 *   (deviceid : 1064R, PERC5) controllers
 */
@@ -1417,32 +1380,6 @@ megasas_build_ldio(struct

RE: [PATCH] megaraid_sas : Fix bug in handling return value of pci_enable_msix_range()

2014-11-04 Thread Sumit Saxena
>-Original Message-
>From: Jiang Liu [mailto:jiang@linux.intel.com]
>Sent: Monday, November 03, 2014 6:14 PM
>To: Neela Syam Kolli; James E.J. Bottomley
>Cc: Jiang Liu; Alexander Gordeev; linux-...@vger.kernel.org; linux-
>s...@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [PATCH] megaraid_sas : Fix bug in handling return value of
>pci_enable_msix_range()
>
>Function pci_enable_msix_range() may return negative values for error
>conditions. So it's a bug by checking (pci_enable_msix_range() != 0) for
>success and causes failure to megaraid driver when MSI is disabled.
>[   16.487267] megaraid_sas :02:00.0: Controller type: iMR
>[   16.487275] genirq: Flags mismatch irq 0.  (megasas) vs.
00015a00 (tii
>mer)
>[   16.487347] megasas: Failed to register IRQ for vector 0.
>
>Fixes: 8ae80ed1734b "megaraid: Use pci_enable_msix_range() instead of
>pci_enable_msix()"
>
>Signed-off-by: Jiang Liu 
>Cc: Alexander Gordeev 
>Cc: "Bjorn Helgaas "
>Cc: linux-...@vger.kernel.org
>Cc:  # 3.17
>---
> drivers/scsi/megaraid/megaraid_sas_base.c |2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index f6a69a3b1b3f..5640ad1c8214 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -4453,7 +4453,7 @@ static int megasas_init_fw(struct megasas_instance
>*instance)
>   instance->msixentry[i].entry = i;
>   i = pci_enable_msix_range(instance->pdev, instance-
>>msixentry,
> 1, instance->msix_vectors);
>-  if (i)
>+      if (i > 0)
>   instance->msix_vectors = i;
>   else
>   instance->msix_vectors = 0;

Acked-by: Sumit Saxena 

>--
>1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] megaraid_sas : Fix bug in handling return value of pci_enable_msix_range()

2014-11-04 Thread Sumit Saxena
-Original Message-
From: Jiang Liu [mailto:jiang@linux.intel.com]
Sent: Monday, November 03, 2014 6:14 PM
To: Neela Syam Kolli; James E.J. Bottomley
Cc: Jiang Liu; Alexander Gordeev; linux-...@vger.kernel.org; linux-
s...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] megaraid_sas : Fix bug in handling return value of
pci_enable_msix_range()

Function pci_enable_msix_range() may return negative values for error
conditions. So it's a bug by checking (pci_enable_msix_range() != 0) for
success and causes failure to megaraid driver when MSI is disabled.
[   16.487267] megaraid_sas :02:00.0: Controller type: iMR
[   16.487275] genirq: Flags mismatch irq 0.  (megasas) vs.
00015a00 (tii
mer)
[   16.487347] megasas: Failed to register IRQ for vector 0.

Fixes: 8ae80ed1734b megaraid: Use pci_enable_msix_range() instead of
pci_enable_msix()

Signed-off-by: Jiang Liu jiang@linux.intel.com
Cc: Alexander Gordeev agord...@redhat.com
Cc: Bjorn Helgaas bhelg...@google.com
Cc: linux-...@vger.kernel.org
Cc: sta...@vger.kernel.org # 3.17
---
 drivers/scsi/megaraid/megaraid_sas_base.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index f6a69a3b1b3f..5640ad1c8214 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4453,7 +4453,7 @@ static int megasas_init_fw(struct megasas_instance
*instance)
   instance-msixentry[i].entry = i;
   i = pci_enable_msix_range(instance-pdev, instance-
msixentry,
 1, instance-msix_vectors);
-  if (i)
+  if (i  0)
   instance-msix_vectors = i;
   else
   instance-msix_vectors = 0;

Acked-by: Sumit Saxena sumit.sax...@avagotech.com

--
1.7.10.4
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   >