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=3wOzQg40E/FuUcJcQ7TGl7ENxuwIYnA0Z0GgxL5N/o558BR6QyLKKrUl2xgMa/ctw43q 58yMpsxIbrmnOJCWRnCEnNRtD3CamxTXYtXhlaSWleftyM2INJWvuPBP69SRQb1K3BeMb 31tLKGwoBU5CvCVy6D6aqrd4k7rDSPsNw251nW4rpOWJmxInLTgpwft3L4Eglby1J+iTg k75rKnDvNqJDfzk4vSFk6L66p2i/cVJn2wmKA1EGUOoHR07M47fU7P1VOg0mq6RZFx/JE xCaJk7ApZyEfoQPVUWTTV2+2phD6TnYCpbtGpuEh6GmfHjJ8JmgRqy91HEVC96WQA6w== 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-Forwarded-Encrypted: 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-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=renevH9HUvlR+sYdaAqKFAaZOlHpCzbmy1JnvcM/s3I=; b=NZ7GBt6M+ACOY1hWHa+zYMzZSHJCwdE3NNwqJX/5cEqZuj2fHuoAWoKru7MtaH7kxoKx tYvxQ5V3KdE2wjl5U44/iFA45m5zty2K4JHVbjLUjmEZ9oRLXwcy80z3YTXdcw/xLvCHn uVAPtNqGC0TnRrRA8s+uz3JD8w4gTb1E8Nc5U3gUPSf3ADb3EUcuvA5iNYa4VAD/5FmP7 iszdh03wPjY9gD1JdMmTOwEOsYZT5vehaANqpYAqQKtbZ+giNv95ZAux4+agNk2mfgvrQ ZKitGN2ieqiD4sF+5nAJnaq2M0UFarHTTDczkxdTD6Vwm99hFqckdMBIm2jJATm2q5A== 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 6E54D606A320 for ; Tue, 1 Dec 2026 22:57:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6E54D606A320 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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B1J0quO2001224 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-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ja3aj0xhx-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-f200.google.com with SMTP id 5a478bee46e88-386b8624cf7so367864eec.1 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=jQcn+dYPHDaF4SL6inhLD25lt+BKYn7FbS3uQ6IpxA5zlf9Sc1xsX4WZhQeUUiA3ty UBCSb77BqTRnvEnUnXwwxBUJo5tdkLYQrMTi7rF102F8bYXG1p6pITtiIJdVnmcExCsN V1Ri4kPwoeNhtn1BxvTKSN0r+oI/PFzk3aS9tzwXPVcPdl3RnrxTM9k9iuD3STs/169f qmsVHdYYO0fmqiah0ddQQ41rvvutncPBL6MVEI9pXHmFWmt32CLplK54Ha0k0+Zq/vDk SyxNrNofLwF0lhNnTMXD76z+mDvknG9NKp9IU5l3aVBDEBoqSEEw+P5bDxqE6UDg9aVS YslA== X-Forwarded-Encrypted: i=1; AL+hErG3QMuL9TX6meF+PmxNY70mN1K+kiZeaKPqxcR99jNkgJYsOQ5PRJ/zpWpGqq4sg3mudyYmkHz3TnI++H8=@vger.kernel.org X-Gm-Message-State: APuU4Z9Obms2SFc7m+IdkXwSIwTvCZHCO5i6OJRKAa+8LSKx23W2jX+s wp4edUf+9EYBLeHAyqAigcUdImpoS4imPS6ByA/q4KJXOks/wifzvlnUEiNFAmfpi8K/n/mWktN Uh8ChHy/9Dl0y4KmcLYvmlKxsluFS9lOCUpgXBtK1pEiUFKgukBauoLcWz3A9uFlmhCs= X-Gm-Gg: AZFdTZcjpuNJUUbA0a/11kQEOSi/s4kP4UnUqCnfjIiIPzL2s/hmoKQzhZRrPyXw6Qr LDNtXeTnlHp1+ZP7Iz8G3EpVXaqFyMQWNqewObf3opw+EYLpmyjMFC85Ue3Mug2h/KileB/mKO4 Sr1P0tLYyUvyhpgphuPMXjFZJG0es1lCkLKfOzWCjaibPeDPhmB+diInVnmU3dx5i07yI9P+NBn E2SdHDS8pwlXWyAQUsemF/cIWqhTFdIprs6K+yGDGQfrjyyPu7nTuZwJXWy3pR3oKTmMPZ0bj+F JFv+BzVoyqHqRM4qXsCOfheW7bvBAKKGad18MVBelaj2Eez46YrzOMIWXe75cr4JmsrRJLmBLBE P8zS6u7LJsbahAK1a/86sO/v6jbe4d0mqMhItdsILLROmsCIPo0r9tZf+NixvMmnJlzt7+wOLhC L+fYJyzFuWPmtoQnEhBNk= X-Received: by 2002:a05:7301:18aa:b0:386:a0cc:b97d with SMTP id 5a478bee46e88-386a0ccbd2fmr32654358eec.4.1796165851918; 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-kernel@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=Y7xtIReN c=1 sm=1 tr=0 ts=6b0f50dc cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ZdW6uxA9NKXbfdqeeS2OGA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=mCSKKvACUr6GVw8vpA8A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-GUID: 5tA9HI4VuOFYk0bbpPmF6FVqoyBrI1wf X-Proofpoint-ORIG-GUID: 5tA9HI4VuOFYk0bbpPmF6FVqoyBrI1wf X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA5MSBTYWx0ZWRfX9nL0E6hGQEFY fbMAhwlx4lMNAwbd9xlwZgVklLpllr0Oz21WE790JXg7J/nVprMMYN75rKT2mtrm5DEBGEMfm6N RL5SuxnUDj/bQoC9M69RF7+WZz9fuYM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA5MSBTYWx0ZWRfXyCnQijPbvAjZ cArngYf4iDkcF2rKNiIdTEgaASjwsMit1VFa4gC0o//Cl+jgbpad1DCgGZQdz9olT/LpDZ61eku dKhTLIUgpnQIjJcbEothWRLAZgkpL326WQZ5wDg7o4TgOQcrhmYMx9oFdllVDgRWyF4aO4nufvQ Rvu+YrZUj/ZFt43XAiliPk7fGy1Y6MmwlDFcUwjIw0hq9c/fW+PbAjJZW0FccxxME+5imDUEzTS aGxQEg5FRAmB9go3hG6IfIvj0BZAqonS57Am9wO6Dy8WuvjOJAviB7eQ6RrkOxGnX47L0C+LqR4 lnf+SQ6tQY9iMXdUpV9nG1gGSxrtVDvtefFyx0sQk7WeytNjQ6NkjzshiP6biNauV+wx2YrNiPV ZhbWdtQWBS4pVHqGHib44ZbxzKFvuQE814zQTtCHRoW/TLneuC6FjHhrp1S7Ui9XadQtYT1Zkys JSFtd0qZcsqQFCYVuNg== 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 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 spamscore=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 bulkscore=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