1
0
Fork 0
alistair23-linux/drivers/scsi/ufs
Marc Gonzalez d672475664 scsi: ufs: Use explicit access size in ufshcd_dump_regs
memcpy_fromio() doesn't provide any control over access size.  For example,
on arm64, it is implemented using readb and readq.  This may trigger a
synchronous external abort:

[    3.729943] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
[    3.737000] Modules linked in:
[    3.744371] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G S                4.20.0-rc4 #16
[    3.747413] Hardware name: Qualcomm Technologies, Inc. MSM8998 v1 MTP (DT)
[    3.755295] pstate: 00000005 (nzcv daif -PAN -UAO)
[    3.761978] pc : __memcpy_fromio+0x68/0x80
[    3.766718] lr : ufshcd_dump_regs+0x50/0xb0
[    3.770767] sp : ffff00000807ba00
[    3.774830] x29: ffff00000807ba00 x28: 00000000fffffffb
[    3.778344] x27: ffff0000089db068 x26: ffff8000f6e58000
[    3.783728] x25: 000000000000000e x24: 0000000000000800
[    3.789023] x23: ffff8000f6e587c8 x22: 0000000000000800
[    3.794319] x21: ffff000008908368 x20: ffff8000f6e1ab80
[    3.799615] x19: 000000000000006c x18: ffffffffffffffff
[    3.804910] x17: 0000000000000000 x16: 0000000000000000
[    3.810206] x15: ffff000009199648 x14: ffff000089244187
[    3.815502] x13: ffff000009244195 x12: ffff0000091ab000
[    3.820797] x11: 0000000005f5e0ff x10: ffff0000091998a0
[    3.826093] x9 : 0000000000000000 x8 : ffff8000f6e1ac00
[    3.831389] x7 : 0000000000000000 x6 : 0000000000000068
[    3.836676] x5 : ffff8000f6e1abe8 x4 : 0000000000000000
[    3.841971] x3 : ffff00000928c868 x2 : ffff8000f6e1abec
[    3.847267] x1 : ffff00000928c868 x0 : ffff8000f6e1abe8
[    3.852567] Process swapper/0 (pid: 1, stack limit = 0x(____ptrval____))
[    3.857900] Call trace:
[    3.864473]  __memcpy_fromio+0x68/0x80
[    3.866683]  ufs_qcom_dump_dbg_regs+0x1c0/0x370
[    3.870522]  ufshcd_print_host_regs+0x168/0x190
[    3.874946]  ufshcd_init+0xd4c/0xde0
[    3.879459]  ufshcd_pltfrm_init+0x3c8/0x550
[    3.883264]  ufs_qcom_probe+0x24/0x60
[    3.887188]  platform_drv_probe+0x50/0xa0

Assuming aligned 32-bit registers, let's use readl, after making sure
that 'offset' and 'len' are indeed multiples of 4.

Fixes: ba80917d99 ("scsi: ufs: ufshcd_dump_regs to use memcpy_fromio")
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-01-22 21:11:40 -05:00
..
Kconfig scsi: ufs: Add UFS platform driver for Cadence UFS 2018-11-09 07:58:42 -05:00
Makefile scsi: ufs: Add UFS platform driver for Cadence UFS 2018-11-09 07:58:42 -05:00
cdns-pltfrm.c scsi: ufs: Fix platform_no_drv_owner.cocci warnings 2018-12-12 21:37:56 -05:00
tc-dwc-g210-pci.c scsi: ufs: Fix kernel-doc errors and warnings 2018-03-01 21:00:23 -05:00
tc-dwc-g210-pltfrm.c scsi: ufs: Fix kernel-doc errors and warnings 2018-03-01 21:00:23 -05:00
tc-dwc-g210.c scsi: ufs: tc-dwc-g210: make arrays static, reduces object code size 2017-09-15 15:41:45 -04:00
tc-dwc-g210.h ufs: add support for Synopsys G210 Test Chip 2016-07-12 23:16:31 -04:00
ufs-hisi.c scsi: ufs: Fix hynix ufs bug with quirk on hi36xx SoC 2018-11-08 21:22:52 -05:00
ufs-hisi.h scsi: ufs: add Hisilicon ufs driver code 2018-07-19 21:57:39 -04:00
ufs-qcom.c USB/PHY patches for 4.20-rc1 2018-10-26 08:14:13 -07:00
ufs-qcom.h scsi/ufs: qcom: Remove ufs_qcom_phy_*() calls from host 2018-09-26 13:09:37 +05:30
ufs-sysfs.c scsi: ufs: Add support for Auto-Hibernate Idle Timer 2018-03-21 21:21:25 -04:00
ufs-sysfs.h scsi: ufs: sysfs: attributes 2018-02-15 18:35:05 -05:00
ufs.h scsi: ufs: Fix geometry descriptor size 2019-01-11 22:29:32 -05:00
ufs_bsg.c bsg: provide bsg_remove_queue() helper 2018-11-07 13:42:32 -07:00
ufs_bsg.h scsi: ufs: Add a bsg endpoint that supports UPIUs 2018-10-10 23:09:46 -04:00
ufs_quirks.h scsi: ufs: Fix hynix ufs bug with quirk on hi36xx SoC 2018-11-08 21:22:52 -05:00
ufshcd-dwc.c ufs: Adding license info do tc-dwc-g210 and ufshcd-dwc to enable loadable module 2016-07-12 23:16:31 -04:00
ufshcd-dwc.h ufs: add support for DesignWare Controller 2016-07-12 23:16:31 -04:00
ufshcd-pci.c scsi: ufs: Fix kernel-doc errors and warnings 2018-03-01 21:00:23 -05:00
ufshcd-pltfrm.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
ufshcd-pltfrm.h scsi: ufs: make the UFS variant a platform device 2015-11-09 18:00:02 -05:00
ufshcd.c scsi: ufs: Use explicit access size in ufshcd_dump_regs 2019-01-22 21:11:40 -05:00
ufshcd.h scsi: ufs: set the device reference clock setting 2018-11-09 07:52:59 -05:00
ufshci-dwc.h ufs: add support for DesignWare Controller 2016-07-12 23:16:31 -04:00
ufshci.h scsi: ufs: cleanup struct utp_task_req_desc 2018-10-10 23:09:46 -04:00
unipro.h scsi: ufs: ensure that host pa_tactivate is higher than device 2016-11-29 12:06:56 -05:00