From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751251AbdALQfM (ORCPT ); Thu, 12 Jan 2017 11:35:12 -0500 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:45724 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750945AbdALQfK (ORCPT ); Thu, 12 Jan 2017 11:35:10 -0500 Subject: Re: [PATCH] usb: dwc3-exynos Fix dma_mask WARN_ON from xhci_plat_probe() To: Felipe Balbi , gregkh@linuxfoundation.org, arnd@arndb.de References: <20170112002618.14207-1-shuahkh@osg.samsung.com> <87r348rb68.fsf@linux.intel.com> Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan From: Shuah Khan Message-ID: Date: Thu, 12 Jan 2017 09:35:00 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <87r348rb68.fsf@linux.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/12/2017 12:26 AM, Felipe Balbi wrote: > > 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:168 xhc0 >> [ 3.381381] Modules linked in: >> [ 3.384373] CPU: 2 PID: 108 Comm: kworker/2:1 Not tainted 4.10.0-rc2-00250-g8 >> [ 3.392783] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) >> [ 3.398854] Workqueue: events deferred_probe_work_func >> [ 3.403994] [] (unwind_backtrace) from [] (show_stack+0x) >> [ 3.411696] [] (show_stack) from [] (dump_stack+0x78/0x8) >> [ 3.418877] [] (dump_stack) from [] (__warn+0xe8/0x100) >> [ 3.425796] [] (__warn) from [] (warn_slowpath_null+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 [] (driver_prob) >> [ 3.458994] [] (driver_probe_device) from [] (bus_for_ea) >> [ 3.467485] [] (bus_for_each_drv) from [] (__device_atta) >> [ 3.475716] [] (__device_attach) from [] (bus_probe_devi) >> [ 3.483872] [] (bus_probe_device) from [] (device_add+0x) >> [ 3.491741] [] (device_add) from [] (platform_device_add) >> [ 3.499892] [] (platform_device_add) from [] (dwc3_host_) >> [ 3.508379] [] (dwc3_host_init) from [] (dwc3_probe+0x94) >> [ 3.516091] [] (dwc3_probe) from [] (platform_drv_probe+) >> [ 3.523975] [] (platform_drv_probe) from [] (driver_prob) >> [ 3.532814] [] (driver_probe_device) from [] (bus_for_ea) >> [ 3.541306] [] (bus_for_each_drv) from [] (__device_atta) >> [ 3.549538] [] (__device_attach) from [] (bus_probe_devi) >> [ 3.557684] [] (bus_probe_device) from [] (device_add+0x) >> [ 3.565582] [] (device_add) from [] (of_platform_device_) >> [ 3.574586] [] (of_platform_device_create_pdata) from []) >> [ 3.584722] [] (of_platform_bus_create) from [] (of_plat) >> [ 3.593828] [] (of_platform_populate) from [] (dwc3_exyn) >> [ 3.602660] [] (dwc3_exynos_probe) from [] (platform_drv) >> [ 3.611150] [] (platform_drv_probe) from [] (driver_prob) >> [ 3.619988] [] (driver_probe_device) from [] (bus_for_ea) >> [ 3.628480] [] (bus_for_each_drv) from [] (__device_atta) >> [ 3.636712] [] (__device_attach) from [] (bus_probe_devi) >> [ 3.644857] [] (bus_probe_device) from [] (deferred_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; >> } >> >> + dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); >> xhci->dev.parent = dwc->dev; >> + xhci->dev.dma_mask = dwc->dev->dma_mask; >> + xhci->dev.dma_parms = dwc->dev->dma_parms; > > this is the result of a missed patch. Mathias is discussing the proper > fix for this. > Can you please point me to the thread if you have it handy? thanks, -- Shuah