From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750979AbdALH2k (ORCPT ); Thu, 12 Jan 2017 02:28:40 -0500 Received: from mga01.intel.com ([192.55.52.88]:7210 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750755AbdALH2j (ORCPT ); Thu, 12 Jan 2017 02:28:39 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,348,1477983600"; d="asc'?scan'208";a="212443954" From: Felipe Balbi To: Shuah Khan , gregkh@linuxfoundation.org, arnd@arndb.de Cc: Shuah Khan , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: dwc3-exynos Fix dma_mask WARN_ON from xhci_plat_probe() In-Reply-To: <20170112002618.14207-1-shuahkh@osg.samsung.com> References: <20170112002618.14207-1-shuahkh@osg.samsung.com> Date: Thu, 12 Jan 2017 09:26:39 +0200 Message-ID: <87r348rb68.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Shuah Khan writes: > During dwc3_exynos_probe(), WARN_ON(!pdev->dev.dma_mask) is triggered from > xhci_plat_probe(). dwc3_host_init() doesn't configure DMA prior to adding > the platform device. > > dwc3_host_init() was changed to not configure DMA with the change to use > bus->sysdev for DMA config. > > sysdev_is_parent is not true for dwc3-exynos. This might be the reason why > there is a need to configure DMA in dwc3_host_init() prior to adding the > platform device for xhci in this path. > > This fix adds the DMA config to dwc3_host_init() without undoing any other > changes in > commit d64ff406e51e ("usb: dwc3: use bus->sysdev for DMA configuration") > > [ 3.372356] WARNING: CPU: 2 PID: 108 at drivers/usb/host/xhci-plat.c:1= 68 xhc0 > [ 3.381381] Modules linked in: > [ 3.384373] CPU: 2 PID: 108 Comm: kworker/2:1 Not tainted 4.10.0-rc2-0= 0250-g8 > [ 3.392783] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) > [ 3.398854] Workqueue: events deferred_probe_work_func > [ 3.403994] [] (unwind_backtrace) from [] (show_st= ack+0x) > [ 3.411696] [] (show_stack) from [] (dump_stack+0x= 78/0x8) > [ 3.418877] [] (dump_stack) from [] (__warn+0xe8/0= x100) > [ 3.425796] [] (__warn) from [] (warn_slowpath_nul= l+0x20) > [ 3.433344] [] (warn_slowpath_null) from [] (xhci_= plat_p) > [ 3.441845] [] (xhci_plat_probe) from [] (platform= _drv_p) > [ 3.450157] [] (platform_drv_probe) from [] (drive= r_prob) > [ 3.458994] [] (driver_probe_device) from [] (bus_= for_ea) > [ 3.467485] [] (bus_for_each_drv) from [] (__devic= e_atta) > [ 3.475716] [] (__device_attach) from [] (bus_prob= e_devi) > [ 3.483872] [] (bus_probe_device) from [] (device_= add+0x) > [ 3.491741] [] (device_add) from [] (platform_devi= ce_add) > [ 3.499892] [] (platform_device_add) from [] (dwc3= _host_) > [ 3.508379] [] (dwc3_host_init) from [] (dwc3_prob= e+0x94) > [ 3.516091] [] (dwc3_probe) from [] (platform_drv_= probe+) > [ 3.523975] [] (platform_drv_probe) from [] (drive= r_prob) > [ 3.532814] [] (driver_probe_device) from [] (bus_= for_ea) > [ 3.541306] [] (bus_for_each_drv) from [] (__devic= e_atta) > [ 3.549538] [] (__device_attach) from [] (bus_prob= e_devi) > [ 3.557684] [] (bus_probe_device) from [] (device_= add+0x) > [ 3.565582] [] (device_add) from [] (of_platform_d= evice_) > [ 3.574586] [] (of_platform_device_create_pdata) from []) > [ 3.584722] [] (of_platform_bus_create) from [] (o= f_plat) > [ 3.593828] [] (of_platform_populate) from [] (dwc= 3_exyn) > [ 3.602660] [] (dwc3_exynos_probe) from [] (platfo= rm_drv) > [ 3.611150] [] (platform_drv_probe) from [] (drive= r_prob) > [ 3.619988] [] (driver_probe_device) from [] (bus_= for_ea) > [ 3.628480] [] (bus_for_each_drv) from [] (__devic= e_atta) > [ 3.636712] [] (__device_attach) from [] (bus_prob= e_devi) > [ 3.644857] [] (bus_probe_device) from [] (deferre= d_prob) > [ 3.653798] [] (deferred_probe_work_func) from [] = (proce) > > Signed-off-by: Shuah Khan > --- > Arnd! I isolated the smallest change to avoid the WARN_ON. Please let me > know if this problem could be fixed in another way. > > drivers/usb/dwc3/host.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c > index 487f0ff..f68f71f 100644 > --- a/drivers/usb/dwc3/host.c > +++ b/drivers/usb/dwc3/host.c > @@ -84,7 +84,10 @@ int dwc3_host_init(struct dwc3 *dwc) > return -ENOMEM; > } >=20=20 > + dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); > xhci->dev.parent =3D dwc->dev; > + xhci->dev.dma_mask =3D dwc->dev->dma_mask; > + xhci->dev.dma_parms =3D dwc->dev->dma_parms; this is the result of a missed patch. Mathias is discussing the proper fix for this. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlh3L68ACgkQzL64meEa mQZE9hAApZH4i3FR2fAg/rr//3UQR7wZztXq4qIQ1CblRBAZQgiRGbTL1wn41Ufr uZXzdOO9XlozeFILngvfqBWUrI7QlV/nxP9BEIwKh4Z6S7KukX6XKGgQdk+rCgat qSfhyxfRuvznBrn8o2lzn2F+qtYH4ig3HRUgsszyin1rWV3ekvvtF70fLrtgp4dr 5NtkJ6T5Jx5zaj8FjMdayogjNrjvCj3HIo7UsKB9x6JQqV6PNVzD7c15upJ4ZJ+j dQR9FpT4WQJbP6jUxKFcyVHmRvkr+xPkGLBU+edZoAFMtBZaUGoh0tBw3/c2FSMz cVBkfjgIHLCId9qYtuefvw9ovYFYpnWpghgys3ML/qjcLOU72ZiwpCm4bDQcAL6n AC3UctDDSqBgCLxSo4Tig5ZbEyKXwORjkfByRPyDCxwtZjfCrdm9X9wnSGrbmTUa yt01N3KoLV20W3rrGnCTxZSSk4sWBve3zxC7+pruOZ2WVJgXDsMAWTZjKsxBwTXO udxbV62TW7xFlc82O9y19EGTD6LAoiZ5UkdzzuuoCbwBFuyhX0l+3XkqdIdVvIx7 /KNSiZqyHjLKbJ/83T1KHacaKiQLTl29CXbEwakhyqbuVYiryO1BN9J7soyYcKOJ SiInlc/Ep56amyJ09s+z2Gqs2s5SDtJJBL48gaSn3Neu6gs4RWE= =sRTf -----END PGP SIGNATURE----- --=-=-=--