Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6326297rwr; Mon, 24 Apr 2023 18:23:35 -0700 (PDT) X-Google-Smtp-Source: AKy350bVG904EbcKfJHDGwRYM4pUQn8ELzVHLtEEG5FKw5Jv1ipVa5gDjMPyGc3IrKd0SrV89aaV X-Received: by 2002:a05:6a20:7da7:b0:f2:eb8b:779e with SMTP id v39-20020a056a207da700b000f2eb8b779emr12451476pzj.41.1682385814745; Mon, 24 Apr 2023 18:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682385814; cv=none; d=google.com; s=arc-20160816; b=EWqy712Zn8Xs/w8tqM5dIQK2z4m2E7zHq/a+ATdpnOjQVmCd+6EUE8DfyoUebphWIX B5f2V8wYmK9fMcCM2532FoFSezztmAxy/TrfApKutK89YnLtj50TFnquPs0KBV3OEpek OhFg57eIMvM8xG3y7PUMQ5J7YwnxTbFTqi0Vt6NVIQuSZCS7vS7GIGTqwTrtGRzgJChG Q0UhWAaAl2pCJUZ9IhdHRDWEYPABdU/AuNZem4lHMi4bsDlsujFbmyUYcFrGczOg5qMy hJTWB4lMjMtH9eNvJtesDH7wMpurEfy4gyoeykKfG0PpunzUMYA6FqYda6OHy8tUq9v4 CZ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=LERFdXcjVsFCSOZUAfrxaZzzvQVZ0km1XAFRXQ+kCQ0=; b=bLlJh44rINCY1dzag87PQlL0h0SBAXFa5EQJNM7rhr9LA/lOgpsKpM9RDZMqsPevva wSi9VV/se61guSn7KYvTqRqN5M0tZc80xFWSaYEeZpqU1ZugsXTOQ1aPs1s+sfWI3L0U mFugvNto+5LAs1G/xonMifzVwqadPZQQo4ZE+oJUU8HgYnKyMcX99SogG50MbZgM/8ri h4lsWnOJDWhI6OUoYJyN5GlvyvXqVL2ahKP7UucovdTUGPKW/kG2Q8Uc8lXCEecd6Ca7 mUxvsrEgiXRWe3TzKxNhEPAz0/X/2zNz+/kkurflBfpESu1zWfgwK1VbfVyUQAlJRfFI mOzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AnQnZy3x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r132-20020a632b8a000000b005285dfe5ba3si1809187pgr.29.2023.04.24.18.23.21; Mon, 24 Apr 2023 18:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AnQnZy3x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233020AbjDYBSH (ORCPT + 99 others); Mon, 24 Apr 2023 21:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbjDYBSE (ORCPT ); Mon, 24 Apr 2023 21:18:04 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 877F64ED9; Mon, 24 Apr 2023 18:18:03 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33P17Zh9018261; Tue, 25 Apr 2023 01:17:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : from : to : cc : references : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=LERFdXcjVsFCSOZUAfrxaZzzvQVZ0km1XAFRXQ+kCQ0=; b=AnQnZy3xIwN8Ianz46csf3zMDVKU8wO+r3Me9Iho4hjOJ7WU0yzAI0DL6SxiY3tkfPkC cSni4Thg1hZtO3V6AulkxnGBuTyfp9gfWLX0z2JbtKNfbqb9+Eq3i2nGYSXGtipai4TA +E+R0SBrg5NDaOOaQpZ00KYo6QdIwmh0MKCTprKlgi0lQOVQYfYVBla76inxLi7OCEgy gH1HK1Myoo4wx2HUkwrfefMeDFZPtkGSHWSlU3mLkv7OUvB0p+5W8lU9AMvAeNQHlOrW K5i/wyGWpy2Ae796fmE8YHKycFvo2PO/bTfxwf0ReMoro6n32zSPK8S7FTcHQJgnHdpB LQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q5ndpt2vj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Apr 2023 01:17:30 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33P1HTbl012769 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Apr 2023 01:17:29 GMT Received: from [10.110.17.95] (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 24 Apr 2023 18:17:26 -0700 Message-ID: <579b6a18-624d-8071-e326-fc69028d3fc5@quicinc.com> Date: Mon, 24 Apr 2023 18:17:25 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v3 01/28] xhci: Add support to allocate several interrupters Content-Language: en-US From: Wesley Cheng To: Mathias Nyman , , , , , , , , , , , , , CC: , , , , , , References: <20230308235751.495-1-quic_wcheng@quicinc.com> <20230308235751.495-2-quic_wcheng@quicinc.com> <6024f762-6085-10cd-e73a-9031722b2334@quicinc.com> In-Reply-To: <6024f762-6085-10cd-e73a-9031722b2334@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: z0dwS-2-H847QR2W6V6IV0XIC_kqxSbN X-Proofpoint-ORIG-GUID: z0dwS-2-H847QR2W6V6IV0XIC_kqxSbN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-25_01,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 impostorscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304250008 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathias, On 3/13/2023 1:08 PM, Wesley Cheng wrote: > Hi Mathias, > > On 3/10/2023 7:07 AM, Mathias Nyman wrote: >> On 9.3.2023 1.57, Wesley Cheng wrote: >>> From: Mathias Nyman >>> >>> Introduce xHCI APIs to allow for clients to allocate and free >>> interrupters.  This allocates an array of interrupters, which is >>> based on >>> the max_interrupters parameter.  The primary interrupter is set as the >>> first entry in the array, and secondary interrupters following after. >>> >> >> I'm thinking about changing this offloading xHCI API >> xhci should be aware and keep track of which devices and endpoints that >> are offloaded to avoid device getting offloaded twice, avoid xhci driver >> from queuing anything itself for these, and act properly if the offloaded >> device or entire host is removed. >> >> So first thing audio side would need to do do is register/create an >> offload entry for the device using the API: >> >> struct xhci_sideband *xhci_sideband_register(struct usb_device *udev) >> >> (xHCI specs calls offload sideband) >> Then endpoints and interrupters can be added and removed from this >> offload entry >> >> I have some early thoughts written as non-compiling code in: >> >> git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git >> feature_interrupters >> https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=feature_interrupters >> >> >> Let me know what you think about this. >> > > The concept/framework you built looks good to me.  Makes sense to have > XHCI better maintain the offloading users.  One thing I would request is > to move xhci-sideband.h to the include directory since the class driver > levels would need to be able to reference the structure and APIs you've > exposed. > > I have yet to try it with our implementation, but I'll work on plugging > it in and fix any issues I see along the way. Sorry for the late reply on some of the efforts on adding your new xhci-sideband driver. I saw your comments with respect to building the SG table for rings with multiple segments, ie stream xfer rings. I had tried some things to achieve the page links, but after reviewing some of the Linux memory APIs, I'm not sure we can achieve it. This is because we're not simply relying on the direct DMA ops here to build the SG table. In the IOMMU mapped cases, it calls in iommu_dma_get_sgtable(), which has some convoluted logic to build the sgt. Instead of allocating one sgt with multiple sgls (based on # of ring segments), would it make sense to just build multiple sgts for each ring segment? The vendor class driver could still fetch the required memory information to translate each sgt to a physical address and ring segment linking can happen within the external DSP if it supports it. Thanks Wesley Cheng