public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Shuah Khan <shuahkh@osg.samsung.com>,
	gregkh@linuxfoundation.org, arnd@arndb.de
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
	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()
Date: Thu, 12 Jan 2017 09:26:39 +0200	[thread overview]
Message-ID: <87r348rb68.fsf@linux.intel.com> (raw)
In-Reply-To: <20170112002618.14207-1-shuahkh@osg.samsung.com>

[-- Attachment #1: Type: text/plain, Size: 4498 bytes --]


Hi,

Shuah Khan <shuahkh@osg.samsung.com> 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] [<c010e19c>] (unwind_backtrace) from [<c010ae84>] (show_stack+0x)
> [    3.411696] [<c010ae84>] (show_stack) from [<c0335d50>] (dump_stack+0x78/0x8)
> [    3.418877] [<c0335d50>] (dump_stack) from [<c011aef8>] (__warn+0xe8/0x100)
> [    3.425796] [<c011aef8>] (__warn) from [<c011afc0>] (warn_slowpath_null+0x20)
> [    3.433344] [<c011afc0>] (warn_slowpath_null) from [<c04deb74>] (xhci_plat_p)
> [    3.441845] [<c04deb74>] (xhci_plat_probe) from [<c041f1dc>] (platform_drv_p)
> [    3.450157] [<c041f1dc>] (platform_drv_probe) from [<c041d848>] (driver_prob)
> [    3.458994] [<c041d848>] (driver_probe_device) from [<c041bd78>] (bus_for_ea)
> [    3.467485] [<c041bd78>] (bus_for_each_drv) from [<c041d538>] (__device_atta)
> [    3.475716] [<c041d538>] (__device_attach) from [<c041cb70>] (bus_probe_devi)
> [    3.483872] [<c041cb70>] (bus_probe_device) from [<c041af54>] (device_add+0x)
> [    3.491741] [<c041af54>] (device_add) from [<c041ef4c>] (platform_device_add)
> [    3.499892] [<c041ef4c>] (platform_device_add) from [<c04a5168>] (dwc3_host_)
> [    3.508379] [<c04a5168>] (dwc3_host_init) from [<c04a4f64>] (dwc3_probe+0x94)
> [    3.516091] [<c04a4f64>] (dwc3_probe) from [<c041f1dc>] (platform_drv_probe+)
> [    3.523975] [<c041f1dc>] (platform_drv_probe) from [<c041d848>] (driver_prob)
> [    3.532814] [<c041d848>] (driver_probe_device) from [<c041bd78>] (bus_for_ea)
> [    3.541306] [<c041bd78>] (bus_for_each_drv) from [<c041d538>] (__device_atta)
> [    3.549538] [<c041d538>] (__device_attach) from [<c041cb70>] (bus_probe_devi)
> [    3.557684] [<c041cb70>] (bus_probe_device) from [<c041af54>] (device_add+0x)
> [    3.565582] [<c041af54>] (device_add) from [<c0576334>] (of_platform_device_)
> [    3.574586] [<c0576334>] (of_platform_device_create_pdata) from [<c0576464>])
> [    3.584722] [<c0576464>] (of_platform_bus_create) from [<c05767d8>] (of_plat)
> [    3.593828] [<c05767d8>] (of_platform_populate) from [<c04ab334>] (dwc3_exyn)
> [    3.602660] [<c04ab334>] (dwc3_exynos_probe) from [<c041f1dc>] (platform_drv)
> [    3.611150] [<c041f1dc>] (platform_drv_probe) from [<c041d848>] (driver_prob)
> [    3.619988] [<c041d848>] (driver_probe_device) from [<c041bd78>] (bus_for_ea)
> [    3.628480] [<c041bd78>] (bus_for_each_drv) from [<c041d538>] (__device_atta)
> [    3.636712] [<c041d538>] (__device_attach) from [<c041cb70>] (bus_probe_devi)
> [    3.644857] [<c041cb70>] (bus_probe_device) from [<c041d04c>] (deferred_prob)
> [    3.653798] [<c041d04c>] (deferred_probe_work_func) from [<c0130c68>] (proce)
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> 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.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-01-12  7:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  0:26 [PATCH] usb: dwc3-exynos Fix dma_mask WARN_ON from xhci_plat_probe() Shuah Khan
2017-01-12  7:26 ` Felipe Balbi [this message]
2017-01-12 16:35   ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r348rb68.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuahkh@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox