Re: [PATCH] usb: dwc3: leave default DMA for PCI devices

From: Fabio Aiuto
Date: Sun Nov 14 2021 - 11:12:15 EST


[resend with all CC]

Hello Sven,

On Sun, Nov 14, 2021 at 12:56:02PM +0100, Sven Peter wrote:
> On Sat, Nov 13, 2021, at 15:29, Fabio Aiuto wrote:
> > in case of a PCI dwc3 controller, leave the default DMA
> > mask. Calling of a 64 bit DMA mask breaks the driver on
> > cherrytrail based tablets like Cyberbook T116.
> >
> > Fixes: 45d39448b4d0 ("usb: dwc3: support 64 bit DMA in platform driver")
> > Reported-by: Hans De Goede <hdegoede@xxxxxxxxxx>
> > Tested-by: Fabio Aiuto <fabioaiuto83@xxxxxxxxx>
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@xxxxxxxxx>
> > ---
> > drivers/usb/dwc3/core.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index 643239d7d370..f4c09951b517 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -1594,9 +1594,11 @@ static int dwc3_probe(struct platform_device *pdev)
> >
> > dwc3_get_properties(dwc);
> >
> > - ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
> > - if (ret)
> > - return ret;
> > + if (!dwc->sysdev_is_parent) {
>
>
> Are you sure it's the dwc3 controller that limits DMA to 32 bit addresses and
> not the PCI bus itself?
> I also think the xhci driver will call dma_set_mask_and_coherent again
> later on when dwc3 is used in host mode.

I could not have answered better than Hans, I'm just adding the bisect
log:

git bisect start
# bad: [7d2a07b769330c34b4deabeed939325c77a7ec2f] Linux 5.14
git bisect bad 7d2a07b769330c34b4deabeed939325c77a7ec2f
# good: [62fb9874f5da54fdb243003b386128037319b219] Linux 5.13
git bisect good 7cf3dead1ad70c72edb03e2d98e1f3dcd332cdb2
# good: [406254918b232db198ed60f5bf1f8b84d96bca00] Merge tag 'perf-tools-for-v5.14-2021-07-01' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
git bisect good 406254918b232db198ed60f5bf1f8b84d96bca00
# bad: [4ea90317956718e0648e1f87e56530db809a5a04] Merge tag 'for-linus-5.14-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
git bisect bad 4ea90317956718e0648e1f87e56530db809a5a04
# good: [8fc4fb1728855a22f9149079ba51877f5ee61fc9] Merge tag 'm68knommu-for-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
git bisect good 8fc4fb1728855a22f9149079ba51877f5ee61fc9
# good: [77ad1f0e99bd00af024e650b862cfda3137af660] staging: hi6421-spmi-pmic: cleanup some macros
git bisect good 77ad1f0e99bd00af024e650b862cfda3137af660
# good: [eed0218e8cae9fcd186c30e9fcf5fe46a87e056e] Merge tag 'char-misc-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
git bisect good eed0218e8cae9fcd186c30e9fcf5fe46a87e056e
# good: [c932ed0adb09a7fa6d6649ee04dd78c83ab07ada] Merge tag 'tty-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect good c932ed0adb09a7fa6d6649ee04dd78c83ab07ada
# bad: [738d5ad104bbbe5d1bfb6c0553bb4a1eb91cc433] Revert "of/platform: Add stubs for of_platform_device_create/destroy()"
git bisect bad 738d5ad104bbbe5d1bfb6c0553bb4a1eb91cc433
# good: [8268acfe1cc967dbe9fbb05b5f07a19675a81cff] usb: isp1760: isp1760-udc: Provide missing description for 'udc' param
git bisect good 8268acfe1cc967dbe9fbb05b5f07a19675a81cff
# bad: [318324e6df9787f8ec06660224f555471c8f36d1] usb: musb: Implement tracing for state change events
git bisect bad 318324e6df9787f8ec06660224f555471c8f36d1
# good: [ca5ce82529104e96ccc5e1888979258e233e1644] usb: typec: intel_pmc_mux: Update IOM port status offset for AlderLake
git bisect good ca5ce82529104e96ccc5e1888979258e233e1644
# bad: [ecfbd7b9054bddb12cea07fda41bb3a79a7b0149] usb: gadget: f_fs: Fix setting of device and driver data cross-references
git bisect bad ecfbd7b9054bddb12cea07fda41bb3a79a7b0149
# good: [87191ca9f90244d4e003fbe5c77390b5e585a5ef] USB: UDC: Implement udc_async_callbacks in net2272
git bisect good 87191ca9f90244d4e003fbe5c77390b5e585a5ef
# good: [307462a6f5c5a563ec084bb315f4e0279dfb2026] usb: gadget: function: printer: use list_move instead of list_del/list_add
git bisect good 307462a6f5c5a563ec084bb315f4e0279dfb2026
# bad: [45d39448b4d0260743f25d88fd929451ec8296f2] usb: dwc3: support 64 bit DMA in platform driver
git bisect bad 45d39448b4d0260743f25d88fd929451ec8296f2
# good: [60dfe484cef45293e631b3a6e8995f1689818172] USB: core: Avoid WARNings for 0-length descriptor requests
git bisect good 60dfe484cef45293e631b3a6e8995f1689818172
# first bad commit: [45d39448b4d0260743f25d88fd929451ec8296f2] usb: dwc3: support 64 bit DMA in platform driver

>
>
>
> Sven

thank you,

fabio