From: Wesley Cheng <wesley.cheng@oss.qualcomm.com>
To: 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 00:50:53 -0700 [thread overview]
Message-ID: <0bf654f3-51c5-4555-8cdd-dc9d25dd9f78@oss.qualcomm.com> (raw)
In-Reply-To: <25ebe180-a620-4170-92f7-fda6c55a4129@oss.qualcomm.com>
On 8/25/2026 12:08 PM, Wesley Cheng wrote:
>
>
> On 8/25/2026 12:43 AM, Michal Pecio wrote:
>> Hi,
>>
>> On Mon, 24 Aug 2026 19:06:54 -0700, 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
>>
>> FYI it's worse than you think - xhci_ring_to_sgtable() returns wrong
>> data and uses some allocation out of bounds on these systems. Quickly
>> scanning through the patch I haven't noticed any changes there.
>>
>
> Hi Michal,
>
> Thanks for the review.
>
> I had a tidbit that I tested that addressed an OOB condition, but as it
> currently stands, that API should be working properly, if TRB segment size
> == page size. Hence, why I left it out as a change.
>
> The OOB condition I saw was that when 16k pages were used (w/o this
> series), since specified rings can exist at a page offset, that offset
> information is never populated, so we might be mapping the incorrect range.
>
> Regardless, I'll introduce that change in the next revision, since that's
> information that shouldn't be left out.
>
>>> 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.
>>
>> If that's a security or reliability concern, perhaps each sideband
>> instance should create its own DMA pool, as opposed to allocating every
>> ring segment on a separate page?
>>
>
> This is an interesting suggestion. Let me take a look at it more and get
> back to you.
>
Hi Michal,
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.
BTW, I tried my best to see if I could re-use existing ring/segment alloc
apis w/o modifying the arguments, but up to a certain point it was
unavoidable. However, I think code re-use is better than having a, more or
less the same, sideband API variant.
Thanks
Wesley Cheng
> Thanks
> Wesley Cheng
>
>> I suppose each 'xhci_ring' could keep a pointer to its segment pool and
>> things would work for everyone, with very few changes.
>>
>> Regards,
>> Michal
>
next prev parent reply other threads:[~2026-08-26 7:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 2:06 [PATCH 0/2] Add larger page size support for USB audio offload path 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 [this message]
2026-08-26 10:25 ` Michal Pecio
2026-08-26 11:44 ` Mathias Nyman
2026-08-26 19:58 ` Wesley Cheng
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=0bf654f3-51c5-4555-8cdd-dc9d25dd9f78@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=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