Skip to content
Permalink
Fengnan-Chang/…
Switch branches/tags

Commits on Nov 11, 2021

  1. scsi:ufs:add quirk to keep write booster on

    Some samsung devices have performance issue when the
    remaining space is low, and the write booster needs
    to be always on.
    
    Therefore, add quirk option UFS_DEVICE_QUIRK_KEEP_ON_WB
    
    Signed-off-by: tanghuan <tanghuan@vivo.com>
    tanghuan authored and intel-lab-lkp committed Nov 11, 2021

Commits on Nov 9, 2021

  1. scsi: qla2xxx: Fix mailbox direction flags in qla2xxx_get_adapter_id()

    The SCM changes set the flags in mcp->out_mb instead of mcp->in_mb so the
    data was not actually being read into the mcp->mb[] array from the adapter.
    
    Link: https://lore.kernel.org/r/20211108183012.13895-1-emilne@redhat.com
    Fixes: 9f2475f ("scsi: qla2xxx: SAN congestion management implementation")
    Cc: stable@vger.kernel.org
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Reviewed-by: Arun Easi <aeasi@marvell.com>
    Signed-off-by: Ewan D. Milne <emilne@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Ewan D. Milne authored and martinkpetersen committed Nov 9, 2021
  2. scsi: ufs: core: Fix another task management completion race

    hba->outstanding_tasks, which is read under host_lock spinlock, tells the
    interrupt handler what task management tags are in use by the driver.  The
    doorbell register bits indicate which tags are in use by the hardware.  A
    doorbell bit that is 0 is because the bit has yet to be set by the driver,
    or because the task is complete. It is only possible to disambiguate the 2
    cases, if reading/writing the doorbell register is synchronized with
    reading/writing hba->outstanding_tasks.
    
    For that reason, reading REG_UTP_TASK_REQ_DOOR_BELL must be done under
    spinlock.
    
    Link: https://lore.kernel.org/r/20211108064815.569494-3-adrian.hunter@intel.com
    Fixes: f5ef336 ("scsi: ufs: core: Fix task management completion")
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    ahunter6 authored and martinkpetersen committed Nov 9, 2021
  3. scsi: ufs: core: Fix task management completion timeout race

    __ufshcd_issue_tm_cmd() clears req->end_io_data after timing out, which
    races with the completion function ufshcd_tmc_handler() which expects
    req->end_io_data to have a value.
    
    Note __ufshcd_issue_tm_cmd() and ufshcd_tmc_handler() are already
    synchronized using hba->tmf_rqs and hba->outstanding_tasks under the
    host_lock spinlock.
    
    It is also not necessary (nor typical) to clear req->end_io_data because
    the block layer does it before allocating out requests e.g. via
    blk_get_request().
    
    So fix by not clearing it.
    
    Link: https://lore.kernel.org/r/20211108064815.569494-2-adrian.hunter@intel.com
    Fixes: f5ef336 ("scsi: ufs: core: Fix task management completion")
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    ahunter6 authored and martinkpetersen committed Nov 9, 2021
  4. scsi: core: sysfs: Fix hang when device state is set via sysfs

    This fixes a regression added with:
    
    commit f0f82e2 ("scsi: core: Fix capacity set to zero after
    offlinining device")
    
    The problem is that after iSCSI recovery, iscsid will call into the kernel
    to set the dev's state to running, and with that patch we now call
    scsi_rescan_device() with the state_mutex held. If the SCSI error handler
    thread is just starting to test the device in scsi_send_eh_cmnd() then it's
    going to try to grab the state_mutex.
    
    We are then stuck, because when scsi_rescan_device() tries to send its I/O
    scsi_queue_rq() calls -> scsi_host_queue_ready() -> scsi_host_in_recovery()
    which will return true (the host state is still in recovery) and I/O will
    just be requeued. scsi_send_eh_cmnd() will then never be able to grab the
    state_mutex to finish error handling.
    
    To prevent the deadlock move the rescan-related code to after we drop the
    state_mutex.
    
    This also adds a check for if we are already in the running state. This
    prevents extra scans and helps the iscsid case where if the transport class
    has already onlined the device during its recovery process then we don't
    need userspace to do it again plus possibly block that daemon.
    
    Link: https://lore.kernel.org/r/20211105221048.6541-3-michael.christie@oracle.com
    Fixes: f0f82e2 ("scsi: core: Fix capacity set to zero after offlinining device")
    Cc: Bart Van Assche <bvanassche@acm.org>
    Cc: lijinlin <lijinlin3@huawei.com>
    Cc: Wu Bo <wubo40@huawei.com>
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Reviewed-by: Wu Bo <wubo40@huawei.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    mikechristie authored and martinkpetersen committed Nov 9, 2021
  5. scsi: iscsi: Unblock session then wake up error handler

    We can race where iscsi_session_recovery_timedout() has woken up the error
    handler thread and it's now setting the devices to offline, and
    session_recovery_timedout()'s call to scsi_target_unblock() is also trying
    to set the device's state to transport-offline. We can then get a mix of
    states.
    
    For the case where we can't relogin we want the devices to be in
    transport-offline so when we have repaired the connection
    __iscsi_unblock_session() can set the state back to running.
    
    Set the device state then call into libiscsi to wake up the error handler.
    
    Link: https://lore.kernel.org/r/20211105221048.6541-2-michael.christie@oracle.com
    Reviewed-by: Lee Duncan <lduncan@suse.com>
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    mikechristie authored and martinkpetersen committed Nov 9, 2021
  6. scsi: ufs: core: Improve SCSI abort handling

    The following has been observed on a test setup:
    
    WARNING: CPU: 4 PID: 250 at drivers/scsi/ufs/ufshcd.c:2737 ufshcd_queuecommand+0x468/0x65c
    Call trace:
     ufshcd_queuecommand+0x468/0x65c
     scsi_send_eh_cmnd+0x224/0x6a0
     scsi_eh_test_devices+0x248/0x418
     scsi_eh_ready_devs+0xc34/0xe58
     scsi_error_handler+0x204/0x80c
     kthread+0x150/0x1b4
     ret_from_fork+0x10/0x30
    
    That warning is triggered by the following statement:
    
    	WARN_ON(lrbp->cmd);
    
    Fix this warning by clearing lrbp->cmd from the abort handler.
    
    Link: https://lore.kernel.org/r/20211104181059.4129537-1-bvanassche@acm.org
    Fixes: 7a3e97b ("[SCSI] ufshcd: UFS Host controller driver")
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    bvanassche authored and martinkpetersen committed Nov 9, 2021

Commits on Nov 5, 2021

  1. scsi: scsi_debug: Don't call kcalloc() if size arg is zero

    If the size arg to kcalloc() is zero, it returns ZERO_SIZE_PTR.  Because of
    that, for a following NULL pointer check to work on the returned pointer,
    kcalloc() must not be called with the size arg equal to zero. Return early
    without error before the kcalloc() call if size arg is zero.
    
    BUG: KASAN: null-ptr-deref in memcpy include/linux/fortify-string.h:191 [inline]
    BUG: KASAN: null-ptr-deref in sg_copy_buffer+0x138/0x240 lib/scatterlist.c:974
    Write of size 4 at addr 0000000000000010 by task syz-executor.1/22789
    
    CPU: 1 PID: 22789 Comm: syz-executor.1 Not tainted 5.15.0-syzk #1
    Hardware name: Red Hat KVM, BIOS 1.13.0-2
    Call Trace:
     __dump_stack lib/dump_stack.c:88 [inline]
     dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106
     __kasan_report mm/kasan/report.c:446 [inline]
     kasan_report.cold.14+0x112/0x117 mm/kasan/report.c:459
     check_region_inline mm/kasan/generic.c:183 [inline]
     kasan_check_range+0x1a3/0x210 mm/kasan/generic.c:189
     memcpy+0x3b/0x60 mm/kasan/shadow.c:66
     memcpy include/linux/fortify-string.h:191 [inline]
     sg_copy_buffer+0x138/0x240 lib/scatterlist.c:974
     do_dout_fetch drivers/scsi/scsi_debug.c:2954 [inline]
     do_dout_fetch drivers/scsi/scsi_debug.c:2946 [inline]
     resp_verify+0x49e/0x930 drivers/scsi/scsi_debug.c:4276
     schedule_resp+0x4d8/0x1a70 drivers/scsi/scsi_debug.c:5478
     scsi_debug_queuecommand+0x8c9/0x1ec0 drivers/scsi/scsi_debug.c:7533
     scsi_dispatch_cmd drivers/scsi/scsi_lib.c:1520 [inline]
     scsi_queue_rq+0x16b0/0x2d40 drivers/scsi/scsi_lib.c:1699
     blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1639
     __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
     blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
     __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1761
     __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1838
     blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
     blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
     blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:62
     blk_execute_rq+0xdb/0x360 block/blk-exec.c:102
     sg_scsi_ioctl drivers/scsi/scsi_ioctl.c:621 [inline]
     scsi_ioctl+0x8bb/0x15c0 drivers/scsi/scsi_ioctl.c:930
     sg_ioctl_common+0x172d/0x2710 drivers/scsi/sg.c:1112
     sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1165
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:874 [inline]
     __se_sys_ioctl fs/ioctl.c:860 [inline]
     __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Link: https://lore.kernel.org/r/1636056397-13151-1-git-send-email-george.kennedy@oracle.com
    Reported-by: syzkaller <syzkaller@googlegroups.com>
    Acked-by: Douglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: George Kennedy <george.kennedy@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    gkennedy12 authored and martinkpetersen committed Nov 5, 2021
  2. scsi: core: Remove command size deduction from scsi_setup_scsi_cmnd()

    No need to deduce command size in scsi_setup_scsi_cmnd() anymore as
    appropriate checks have been added to scsi_fill_sghdr_rq() function and the
    cmd_len should never be zero here.  The code to do that wasn't correct
    anyway, as it used uninitialized cmd->cmnd, which caused a null-ptr-deref
    if the command size was zero as in the trace below. Fix this by removing
    the unneeded code.
    
    KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
    CPU: 0 PID: 1822 Comm: repro Not tainted 5.15.0 #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014
    Call Trace:
     blk_mq_dispatch_rq_list+0x7c7/0x12d0
     __blk_mq_sched_dispatch_requests+0x244/0x380
     blk_mq_sched_dispatch_requests+0xf0/0x160
     __blk_mq_run_hw_queue+0xe8/0x160
     __blk_mq_delay_run_hw_queue+0x252/0x5d0
     blk_mq_run_hw_queue+0x1dd/0x3b0
     blk_mq_sched_insert_request+0x1ff/0x3e0
     blk_execute_rq_nowait+0x173/0x1e0
     blk_execute_rq+0x15c/0x540
     sg_io+0x97c/0x1370
     scsi_ioctl+0xe16/0x28e0
     sd_ioctl+0x134/0x170
     blkdev_ioctl+0x362/0x6e0
     block_ioctl+0xb0/0xf0
     vfs_ioctl+0xa7/0xf0
     do_syscall_64+0x3d/0xb0
     entry_SYSCALL_64_after_hwframe+0x44/0xae
    ---[ end trace 8b086e334adef6d2 ]---
    Kernel panic - not syncing: Fatal exception
    
    Link: https://lore.kernel.org/r/20211103170659.22151-2-tadeusz.struk@linaro.org
    Fixes: 2ceda20 ("scsi: core: Move command size detection out of the fast path")
    Cc: Bart Van Assche <bvanassche@acm.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: <linux-scsi@vger.kernel.org>
    Cc: <linux-kernel@vger.kernel.org>
    Cc: <stable@vger.kernel.org> # 5.15, 5.14, 5.10
    Reported-by: syzbot+5516b30f5401d4dcbcae@syzkaller.appspotmail.com
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    tstruk authored and martinkpetersen committed Nov 5, 2021

Commits on Nov 4, 2021

  1. scsi: scsi_ioctl: Validate command size

    Need to make sure the command size is valid before copying the command from
    user space.
    
    Link: https://lore.kernel.org/r/20211103170659.22151-1-tadeusz.struk@linaro.org
    Cc: Bart Van Assche <bvanassche@acm.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: <linux-scsi@vger.kernel.org>
    Cc: <linux-kernel@vger.kernel.org>
    Cc: <stable@vger.kernel.org> # 5.15, 5.14, 5.10
    Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    tstruk authored and martinkpetersen committed Nov 4, 2021
  2. scsi: ufs: ufshpb: Properly handle max-single-cmd

    The spec recommends that for transfer length larger than the max-single-cmd
    attribute (bMAX_DATA_SIZE_FOR_HPB_SINGLE_CMD) it is possible to couple
    pre-requests with the HPB-READ command.  Being a recommendation, using
    pre-requests can be perceived merely as a means of optimization.  A common
    practice was to send pre-requests for chunks within some interval, and
    leave the READ10 untouched if larger.
    
    Now that the pre-request flows have been removed, all the commands are
    single commands.  Properly handle this attribute and do not send HPB-READ
    for transfer lengths larger than max-single-cmd.
    
    [mkp: resolve conflict]
    
    Fixes: 09d9e4d ("scsi: ufs: ufshpb: Remove HPB2.0 flows")
    Link: https://lore.kernel.org/r/20211031123654.17719-1-avri.altman@wdc.com
    Reviewed-by: Daejun Park <daejun7.park@samsung.com>
    Signed-off-by: Avri Altman <avri.altman@wdc.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    avri-altman authored and martinkpetersen committed Nov 4, 2021
  3. Merge branch '5.15/scsi-fixes' into 5.16/scsi-queue

    The partial UFS revert in 5.15 is needed for some additional fixes in
    the 5.16 SCSI tree. Merge the fixes branch.
    
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    martinkpetersen committed Nov 4, 2021
  4. scsi: core: Avoid leaving shost->last_reset with stale value if EH do…

    …es not run
    
    The changes to issue the abort from the scmd->abort_work instead of the EH
    thread introduced a problem if eh_deadline is used.  If aborting the
    command(s) is successful, and there are never any scmds added to the
    shost->eh_cmd_q, there is no code path which will reset the ->last_reset
    value back to zero.
    
    The effect of this is that after a successful abort with no EH thread
    activity, a subsequent timeout, perhaps a long time later, might
    immediately be considered past a user-set eh_deadline time, and the host
    will be reset with no attempt at recovery.
    
    Fix this by resetting ->last_reset back to zero in scmd_eh_abort_handler()
    if it is determined that the EH thread will not run to do this.
    
    Thanks to Gopinath Marappan for investigating this problem.
    
    Link: https://lore.kernel.org/r/20211029194311.17504-2-emilne@redhat.com
    Fixes: e494f6a ("[SCSI] improved eh timeout handler")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ewan D. Milne <emilne@redhat.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Ewan D. Milne authored and martinkpetersen committed Nov 4, 2021
  5. scsi: bsg: Fix errno when scsi_bsg_register_queue() fails

    When the value of error is printed, it will always be 0. We should print
    the correct error code when scsi_bsg_register_queue() fails.
    
    Link: https://lore.kernel.org/r/20211022010201.426746-1-liu.yun@linux.dev
    Fixes: ead09dd ("scsi: bsg: Simplify device registration")
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    JackieLiu1 authored and martinkpetersen committed Nov 4, 2021

Commits on Oct 30, 2021

  1. scsi: ufs: ufshpb: Remove HPB2.0 flows

    The Host Performance Buffer feature allows UFS read commands to carry the
    physical media addresses along with the LBAs, thus allowing less internal
    L2P-table switches in the device.  HPB1.0 allowed a single LBA, while
    HPB2.0 increases this capacity up to 255 blocks.
    
    Carrying more than a single record, the read operation is no longer purely
    of type "read" but a "hybrid" command: Writing the physical address to the
    device in one operation and reading back the required payload in another.
    
    The JEDEC HPB spec defines two commands for this operation:
    HPB-WRITE-BUFFER (0x2) to write the physical addresses to device, and
    HPB-READ to read the payload.
    
    With the current HPB design the UFS driver has no alternative but to divide
    the READ request into 2 separate commands: HPB-WRITE-BUFFER and HPB-READ.
    This causes a great deal of aggravation to the block layer guys who
    demanded that we completely revert the entire HPB driver regardless of the
    huge amount of corporate effort already invested in it.
    
    As a compromise, remove only the pieces that implement the 2.0
    specification. This is done as a matter of urgency for the final 5.15
    release.
    
    Link: https://lore.kernel.org/r/20211030062301.248-1-avri.altman@wdc.com
    Tested-by: Avri Altman <avri.altman@wdc.com>
    Tested-by: Bean Huo <beanhuo@micron.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Co-developed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
    Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
    Signed-off-by: Avri Altman <avri.altman@wdc.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    avri-altman authored and martinkpetersen committed Oct 30, 2021

Commits on Oct 29, 2021

  1. scsi: mpt3sas: Fix reference tag handling for WRITE_INSERT

    Testing revealed a problem with how the reference tag was handled for
    a WRITE_INSERT operation. The SCSI_PROT_REF_CHECK flag is not set when
    the controller is asked to generate the protection information
    (i.e. not DIX). And as a result the initial reference tag would not be
    set in the WRITE_INSERT case.
    
    Separate handling of the REF_CHECK and REF_INCREMENT flags to align
    with both the DIX spec and the MPI implementation.
    
    Link: https://lore.kernel.org/r/20211028034202.24225-1-martin.petersen@oracle.com
    Fixes: b3e2c72 ("scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI")
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    martinkpetersen committed Oct 29, 2021

Commits on Oct 28, 2021

  1. scsi: sr: Remove duplicate assignment

    Link: https://lore.kernel.org/r/YXgybUhYN+Vrruj8@localhost.localdomain
    Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Alexey Dobriyan authored and martinkpetersen committed Oct 28, 2021
  2. scsi: ufs: ufs-exynos: Introduce ExynosAuto v9 virtual host

    Introduce virtual host driver for ExynosAuto v9 UFS mHCI.
    
    The VH (Virtual Host) only supports data transfer functions so most of
    physical features must be disabled by setting the following quirks:
    
     - UFSHCD_QUIRK_BROKEN_UIC_CMD
    
     - UFSHCD_QUIRK_SKIP_PH_CONFIGURATION
    
    Before initialization, the VH must wait until PH is ready. This wait is
    currently implemented via polling.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-15-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  3. scsi: ufs: ufs-exynos: Multi-host configuration for ExynosAuto v9

    The UFS controller of the ExynosAuto v9 SoC supports a multi-host interface
    for I/O virtualization. In general, we're using para-virtualized driver to
    support a block device by several virtual machines.
    
    Multi-host functionality extends the host controller by providing register
    interfaces that can be used by each VM's UFS drivers respectively. This way
    we can provide direct access to the UFS device for multiple VMs similar to
    PCIe SR-IOV.
    
    We divide this M-HCI as PH (Physical Host) and VHs (Virtual Host). The PH
    supports all UFSHCI functions (all SAPs) like a conventional UFSHCI but the
    VH only supports data transfer functions. Thus, except UTP_CMD_SAP and
    UTP_TMPSAP, the PH should handle all the physical features.
    
    Provide an initial implementation of PH part. M-HCI can support up to four
    interfaces (1 for a PH and 3 for VHs) but this patch initially supports
    only 1 PH and 1 VH. For this, we uses TASK_TAG[7:5] field so TASK_TAG[4:0]
    for 32 doorbell will be supported. After the PH is initiated, this will
    send a ready message to VHs through a mailbox register. The message handler
    is not fully implemented yet such as supporting reset / abort cases.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-14-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Reviewed-by: Inki Dae <inki.dae@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  4. scsi: ufs: ufs-exynos: Support ExynosAuto v9 UFS

    Add support for the ExynosAuto v9 SoC. This requires controlling the UFS IP
    shareability register via syscon and regmap.  The offset of the register
    can be different according to the UFS instance and SoC specific offset
    value. As a result, we need to get the offset value from DT property.
    
    Unlike exynos7, this implementation has a different M-PHY setting which
    must be configured via exynosauto_ufs_pre_link.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-12-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  5. scsi: ufs: ufs-exynos: Add pre/post_hce_enable drv callbacks

    Add driver-specific pre/post_hce_enable callbacks to execute extra
    initializations before and after hce_enable_notify callback.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-11-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  6. scsi: ufs: ufs-exynos: Factor out priv data init

    To leverage the initialization code for the other variant of the exynos-ufs
    driver, factor out the assignment part.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-10-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  7. scsi: ufs: ufs-exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR option

    To skip exynos_ufs_config_phy_*_attr settings for exynos-ufs variant,
    provide EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR as an opts flag.
    
    For the ExynosAuto v9 SoC's controller, M-Phy timing setting is not
    required and most of vendor-specific configuration will be performed in the
    pre_link callback function.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-9-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  8. scsi: ufs: ufs-exynos: Support custom version of ufs_hba_variant_ops

    By default, ufs_hba_exynos_ops will be used. Add support for a custom
    version of ufs_hba_variant_ops because some variants of exynos-ufs will use
    only few callbacks.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-8-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  9. scsi: ufs: ufs-exynos: Add setup_clocks callback

    Add setup_clocks callback to control/gate clocks by ufshcd.  To avoid
    calling before initialization, check whether UFS is on or not and call it
    initially from pre_link callback.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-7-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: Kiwoong Kim <kwmad.kim@samsung.com>
    Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  10. scsi: ufs: ufs-exynos: Add refclkout_stop control

    This patch adds REFCLKOUT_STOP control to CLK_STOP_MASK. This permits
    enabling/disabling reference clock out control for the UFS device.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-6-chanho61.park@samsung.com
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  11. scsi: ufs: ufs-exynos: Simplify drv_data retrieval

    The compatible field of exynos_ufs_drv_data is not necessary because
    of_device_id already has it. Thus, we don't need it anymore and we can get
    drv_data by device_get_match_data.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-5-chanho61.park@samsung.com
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  12. scsi: ufs: ufs-exynos: Change pclk available max value

    To support 167MHz PCLK, we need to adjust the maximum value.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-4-chanho61.park@samsung.com
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Reviewed-by: Inki Dae <inki.dae@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Chanho Park authored and martinkpetersen committed Oct 28, 2021
  13. scsi: ufs: Add quirk to enable host controller without PH configuration

    Samsung ExynosAuto v9 SoC virtual hosts do not support device management.
    Add a quirk to skip the physical host interface configuration part that
    cannot be performed in the virtual host.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-3-chanho61.park@samsung.com
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: Bart Van Assche <bvanassche@acm.org>
    Suggested-by: Alim Akhtar <alim.akhtar@samsung.com>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Signed-off-by: jongmin jeong <jjmin.jeong@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    jjmin-jeong authored and martinkpetersen committed Oct 28, 2021
  14. scsi: ufs: Add quirk to handle broken UIC command

    Samsung ExynosAuto v9 SoC has two types of host controller interface to
    support the virtualization of UFS Device.  One is the physical host (PH)
    that is the same as conventional UFSHCI, and the other is the virtual host
    (VH) that supports data transfer function only.
    
    In this configuration the virtual host does not support UIC commands. Add a
    quirk to return 0 when the UIC command send function is called.
    
    Link: https://lore.kernel.org/r/20211018124216.153072-2-chanho61.park@samsung.com
    Cc: Alim Akhtar <alim.akhtar@samsung.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Signed-off-by: jongmin jeong <jjmin.jeong@samsung.com>
    Signed-off-by: Chanho Park <chanho61.park@samsung.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    jjmin-jeong authored and martinkpetersen committed Oct 28, 2021
  15. scsi: core: Fix early registration of sysfs attributes for scsi_device

    v4.17 commit 86b87cd ("scsi: core: host template attribute groups")
    introduced explicit sysfs_create_groups() in scsi_sysfs_add_sdev()
    and sysfs_remove_groups() in __scsi_remove_device(), both for sdev_gendev,
    based on a new field const struct attribute_group **sdev_groups
    of struct scsi_host_template.
    
    Commit 92c4b58 ("scsi: core: Register sysfs attributes earlier")
    removed above explicit (de)registration of scsi_device attribute groups.
    It also converted all scsi_device attributes and attribute_groups to
    end up in a new field const struct attribute_group *gendev_attr_groups[6]
    of struct scsi_device. However, that new field was not used anywhere.
    
    Surprisingly, this only caused missing LLDD specific scsi_device sysfs
    attributes. Whereas, scsi core attributes from scsi_sdev_attr_groups
    did continue to exist because of scsi_dev_type.groups.
    
    We separate scsi core attibutes from LLDD specific attributes.
    Hence, we keep the initializing assignment scsi_dev_type =
    { .groups = scsi_sdev_attr_groups, } as this takes care of core
    attributes. Without the separation, it would cause attribute double
    registration due to scsi_dev_type.groups and sdev_gendev.groups.
    
    Julian suggested to assign the sdev_groups pointer of the
    scsi_host_template directly to the groups pointer of sdev_gendev.
    This way we can delete the container scsi_device.gendev_attr_groups
    and the loop copying each entry from hostt->sdev_groups to
    sdev->gendev_attr_groups.
    
    Alternative approaches ruled out:
    Assigning gendev_attr_groups to sdev_dev has no visible effect.
    Assigning sdev->gendev_attr_groups to scsi_dev_type.groups
    caused scsi_device of all scsi host types to get LLDD specific
    attributes of the LLDD for which the last sdev alloc happened to occur,
    as that overwrote scsi_dev_type.groups,
    e.g. scsi_debug had zfcp-specific scsi_device attributes.
    
    Link: https://lore.kernel.org/r/20211026014240.4098365-1-maier@linux.ibm.com
    Fixes: 92c4b58 ("scsi: core: Register sysfs attributes earlier")
    Suggested-by: Julian Wiedmann <jwi@linux.ibm.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Steffen Maier <maier@linux.ibm.com>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    steffen-maier authored and martinkpetersen committed Oct 28, 2021

Commits on Oct 27, 2021

  1. scsi: qla2xxx: Update version to 10.02.07.200-k

    Link: https://lore.kernel.org/r/20211026115412.27691-14-njavali@marvell.com
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Nilesh Javali authored and martinkpetersen committed Oct 27, 2021
  2. scsi: qla2xxx: edif: Fix EDIF bsg

    Various EDIF bsgs did not properly fill out the reply_payload_rcv_len
    field. This causes app to parse empty data in the return payload.
    
    Link: https://lore.kernel.org/r/20211026115412.27691-13-njavali@marvell.com
    Fixes: 7ebb336 ("scsi: qla2xxx: edif: Add start + stop bsgs")
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Quinn Tran <qutran@marvell.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Quinn Tran authored and martinkpetersen committed Oct 27, 2021
  3. scsi: qla2xxx: edif: Fix inconsistent check of db_flags

    db_flags field is a bit field. Replace value check with bit flag check.
    
    Link: https://lore.kernel.org/r/20211026115412.27691-12-njavali@marvell.com
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Quinn Tran <qutran@marvell.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Quinn Tran authored and martinkpetersen committed Oct 27, 2021
  4. scsi: qla2xxx: edif: Increase ELS payload

    Currently, firmware limits ELS payload to FC frame size/2112.  This patch
    adjusts memory buffer size to be able to handle max ELS payload.
    
    Link: https://lore.kernel.org/r/20211026115412.27691-11-njavali@marvell.com
    Fixes: 84318a9 ("scsi: qla2xxx: edif: Add send, receive, and accept for auth_els")
    Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
    Signed-off-by: Quinn Tran <qutran@marvell.com>
    Signed-off-by: Nilesh Javali <njavali@marvell.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Quinn Tran authored and martinkpetersen committed Oct 27, 2021
Older