From: Wesley Cheng <wesley.cheng@oss.qualcomm.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>,
Michal Pecio <michal.pecio@gmail.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sound@vger.kernel.org
Subject: Re: [PATCH 0/2] Add larger page size support for USB audio offload path
Date: Wed, 26 Aug 2026 12:58:13 -0700 [thread overview]
Message-ID: <68a7cf57-8484-436a-9d3a-4d993c4e542b@oss.qualcomm.com> (raw)
In-Reply-To: <05117737-8793-4db9-9815-f617ac085d82@linux.intel.com>
On 8/26/2026 4:44 AM, Mathias Nyman wrote:
> On 8/26/26 13:25, Michal Pecio wrote:
>> On Wed, 26 Aug 2026 00:50:53 -0700, Wesley Cheng wrote:
>>> Thanks for this suggestion. I think it actually makes the overall
>>> design a lot better. So now that the sideband driver has its own
>>> segment pool (per sideband instance), we expect that any page
>>> allocations done from this pool is technically owned by the audio
>>> DSP. This allows us to still utilize 4k ring segments, while mapping
>>> the entire 16k page, so it helps conserve/optimize the memory
>>> allocations. I will do a bit more testing and review before
>>> submitting a new revision w/ these changes.
>>
>> The part about memory being "owned by the audio DSP" made me wonder
>> if it would be helpful to let offload drivers allocate their own memory
>> and then just dma_map() it for the xHC. No new rings would be allocated
>> for offloaded endpoints when they are enabled, we would point Endpoint
>> Context of the xHC to the sideband ring and leave ep->ring as NULL.
>>
>> Offload drivers would have full control over memory allocation - size,
>> number of segments (it seems that qc-usb-audio only uses one out of two
>> allocated by xhci-hcd), alignment, anything else.
>>
>> It would become impossible to offload an endpoint which is already
>> enabled, but is this an issue for anyone?
>>
>> NULL ep->ring will cause oopses/panics when somebody submits URBs to
>> offloaded endpoints, but I think it wouldn't be a problem otherwise.
>>
> I have similar thoughts.
>
> One idea would be to basically let sideband allocate the entire ring and set
> ep->new_ring early. This would tell xhci_endpoint_init() that a ring exists
> and
> a new one should not be allocated.
>
> xhci ring allocation would need some refactoring to create helpers for
> sideband
> to allocate and initialize all the other parts of the ring.
>
> This is something that VTIO (xhci spec section 4.25) would also need.
> There an endpoint can be handed over to a secondary DMA ID (second, new PCI
> BDF),
> that the normal xhci driver can be excluded from with iommu.
>
> VTIO use case is something like trusted VM accessing a secure usb storage
> device,
> preventing regular OS running the xhci driver in another VM from touching it.
>
> The secure VM needs to allocate and map the ring to this secondary PCI BDF
>
Interesting, so in both you're comments, it looks like when USB endpoints
are offloaded, you want that to be fully isolated from the xHCI layer
running on the Linux machine/proc. During the initial USB audio offload
series submission, I think there was a point where we had a discussion
where we decided to support both the Linux USB sound path alongside the
offload path. This is because applications that are unaware of the offload
path can still utilize the USB sound PCM devices.
In that situation, we're needing to map the region for both domains, and
proper ring structures in xHCI, which is the current design.
However, with the current changes I have, it might address some of these
points. I'll just give a quick highlight of them:
1. Currently, during xhci_sideband_register() I'm creating a sideband
segment pool and saving that reference. (if we wanted to adjust this to
your design, I think we can have the DMA segment pool allocations be
handled by the offload client driver and passed into xhci-sideband) I
think keeping the dma pool design just fits better with the overall xHCI
ring helpers, and all you need is the device structure associated w/ the
SID you're trying to map to in the offload driver.
2. xhci_sideband_add_endpoint() will populate the sideband entry for an USB
endpoint. This is used as the trigger for which pool to fetch new_ring
from in xhci_endpoint_init(). This pool will get propagated down to the
normal xHCI ring segment allocator, and will fetch an entry from the dma
pool.
I guess the only thing missing is a way to avoid the current xHCI APIs to
avoid operating on rings that have been offloaded, but as stated earlier,
at least in the USB audio offload use case, we'd still want the Linux
environment to be able to operate on the ring. I'm just trying to see if
we can come up with a way to accommodate the VTIO situation as well.
Thanks
Wesley Cheng
next prev parent reply other threads:[~2026-08-26 19:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 2:06 Wesley Cheng
2026-08-25 2:06 ` [PATCH 1/2] xhci: sideband: support page-aligned ring segment allocation Wesley Cheng
2026-08-25 2:06 ` [PATCH 2/2] ALSA: usb-audio: qcom: request page-aligned xHCI ring buffers Wesley Cheng
2026-08-25 7:43 ` [PATCH 0/2] Add larger page size support for USB audio offload path Michal Pecio
2026-08-25 19:08 ` Wesley Cheng
2026-08-26 7:50 ` Wesley Cheng
2026-08-26 10:25 ` Michal Pecio
2026-08-26 11:44 ` Mathias Nyman
2026-08-26 19:58 ` Wesley Cheng [this message]
2026-08-25 11:09 ` Takashi Iwai
2026-08-25 19:09 ` Wesley Cheng
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=68a7cf57-8484-436a-9d3a-4d993c4e542b@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®