From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB2B53B2FD6 for ; Tue, 25 Aug 2026 19:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787684955; cv=none; b=bt+lDn30z7A394I/zc6c7Xnd6p48zhdnK04pq6+iE0ZShG1TkMPjxX5/aVMUEJzBP/PaBkRbkKCCmraPDUd4oMCy9tX6oOvT36/7q5dklTP2OTqawSu0rJHAFfL5xRFcP8szNz8iaoGiQFoX1KzPU3bD2A5pS8OAL+zgei7RGG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787684955; c=relaxed/simple; bh=54fx7/1MhDCKQgMrG6dJOr+lw4T2NnxLn8gzlzkgMq4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=G/qJ8UxCDhiVRr4BvJJXBW7wuCI3s7EcMaMVmT5YImax7Jyt7/FIUPSRLyox9aLJ02wtabXu2tNb0P1/htczHdGRRZ4Kir7yP/ZalLcBNEPSXrruu4d2xgfQOF9V1HNtMHgzDxctnSTYe6wBCUu1hYutcbb5DEWwSzGxnvnmSfs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=el4jWjve; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=A6LjY5ZQ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="el4jWjve"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="A6LjY5ZQ" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67PHh7xl2995586 for ; Tue, 25 Aug 2026 19:09:12 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= QhQeQs6iukOPc54XzBtdmkp7GWu3IZZHouTapaF13WM=; b=el4jWjve8Wz0IOGo i42UC51PHw5jIQtWHHdRgRx4muDCOFCueVj+Zp9SdVpC5hzcSwOYBH0d91JS8VSD 2P7WxkFIoNeqtvxhp/DiHnW7KMhN1IY6vAZDl+aj16qUGT60qxa4vNXIffRw95V6 Z74lhF998N8Oz+MM2wmul2xsVwkCqpo39W+4zatnh/nrDDq2i6LnyzuFvObfHF5v Gs1+fSV9UC4c9Q6yoSCKfaVigoqYaT8By+OaD/LSgnx9nCm/uxNHaUxHor5o/H1F k1ibOpo7tEuUGPCz2umFgWYtUxp2Bk0jPi3H6+NeGMAmoFfETGoXXaGQp15tVD3K mM1oUA== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g9fgr0cru-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 25 Aug 2026 19:09:12 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2cf7dd9fd91so2227325ad.1 for ; Tue, 25 Aug 2026 12:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787684951; x=1788289751; 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=QhQeQs6iukOPc54XzBtdmkp7GWu3IZZHouTapaF13WM=; b=A6LjY5ZQEOaA3chaQ+SP2fRZ7LsVlPqvs9cqEfp2WbEyvB8GhN5J6ssCtVtLBUC6EQ Fg+mQErK8WMD5QXDdIvO7n6WLPNJaoSIbsieR5HeeL2t1AfPfniilzY5hzjA165XPYFn T1PNFl0FbAjeaw7Odt6bClcTDxMMnMh+jJpXOAnLT10nqDhE7qTXPDxf/b8zlNxJ3cBv 5rwOzNT15YIYtJGy2oLA5pAOlJkzsyTeYxotD5HCuq5Tt3C6ZC1LLnrYpdwIr09bFNHQ 7/9IgMg/4Cu4SZWlJrDzsrb7wjp/FdfRukFa0GsOYIEBLxGPkbiDCB2OfZBzF5O1dmZs Lh4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787684951; x=1788289751; 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=QhQeQs6iukOPc54XzBtdmkp7GWu3IZZHouTapaF13WM=; b=N+aPItFyHLkC7CS2KxdF68RTZzs3TCU0o6Ji1P1GatWWMDUtBp0CxMIAPeEzYa7nDX A5CAO6OS2qdN9jojwBCtmi6WbVO/kbtlVn1mv2DAS/gXeZohP3KOzHKue74jOml+iNT8 XhOU6Vxci3AWDfy0xQkxGEuo8BBvQJjsE/0jCqqmqLWLpNqohvv1Jik1iqu06Ukp4AJR dYxB/A68kHhrv0jKRHbLF2i9qqnEsGRdCpNK1tAp/XsMKpAcosvKVUM/K0gYwTSWaNyG K1X4bbqzCUCAoFALKjgqaL+spbk83dFO+JaIeKK2Wz9iJOrRCjzbtC9Cora70koAtBUF JD9A== X-Forwarded-Encrypted: i=1; AHgh+Ro8lqVbYrZfUARlXn8+BqODRPONsCnjJv8MD7ewcblaFCR7EpEta9WcitMF1GQruhCAmwOOnZ4Q2SpcWYA=@vger.kernel.org X-Gm-Message-State: AFuF++kOK+xYwxn2y5VN3HkwnA9m7OcBq/EQi/2fXy7d2UDwtCWEoGB0 /07HEtsR4Ii5ikBSOQha/+95RVNUL3lCsvtFgh7/+E8jT0jV+6ElN3JZAd78OROsyYh2oU2ZyOJ E+6HSN+tqHz0Q0RUyUms1oTf1kRMStVdlUtPfoyLx99Jki0oCbigW6/1msOG3o6JzGBE= X-Gm-Gg: AR+sD1378kmmXD+5kRxx4Oh9ngyoIsGsd+t1rjXENYwlkV+FLJvRMEwLwMM2wxxuMbe SzKuIRondtWh6tyDtptWaVnAP1vxxeLxCiqsxkPwc/ey+nr2rCpwnzd2dol3WeUo/VyGYiLm4sf IuAr4Pa8Zd9RO9WwBJjr19MU3ir9y1n7xt5MZzACBgVF5pZLQGuc8ttWij41J9q+pfYXWmatR3w pjQIMRdkiaGfsUf2UxYp1xzbG5qALcEijsk8pkZnV2T3HkvaLctRL2/DhDR4h5VW9ZLKC0ubEov Vh1Nho8pJN/3y1Hqm6MOVUGN5KYVw1WkZ2O8id6dEiFqvcMp+TLEkV+SdbxPdZHAFcruoATBQpO 6yiWnQ5OasZ3BdF7802tbYbjGgYeAtU3RXRSgJ8ETdqXR8N8= X-Received: by 2002:a05:6a20:20c3:b0:3cd:20e4:2aad with SMTP id adf61e73a8af0-3cf7596a64fmr1339904637.4.1787684951527; Tue, 25 Aug 2026 12:09:11 -0700 (PDT) X-Received: by 2002:a05:6a20:20c3:b0:3cd:20e4:2aad with SMTP id adf61e73a8af0-3cf7596a64fmr1339796637.4.1787684951025; Tue, 25 Aug 2026 12:09:11 -0700 (PDT) Received: from [10.73.194.28] (pat_11.qualcomm.com. [192.35.156.11]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3283d730c57sm1091912eec.12.2026.08.25.12.09.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Aug 2026 12:09:10 -0700 (PDT) Message-ID: Date: Tue, 25 Aug 2026 12:09:09 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] Add larger page size support for USB audio offload path To: Takashi Iwai Cc: Mathias Nyman , Greg Kroah-Hartman , Jaroslav Kysela , Takashi Iwai , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org References: <20260824-16k_offload_v1_b4-v1-0-49a6be60ca30@oss.qualcomm.com> <87o6eqsbgu.wl-tiwai@suse.de> Content-Language: en-US From: Wesley Cheng In-Reply-To: <87o6eqsbgu.wl-tiwai@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: PB3JViqB7_qvm4uC6hVTYTQf81c8xQg3 X-Proofpoint-Spam-Info: AW1haW4tMjYwODI1MDE2MyBTYWx0ZWRfX4BGvqAfGS0mJ GdjbvBHMPUPbppY9fFkBLrvABSorih1nXpL2Oi5W5GtKy0QwzmLyX7KacR5bZCKQeqKWzy+Zv+A b0/d3m65P6HESyoBNtxft+l2jTG1dVk= X-Proofpoint-ORIG-GUID: PB3JViqB7_qvm4uC6hVTYTQf81c8xQg3 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODI1MDE2MyBTYWx0ZWRfXwcask6EdhGVz H1p/xWGZkF1HCNkivYFvPcVN6AGZqjV14INxVJiRjn5xKWBTDc0Xt+F6XfbYMrIVH2MRDIY6cFS FObCazB9vtOUyWHi1g1884UXcN2CrI5GgsezyBHVOxFebDkNLnR3wfnDa2nEjcb6GxF3e9Dhp/B j11DZto8Fjd2qNbcoGi1aUfCSZn9FQElnDbnxyr4VIvnp6SkZEZXFjhRE0Pk6R6rRLF10iT1qK+ 3QJ+/LQsV596KBkk1qfL5clUbrtIiWX1vJMpyNx1FlwBvAHxcgYEth7HvyYtY8GQbN9K9hv0z0V rApPG5IqIaTedpj953gmggh8helJ17uCf4z/+Gs1ywKKu0s0magcMSbyO7nnYGy+81uZmmHIV/o iBZOSYeOqUW+YgQ5CfuTCh47JpFxw7KNypH7tNtbjX/vraSbG1Plr4eb8Wv7BO4Hq5PmrxfjrEu 3ic6qxnOShPaMeAd3sA== X-Authority-Analysis: v=2.4 cv=TvfWQjXh c=1 sm=1 tr=0 ts=6a8de858 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ZdW6uxA9NKXbfdqeeS2OGA==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=5kBUKlsEpMLtOZ44VFUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-25_05,2026-08-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 priorityscore=1501 spamscore=0 malwarescore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608250163 On 8/25/2026 4:09 AM, Takashi Iwai wrote: > On Tue, 25 Aug 2026 04:06:54 +0200, > 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, this series introduces the alignment_req parameter. >> 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. By setting the alignment_req >> beforehand, when allocating the ring segment, it can fulfill the audio DSP >> alignment requirements by allocating DMA-able memory on the fly (based on >> what is being requested) versus fetching it from the segment pool. >> Likewise, keep track of if memory was dynamically allocated to handle the >> free path properly. The function call flow will now look like the >> following: >> >> handle_uaudio_stream_req() >> │ >> ▼ >> enable_audio_stream(subs, ..., pcm_card_num) >> │ >> ├─ xhci_sideband_add_endpoint(sb, data_ep, PAGE_SIZE) >> │ │ alignment_req == PAGE_SIZE >> │ ▼ >> │ sb->alignment_req = alignment_req >> │ >> ├─ snd_usb_endpoint_prepare(chip, data_endpoint) >> │ → xhci_check_bandwidth() → xhci_endpoint_init()) >> │ ▼ >> xhci_endpoint_init(..., ep_index, ...) >> │ if (sideband && sideband->alignment_req) >> │ new_ring = xhci_ring_alloc(xhci, 2, ring_type, max_packet, >> │ sideband->alignment_req, mem_flags) >> │ ▼ >> xhci_ring_alloc(..., alignment_req, ...) >> │ ring->alignment_req = alignment_req >> │ ▼ >> xhci_alloc_segments_for_ring(xhci, ring, flags) >> │ xhci_segment_alloc(xhci, ..., ring->alignment_req, flags) >> │ ▼ >> xhci_segment_alloc(..., alignment_req, flags) >> if (alignment_req > TRB_SEGMENT_SIZE) >> seg->trbs = dma_alloc_coherent(dev, alignment_req, &dma, flags) >> else >> seg->trbs = dma_pool_zalloc(xhci->segment_pool, ...) >> >> 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. The same >> alignment_req parameter is passed, and during xHCI event ring creation, the >> same set of APIs are utilized, so the runtime memory allocation is already >> handled. >> >> 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 >> --- >> Wesley Cheng (2): >> xhci: sideband: support page-aligned ring segment allocation >> ALSA: usb-audio: qcom: request page-aligned xHCI ring buffers > > I guess your first patch alone breaks the build, and this is bad for > bisection. When you change the API, the callers should be addressed > in the same commit altogether in order to keep the stuff working > during the transition. > Hi Takashi, Understood, I will figure out how to adjust these patches so that incremental builds don't break on the next revision. Thanks Wesley Cheng > > thanks, > > Takashi