From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796165853; b=SQMQlNDcJBxCVq9UP2W6Cd8BWJISzMPAi9ANLRepfI3J7FhgEB3HxDXDfMF4KozJ3LSL onPx3bwtzu0Y3BWuQIX2lY5HyP6uns+tcbaNVzIPPp7s9yDMbWGW2BcQ910hLVFCzIIid mNH0pLP5DLfNluZi1ZHVymgpkY4sLp/z9JLAEYlAj3qFOX3gm3LliHjpxF7rdJeOBgRui OcYSaDngc5KOUQPlpXUb3lpzG+9xxKAfQVErgtKSmQxATSOVtl2q3p2vzkPTwexBiZNyM fNYUUSPyXtTQkkTq8kh3ZcCYRGIMh0/uwMHSQpDg4ymobSqxhxEj+3BLgwz1BVB9CJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796165853; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:X-Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-Authority-Analysis: X-Proofpoint-Spam-Info:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=renevH9HUvlR+sYdaAqKFAaZOlHpCzbmy1JnvcM/s3I=; b=F0ISRyCvUDYdT8iRAG0xocO/WnX7t5fz46MDyhtiKB6ieFDdqjoUQYlpIHCp50cW5u6D 9jbCdJO8jWwnu4kzvqCbWjtGzAvv7/8BQH9+pJ8dYBnZQfMyB3iGBSQaG3L2qR5q/DOb6 Sy4ZkB8bLgzK4WIRTedbVoSNsljKi+ylxwuBHUYVLpU5nNl1/NecJnfyUw47INSwAxP7u t3hFm8ALaB4eQ2Pdpcm+ClIZsrkc3KMmoJGRpOBw8E1aYXv5lsmgk49lb139vY+UXQvMS t5diKsQLAmhsPaQpbY/F2sZjVPoGKPDrCf592X+RNvot0/ZaJ32J1hSi4nXEo8Jv8+w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ZxsX+op9; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=YfMAPA2P; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E75A606A31A for ; Tue, 1 Dec 2026 22:57:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4E75A606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=ZxsX+op9; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=YfMAPA2P Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B1Ks4BR1066482 for ; Tue, 1 Dec 2026 22:57:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= renevH9HUvlR+sYdaAqKFAaZOlHpCzbmy1JnvcM/s3I=; b=ZxsX+op9D5x6WCjE b02DrjiY8zLar4x24ypuzYRSTC/3i/jiL6jwMHM076UMZzCdX2Iha87InwamZANS ZdqjsodyFNCMXznDe7dsK0g497V1kbeyKkYtv+DZVBZd7m/N9xdD09LcdK4esKCV 9lFLYP0upSS1ee2/FO/+2dbCqZZaKXd6Cevv18Yse7bKkEODMG08Oy9yYYI9WZRQ I+AFLk8BjuRJQuFDi/cqxBdSqEsfy7DC2IHct1hG/+fiAzGqF3zqN+8dVwC1O2qZ D2mkm0k4YeFcU+JzW9KyY4wRtSNatTUtBr4IHJRj+OEQ3RQXOS1/kU9yuBfh62zy fM8Vhw== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ja5p9gbju-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 22:57:32 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-386ad819860so8686758eec.0 for ; Tue, 01 Dec 2026 14:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796165852; x=1796770652; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=renevH9HUvlR+sYdaAqKFAaZOlHpCzbmy1JnvcM/s3I=; b=YfMAPA2Pn9TMjbHtUR87Ulwd27XsVMcjGx0p7E3RmYtF+PEmhOXFaWjab2z859ni6M nFLhqfE8KXWT+a2zSr68pxIC1J/bsAM15JQ4Kdvw9mGhMzYxLfeYNagJWoTJ5O1msy6L N8j9P1Z32Ewe6VIlGa1OF+HBDwKWc7RM9mm+W7zes86W0QRS2AMSWj6UIqmPvzylbzu3 uQEeTQCKJJ7PehKsC3O2aI3YsejhLa/GlIwHkwe+NLULnVhh1QaMpqa+8BVwU84HtMVz j2hu69hwRR7OlPifftqpMYXgSunD3MTXVjtIKrncKAfLdKjCDzNJZ65OdLJI5IZ5X3O+ 5jDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796165852; x=1796770652; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=renevH9HUvlR+sYdaAqKFAaZOlHpCzbmy1JnvcM/s3I=; b=jWLHuk64oiLJjnlR/3+yLWP9kqDXC2SjILn6z3SbCUaVcsC63dOoLBO461u8mgFVoB 2pfPtGoR6a2rxTTmmJRpW7sq9wFNyY0pPHW/ICB2WAMpKrgom41b/8p+en84vF4QK/4C TR7Rlx+svA/7b5w5nzKqqqHN/OlacTcdwtVc77DDwgPPRpQGzsEYziC0tNJHDH5o2CL8 db3/6LFSHKwS2ow6jQIQPzuY5+lK0fBEMdW6kaXBL3ydgTHfhpSAwdKrDRVSFfCyZ/1S G4JXf7xAa1/F8QQGDBSNha/fa8VQuAaKhsWgHuCzrN1DRKPrNnPzr0OsQuXtbdjcKxqu B4Dw== X-Gm-Message-State: APuU4Z8m+bvms62PhLoHmos/VXOlGkJUdbo7dGlOhHZVygVFEe7RYuXs 04NLQ1kgF1GG8RrGMlNT9yuuYY9d787ayb4YWjIenLMn6S2NLIhaHpCw5jheXoW4+ey5ydL+ikD jyw505QoAwt0VFpWDIjpW/kv9ndMLpRD/cVpjLnyHsUNzrfcKrYIwMDSlscPlrUI= X-Gm-Gg: AZFdTZeEhQBhUn9jJ6JUOaemkzwiStogI1x5IJbt6YdU4cDQtU7SsuucXXE1Yk7plly 6pRumm3/xetB30hPfnyvUJNgfEZx9ouralGKo6iwkYj64BJiSsFTtl1s1P2BR8yc6xep9YOL8R+ d0FpkYvsTMgLhOskNdeAPozmHbzPtaXYcY7NPyvvZTmmN4teeNbtE4kC1hKrWDLOlbTaBFbLUQc mOV7B9jwAzkU1AzRlegjPoMJPsmbr+5S0M6fhNWN23dZY/YL5mWnLpXkbGG82FrgMqLMucKU+jm lndbIiIXhPVFCg4sKiZNh4LbrU5T6t2vEAp/+uylVR9O4y/Z/mpU/4fzf7/5TBUOwAQyR4ewv61 UXkSSsj6i3DDYfp7rGBnUBKDhpEBvDfl+axhjrNcSU2eO9sFGP+JB+J5tzKQ89A7oSmLX8SgsVh 4XpF3xBXmgNJYiA6oaqCs= X-Received: by 2002:a05:7301:18aa:b0:386:a0cc:b97d with SMTP id 5a478bee46e88-386a0ccbd2fmr32654359eec.4.1796165851922; Tue, 01 Dec 2026 14:57:31 -0800 (PST) X-Received: by 2002:a05:7301:18aa:b0:386:a0cc:b97d with SMTP id 5a478bee46e88-386a0ccbd2fmr32654331eec.4.1796165851354; Tue, 01 Dec 2026 14:57:31 -0800 (PST) Received: from [10.73.198.203] (pat_11.qualcomm.com. [192.35.156.11]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386aa203267sm74346295eec.0.2026.12.01.14.57.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 14:57:31 -0800 (PST) Message-ID: <05c4ea5f-a67a-4d0a-a469-dcf4816c4dc4@oss.qualcomm.com> Date: Tue, 1 Dec 2026 14:57:30 -0800 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 0/4] Add larger page size support for USB audio offload path To: Mathias Nyman , Greg Kroah-Hartman , Jaroslav Kysela , Takashi Iwai , Michal Pecio Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, Mathias Nyman References: <20261201-16k_offload_v1_b4-v7-0-ad9ddad2530d@oss.qualcomm.com> Content-Language: en-US From: Wesley Cheng In-Reply-To: <20261201-16k_offload_v1_b4-v7-0-ad9ddad2530d@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=Ft6QbGrq c=1 sm=1 tr=0 ts=6b0f50dc cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ZdW6uxA9NKXbfdqeeS2OGA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=mCSKKvACUr6GVw8vpA8A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA5MSBTYWx0ZWRfX7KUoBNSJRnOk BqDiV/a5ndk3Xg0X1A3GN9Uk9xR+h30xqkCf1QA2mLJd8BmTJSMVtWYkC6zNJsgXqkSVdb1Ag8k XMSlItn2rCLdTd5BuJfXTKk1X0RvNtI= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA5MSBTYWx0ZWRfX+V5rR/GCZ5B/ Y9EnZvnHKgqKPOhvfq6LVvRlXYz2dZPOoGISsALLyGMJd8rTx9iVmJQDnyY2uxcop3UquJT3PJX K5suODQf2UIHJN8GIruXRgFyaxOz2NJN4Iof2/RYBVblnUame2KWO7zoWg7jUjqVFxUozUEhCCV mGwAelrdclzv32v4rl4fGMFUaWGZlhNYquqwj8+UoFaMalf2jzfrmuopPr2gahXKuLiijQds4FW nHKoSM4BzfaxF+rpYY0jUL/4hYG2W6se2Mmoiz7gxQBHo+WxvcSvKP468Qo9BC2NtpTDQe9QLfp LuQn+w2OowpYYs9Pz5BE7mwfcRiJsC2YZb7lZRmLPl1oHT1oo4QSb44D1rVlcb5r5NfynoMbCwj DX5ClsPkohloyJstN5owU2kjkeKsZoj7TR7JNGMB9thRgkBd11tTKxU1URmpT1SSn388Ifb4Rk6 1xp7PYzAmuuBXXZvOKA== X-Proofpoint-ORIG-GUID: X4f7zQmL0G947a0D2XVNuQ0cqwdBfZSL X-Proofpoint-GUID: X4f7zQmL0G947a0D2XVNuQ0cqwdBfZSL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_04,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 clxscore=1015 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010091 On 12/1/2026 2:08 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() > > Similar logic is added for the secondary interrupter path as well. The USB > offload class driver calls xhci_sideband_create_interrupter(), which will > be responsible for allocating the secondary event ring. > > xHCI core remains responsible for freeing these rings, once the endpoint > has been dropped or the slot disabled. This also covers disconnecting the > USB audio device while audio offload is active: usb_set_interface() > returns early as the interface is unregistering, and the rings are freed > later, when USB core drops the device's endpoints. As xhci_free_dev() > frees the virt device with interrupts disabled, where dma_free_coherent() > can't be called, those rings are freed after xhci->lock is released. > > This was confirmed to work on the SM8350 MTP platform, with the > CONFIG_ARM64_16K_PAGES config enabled, alongside tinyaudio binaries: > > tinymix -D 0 set 513 1 (Enables USB_RX multimedia#1 path) > tinyplay -D 0 -d 0.... (Routes PCM data to ASoC platform sound card) > > Signed-off-by: Wesley Cheng > --- > Changes in v7: Sorry please ignore this version. I had some artifacts in my workspace that carried over. I apologize... resent v8. Thanks Wesley Cheng