25 Mar, 2020

1 commit

  • Some USB bridge devices will return a default set of characteristics during
    initialization. And then, once an attached drive has spun up, substitute
    the actual parameters reported by the drive. According to the SCSI spec,
    the device should return a UNIT ATTENTION in case any reported parameters
    change. But in this case the change is made silently after a small window
    where default values are reported.

    Commit a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of
    physical block size") validated the reported optimal I/O size against the
    physical block size to overcome problems with devices reporting nonsensical
    transfer sizes. However, this validation did not account for the fact that
    aforementioned devices will return default values during a brief window
    during spin-up. The subsequent change in reported characteristics would
    invalidate the checking that had previously been performed.

    Unset a previously configured optimal I/O size should the sanity checking
    fail on subsequent revalidate attempts.

    Link: https://lore.kernel.org/r/33fb522e-4f61-1b76-914f-c9e6a3553c9b@gmail.com
    Cc: Bryan Gurney
    Cc:
    Reported-by: Bernhard Sulzer
    Tested-by: Bernhard Sulzer
    Signed-off-by: Martin K. Petersen

    Martin K. Petersen
     

18 Mar, 2020

1 commit

  • I/Os could be passed down while the device FC SCSI device is being deleted.
    This would result in unnecessary delay of I/O and driver messages (when
    extended logging is set).

    [mkp: fixed commit hash and added SoB for Nilesh]

    Link: https://lore.kernel.org/r/20200313085001.3781-1-njavali@marvell.com
    Fixes: 3c75ad1d87c7 ("scsi: qla2xxx: Remove defer flag to indicate immeadiate port loss") # v5.6-rc1+
    Tested-by: Laurence Oberman
    Reviewed-by: Laurence Oberman
    Reviewed-by: Ewan D. Milne
    Reviewed-by: Roman Bolshakov
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Arun Easi
    Signed-off-by: Nilesh Javali
    Signed-off-by: Martin K. Petersen

    Arun Easi
     

11 Mar, 2020

2 commits

  • When trying to rescan disks in petitboot shell, we hit the following
    softlockup stacktrace:

    Kernel panic - not syncing: System is deadlocked on memory
    [ 241.223394] CPU: 32 PID: 693 Comm: sh Not tainted 5.4.16-openpower1 #1
    [ 241.223406] Call Trace:
    [ 241.223415] [c0000003f07c3180] [c000000000493fc4] dump_stack+0xa4/0xd8 (unreliable)
    [ 241.223432] [c0000003f07c31c0] [c00000000007d4ac] panic+0x148/0x3cc
    [ 241.223446] [c0000003f07c3260] [c000000000114b10] out_of_memory+0x468/0x4c4
    [ 241.223461] [c0000003f07c3300] [c0000000001472b0] __alloc_pages_slowpath+0x594/0x6d8
    [ 241.223476] [c0000003f07c3420] [c00000000014757c] __alloc_pages_nodemask+0x188/0x1a4
    [ 241.223492] [c0000003f07c34a0] [c000000000153e10] alloc_pages_current+0xcc/0xd8
    [ 241.223508] [c0000003f07c34e0] [c0000000001577ac] alloc_slab_page+0x30/0x98
    [ 241.223524] [c0000003f07c3520] [c0000000001597fc] new_slab+0x138/0x40c
    [ 241.223538] [c0000003f07c35f0] [c00000000015b204] ___slab_alloc+0x1e4/0x404
    [ 241.223552] [c0000003f07c36c0] [c00000000015b450] __slab_alloc+0x2c/0x48
    [ 241.223566] [c0000003f07c36f0] [c00000000015b754] kmem_cache_alloc_node+0x9c/0x1b4
    [ 241.223582] [c0000003f07c3760] [c000000000218c48] blk_alloc_queue_node+0x34/0x270
    [ 241.223599] [c0000003f07c37b0] [c000000000226574] blk_mq_init_queue+0x2c/0x78
    [ 241.223615] [c0000003f07c37e0] [c0000000002ff710] scsi_mq_alloc_queue+0x28/0x70
    [ 241.223631] [c0000003f07c3810] [c0000000003005b8] scsi_alloc_sdev+0x184/0x264
    [ 241.223647] [c0000003f07c38a0] [c000000000300ba0] scsi_probe_and_add_lun+0x288/0xa3c
    [ 241.223663] [c0000003f07c3a00] [c000000000301768] __scsi_scan_target+0xcc/0x478
    [ 241.223679] [c0000003f07c3b20] [c000000000301c64] scsi_scan_channel.part.9+0x74/0x7c
    [ 241.223696] [c0000003f07c3b70] [c000000000301df4] scsi_scan_host_selected+0xe0/0x158
    [ 241.223712] [c0000003f07c3bd0] [c000000000303f04] store_scan+0x104/0x114
    [ 241.223727] [c0000003f07c3cb0] [c0000000002d5ac4] dev_attr_store+0x30/0x4c
    [ 241.223741] [c0000003f07c3cd0] [c0000000001dbc34] sysfs_kf_write+0x64/0x78
    [ 241.223756] [c0000003f07c3cf0] [c0000000001da858] kernfs_fop_write+0x170/0x1b8
    [ 241.223773] [c0000003f07c3d40] [c0000000001621fc] __vfs_write+0x34/0x60
    [ 241.223787] [c0000003f07c3d60] [c000000000163c2c] vfs_write+0xa8/0xcc
    [ 241.223802] [c0000003f07c3db0] [c000000000163df4] ksys_write+0x70/0xbc
    [ 241.223816] [c0000003f07c3e20] [c00000000000b40c] system_call+0x5c/0x68

    As a part of the scan process Linux will allocate and configure a
    scsi_device for each target to be scanned. If the device is not present,
    then the scsi_device is torn down. As a part of scsi_device teardown a
    workqueue item will be scheduled and the lockups we see are because there
    are 250k workqueue items to be processed. Accoding to the specification of
    SIS-64 sas controller, max_channel should be decreased on SIS-64 adapters
    to 4.

    The patch fixes softlockup issue.

    Thanks for Oliver Halloran's help with debugging and explanation!

    Link: https://lore.kernel.org/r/1583510248-23672-1-git-send-email-wenxiong@linux.vnet.ibm.com
    Signed-off-by: Wen Xiong
    Signed-off-by: Martin K. Petersen

    Wen Xiong
     
  • Before access auto hibner8 timer register, make sure power and clock are
    properly configured to avoid unclocked register access.

    Link: https://lore.kernel.org/r/1583398391-14273-1-git-send-email-cang@codeaurora.org
    Fixes: ba7af5ec5126 ("scsi: ufs: export ufshcd_auto_hibern8_update for vendor usage")
    Reviewed-by: Stanley Chu
    Signed-off-by: Can Guo
    Signed-off-by: Martin K. Petersen

    Can Guo
     

25 Feb, 2020

2 commits

  • Arnd Bergmann inadvertently typoed these in d320a9551e394 and 64cbfa96551a;
    they seem to be the cause of
    https://bugzilla.redhat.com/show_bug.cgi?id=1801353 , invalid SCSI commands
    when udev tries to query a DVD drive.

    [arnd] Found another instance of the same bug, also introduced in my
    compat_ioctl series.

    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1801353
    Link: https://lore.kernel.org/r/20200219165139.3467320-1-arnd@arndb.de
    Fixes: c103d6ee69f9 ("compat_ioctl: ide: floppy: add handler")
    Fixes: 64cbfa96551a ("compat_ioctl: move cdrom commands into cdrom.c")
    Fixes: d320a9551e39 ("compat_ioctl: scsi: move ioctl handling into drivers")
    Bisected-by: Chris Murphy
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Adam Williamson
    Signed-off-by: Martin K. Petersen

    Adam Williamson
     
  • The block layer generic blk_revalidate_disk_zones() checks the validity of
    zone descriptors reported by a disk using the blk_revalidate_zone_cb()
    callback function executed for each zone descriptor. If a ZBC disk reports
    invalid zone descriptors, blk_revalidate_disk_zones() returns an error and
    sd_zbc_read_zones() changes the disk capacity to 0, which in turn results
    in the gendisk structure capacity to be set to 0. This all works well for
    the first revalidate pass on a disk and the block layer detects the
    capactiy change.

    On the second revalidate pass, blk_revalidate_disk_zones() is called again
    and sd_zbc_report_zones() executed to check the zones a second time.
    However, for this second pass, the gendisk capacity is now 0, which results
    in sd_zbc_report_zones() to do nothing and to report success and no
    zones. blk_revalidate_disk_zones() in turn returns success and sets the
    disk queue chunk_sectors limit with zero as no zones were checked, causing
    a oops to trigger on the BUG_ON(!is_power_of_2(chunk_sectors)) in
    blk_queue_chunk_sectors().

    Fix this by using the sdkp capacity field rather than the gendisk capacity
    for the report zones loop in sd_zbc_report_zones(). Also add a check to
    return immediately an error if the sdkp capacity is 0. With this fix,
    invalid/buggy ZBC disk scan does not trigger a oops and are exposed with a
    0 capacity. This change also preserve the chance for the disk to be
    correctly revalidated on the second revalidate pass as the scsi disk
    structure capacity field is always set to the disk reported value when
    sd_zbc_report_zones() is called.

    Link: https://lore.kernel.org/r/20200219063800.880834-1-damien.lemoal@wdc.com
    Fixes: d41003513e61 ("block: rework zone reporting")
    Cc: Cc: # v5.5
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Damien Le Moal
    Signed-off-by: Martin K. Petersen

    Damien Le Moal
     

22 Feb, 2020

1 commit

  • fc_disc_gpn_id_resp() should be the last function using it so free it here
    to avoid memory leak.

    Link: https://lore.kernel.org/r/1579013000-14570-2-git-send-email-igor.druzhinin@citrix.com
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Igor Druzhinin
    Signed-off-by: Martin K. Petersen

    Igor Druzhinin
     

13 Feb, 2020

1 commit

  • Add a flag to DMA memory allocation to silence a warning.

    This driver allocates DMA memory for IO frames. This allocation may exceed
    MAX_ORDER pages for few megaraid_sas controllers (controllers with very
    high queue depth). Consequently, the driver has logic to keep reducing the
    controller queue depth until the DMA memory allocation succeeds.

    On impacted megaraid_sas controllers there would be multiple DMA allocation
    failures until driver settled on an allocation that fit. These failed DMA
    allocation requests caused stack traces in system logs. These were not
    harmful and this patch silences those warnings/stack traces.

    [mkp: clarified commit desc]

    Link: https://lore.kernel.org/r/20200204152413.7107-1-thenzl@redhat.com
    Signed-off-by: Tomas Henzl
    Acked-by: Sumit Saxena
    Reviewed-by: Lee Duncan
    Signed-off-by: Martin K. Petersen

    Tomas Henzl
     

09 Feb, 2020

1 commit

  • Pull misc SCSI fixes from James Bottomley:
    "Five small patches, all in drivers or doc, which missed the initial
    pull request.

    The qla2xxx and megaraid_sas are actual fixes and the rest are
    spelling and doc changes"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: ufs: fix spelling mistake "initilized" -> "initialized"
    scsi: pm80xx: fix spelling mistake "to" -> "too"
    scsi: MAINTAINERS: ufs: remove pedrom.sousa@synopsys.com
    scsi: megaraid_sas: fixup MSIx interrupt setup during resume
    scsi: qla2xxx: Fix unbound NVME response length

    Linus Torvalds
     

04 Feb, 2020

1 commit

  • The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
    seq_file.h.

    Conversion rule is:

    llseek => proc_lseek
    unlocked_ioctl => proc_ioctl

    xxx => proc_xxx

    delete ".owner = THIS_MODULE" line

    [akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c]
    [sfr@canb.auug.org.au: fix kernel/sched/psi.c]
    Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au
    Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

30 Jan, 2020

5 commits

  • There is a spelling mistake in a pr_err message. Fix it.

    Link: https://lore.kernel.org/r/20200122091250.2777221-1-colin.king@canonical.com
    Signed-off-by: Colin Ian King
    Reviewed-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Colin Ian King
     
  • There is a spelling mistake in a pm8001_printk message. Fix it.

    Link: https://lore.kernel.org/r/20200123005706.2834281-1-colin.king@canonical.com
    Signed-off-by: Colin Ian King
    Acked-by: Jack Wang
    Signed-off-by: Martin K. Petersen

    Colin Ian King
     
  • Streamline resume workflow by using the same functions for enabling MSIx
    interrupts as used during initialisation. Without it the driver might
    crash during resume with:

    WARNING: CPU: 2 PID: 4306 at ../drivers/pci/msi.c:1303 pci_irq_get_affinity+0x3b/0x90

    Link: https://lore.kernel.org/r/20200113132609.69536-1-hare@suse.de
    Signed-off-by: Hannes Reinecke
    Acked-by: Sumit Saxena
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     
  • On certain cases when response length is less than 32, NVME response data
    is supplied inline in IOCB. This is indicated by some combination of state
    flags. There was an instance when a high, and incorrect, response length
    was indicated causing driver to overrun buffers. Fix this by checking and
    limiting the response payload length.

    Fixes: 7401bc18d1ee3 ("scsi: qla2xxx: Add FC-NVMe command handling")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200124045014.23554-1-hmadhani@marvell.com
    Signed-off-by: Arun Easi
    Signed-off-by: Himanshu Madhani
    Reviewed-by: Ewan D. Milne
    Signed-off-by: Martin K. Petersen

    Arun Easi
     
  • Pull SCSI updates from James Bottomley:
    "This series is slightly unusual because it includes Arnd's compat
    ioctl tree here:

    1c46a2cf2dbd Merge tag 'block-ioctl-cleanup-5.6' into 5.6/scsi-queue

    Excluding Arnd's changes, this is mostly an update of the usual
    drivers: megaraid_sas, mpt3sas, qla2xxx, ufs, lpfc, hisi_sas.

    There are a couple of core and base updates around error propagation
    and atomicity in the attribute container base we use for the SCSI
    transport classes.

    The rest is minor changes and updates"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (149 commits)
    scsi: hisi_sas: Rename hisi_sas_cq.pci_irq_mask
    scsi: hisi_sas: Add prints for v3 hw interrupt converge and automatic affinity
    scsi: hisi_sas: Modify the file permissions of trigger_dump to write only
    scsi: hisi_sas: Replace magic number when handle channel interrupt
    scsi: hisi_sas: replace spin_lock_irqsave/spin_unlock_restore with spin_lock/spin_unlock
    scsi: hisi_sas: use threaded irq to process CQ interrupts
    scsi: ufs: Use UFS device indicated maximum LU number
    scsi: ufs: Add max_lu_supported in struct ufs_dev_info
    scsi: ufs: Delete is_init_prefetch from struct ufs_hba
    scsi: ufs: Inline two functions into their callers
    scsi: ufs: Move ufshcd_get_max_pwr_mode() to ufshcd_device_params_init()
    scsi: ufs: Split ufshcd_probe_hba() based on its called flow
    scsi: ufs: Delete struct ufs_dev_desc
    scsi: ufs: Fix ufshcd_probe_hba() reture value in case ufshcd_scsi_add_wlus() fails
    scsi: ufs-mediatek: enable low-power mode for hibern8 state
    scsi: ufs: export some functions for vendor usage
    scsi: ufs-mediatek: add dbg_register_dump implementation
    scsi: qla2xxx: Fix a NULL pointer dereference in an error path
    scsi: qla1280: Make checking for 64bit support consistent
    scsi: megaraid_sas: Update driver version to 07.713.01.00-rc1
    ...

    Linus Torvalds
     

28 Jan, 2020

2 commits

  • Pull ioremap updates from Christoph Hellwig:
    "Remove the ioremap_nocache API (plus wrappers) that are always
    identical to ioremap"

    * tag 'ioremap-5.6' of git://git.infradead.org/users/hch/ioremap:
    remove ioremap_nocache and devm_ioremap_nocache
    MIPS: define ioremap_nocache to ioremap

    Linus Torvalds
     
  • Pull core block updates from Jens Axboe:
    "This may be the most quiet round we've had in years. I'm not
    complaining. Really not a lot to detail here, outside of spelling and
    documentation improvements/fixes, we have:

    - Allow t10-pi to be modular (Herbert)

    - Remove dead code in bfq (Alex)

    - Mark zone management requests with REQ_SYNC (Chaitanya)

    - BFQ division improvement (Wen)

    - Small series improving plugging (Pavel)"

    * tag 'for-5.6/block-2020-01-27' of git://git.kernel.dk/linux-block:
    partitions/ldm: fix spelling mistake "to" -> "too"
    block, bfq: improve arithmetic division in bfq_delta()
    block/bfq: remove unused bfq_class_rt which never used
    block: mark zone-mgmt bios with REQ_SYNC
    blk-mq: Document functions for sending request
    block: Allow t10-pi to be modular
    blk-mq: optimise blk_mq_flush_plug_list()
    list: introduce list_for_each_continue()
    blk-mq: optimise rq sort function

    Linus Torvalds
     

27 Jan, 2020

3 commits

  • Pull block fix from Jens Axboe:
    "Unfortunately this weekend we had a few last minute reports, one was
    for block.

    The partition disable for zoned devices was overly restrictive, it can
    work (and be supported) just fine for host-aware variants.

    Here's a fix ensuring that's the case so we don't break existing users
    of that"

    * tag 'block-5.5-2020-01-26' of git://git.kernel.dk/linux-block:
    block: allow partitions on host aware zone devices

    Linus Torvalds
     
  • Pull SCSI fixes from James Bottomley:
    "Two last minute fixes, both in drivers.

    The fnic one is a highly unlikely condition, but the RDMA one is a
    recently introduced regression that causes a kernel warning to trigger
    in every RDMA logon, which would be unsightly if it got into the final
    release"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: RDMA/isert: Fix a recently introduced regression related to logout
    scsi: fnic: do not queue commands during fwreset

    Linus Torvalds
     
  • Host-aware SMR drives can be used with the commands to explicitly manage
    zone state, but they can also be used as normal disks. In the former
    case it makes perfect sense to allow partitions on them, in the latter
    it does not, just like for host managed devices. Add a check to
    add_partition to allow partitions on host aware devices, but give
    up any zone management capabilities in that case, which also catches
    the previously missed case of adding a partition vs just scanning it.

    Because sd can rescan the attribute at runtime it needs to check if
    a disk has partitions, for which a new helper is added to genhd.h.

    Fixes: 5eac3eb30c9a ("block: Remove partition support for zoned block devices")
    Reported-by: Borislav Petkov
    Signed-off-by: Christoph Hellwig
    Tested-by: Damien Le Moal
    Reviewed-by: Damien Le Moal
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

21 Jan, 2020

20 commits

  • When a link is going down the driver will be calling fnic_cleanup_io(),
    which will traverse all commands and calling 'done' for each found command.
    While the traversal is handled under the host_lock, calling 'done' happens
    after the host_lock is being dropped.

    As fnic_queuecommand_lck() is being called with the host_lock held, it
    might well be that it will pick the command being selected for abortion
    from the above routine and enqueue it for sending, but then 'done' is being
    called on that very command from the above routine.

    Which of course confuses the hell out of the scsi midlayer.

    So fix this by not queueing commands when fnic_cleanup_io is active.

    Link: https://lore.kernel.org/r/20200116102053.62755-1-hare@suse.de
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Martin K. Petersen

    Hannes Reinecke
     
  • In future we will want to use hisi_sas_cq.pci_irq_mask for non-pci
    interrupt masks, so rename to be more general.

    Link: https://lore.kernel.org/r/1579522957-4393-7-git-send-email-john.garry@huawei.com
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    John Garry
     
  • Add prints to inform the user of enabled features.

    Link: https://lore.kernel.org/r/1579522957-4393-6-git-send-email-john.garry@huawei.com
    Signed-off-by: Luo Jiaxing
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    Luo Jiaxing
     
  • The trigger_dump file is only used to manually trigger the dump, and did
    not provide a read callback function for it, so its file permission
    setting to 600 is wrong,and should be changed to 200.

    Link: https://lore.kernel.org/r/1579522957-4393-5-git-send-email-john.garry@huawei.com
    Signed-off-by: Luo Jiaxing
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    Luo Jiaxing
     
  • We use magic number as offset and mask when handle channel interrupt, so
    use macro to replace it.

    Link: https://lore.kernel.org/r/1579522957-4393-4-git-send-email-john.garry@huawei.com
    Signed-off-by: Luo Jiaxing
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    Luo Jiaxing
     
  • After changing tasklet to workqueue or threaded irq, some critical
    resources are only used on threads (not in interrupt or bottom half of
    interrupt), so replace spin_lock_irqsave/spin_unlock_restore with
    spin_lock/spin_unlock to protect those critical resources.

    Link: https://lore.kernel.org/r/1579522957-4393-3-git-send-email-john.garry@huawei.com
    Signed-off-by: Xiang Chen
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    Xiang Chen
     
  • Currently IRQ_EFFECTIVE_AFF_MASK is enabled for ARM_GIC and ARM_GIC3, so it
    only allows a single target CPU in the affinity mask to process interrupts
    and also interrupt thread, and the performance of using threaded irq is
    almost the same as tasklet. But if the config is not enabled, the interrupt
    thread will be allowed all the CPUs in the affinity mask. At that situation
    it improves the performance (about 20%).

    Note: IRQ_EFFECTIVE_AFF_MASK is configured differently for different
    architecture chip, and it seems to be better to make it be configured
    easily.

    Link: https://lore.kernel.org/r/1579522957-4393-2-git-send-email-john.garry@huawei.com
    Signed-off-by: Xiang Chen
    Signed-off-by: John Garry
    Signed-off-by: Martin K. Petersen

    Xiang Chen
     
  • According to Jedec standard UFS 3.0 and UFS 2.1 Spec, Maximum number of
    logical units supported by the UFS device is indicated by parameter
    bMaxNumberLU in Geometry Descriptor. This patch is to delete current hard
    code macro definition of UFS_UPIU_MAX_GENERAL_LUN, and switch to use device
    indicated number instead.

    Link: https://lore.kernel.org/r/20200120130820.1737-9-huobean@gmail.com
    Reviewed-by: Asutosh Das
    Reviewed-by: Alim Akhtar
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • Add one new parameter max_lu_supported in struct ufs_dev_info, which will
    be used to express exactly how many general LUs being supported by UFS
    device, and initialize it during booting stage. This patch also adds a new
    function ufshcd_device_geo_params_init() for initialization of UFS device
    geometry descriptor related parameters.

    Link: https://lore.kernel.org/r/20200120130820.1737-8-huobean@gmail.com
    Reviewed-by: Asutosh Das
    Reviewed-by: Alim Akhtar
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • Without variable is_init_prefetch, the current logic can guarantee
    ufshcd_init_icc_levels() will execute only once, delete it now.

    Link: https://lore.kernel.org/r/20200120130820.1737-7-huobean@gmail.com
    Reviewed-by: Asutosh Das
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • Delete ufshcd_read_power_desc() and ufshcd_read_device_desc(), directly
    inline ufshcd_read_desc() into its callers.

    Link: https://lore.kernel.org/r/20200120130820.1737-6-huobean@gmail.com
    Reviewed-by: Alim Akhtar
    Reviewed-by: Asutosh Das
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • ufshcd_get_max_pwr_mode() only need to be called once while booting, take
    it out from ufshcd_probe_hba() and inline into ufshcd_device_params_init().

    Link: https://lore.kernel.org/r/20200120130820.1737-5-huobean@gmail.com
    Reviewed-by: Stanley Chu
    Reviewed-by: Asutosh Das
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • This patch has two major non-functionality changes:

    1. Take scanning host if-statement out from ufshcd_probe_hba(), and move
    into a new added function ufshcd_add_lus(). In this new function
    ufshcd_add_lus(), the main functionalitis include: ICC initialization, add
    well-known LUs, devfreq initialization, UFS bsg probe and scsi host
    scan. The reason for this change is that these functionalities only being
    called during booting stage flow ufshcd_init()->ufshcd_async_scan(). In the
    processes of error handling and power management ufshcd_suspend(),
    ufshcd_resume(), ufshcd_probe_hba() being called, but these functionalitis
    above metioned are not hit.

    2. Move context of initialization of parameters associated with the UFS
    device to a new added function ufshcd_device_params_init(). The reason of
    this change is that all of these parameters are used by driver, but only
    need to be initialized once when booting. Combine them into an integral
    function, make them easier maintain.

    Link: https://lore.kernel.org/r/20200120130820.1737-4-huobean@gmail.com
    Reviewed-by: Asutosh Das
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • In consideration of UFS host driver uses parameters of struct ufs_dev_desc,
    move its parameters to struct ufs_dev_info, delete struct ufs_dev_desc.

    Link: https://lore.kernel.org/r/20200120130820.1737-3-huobean@gmail.com
    Reviewed-by: Bart Van Assche
    Reviewed-by: Asutosh Das
    Reviewed-by: Alim Akhtar
    Reviewed-by: Stanley Chu
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • A non-zero error value likely being returned by ufshcd_scsi_add_wlus() in
    case of failure of adding the WLs, but ufshcd_probe_hba() doesn't use this
    value, and doesn't report this failure to upper caller. This patch is to
    fix this issue.

    Fixes: 2a8fa600445c ("ufs: manually add well known logical units")
    Link: https://lore.kernel.org/r/20200120130820.1737-2-huobean@gmail.com
    Reviewed-by: Asutosh Das
    Reviewed-by: Alim Akhtar
    Reviewed-by: Stanley Chu
    Signed-off-by: Bean Huo
    Signed-off-by: Martin K. Petersen

    Bean Huo
     
  • In MediaTek Chipsets, UniPro link and ufshci can enter proprietary
    low-power mode while link is in hibern8 state.

    Link: https://lore.kernel.org/r/20200117035108.19699-4-stanley.chu@mediatek.com
    Reviewed-by: Alim Akhtar
    Reviewed-by: Asutosh Das
    Signed-off-by: Stanley Chu
    Signed-off-by: Martin K. Petersen

    Stanley Chu
     
  • Export below functions for vendor usage:

    int ufshcd_hba_enable(struct ufs_hba *hba);
    int ufshcd_make_hba_operational(struct ufs_hba *hba);
    int ufshcd_uic_hibern8_exit(struct ufs_hba *hba);

    Link: https://lore.kernel.org/r/20200117035108.19699-3-stanley.chu@mediatek.com
    Reviewed-by: Alim Akhtar
    Reviewed-by: Asutosh Das
    Signed-off-by: Stanley Chu
    Signed-off-by: Martin K. Petersen

    Stanley Chu
     
  • Add dbg_register_dump variant vendor implementation in MediaTek UFS driver.

    Link: https://lore.kernel.org/r/20200117035108.19699-2-stanley.chu@mediatek.com
    Reviewed-by: Alim Akhtar
    Signed-off-by: Stanley Chu
    Signed-off-by: Martin K. Petersen

    Stanley Chu
     
  • This patch fixes the following Coverity complaint:

    FORWARD_NULL

    qla_init.c: 5275 in qla2x00_configure_local_loop()
    5269
    5270 if (fcport->scan_state == QLA_FCPORT_FOUND)
    5271 qla24xx_fcport_handle_login(vha, fcport);
    5272 }
    5273
    5274 cleanup_allocation:
    >>> CID 353340: (FORWARD_NULL)
    >>> Passing null pointer "new_fcport" to "qla2x00_free_fcport", which dereferences it.
    5275 qla2x00_free_fcport(new_fcport);
    5276
    5277 if (rval != QLA_SUCCESS) {
    5278 ql_dbg(ql_dbg_disc, vha, 0x2098,
    5279 "Configure local loop error exit: rval=%x.\n", rval);
    5280 }
    qla_init.c: 5275 in qla2x00_configure_local_loop()
    5269
    5270 if (fcport->scan_state == QLA_FCPORT_FOUND)
    5271 qla24xx_fcport_handle_login(vha, fcport);
    5272 }
    5273
    5274 cleanup_allocation:
    >>> CID 353340: (FORWARD_NULL)
    >>> Passing null pointer "new_fcport" to "qla2x00_free_fcport", which dereferences it.
    5275 qla2x00_free_fcport(new_fcport);
    5276
    5277 if (rval != QLA_SUCCESS) {
    5278 ql_dbg(ql_dbg_disc, vha, 0x2098,
    5279 "Configure local loop error exit: rval=%x.\n", rval);
    5280 }

    Fixes: 3dae220595ba ("scsi: qla2xxx: Use common routine to free fcport struct")
    Cc: Himanshu Madhani
    Cc: Quinn Tran
    Cc: Martin Wilck
    Cc: Daniel Wagner
    Cc: Roman Bolshakov
    Link: https://lore.kernel.org/r/20200118042056.32232-1-bvanassche@acm.org
    Signed-off-by: Bart Van Assche
    Reviewed-by: Ewan D. Milne
    Reviewed-by: Daniel Wagner
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     
  • Use #ifdef QLA_64BIT_PTR to check if 64bit support is enabled. This
    fixes ("scsi: qla1280: Fix dma firmware download, if dma address is
    64bit").

    Link: https://lore.kernel.org/r/20200117115628.13219-1-tbogendoerfer@suse.de
    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Martin K. Petersen

    Thomas Bogendoerfer