From: Wesley Cheng <wesley.cheng@oss.qualcomm.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Michal Pecio <michal.pecio@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sound@vger.kernel.org,
Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: Re: [PATCH v6 0/4] Add larger page size support for USB audio offload path
Date: Tue, 17 Nov 2026 00:19:06 -0800 [thread overview]
Message-ID: <a38e874c-4685-4892-81b4-a6aeeaaeddb4@oss.qualcomm.com> (raw)
In-Reply-To: <20261109-16k_offload_v1_b4-v6-0-858c6e0e007d@oss.qualcomm.com>
On 11/9/2026 6:38 PM, Wesley Cheng wrote:
> On some environments, 16kB pages can be enabled from the Linux subsystem,
> which manages the IOMMU mappings for the audio DSP within the system. In
> the current design, the following assumptions break when 16k pages are
> utilized:
> 1. xHCI ring size is equal to PAGE_SIZE
> 2. Ring addresses start at the beginning of a page
>
> When the USB offload driver maps the rings (w/ the audio DSP SID), it is
> set with a 16k granular, which is a problem, as several xHCI rings could
> exist on the same page. This is because the rings are currently allocated
> from the segment_pool. Hence, potentially mapping non USB audio related
> rings into the region accessible by the audio DSP.
>
> To mitigate this, sideband rings are no longer allocated from the
> segment_pool. When PAGE_SIZE is larger than TRB_SEGMENT_SIZE, xHCI
> allocates the segments of sideband-tagged endpoint rings, and of the
> sideband secondary event ring, using dma_alloc_coherent(), which gives
> each segment a page of its own. Before the USB audio offload path is
> enabled, the USB audio data streams/endpoint are not active. Only when
> the class driver issues a usb_set_interface() call (done from
> snd_usb_endpoint_prepare()), will the xHCI allocate the transfer ring
> resources. The offload client driver therefore tags the endpoints with
> xhci_sideband_add_endpoint() before that point. The new ring allocation
> flow for sideband/offload clients will be as follows:
>
> handle_uaudio_stream_req()
> ▼
> enable_audio_stream(subs, ..., pcm_card_num)
> ├─ data_ep = uaudio_find_host_endpoint(subs, subs->data_endpoint)
> ├─ xhci_sideband_add_endpoint(sb, data_ep) ← ep->sideband = sb; ep->no_pool_alloc = PAGE_SIZE > TRB_SEGMENT_SIZE
> ├─ snd_usb_endpoint_prepare(chip, sync_endpoint) ─┐
> ├─ snd_usb_endpoint_prepare(chip, data_endpoint) ├─→ xhci_add_endpoint()
> │ ▼
> │ xhci_endpoint_init(xhci, virt_dev, ep, ...)
> │ new_ring = __xhci_ring_alloc(..., ep->no_pool_alloc, ...)
> │ ▼
> │ xhci_alloc_segments_for_ring(xhci, ring, flags)
> │ ▼
> │ xhci_segment_alloc(xhci, max_packet, num, ring->no_pool_alloc, flags)
> │ seg->trbs = dma_alloc_coherent(dev, TRB_SEGMENT_SIZE, &dma, flags)
> ▼
> xhci_sideband_get_endpoint_buffer(sb, data_ep) → xhci_ring_to_sgtable()
>
Hi Mathias,
Was wondering if this design looked a bit more acceptable? Was able to
figure out a way to achieve what you had suggested earlier mitigating the
dma free problem I mentioned in my previous email. If there are any issues
w/ this please let me know.
Thanks
Wesley Cheng
prev parent reply other threads:[~2026-11-17 8:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 2:38 Wesley Cheng
2026-11-10 2:38 ` [PATCH v6 1/4] usb: xhci: sideband: fix ring sg table for sub-page TRB segments Wesley Cheng
2026-11-10 2:38 ` [PATCH v6 2/4] usb: xhci: Allocate sideband ring segments with dma_alloc_coherent() Wesley Cheng
2026-11-10 2:38 ` [PATCH v6 3/4] ALSA: usb-audio: qcom: tag sideband endpoints before ring allocation Wesley Cheng
2026-11-10 2:38 ` [PATCH v6 4/4] ALSA: usb-audio: qcom: fix xfer ring IOMMU unmap on 16K+ page kernels Wesley Cheng
2026-11-17 8:19 ` Wesley Cheng [this message]
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=a38e874c-4685-4892-81b4-a6aeeaaeddb4@oss.qualcomm.com \
--to=wesley.cheng@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mathias.nyman@linux.intel.com \
--cc=michal.pecio@gmail.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®