Commit graph

892,914 commits

Author SHA1 Message Date
Isaac J. Manjarres
bf4e1bea47 iommu/arm-smmu: Ensure power resources are enabled during tlb maintenance
arm_smmu_iotlb_sync can be called outside of arm_smmu_unmap, meaning
that the power resources required to access the SMMU register space
may be disabled. Thus, call arm_smmu_power_[on/off] when invoking
arm_smmu_iotlb_sync and arm_smmu_flush_iotlb_all.

Change-Id: I9f6ec0db9b0e25a5c4bf2b0adb3fb950e6843a86
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-08-19 23:19:57 -07:00
qctecmdr
dcf7c5cb14 Merge "mm: Allow pages that are swapped in to come from the movable zone" 2020-08-19 22:51:13 -07:00
qctecmdr
d0eb308301 Merge "power: qpnp-smb5: Fix Initialize mutex for PD typec designs" 2020-08-19 22:51:13 -07:00
Can Guo
cf218ddb22 block: Fix a race in the runtime power management code
With the current implementation the following race can happen:
* blk_pre_runtime_suspend() calls blk_freeze_queue_start() and
  blk_mq_unfreeze_queue().
* blk_queue_enter() calls blk_queue_pm_only() and that function returns
  true.
* blk_queue_enter() calls blk_pm_request_resume() and that function does
  not call pm_request_resume() because the queue runtime status is
  RPM_ACTIVE.
* blk_pre_runtime_suspend() changes the queue status into RPM_SUSPENDING.

Fix this race by changing the queue runtime status into RPM_SUSPENDING
before switching q_usage_counter to atomic mode.

Change-Id: I5a2c842b959b8c57730b12e4f372abc515a8c8ab
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-20 12:17:49 +08:00
qctecmdr
a16407c5cc Merge "arm64: defconfig: Trim genericarmv8 defconfig" 2020-08-19 20:17:49 -07:00
qctecmdr
cdc7a0e02c Merge "soc: qcom: eud: Fix inconsistent nature of the cmdline" 2020-08-19 20:17:49 -07:00
qctecmdr
05a56a8195 Merge "input: qcom-hv-haptics: toggle CAL_EN mode if HBST is in open loop" 2020-08-19 20:17:48 -07:00
qctecmdr
9b0287edec Merge "byte-cntr: Don't start usb transfer when rwp offset is invalid" 2020-08-19 20:17:48 -07:00
qctecmdr
50b6104974 Merge "defconfig: Enable scheduler Uclamp for Holi" 2020-08-19 20:17:47 -07:00
Mao Jinlong
1c03177d1a byte-cntr: Don't start usb transfer when rwp offset is invalid
Don't start usb transfer when rwp offset is invalid to avoid exception
happening when transfer usb data.

Change-Id: I7182ebb2e66131a21d65f7df0ad239c6346c0e9d
Signed-off-by: Mao Jinlong <jinlmao@codeaurora.org>
2020-08-20 09:10:34 +08:00
Raghavendra Rao Ananta
bd9bea635c soc: qcom: eud: Fix inconsistent nature of the cmdline
The EUD driver's 'enable' command line argument is set to
EUD_ENABLE_CMD even if the bootloader hasn't enabled it,
which is not correct. Hence, update the 'enable' variable
based on the state of the hardware.

Change-Id: I1159436c0e9a803462f2154ccc05649d3f7b40da
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2020-08-19 17:11:37 -07:00
Yue Ma
5e1c81e179 cnss2: Free saved default PCIe config space
During PCIe bus enable, it saves a golden config space as default
config space. Hence free it in PCIe bus disable also.

Change-Id: I25f089ba28d78bd2122ccb813550bfa0d4513b0d
Signed-off-by: Yue Ma <yuem@codeaurora.org>
2020-08-19 15:14:31 -07:00
qctecmdr
2b77ca772b Merge "soc: qcom: mem-buf: Relinquish unclaimed donated memory" 2020-08-19 15:08:38 -07:00
qctecmdr
26773d2817 Merge "pci: pci-msm-msi: Re-name irq chip name for the driver" 2020-08-19 15:08:37 -07:00
qctecmdr
5e72daf3f2 Merge "pci: msm: Add support to handle ep driver requested link down" 2020-08-19 15:08:37 -07:00
Liang Chen
026b8142b4 BACKPORT: kthread: Do not preempt current task if it is going to call schedule()
when we create a kthread with ktrhead_create_on_cpu(),the child thread
entry is ktread.c:ktrhead() which will be preempted by the parent after
call complete(done) while schedule() is not called yet,then the parent
will call wait_task_inactive(child) but the child is still on the runqueue,
so the parent will schedule_hrtimeout() for 1 jiffy,it will waste a lot of
time,especially on startup.

  parent                             child
ktrhead_create_on_cpu()
  wait_fo_completion(&done) -----> ktread.c:ktrhead()
                             |----- complete(done);--wakeup and preempted by parent
 kthread_bind() <------------|  |-> schedule();--dequeue here
  wait_task_inactive(child)     |
   schedule_hrtimeout(1 jiffy) -|

So we hope the child just wakeup parent but not preempted by parent, and the
child is going to call schedule() soon,then the parent will not call
schedule_hrtimeout(1 jiffy) as the child is already dequeue.

The same issue for ktrhead_park()&&kthread_parkme().
This patch can save 120ms on rk312x startup with CONFIG_HZ=300.

Signed-off-by: Liang Chen <cl@rock-chips.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Link: https://lkml.kernel.org/r/20200306070133.18335-2-cl@rock-chips.com
Bug: 163398263
(cherry picked from commit 26c7295be0c5e6da3fa45970e9748be983175b1b)
Change-Id: I4d3dd1af2c640a2f3d57af528532da23e00db194
2020-08-19 20:08:47 +00:00
Yue Ma
2cf1df2b58 cnss2: Notify MSM PCIe bus driver when detect link down
There are cases that CNSS driver or WLAN host driver detects PCIe
link not accessible but link down interrupt is not triggered. In
order to handle these cases, instead of starting recovery directly,
notify MSM PCIe bus which can assert PCIe PERST GPIO and then handle
the link down callback from it as normal link down.

Change-Id: I9af8b3ae33d9c094a412c39962f5c1883c34a12a
Signed-off-by: Yue Ma <yuem@codeaurora.org>
2020-08-19 12:36:42 -07:00
Bhaumik Bhatt
0a4c0b4557 cnss2: print message for abrupt device reset to PBL
At times, the device can abruptly reset due to power rail or
other related issues which can manifest as a linkdown on the
host. As linkdown recovery mechanism is put in place, it would
be helpful to understand why a set of ramdumps was not collected
in these abrupt reset cases. Hence, it is wise to add a print
message to check whether the device has reset to PBL and make
the users aware.

Change-Id: I545a5b87461b05ea436e383fddd2a8d037a8389d
Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
2020-08-19 12:36:35 -07:00
Yue Ma
08b5c57b4f cnss2: Try to recover PCIe link to collect dump after link down
Add the support to recover PCIe link after link down so that it can
try to collect firmware RAM dump to debug.

Change-Id: I227373b2285b3ea415a315ace7db907c477297e8
Signed-off-by: Yue Ma <yuem@codeaurora.org>
2020-08-19 12:36:28 -07:00
Yue Ma
0d77d5e665 cnss2: Save default config space without BME enabled
BME should be enabled after config space has been restored. Make
sure that the default config space saved which is restored during
PCIe link down recovery doesn't have BME enabled.

Change-Id: I227d09620128cbb3232f63a026bc6eb789a0b70c
Signed-off-by: Yue Ma <yuem@codeaurora.org>
2020-08-19 12:36:21 -07:00
Hemant Kumar
0d97dfe55c pci: msm: Add support to handle ep driver requested link down
In case PCIe endpoint driver infers link down because of
completion timeout for config space access or if link fails
to enumerate, ep driver can request to handle the link down.
This allows to stream line the link down notification to ep
driver to initiate recovery operation.

Change-Id: I652e60e570c1e90c9f96d1c197e4b5501cd60a1e
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2020-08-19 12:25:59 -07:00
Greg Kroah-Hartman
f2c591c755 ANDROID: GKI: enable CONFIG_USB_ROLE_SWITCH
It's already enabled in arm64 gki_defconfig by virtue of other
dependancies dragging it in, but enable it in x86 gki_defconfig to
provide good code coverage.

Bug: 163379072
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I26707e49046888e9d4b607e4b6d7766610cedfa1
2020-08-19 19:17:09 +00:00
Todd Kjos
352d8ada45 ANDROID: ABI: Update ABI after UFS error recovery patches
Leaf changes summary: 21 artifacts changed (1 filtered out)
Changed leaf types summary: 2 (1 filtered out) leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 19 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

19 functions with some sub-type change:

  [C] 'function int ufshcd_crypto_cap_find(ufs_hba*, blk_crypto_mode_num, unsigned int)' at ufshcd-crypto.c:40:1 has some sub-type changes:

    CRC value (modversions) changed from 0x66bb6e3c to 0xdf5be4ed

  [C] 'function void ufshcd_crypto_disable_spec(ufs_hba*)' at ufshcd-crypto.c:250:1 has some sub-type changes:

    CRC value (modversions) changed from 0x4d38f061 to 0x2c937f4d

  [C] 'function void ufshcd_crypto_enable_spec(ufs_hba*)' at ufshcd-crypto.c:238:1 has some sub-type changes:

    CRC value (modversions) changed from 0x2ec41648 to 0x3e4398d8

  [C] 'function int ufshcd_dme_get_attr(ufs_hba*, unsigned int, unsigned int*, unsigned char)' at ufshcd.h:1004:1 has some sub-type changes:

    CRC value (modversions) changed from 0xc8a30bfe to 0x91b23c09

  [C] 'function int ufshcd_dme_set_attr(ufs_hba*, unsigned int, unsigned char, unsigned int, unsigned char)' at ufshcd.h:1002:1 has some sub-type changes:

    CRC value (modversions) changed from 0x6e8f8104 to 0xe521b7d4

  [C] 'function int ufshcd_dump_regs(ufs_hba*, size_t, size_t, const char*)' at ufshcd.c:124:1 has some sub-type changes:

    CRC value (modversions) changed from 0xf884730c to 0xafacb437

  [C] 'function u32 ufshcd_get_local_unipro_ver(ufs_hba*)' at ufshcd.c:947:1 has some sub-type changes:

    CRC value (modversions) changed from 0xa4115536 to 0x5ba29f1

  [C] 'function int ufshcd_hold(ufs_hba*, bool)' at ufshcd.c:1628:1 has some sub-type changes:

    CRC value (modversions) changed from 0xdd0150bd to 0x2c3b45af

  [C] 'function int ufshcd_pltfrm_init(platform_device*, const ufs_hba_variant_ops*)' at ufshcd-pltfrm.h:31:1 has some sub-type changes:

    CRC value (modversions) changed from 0x8b5a0527 to 0x6a553691

  [C] 'function int ufshcd_query_attr(ufs_hba*, query_opcode, attr_idn, u8, u8, u32*)' at ufshcd.c:3011:1 has some sub-type changes:

    CRC value (modversions) changed from 0x7e1e7dca to 0xdb7ff407

  [C] 'function int ufshcd_query_descriptor_retry(ufs_hba*, query_opcode, desc_idn, u8, u8, u8*, int*)' at ufshcd.c:3180:1 has some sub-type changes:

    CRC value (modversions) changed from 0x38291d4f to 0xd93e04d3

  [C] 'function int ufshcd_query_flag(ufs_hba*, query_opcode, flag_idn, u8, bool*)' at ufshcd.c:2941:1 has some sub-type changes:

    CRC value (modversions) changed from 0x8fbcc248 to 0xbfcc001a

  [C] 'function void ufshcd_release(ufs_hba*)' at ufshcd.c:1804:1 has some sub-type changes:

    CRC value (modversions) changed from 0xa73a71b3 to 0x8d3a4fd

  [C] 'function void ufshcd_remove(ufs_hba*)' at ufshcd.h:947:1 has some sub-type changes:

    CRC value (modversions) changed from 0xf320631d to 0x2c8e8662

  [C] 'function int ufshcd_shutdown(ufs_hba*)' at ufshcd.h:1001:1 has some sub-type changes:

    CRC value (modversions) changed from 0x1da80ce1 to 0x75c9a638

  [C] 'function int ufshcd_system_resume(ufs_hba*)' at ufshcd.h:1000:1 has some sub-type changes:

    CRC value (modversions) changed from 0xe1cdb47c to 0xc0522ea

  [C] 'function int ufshcd_system_suspend(ufs_hba*)' at ufshcd.h:999:1 has some sub-type changes:

    CRC value (modversions) changed from 0x3a6991b9 to 0xde7f1ce5

  [C] 'function int ufshcd_uic_hibern8_enter(ufs_hba*)' at ufshcd.c:4080:1 has some sub-type changes:

    CRC value (modversions) changed from 0x81575439 to 0xbc0c783f

  [C] 'function int ufshcd_uic_hibern8_exit(ufs_hba*)' at ufshcd.c:4104:1 has some sub-type changes:

    CRC value (modversions) changed from 0x69bd2d57 to 0x6e341295

'struct ufs_hba at ufshcd.h:599:1' changed:
  type size changed from 32000 to 32192 (in bits)
  2 data member insertions:
    'workqueue_struct* ufs_hba::eh_wq', at offset 3264 (in bits) at ufshcd.h:760:1
    'bool ufs_hba::force_reset', at offset 15296 (in bits) at ufshcd.h:770:1
  there are data member changes:
    'work_struct ufs_hba::eh_work' offset changed from 3264 to 3328 (in bits) (by +64 bits)
    'work_struct ufs_hba::eeh_work' offset changed from 3648 to 3712 (in bits) (by +64 bits)
    'u32 ufs_hba::errors' offset changed from 4032 to 4096 (in bits) (by +64 bits)
    'u32 ufs_hba::uic_error' offset changed from 4064 to 4128 (in bits) (by +64 bits)
    'u32 ufs_hba::saved_err' offset changed from 4096 to 4160 (in bits) (by +64 bits)
    'u32 ufs_hba::saved_uic_err' offset changed from 4128 to 4192 (in bits) (by +64 bits)
    type 'struct ufs_stats' of 'ufs_hba::ufs_stats' changed:
      type size changed from 10944 to 11072 (in bits)
      2 data member insertions:
        'u32 ufs_stats::last_intr_status', at offset 0 (in bits) at ufshcd.h:517:1
        'ktime_t ufs_stats::last_intr_ts', at offset 64 (in bits) at ufshcd.h:518:1
      there are data member changes:
        'u32 ufs_stats::hibern8_exit_cnt' offset changed from 0 to 128 (in bits) (by +128 bits)
        'ktime_t ufs_stats::last_hibern8_exit_tstamp' offset changed from 64 to 192 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::pa_err' offset changed from 128 to 256 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::dl_err' offset changed from 960 to 1088 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::nl_err' offset changed from 1792 to 1920 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::tl_err' offset changed from 2624 to 2752 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::dme_err' offset changed from 3456 to 3584 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::auto_hibern8_err' offset changed from 4288 to 4416 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::fatal_err' offset changed from 5120 to 5248 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::link_startup_err' offset changed from 5952 to 6080 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::resume_err' offset changed from 6784 to 6912 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::suspend_err' offset changed from 7616 to 7744 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::dev_reset' offset changed from 8448 to 8576 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::host_reset' offset changed from 9280 to 9408 (in bits) (by +128 bits)
        'ufs_err_reg_hist ufs_stats::task_abort' offset changed from 10112 to 10240 (in bits) (by +128 bits)
      19 impacted interfaces
    and offset changed from 4160 to 4224 (in bits) (by +64 bits)
    'bool ufs_hba::silence_err_logs' offset changed from 15104 to 15304 (in bits) (by +200 bits)
    'ufs_dev_cmd ufs_hba::dev_cmd' offset changed from 15168 to 15360 (in bits) (by +192 bits)
    'ktime_t ufs_hba::last_dme_cmd_tstamp' offset changed from 16192 to 16384 (in bits) (by +192 bits)
    'ufs_dev_info ufs_hba::dev_info' offset changed from 16256 to 16448 (in bits) (by +192 bits)
    'bool ufs_hba::auto_bkops_enabled' offset changed from 16576 to 16768 (in bits) (by +192 bits)
    'ufs_vreg_info ufs_hba::vreg_info' offset changed from 16640 to 16832 (in bits) (by +192 bits)
    'list_head ufs_hba::clk_list_head' offset changed from 16896 to 17088 (in bits) (by +192 bits)
    'bool ufs_hba::wlun_dev_clr_ua' offset changed from 17024 to 17216 (in bits) (by +192 bits)
    'int ufs_hba::req_abort_count' offset changed from 17056 to 17248 (in bits) (by +192 bits)
    'u32 ufs_hba::lanes_per_direction' offset changed from 17088 to 17280 (in bits) (by +192 bits)
    'ufs_pa_layer_attr ufs_hba::pwr_info' offset changed from 17120 to 17312 (in bits) (by +192 bits)
    'ufs_pwr_mode_info ufs_hba::max_pwr_info' offset changed from 17344 to 17536 (in bits) (by +192 bits)
    'ufs_clk_gating ufs_hba::clk_gating' offset changed from 17600 to 17792 (in bits) (by +192 bits)
    'u32 ufs_hba::caps' offset changed from 19904 to 20096 (in bits) (by +192 bits)
    'devfreq* ufs_hba::devfreq' offset changed from 19968 to 20160 (in bits) (by +192 bits)
    'ufs_clk_scaling ufs_hba::clk_scaling' offset changed from 20032 to 20224 (in bits) (by +192 bits)
    'bool ufs_hba::is_sys_suspended' offset changed from 21696 to 21888 (in bits) (by +192 bits)
    'bkops_status ufs_hba::urgent_bkops_lvl' offset changed from 21728 to 21920 (in bits) (by +192 bits)
    'bool ufs_hba::is_urgent_bkops_lvl_checked' offset changed from 21760 to 21952 (in bits) (by +192 bits)
    'rw_semaphore ufs_hba::clk_scaling_lock' offset changed from 21824 to 22016 (in bits) (by +192 bits)
    'ufs_desc_size ufs_hba::desc_size' offset changed from 22144 to 22336 (in bits) (by +192 bits)
    'atomic_t ufs_hba::scsi_block_reqs_cnt' offset changed from 22368 to 22560 (in bits) (by +192 bits)
    'device ufs_hba::bsg_dev' offset changed from 22400 to 22592 (in bits) (by +192 bits)
    'request_queue* ufs_hba::bsg_queue' offset changed from 29760 to 29952 (in bits) (by +192 bits)
    'ufs_crypto_capabilities ufs_hba::crypto_capabilities' offset changed from 29824 to 30016 (in bits) (by +192 bits)
    'ufs_crypto_cap_entry* ufs_hba::crypto_cap_array' offset changed from 29888 to 30080 (in bits) (by +192 bits)
    'u32 ufs_hba::crypto_cfg_register' offset changed from 29952 to 30144 (in bits) (by +192 bits)
    'keyslot_manager* ufs_hba::ksm' offset changed from 30016 to 30208 (in bits) (by +192 bits)
    'void* ufs_hba::crypto_DO_NOT_USE[8]' offset changed from 30080 to 30272 (in bits) (by +192 bits)
    'bool ufs_hba::wb_buf_flush_enabled' offset changed from 30592 to 30784 (in bits) (by +192 bits)
    'bool ufs_hba::wb_enabled' offset changed from 30600 to 30792 (in bits) (by +192 bits)
    'delayed_work ufs_hba::rpm_dev_flush_recheck_work' offset changed from 30656 to 30848 (in bits) (by +192 bits)
    'u64 ufs_hba::android_kabi_reserved1' offset changed from 31744 to 31936 (in bits) (by +192 bits)
    'u64 ufs_hba::android_kabi_reserved2' offset changed from 31808 to 32000 (in bits) (by +192 bits)
    'u64 ufs_hba::android_kabi_reserved3' offset changed from 31872 to 32064 (in bits) (by +192 bits)
    'u64 ufs_hba::android_kabi_reserved4' offset changed from 31936 to 32128 (in bits) (by +192 bits)
  19 impacted interfaces

'struct ufs_stats at ufshcd.h:509:1' changed:
  details were reported earlier

Bug: 165343119
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ib28519365126f83131793b8738d62e06b3f16ad5
2020-08-19 10:52:40 -07:00
Can Guo
0574a84661 BACKPORT: FROMGIT: scsi: ufs: Properly release resources if a task is aborted successfully
In current UFS task abort hook, namely ufshcd_abort(), if one task is
aborted successfully, clk_gating.active_reqs held by this task is not
decreased, which makes clk_gating.active_reqs stay above zero forever, thus
clock gating would never happen. Instead of releasing resources of one task
"manually", use the existing func __ufshcd_transfer_req_compl().  This
change also eliminates a possible race of scsi_dma_unmap() from the real
completion in IRQ handler path.

Link: https://lore.kernel.org/r/1596975355-39813-10-git-send-email-cang@codeaurora.org
Fixes: 5a0b0cb9be ("ufs: Add support for clock gating")
CC: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 35afe60929abd61567f48608e55f5987c6fd1aa0
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: Ief56863c07fc9b7983d48a4ab91916ffc0b07b14
[can: Resolved minor conflict in ufshcd_abort()]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:40 -07:00
Can Guo
76907b837f BACKPORT: FROMGIT: scsi: ufs: Fix a race condition between error handler and runtime PM ops
The current IRQ handler blocks SCSI requests before scheduling eh_work,
when error handler calls pm_runtime_get_sync, if ufshcd_suspend/resume
sends a SCSI cmd, most likely the SSU cmd, since SCSI requests are blocked,
pm_runtime_get_sync() will never return because ufshcd_suspend/resume is
blocked by the SCSI cmd.

 - In queuecommand path, hba->ufshcd_state check and ufshcd_send_command
   should stay under the same spin lock. This is to make sure that no more
   commands leak into doorbell after hba->ufshcd_state is changed.

 - Don't block SCSI requests before error handler starts to run, let error
   handler block SCSI requests when it is ready to start error recovery.

 - Don't let SCSI layer keep requeuing the SCSI cmds sent from HBA runtime
   PM ops, let them pass or fail them. Let them pass if eh_work is
   scheduled due to non-fatal errors. Fail them if eh_work is scheduled due
   to fatal errors, otherwise the cmds may eventually time out since UFS is
   in bad state, which gets error handler blocked for too long. If we fail
   the SCSI cmds sent from HBA runtime PM ops, HBA runtime PM ops fails
   too, but it does not hurt since error handler can recover HBA runtime PM
   error.

Link: https://lore.kernel.org/r/1596975355-39813-9-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 5586dd8ea250ab0851caeab6f461a9dbf57c806f
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I7a0e563e47c28f7cf61c88485e5907d6d1d9ab02
[can: Resolved minor conflicts in queuecommand and err_handler]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:40 -07:00
Can Guo
ae1904cad9 FROMGIT: scsi: ufs: Move dumps in IRQ handler to error handler
Performing dumps in the IRQ handler causes system stability issues. Move
dumps to the error handler and only print basic host registers here.

Link: https://lore.kernel.org/r/1596975355-39813-8-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit c3be8d1ee1bff7c6f7e588d2a87f076148f40326
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I8ab59f56cb44d3b31c493c775377ffb579d57d85
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:40 -07:00
Can Guo
45ab6948c2 BACKPORT: FROMGIT: scsi: ufs: Recover HBA runtime PM error in error handler
The current error handler can not recover HBA runtime PM error if
ufshcd_suspend/resume has failed due to UFS errors, e.g. hibern8 enter/exit
error or SSU cmd error. When this happens, error handler may fail
performing a full reset and restore because error handler always assumes
that power, IRQs and clocks are ready after pm_runtime_get_sync returns,
but actually they are not if ufshcd_resume fails[1].

If ufschd_suspend/resume fails due to UFS errors, runtime PM framework
saves the error value to dev.power.runtime_error. After that, HBA dev
runtime suspend/resume would not be invoked anymore unless runtime_error is
cleared[2].

In case of ufshcd_suspend/resume fails due to UFS errors, for scenario [1],
error handler cannot assume anything of pm_runtime_get_sync, meaning error
handler should explicitly turn ON powers, IRQs and clocks again. To get the
HBA runtime PM work as regard for scenario [2], error handler can clear the
runtime_error by calling pm_runtime_set_active() if full reset and restore
succeeds. And, more important, if pm_runtime_set_active() returns no error,
which means runtime_error has been cleared, we also need to resume those
scsi devices under HBA in case any of them has failed to be resumed due to
HBA runtime resume failure. This is to unblock blk_queue_enter in case
there are bios waiting inside it.

Link: https://lore.kernel.org/r/1596975355-39813-7-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit c72e79c0ad2bd7efb1cf84f630f59daf9ba8c510
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I66e05ea58aa9af7f009f20e0791cd9bf76237fcd
[can: Resolved minor conflict in ufshcd.c]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:40 -07:00
Can Guo
2e0034f5e2 BACKPORT: FROMGIT: scsi: ufs: Fix concurrency of error handler and other error recovery paths
Error recovery can be invoked from multiple code paths, including hibern8
enter/exit (from ufshcd_link_recovery), ufshcd_eh_host_reset_handler() and
eh_work scheduled from IRQ context. Ultimately, these paths are all trying
to invoke ufshcd_reset_and_restore() in either a synchronous or
asynchronous manner. This causes problems:

 - If link recovery happens during ungate work, ufshcd_hold() would be
   called recursively. Although commit 53c12d0ef6 ("scsi: ufs: fix error
   recovery after the hibern8 exit failure") fixed a deadlock due to
   recursive calls of ufshcd_hold() by adding a check of eh_in_progress
   into ufshcd_hold, this check allows eh_work to run in parallel while
   link recovery is running.

 - Similar concurrency can also happen when error recovery is invoked from
   ufshcd_eh_host_reset_handler and ufshcd_link_recovery.

 - Concurrency can even happen between eh_works. eh_work, currently queued
   on system_wq, is allowed to have multiple instances running in parallel,
   but we don't have proper protection for that.

If any of above concurrency scenarios happen, error recovery would fail and
lead ufs device and host into bad states. To fix the concurrency problem,
this change queues eh_work on a single threaded workqueue and removes link
recovery calls from the hibern8 enter/exit path. In addition, make use of
eh_work in eh_host_reset_handler instead of calling
ufshcd_reset_and_restore. This unifies the UFS error recovery mechanism.

According to the UFSHCI JEDEC spec, hibern8 enter/exit error occurs when
the link is broken. This essentially applies to any power mode change
operations (since they all use PACP_PWR cmds in UniPro layer). So, if a
power mode change operation (including AH8 enter/exit) fails, mark link
state as UIC_LINK_BROKEN_STATE and schedule the eh_work.  In this case,
error handler needs to do a full reset and restore to recover the link back
to active. Before the link state is recovered to active,
ufshcd_uic_pwr_ctrl simply returns -ENOLINK to avoid more errors.

Link: https://lore.kernel.org/r/1596975355-39813-6-git-send-email-cang@codeaurora.org
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 4db7a23605973ac4a2cb24e759bebaaa82054f21
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I9718d7752016682607fc6735402fad7c0059ed3a
[can: Resolved minor conflict in ufshcd.c]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:39 -07:00
Can Guo
e6a9744bfe BACKPORT: FROMGIT: scsi: ufs: Add some debug information to ufshcd_print_host_state()
Information about the last interrupt status and timestamp is helpful when
debugging system stability issues (IRQ starvation, for instance). Add this
information to ufshcd_print_host_state() output.

In addition, UFS device information such as model name and firmware version
also comes in handy during debugging. This is printed as well.

Link: https://lore.kernel.org/r/1596975355-39813-5-git-send-email-cang@codeaurora.org
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 3f8af6044713fab0aeb884e1be6bcc2cb276725e
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I6b8ec998a0563252786f1baf2e6bc962659118a8
[can: Resolved minor conflict in ufshcd.c]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:39 -07:00
Can Guo
5174cff341 FROMGIT: scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs
Dumping testbus registers outputs a lot of information and can cause
stability issues. Remove the dump code.

Link: https://lore.kernel.org/r/1596975355-39813-4-git-send-email-cang@codeaurora.org
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 423cc66b5152a309e99a3693d856157a5e4a8d39
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I8f7eee4381d15e686d716ab08d24e615df2d08b8
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:39 -07:00
Can Guo
96de04c7eb FROMGIT: scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config()
If ufs_qcom_dump_dbg_regs() calls ufs_qcom_testbus_config() from
ufshcd_suspend/resume and/or clk gate/ungate context, pm_runtime_get_sync()
and ufshcd_hold() will cause a race condition. Fix this by removing the
unnecessary calls of pm_runtime_get_sync() and ufshcd_hold().

Link: https://lore.kernel.org/r/1596975355-39813-3-git-send-email-cang@codeaurora.org
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 89dd87acd40a44de8ff3358138aedf8f73f4efc6
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: I9d7316220df2631493ed385b5243e182458b1376
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:39 -07:00
Can Guo
42ff9205b9 FROMGIT: scsi: ufs: Add checks before setting clk-gating states
Clock gating can be turned on/off selectively which means the associated
state information is only correct if the feature is enabled. This change
makes sure that we only look at state of clk-gating if it is enabled.

Link: https://lore.kernel.org/r/1596975355-39813-2-git-send-email-cang@codeaurora.org
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 165343119
(cherry picked from commit 2dec9475a4028ba0a4ede51452f89dead2c008e1
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.10/scsi-queue)
Change-Id: Ie1f582658d27935891236cad3fb23c018240a15b
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-08-19 10:52:39 -07:00
Isaac J. Manjarres
84d7f52bcb mm: Allow pages that are swapped in to come from the movable zone
Pages that are swapped out are pages that can reside in the movable
zone. However, when they are swapped in, they are restricted to the
normal zone, when they can reside in the movable zone again. Set the
GFP flags accordingly for swapin allocations, so that they can be
satisfied from the movable zone.

Change-Id: I25919034a5197a1c4f830e498d32347aa460187f
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-08-19 10:36:06 -07:00
qctecmdr
65a3cf720f Merge "msm: synx: fix cleanup of fence during handle creation" 2020-08-19 09:35:25 -07:00
qctecmdr
ba3bad2943 Merge "msm: kgsl: Avoid race of fault handler and recovery" 2020-08-19 09:35:24 -07:00
Sami Tolvanen
f58c4d2771 ANDROID: kbuild: don't preprocess module-lto.lds
__cfi_check needs to be aligned to 4k, not necessarily PAGE_SIZE.
Furthermore, using arch-specific includes currently breaks `make
scripts`.

Bug: 165591024
Change-Id: Id80fce84d4c111374718d8d84e7c06812a5d4e4b
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2020-08-19 09:15:50 -07:00
Bae Soukjin
d88b2969cf ANDROID: vendor_hooks: Add vendor hook to the net
android_vh_ptype_head:
    To add a debugging chain to ptype list

  android_vh_kfree_skb
    To sniff the dropped packet at kernel network

Bug: 163716381

Signed-off-by: Bae Soukjin <soukjin.bae@samsung.com>
Change-Id: Ide80bf0a129da31a1824d4a33026ac42be327361
2020-08-19 14:29:16 +00:00
Lina Iyer
603c54fda3 drivers: qcom: rpmh-rsc: check for control TCS availablilty
Write the PDC data only if the RSC allow writing to the control TCS.

Change-Id: I7795773075a563c939f41dc8f389d618120ec7e0
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
2020-08-19 08:28:56 -06:00
Srinivas Rao L
841f4e8a74 cpuidle: lpm-levels: Fix RIMPS timer programming
For the hotplug case there is chance that RIMPS timer being
programmed even if the last core in the domain is going down.
Consider online state of cpu's to fix this.

Change-Id: Id2bdd99c0e93ea67d5c9a1ae77fa033f004809c9
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
2020-08-19 19:58:21 +05:30
Lingutla Chandrasekhar
6c32bd14fd defconfig: Enable scheduler Uclamp for Holi
Enable Uclamp for Holi, which is replacement of STUNE.

Change-Id: Ie89b57b244bc818759e63b320d9f015dba5255ec
Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org>
2020-08-19 19:36:33 +05:30
himta ram
a63da6461e arm64: defconfig: Enable CONFIG_MEDIA_RADIO_SUPPORT on Lahaina
Enable CONFIG_MEDIA_RADIO_SUPPORT on Lahaina.

Change-Id: If9111ba4ac18a27b551d78ac71278cff254e2ca6
Signed-off-by: himta ram <hram@codeaurora.org>
2020-08-19 05:27:02 -07:00
Greg Kroah-Hartman
cc14895110 Revert "ALSA: usb-audio: work around streaming quirk for MacroSilicon MS2109"
This reverts commit 10de419977 which is
commit 1b7ecc241a67ad6b584e071bd791a54e0cd5f097 upstream.

It breaks the abi for the android11-5.4 branch, and isn't needed in
android devices, so just revert it.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I081472f3c3663edaa0c1275fe5e1303833bd533c
2020-08-19 11:03:25 +02:00
qctecmdr
8f5109a94b Merge "usb: XHCI: Implement xhci_handshake_check_state() API" 2020-08-19 01:50:26 -07:00
gkiranku
38eedef680 msm: kgsl: Avoid race of fault handler and recovery
There is a possibility of cx gdsc off timeout when stall on fault
is enabled. smmu fault handler is blocked on device mutex to keep
cx vote and dispatcher trying to turn it off for recovery. To avoid
this race condition, return from fault handler when there is contention
for device mutex.

Change-Id: Ia895152f8cf1ce9bdcfecf256558ba291dabc978
Signed-off-by: gkiranku <gkiranku@codeaurora.org>
2020-08-19 13:24:09 +05:30
Greg Kroah-Hartman
c0b1779755 This is the 5.4.59 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl88xTwACgkQONu9yGCS
 aT60Lw/9HV3JZ0KDYKHRRS/n4UWh2w7jHe5hwFTfX8/KibexzGzgV3gTaXsyQx75
 Bj2ruJTGZKDvy+a9/IsjTe1v1/HPwPydDyfABNl/Rn8vQuyHzyyGzQo2owqGb57w
 4wVuoqhPASn0n2QAMG05caAx1uqPlXcT/I4H8vpzieNEHbB/2TbwFiWvrDC2d+nw
 mw1PkRmaFp2GSMOHSb68n2oYUv19EBHDtxF9WkwyftdKALQYz5x4O/n4lhpzMSmO
 OeiUg/dpLi0bptL1SQAfaY/Lxa1gFb62YvP47WbWp/P6zespOInk2n8kmpoHxol3
 MMZelRCdl9NtIKVXMEOFEv/asXPlF2wARGmNejGCYLaRqal1bH67yG4eja7biIJe
 gr5OBOFVPol83sPAnb6V4P2SEs650WR95hshYpRL9lbmcHY4q5zoXVm9ul/Hp49R
 qjjfxHDNQQoQgX4ZhEJLp2a5AEJUM4Kz28pZXHyczKYc2R6/AZWqHfnbQVURf+au
 0xJ/tOFxn3yqRtTkmuuifkZcUTJ5iRnzxUUYiGyhTqZOTNZTD0FgiI+S7gckI//K
 idoWGTszHZb6YkNBEwz4WJFtxCGpO95xgD95jOpJVxFcJ5f5PpfZE7RkXUDLR5UO
 XzJopB3nOT1h3EoI3xq7aPDF1hKbkp+VRMWcVrBeP9KgcpLisS4=
 =Tk2c
 -----END PGP SIGNATURE-----

Merge 5.4.59 into android11-5.4

Changes in 5.4.59
	tracepoint: Mark __tracepoint_string's __used
	HID: input: Fix devices that return multiple bytes in battery report
	nvme: add a Identify Namespace Identification Descriptor list quirk
	fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe
	clk: qcom: clk-rpmh: Wait for completion when enabling clocks
	x86/mce/inject: Fix a wrong assignment of i_mce.status
	sched/fair: Fix NOHZ next idle balance
	sched: correct SD_flags returned by tl->sd_flags()
	arm64: dts: rockchip: fix rk3368-lion gmac reset gpio
	arm64: dts: rockchip: fix rk3399-puma vcc5v0-host gpio
	arm64: dts: rockchip: fix rk3399-puma gmac reset gpio
	EDAC: Fix reference count leaks
	crc-t10dif: Fix potential crypto notify dead-lock
	arm64: dts: qcom: msm8916: Replace invalid bias-pull-none property
	blktrace: fix debugfs use after free
	crypto: ccree - fix resource leak on error path
	ARM: exynos: MCPM: Restore big.LITTLE cpuidle support
	firmware: arm_scmi: Fix SCMI genpd domain probing
	arm64: dts: exynos: Fix silent hang after boot on Espresso
	sched/uclamp: Fix initialization of struct uclamp_rq
	clk: scmi: Fix min and max rate when registering clocks with discrete rates
	m68k: mac: Don't send IOP message until channel is idle
	m68k: mac: Fix IOP status/control register writes
	platform/x86: intel-hid: Fix return value check in check_acpi_dev()
	platform/x86: intel-vbtn: Fix return value check in check_acpi_dev()
	ARM: dts: gose: Fix ports node name for adv7180
	ARM: dts: gose: Fix ports node name for adv7612
	ARM: at91: pm: add missing put_device() call in at91_pm_sram_init()
	ARM: dts: sunxi: bananapi-m2-plus-v1.2: Add regulator supply to all CPU cores
	ARM: dts: sunxi: bananapi-m2-plus-v1.2: Fix CPU supply voltages
	spi: lantiq: fix: Rx overflow error in full duplex mode
	tpm: Require that all digests are present in TCG_PCR_EVENT2 structures
	recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64.
	regulator: fix memory leak on error path of regulator_register()
	io_uring: fix sq array offset calculation
	spi: rockchip: Fix error in SPI slave pio read
	ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh()
	iocost: Fix check condition of iocg abs_vdebt
	irqchip/ti-sci-inta: Fix return value about devm_ioremap_resource()
	seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID
	md: raid0/linear: fix dereference before null check on pointer mddev
	nvme-tcp: fix controller reset hang during traffic
	nvme-rdma: fix controller reset hang during traffic
	nvme-multipath: fix logic for non-optimized paths
	nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths
	drm/tilcdc: fix leak & null ref in panel_connector_get_modes
	soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
	Bluetooth: add a mutex lock to avoid UAF in do_enale_set
	loop: be paranoid on exit and prevent new additions / removals
	fs/btrfs: Add cond_resched() for try_release_extent_mapping() stalls
	drm/amdgpu: avoid dereferencing a NULL pointer
	drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync
	crypto: aesni - Fix build with LLVM_IAS=1
	video: fbdev: savage: fix memory leak on error handling path in probe
	video: fbdev: neofb: fix memory leak in neo_scan_monitor()
	bus: ti-sysc: Add missing quirk flags for usb_host_hs
	md-cluster: fix wild pointer of unlock_all_bitmaps()
	drm/nouveau/kms/nv50-: Fix disabling dithering
	arm64: dts: hisilicon: hikey: fixes to comply with adi, adv7533 DT binding
	drm/etnaviv: fix ref count leak via pm_runtime_get_sync
	drm/nouveau: fix reference count leak in nouveau_debugfs_strap_peek
	drm/nouveau: fix multiple instances of reference count leaks
	mmc: sdhci-cadence: do not use hardware tuning for SD mode
	btrfs: fix lockdep splat from btrfs_dump_space_info
	usb: mtu3: clear dual mode of u3port when disable device
	drm: msm: a6xx: fix gpu failure after system resume
	drm/msm: Fix a null pointer access in msm_gem_shrinker_count()
	drm/debugfs: fix plain echo to connector "force" attribute
	drm/radeon: disable AGP by default
	irqchip/irq-mtk-sysirq: Replace spinlock with raw_spinlock
	mm/mmap.c: Add cond_resched() for exit_mmap() CPU stalls
	drm/amdgpu/display bail early in dm_pp_get_static_clocks
	drm/amd/powerplay: fix compile error with ARCH=arc
	bpf: Fix fds_example SIGSEGV error
	brcmfmac: keep SDIO watchdog running when console_interval is non-zero
	brcmfmac: To fix Bss Info flag definition Bug
	brcmfmac: set state of hanger slot to FREE when flushing PSQ
	platform/x86: asus-nb-wmi: add support for ASUS ROG Zephyrus G14 and G15
	iwlegacy: Check the return value of pcie_capability_read_*()
	gpu: host1x: debug: Fix multiple channels emitting messages simultaneously
	ionic: update eid test for overflow
	mmc: sdhci-pci-o2micro: Bug fix for O2 host controller Seabird1
	usb: gadget: net2280: fix memory leak on probe error handling paths
	bdc: Fix bug causing crash after multiple disconnects
	usb: bdc: Halt controller on suspend
	dyndbg: fix a BUG_ON in ddebug_describe_flags
	bcache: fix super block seq numbers comparision in register_cache_set()
	ACPICA: Do not increment operation_region reference counts for field units
	drm/msm: ratelimit crtc event overflow error
	drm/gem: Fix a leak in drm_gem_objects_lookup()
	drm/bridge: ti-sn65dsi86: Clear old error bits before AUX transfers
	agp/intel: Fix a memory leak on module initialisation failure
	mwifiex: Fix firmware filename for sd8977 chipset
	mwifiex: Fix firmware filename for sd8997 chipset
	btmrvl: Fix firmware filename for sd8977 chipset
	btmrvl: Fix firmware filename for sd8997 chipset
	video: fbdev: sm712fb: fix an issue about iounmap for a wrong address
	console: newport_con: fix an issue about leak related system resources
	video: pxafb: Fix the function used to balance a 'dma_alloc_coherent()' call
	ath10k: Acquire tx_lock in tx error paths
	iio: improve IIO_CONCENTRATION channel type description
	drm/etnaviv: Fix error path on failure to enable bus clk
	drm/arm: fix unintentional integer overflow on left shift
	clk: bcm63xx-gate: fix last clock availability
	leds: lm355x: avoid enum conversion warning
	Bluetooth: btusb: fix up firmware download sequence
	Bluetooth: btmtksdio: fix up firmware download sequence
	media: cxusb-analog: fix V4L2 dependency
	media: marvell-ccic: Add missed v4l2_async_notifier_cleanup()
	media: omap3isp: Add missed v4l2_ctrl_handler_free() for preview_init_entities()
	ASoC: SOF: nocodec: add missing .owner field
	ASoC: Intel: bxt_rt298: add missing .owner field
	scsi: cumana_2: Fix different dev_id between request_irq() and free_irq()
	drm/mipi: use dcs write for mipi_dsi_dcs_set_tear_scanline
	cxl: Fix kobject memleak
	drm/radeon: fix array out-of-bounds read and write issues
	staging: vchiq_arm: Add a matching unregister call
	iavf: fix error return code in iavf_init_get_resources()
	iavf: Fix updating statistics
	RDMA/core: Fix bogus WARN_ON during ib_unregister_device_queued()
	scsi: powertec: Fix different dev_id between request_irq() and free_irq()
	scsi: eesox: Fix different dev_id between request_irq() and free_irq()
	ipvs: allow connection reuse for unconfirmed conntrack
	media: firewire: Using uninitialized values in node_probe()
	media: exynos4-is: Add missed check for pinctrl_lookup_state()
	media: cros-ec-cec: do not bail on device_init_wakeup failure
	xfs: don't eat an EIO/ENOSPC writeback error when scrubbing data fork
	xfs: fix reflink quota reservation accounting error
	RDMA/rxe: Skip dgid check in loopback mode
	PCI: Fix pci_cfg_wait queue locking problem
	drm/stm: repair runtime power management
	kobject: Avoid premature parent object freeing in kobject_cleanup()
	leds: core: Flush scheduled work for system suspend
	drm: panel: simple: Fix bpc for LG LB070WV8 panel
	phy: exynos5-usbdrd: Calibrating makes sense only for USB2.0 PHY
	drm/bridge: sil_sii8620: initialize return of sii8620_readb
	scsi: scsi_debug: Add check for sdebug_max_queue during module init
	mwifiex: Prevent memory corruption handling keys
	kernfs: do not call fsnotify() with name without a parent
	powerpc/rtas: don't online CPUs for partition suspend
	powerpc/vdso: Fix vdso cpu truncation
	RDMA/qedr: SRQ's bug fixes
	RDMA/rxe: Prevent access to wr->next ptr afrer wr is posted to send queue
	ima: Have the LSM free its audit rule
	staging: rtl8192u: fix a dubious looking mask before a shift
	ASoC: meson: fixes the missed kfree() for axg_card_add_tdm_loopback
	PCI/ASPM: Add missing newline in sysfs 'policy'
	phy: renesas: rcar-gen3-usb2: move irq registration to init
	powerpc/book3s64/pkeys: Use PVR check instead of cpu feature
	drm/imx: fix use after free
	drm/imx: tve: fix regulator_disable error path
	gpu: ipu-v3: Restore RGB32, BGR32
	spi: lantiq-ssc: Fix warning by using WQ_MEM_RECLAIM
	USB: serial: iuu_phoenix: fix led-activity helpers
	usb: core: fix quirks_param_set() writing to a const pointer
	thermal: ti-soc-thermal: Fix reversed condition in ti_thermal_expose_sensor()
	coresight: tmc: Fix TMC mode read in tmc_read_unprepare_etb()
	powerpc/perf: Fix missing is_sier_aviable() during build
	mt76: mt7615: fix potential memory leak in mcu message handler
	phy: armada-38x: fix NETA lockup when repeatedly switching speeds
	MIPS: OCTEON: add missing put_device() call in dwc3_octeon_device_init()
	usb: dwc2: Fix error path in gadget registration
	usb: gadget: f_uac2: fix AC Interface Header Descriptor wTotalLength
	scsi: megaraid_sas: Clear affinity hint
	scsi: mesh: Fix panic after host or bus reset
	net: dsa: mv88e6xxx: MV88E6097 does not support jumbo configuration
	macintosh/via-macii: Access autopoll_devs when inside lock
	PCI: cadence: Fix updating Vendor ID and Subsystem Vendor ID register
	RDMA/core: Fix return error value in _ib_modify_qp() to negative
	Smack: fix another vsscanf out of bounds
	Smack: prevent underflow in smk_set_cipso()
	power: supply: check if calc_soc succeeded in pm860x_init_battery
	Bluetooth: hci_h5: Set HCI_UART_RESET_ON_INIT to correct flags
	Bluetooth: hci_serdev: Only unregister device if it was registered
	net: dsa: rtl8366: Fix VLAN semantics
	net: dsa: rtl8366: Fix VLAN set-up
	xfs: fix inode allocation block res calculation precedence
	selftests/powerpc: Squash spurious errors due to device removal
	powerpc/32s: Fix CONFIG_BOOK3S_601 uses
	powerpc/boot: Fix CONFIG_PPC_MPC52XX references
	selftests/powerpc: Fix CPU affinity for child process
	RDMA/netlink: Remove CAP_NET_RAW check when dump a raw QP
	PCI: Release IVRS table in AMD ACS quirk
	cpufreq: ap806: fix cpufreq driver needs ap cpu clk
	selftests/powerpc: Fix online CPU selection
	ASoC: meson: axg-tdm-interface: fix link fmt setup
	ASoC: meson: axg-tdmin: fix g12a skew
	ASoC: meson: axg-tdm-formatters: fix sclk inversion
	ASoC: fsl_sai: Fix value of FSL_SAI_CR1_RFW_MASK
	s390/qeth: don't process empty bridge port events
	ice: Graceful error handling in HW table calloc failure
	rtw88: fix LDPC field for RA info
	rtw88: fix short GI capability based on current bandwidth
	rtw88: coex: only skip coex triggered by BT info
	wl1251: fix always return 0 error
	tools, build: Propagate build failures from tools/build/Makefile.build
	tools, bpftool: Fix wrong return value in do_dump()
	net/mlx5: DR, Change push vlan action sequence
	net/mlx5: Delete extra dump stack that gives nothing
	net: ethernet: aquantia: Fix wrong return value
	liquidio: Fix wrong return value in cn23xx_get_pf_num()
	net: spider_net: Fix the size used in a 'dma_free_coherent()' call
	fsl/fman: use 32-bit unsigned integer
	fsl/fman: fix dereference null return value
	fsl/fman: fix unreachable code
	fsl/fman: check dereferencing null pointer
	fsl/fman: fix eth hash table allocation
	net: thunderx: initialize VF's mailbox mutex before first usage
	dlm: Fix kobject memleak
	ocfs2: fix unbalanced locking
	pinctrl-single: fix pcs_parse_pinconf() return value
	svcrdma: Fix page leak in svc_rdma_recv_read_chunk()
	SUNRPC: Fix ("SUNRPC: Add "@len" parameter to gss_unwrap()")
	x86/fsgsbase/64: Fix NULL deref in 86_fsgsbase_read_task
	crypto: aesni - add compatibility with IAS
	af_packet: TPACKET_V3: fix fill status rwlock imbalance
	drivers/net/wan/lapbether: Added needed_headroom and a skb->len check
	net: Fix potential memory leak in proto_register()
	net/nfc/rawsock.c: add CAP_NET_RAW check.
	net: phy: fix memory leak in device-create error path
	net: Set fput_needed iff FDPUT_FPUT is set
	net/tls: Fix kmap usage
	tcp: correct read of TFO keys on big endian systems
	vmxnet3: use correct tcp hdr length when packet is encapsulated
	net: refactor bind_bucket fastreuse into helper
	net: initialize fastreuse on inet_inherit_port
	USB: serial: cp210x: re-enable auto-RTS on open
	USB: serial: cp210x: enable usb generic throttle/unthrottle
	ALSA: hda - fix the micmute led status for Lenovo ThinkCentre AIO
	ALSA: usb-audio: Creative USB X-Fi Pro SB1095 volume knob support
	ALSA: usb-audio: fix overeager device match for MacroSilicon MS2109
	ALSA: usb-audio: work around streaming quirk for MacroSilicon MS2109
	9p: Fix memory leak in v9fs_mount
	media: media-request: Fix crash if memory allocation fails
	drm/ttm/nouveau: don't call tt destroy callback on alloc failure.
	io_uring: set ctx sq/cq entry count earlier
	NFS: Don't move layouts to plh_return_segs list while in use
	NFS: Don't return layout segments that are in use
	cpufreq: Fix locking issues with governors
	cpufreq: dt: fix oops on armada37xx
	include/asm-generic/vmlinux.lds.h: align ro_after_init
	spi: spidev: Align buffers for DMA
	mtd: rawnand: qcom: avoid write to unavailable register
	erofs: fix extended inode could cross boundary
	Revert "parisc: Drop LDCW barrier in CAS code when running UP"
	Revert "parisc: Use ldcw instruction for SMP spinlock release barrier"
	Revert "parisc: Revert "Release spinlocks using ordered store""
	parisc: Do not use an ordered store in pa_tlb_lock()
	parisc: Implement __smp_store_release and __smp_load_acquire barriers
	parisc: mask out enable and reserved bits from sba imask
	ARM: 8992/1: Fix unwind_frame for clang-built kernels
	irqdomain/treewide: Free firmware node after domain removal
	ALSA: usb-audio: add quirk for Pioneer DDJ-RB
	tpm: Unify the mismatching TPM space buffer sizes
	pstore: Fix linking when crypto API disabled
	crypto: hisilicon - don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified
	crypto: qat - fix double free in qat_uclo_create_batch_init_list
	crypto: ccp - Fix use of merged scatterlists
	crypto: cpt - don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified
	bitfield.h: don't compile-time validate _val in FIELD_FIT
	fs/minix: check return value of sb_getblk()
	fs/minix: don't allow getting deleted inodes
	fs/minix: reject too-large maximum file size
	xen/balloon: fix accounting in alloc_xenballooned_pages error path
	xen/balloon: make the balloon wait interruptible
	xen/gntdev: Fix dmabuf import with non-zero sgt offset
	s390/dasd: fix inability to use DASD with DIAG driver
	s390/gmap: improve THP splitting
	io_uring: Fix NULL pointer dereference in loop_rw_iter()
	Linux 5.4.59

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4bc685ec9234d8f72a9c66ee2d509a2975f6d711
2020-08-19 08:40:57 +02:00
Greg Kroah-Hartman
f61e1c3638 Linux 5.4.59
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-19 08:16:29 +02:00
Guoyu Huang
5de0b5247c io_uring: Fix NULL pointer dereference in loop_rw_iter()
commit 2dd2111d0d383df104b144e0d1f6b5a00cb7cd88 upstream.

loop_rw_iter() does not check whether the file has a read or
write function. This can lead to NULL pointer dereference
when the user passes in a file descriptor that does not have
read or write function.

The crash log looks like this:

[   99.834071] BUG: kernel NULL pointer dereference, address: 0000000000000000
[   99.835364] #PF: supervisor instruction fetch in kernel mode
[   99.836522] #PF: error_code(0x0010) - not-present page
[   99.837771] PGD 8000000079d62067 P4D 8000000079d62067 PUD 79d8c067 PMD 0
[   99.839649] Oops: 0010 [#2] SMP PTI
[   99.840591] CPU: 1 PID: 333 Comm: io_wqe_worker-0 Tainted: G      D           5.8.0 #2
[   99.842622] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014
[   99.845140] RIP: 0010:0x0
[   99.845840] Code: Bad RIP value.
[   99.846672] RSP: 0018:ffffa1c7c01ebc08 EFLAGS: 00010202
[   99.848018] RAX: 0000000000000000 RBX: ffff92363bd67300 RCX: ffff92363d461208
[   99.849854] RDX: 0000000000000010 RSI: 00007ffdbf696bb0 RDI: ffff92363bd67300
[   99.851743] RBP: ffffa1c7c01ebc40 R08: 0000000000000000 R09: 0000000000000000
[   99.853394] R10: ffffffff9ec692a0 R11: 0000000000000000 R12: 0000000000000010
[   99.855148] R13: 0000000000000000 R14: ffff92363d461208 R15: ffffa1c7c01ebc68
[   99.856914] FS:  0000000000000000(0000) GS:ffff92363dd00000(0000) knlGS:0000000000000000
[   99.858651] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   99.860032] CR2: ffffffffffffffd6 CR3: 000000007ac66000 CR4: 00000000000006e0
[   99.861979] Call Trace:
[   99.862617]  loop_rw_iter.part.0+0xad/0x110
[   99.863838]  io_write+0x2ae/0x380
[   99.864644]  ? kvm_sched_clock_read+0x11/0x20
[   99.865595]  ? sched_clock+0x9/0x10
[   99.866453]  ? sched_clock_cpu+0x11/0xb0
[   99.867326]  ? newidle_balance+0x1d4/0x3c0
[   99.868283]  io_issue_sqe+0xd8f/0x1340
[   99.869216]  ? __switch_to+0x7f/0x450
[   99.870280]  ? __switch_to_asm+0x42/0x70
[   99.871254]  ? __switch_to_asm+0x36/0x70
[   99.872133]  ? lock_timer_base+0x72/0xa0
[   99.873155]  ? switch_mm_irqs_off+0x1bf/0x420
[   99.874152]  io_wq_submit_work+0x64/0x180
[   99.875192]  ? kthread_use_mm+0x71/0x100
[   99.876132]  io_worker_handle_work+0x267/0x440
[   99.877233]  io_wqe_worker+0x297/0x350
[   99.878145]  kthread+0x112/0x150
[   99.878849]  ? __io_worker_unuse+0x100/0x100
[   99.879935]  ? kthread_park+0x90/0x90
[   99.880874]  ret_from_fork+0x22/0x30
[   99.881679] Modules linked in:
[   99.882493] CR2: 0000000000000000
[   99.883324] ---[ end trace 4453745f4673190b ]---
[   99.884289] RIP: 0010:0x0
[   99.884837] Code: Bad RIP value.
[   99.885492] RSP: 0018:ffffa1c7c01ebc08 EFLAGS: 00010202
[   99.886851] RAX: 0000000000000000 RBX: ffff92363acd7f00 RCX: ffff92363d461608
[   99.888561] RDX: 0000000000000010 RSI: 00007ffe040d9e10 RDI: ffff92363acd7f00
[   99.890203] RBP: ffffa1c7c01ebc40 R08: 0000000000000000 R09: 0000000000000000
[   99.891907] R10: ffffffff9ec692a0 R11: 0000000000000000 R12: 0000000000000010
[   99.894106] R13: 0000000000000000 R14: ffff92363d461608 R15: ffffa1c7c01ebc68
[   99.896079] FS:  0000000000000000(0000) GS:ffff92363dd00000(0000) knlGS:0000000000000000
[   99.898017] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   99.899197] CR2: ffffffffffffffd6 CR3: 000000007ac66000 CR4: 00000000000006e0

Fixes: 32960613b7 ("io_uring: correctly handle non ->{read,write}_iter() file_operations")
Cc: stable@vger.kernel.org
Signed-off-by: Guoyu Huang <hgy5945@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-19 08:16:29 +02:00
Gerald Schaefer
4db28111b2 s390/gmap: improve THP splitting
commit ba925fa35057a062ac98c3e8138b013ce4ce351c upstream.

During s390_enable_sie(), we need to take care of splitting all qemu user
process THP mappings. This is currently done with follow_page(FOLL_SPLIT),
by simply iterating over all vma ranges, with PAGE_SIZE increment.

This logic is sub-optimal and can result in a lot of unnecessary overhead,
especially when using qemu and ASAN with large shadow map. Ilya reported
significant system slow-down with one CPU busy for a long time and overall
unresponsiveness.

Fix this by using walk_page_vma() and directly calling split_huge_pmd()
only for present pmds, which greatly reduces overhead.

Cc: <stable@vger.kernel.org> # v5.4+
Reported-by: Ilya Leoshkevich <iii@linux.ibm.com>
Tested-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-19 08:16:29 +02:00
Stefan Haberland
756a70b6dc s390/dasd: fix inability to use DASD with DIAG driver
commit 9f4aa52387c68049403b59939df5c0dd8e3872cc upstream.

During initialization of the DASD DIAG driver a request is issued
that has a bio structure that resides on the stack. With virtually
mapped kernel stacks this bio address might be in virtual storage
which is unsuitable for usage with the diag250 call.
In this case the device can not be set online using the DIAG
discipline and fails with -EOPNOTSUP.
In the system journal the following error message is presented:

dasd: X.X.XXXX Setting the DASD online with discipline DIAG failed
with rc=-95

Fix by allocating the bio structure instead of having it on the stack.

Fixes: ce3dc44749 ("s390: add support for virtually mapped kernel stacks")
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: stable@vger.kernel.org #4.20
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-19 08:16:29 +02:00
Oleksandr Andrushchenko
dccc66daeb xen/gntdev: Fix dmabuf import with non-zero sgt offset
commit 5fa4e6f1c2d8c9a4e47e1931b42893172d388f2b upstream.

It is possible that the scatter-gather table during dmabuf import has
non-zero offset of the data, but user-space doesn't expect that.
Fix this by failing the import, so user-space doesn't access wrong data.

Fixes: bf8dc55b13 ("xen/gntdev: Implement dma-buf import functionality")

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200813062113.11030-2-andr2000@gmail.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-19 08:16:29 +02:00