All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Vi_ _Ku <vishalmimani008@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
	stable@vger.kernel.org, thierry.reding@gmail.com,
	jonathanh@nvidia.com, digetx@gmail.com
Subject: Re: [PATCH] usb: gadget: tegra-xudc: drain EP pipeline before DMA unmap
Date: Thu, 25 Jun 2026 15:53:35 +0100	[thread overview]
Message-ID: <2026062523-shank-explicit-6e09@gregkh> (raw)
In-Reply-To: <CAN+vipx-6gco_XMnV+JxbkRegJ=i8tSKFdBN4KcT16UceQduqQ@mail.gmail.com>

On Fri, Jun 05, 2026 at 02:16:47PM +0900, Vi_ _Ku wrote:
> On Tegra186/194/234 the XUDC appears to post a transfer-completion
> event when the DMA write is dispatched to the AXI interconnect, before
> the store is committed to memory.  Under SMMU strict mode dma_unmap()
> synchronously removes the IOVA TLB entry.  If an in-flight AXI write
> to that IOVA has not yet been committed, the SMMU raises a translation
> fault (fsr=0x402) that permanently wedges the bulk endpoint; the host
> cdc_ncm TX queue stalls and fires NETDEV WATCHDOG after 5 s.
> 
> Fix for non-control endpoints: poll EP_THREAD_ACTIVE until the endpoint
> sequencer goes idle before calling dma_unmap().  Follow the poll with an
> MMIO read-back that orders prior CPU writes to device memory.  Only
> after that does dma_unmap() invalidate the TLB entry.
> 
> On timeout, skip the dma_unmap to avoid triggering the SMMU fault.  The
> DMA mapping leaks, but the hardware is already in an unrecoverable state
> at that point.
> 
> ep_wait_for_inactive() uses readl_poll_timeout_atomic() (1 µs poll,
> 100 µs timeout), already called from IRQ context in
> __tegra_xudc_ep_dequeue().  Change its return type from void to int so
> both call sites can detect and report a timeout.
> 
> Control endpoints (EP0) are excluded: their completions go through the
> control-transfer state machine where the DMA is fully committed before
> req_done is called.
> 
> Fixes: d720f0f7bfa0 ("usb: gadget: Add Tegra XUSB device mode controller
> driver")
> Cc: stable@vger.kernel.org
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: Dmitry Osipenko <digetx@gmail.com>
> Cc: linux-tegra@vger.kernel.org
> Signed-off-by: Vishal Kumar <vishalmimani008@gmail.com>

Does not match your "From:" line :(

       reply	other threads:[~2026-06-25 14:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAN+vipx-6gco_XMnV+JxbkRegJ=i8tSKFdBN4KcT16UceQduqQ@mail.gmail.com>
2026-06-25 14:53 ` Greg KH [this message]
2026-06-25 20:59   ` [PATCH] usb: gadget: tegra-xudc: drain EP pipeline before DMA unmap Jon Hunter
2026-06-06  2:40 [PATCH] usb: gadget: tegra-xudc: drain EP pipeline before dma_unmap Vishal Kumar
2026-06-22 13:24 ` Jon Hunter
  -- strict thread matches above, loose matches on Subject: below --
2026-06-05  7:27 [PATCH] usb: gadget: tegra-xudc: drain EP pipeline before DMA unmap Vishal Kumar
2026-06-05 14:59 ` Greg KH
     [not found] <6a226993.a5745248.34e478.a9cd@mx.google.com>
2026-06-05  6:35 ` Greg KH

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=2026062523-shank-explicit-6e09@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vishalmimani008@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.