Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3287969pxb; Sun, 29 Aug 2021 20:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFwxLbT9wVneHQ7RYO9Mlw6p5GZrfcXAk8Cs59NJJRpeDxxl71sGMazwS0wi6xQ6meJcfg X-Received: by 2002:a05:6402:505:: with SMTP id m5mr21699340edv.217.1630295477894; Sun, 29 Aug 2021 20:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630295477; cv=none; d=google.com; s=arc-20160816; b=gxpkX+IDLlhDF8vzYzTGLJKwSzdPTvFKiWxlv+sLgukZ8QeTawXtDO6lh2t41tVXTE W5qP9RIQtJkP7myxwBDpZbKl/gF5iQeYNdM9K1RbzfQqeRiBPWrX0mfcQWX9Knk7Yy9F 0G2SiWO6PkgbXFF16UzNdkGm2f03CcmAqaFstS5Ix4yzpshUOnyWeWK3p0EZcprgolkx z8nZB4NULy1iTUdDi+UzKiH4W+WyYVJ6e23XjsdRIGEz2QtApqSb6hrVZJjWeSxvtazU FmCV3I4TS6jFpAgM1BUWMS5yt2wTK2V9auowRo/I8fPwh+kyux79UzzFwHqW88U1VtoO XIKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Xd5yJwKt1hvq4WFoSQExGBW6PX7FM9F2aTtlw2PPNgY=; b=rusFAoUPCE+OVUDKjsVzp9+flhpwDa2EJaCoxuYRU96lIxdm6NCHgPGLRuGsQpsX9h UkekZCUx7ghX6NdolSehViglEo7uGwpMFVwIwRLCiSA+ctjsZsJwcI7s+t2b7ZERHM6q d25XAW1lvkHVJSWYRN5ADOfvDB88oM0uYESahT7y0MAnAXZNoLAnMkYQ+In5OG3zvc91 fSYrI6BuSdnqTt4/vZ1bq++OkuhRjzGoh6UCpB8v5slCC5Ug71dU+8nl9vKzLgbMLPGE rLU2cEQ31vI8O0PgeCsjQOVAeAsLIK/FQnl5BdClgomtn+ZN30uvBee7FhPl9cL1bHf9 zTCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ODVUQWj1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb5si13882813ejc.310.2021.08.29.20.50.54; Sun, 29 Aug 2021 20:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ODVUQWj1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbhH3Du3 (ORCPT + 99 others); Sun, 29 Aug 2021 23:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbhH3Du2 (ORCPT ); Sun, 29 Aug 2021 23:50:28 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C25C061756 for ; Sun, 29 Aug 2021 20:49:35 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id fs6so8539168pjb.4 for ; Sun, 29 Aug 2021 20:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Xd5yJwKt1hvq4WFoSQExGBW6PX7FM9F2aTtlw2PPNgY=; b=ODVUQWj14e/o8PyewpgAxwqPLPtNZxpcvYC7MQqgubN1OZCRQtPlikZPOuHN8zA+IJ AmMTMTtAN7CuB0VSOA/tB8UnW3E3LRwBSCrC4hUcaQenqGasINce2kIBeYcVbtSdJ9cu 1Q8b8N+K08CnfXfINsRxo+rpJvIGJR1Y7DLjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Xd5yJwKt1hvq4WFoSQExGBW6PX7FM9F2aTtlw2PPNgY=; b=C5rm+Dn4anDfJROeotcQKmnAbkByHRwNVAFHLO8qWk1yrHd0mJPcoLjKO5Mc3Z51IY XhSDzV5jKSgeukqRbjkH/Wi4ojdLEFaKmMSgbbami6Mj/RcEaZQU+iB2JN1nIgoA59EX PAs8PUtbHwm6HjU7hBGj3WPHbUj5dOKKLQKJxFuX27ixWrWiG6l/pwWCKUk19g3k70M5 oeabH9RccB//KMCq8uOcb8OPm7D+Ek9BLrhvUq5lhWg4wyuRXvz7mEYhpColN8Ts21+t yabG7IQZkM2IOPO05tDbqAPzHEB1rq4ugbiFNHfuKFaMYCjdPwoAcAvsGHaHTp5VERW9 C3eA== X-Gm-Message-State: AOAM533ubbBdwsilic8DYAjb6s8wPph84ATUYTeot/3Q3tRfbKz+3Dg+ t0EIl0KV8G+dkT3bmnQ3tUiJtIwlSKKSsn7eH/vuHA== X-Received: by 2002:a17:902:8c83:b029:129:17e5:a1cc with SMTP id t3-20020a1709028c83b029012917e5a1ccmr19994569plo.49.1630295374896; Sun, 29 Aug 2021 20:49:34 -0700 (PDT) MIME-Version: 1.0 References: <20210826025144.51992-1-chunfeng.yun@mediatek.com> <20210826025144.51992-3-chunfeng.yun@mediatek.com> <72ee7a203d8a49e6e43a954b45133470ee6d5c16.camel@mediatek.com> <18cb18d7d0ea4a3bb46921aca88c53646f1b3764.camel@mediatek.com> In-Reply-To: <18cb18d7d0ea4a3bb46921aca88c53646f1b3764.camel@mediatek.com> From: Ikjoon Jang Date: Mon, 30 Aug 2021 11:49:24 +0800 Message-ID: Subject: Re: [PATCH next v2 3/6] usb: xhci-mtk: update fs bus bandwidth by bw_budget_table To: =?UTF-8?B?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= Cc: "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "linux-usb@vger.kernel.org" , =?UTF-8?B?WWFxaWkgV3UgKOatpuS6muWlhyk=?= , "mathias.nyman@intel.com" , =?UTF-8?B?RWRkaWUgSHVuZyAo5rSq5q2j6ZGrKQ==?= , "linux-arm-kernel@lists.infradead.org" , "gregkh@linuxfoundation.org" , "matthias.bgg@gmail.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 5:49 PM Chunfeng Yun (=E4=BA=91=E6=98=A5=E5=B3=B0) wrote: > > On Fri, 2021-08-27 at 17:14 +0800, Ikjoon Jang wrote: > > On Fri, Aug 27, 2021 at 2:49 PM Chunfeng Yun (=E4=BA=91=E6=98=A5=E5=B3= =B0) > > wrote: > > > > > > On Thu, 2021-08-26 at 19:54 +0800, Ikjoon Jang wrote: > > > > Hi Chunfeng, > > > > > > > > On Thu, Aug 26, 2021 at 10:52 AM Chunfeng Yun < > > > > chunfeng.yun@mediatek.com> wrote: > > > > > > > > > > Use @bw_budget_table[] to update fs bus bandwidth due to > > > > > not all microframes consume @bw_cost_per_microframe, see > > > > > setup_sch_info(). > > > > > > > > > > Signed-off-by: Chunfeng Yun > > > > > --- > > > > > v2: new patch, move from another series > > > > > --- > > > > > drivers/usb/host/xhci-mtk-sch.c | 17 +++++++---------- > > > > > 1 file changed, 7 insertions(+), 10 deletions(-) > > > > > > > > > > diff --git a/drivers/usb/host/xhci-mtk-sch.c > > > > > b/drivers/usb/host/xhci-mtk-sch.c > > > > > index cffcaf4dfa9f..83abd28269ca 100644 > > > > > --- a/drivers/usb/host/xhci-mtk-sch.c > > > > > +++ b/drivers/usb/host/xhci-mtk-sch.c > > > > > @@ -458,8 +458,8 @@ static int check_fs_bus_bw(struct > > > > > mu3h_sch_ep_info *sch_ep, int offset) > > > > > * Compared with hs bus, no matter what ep > > > > > type, > > > > > * the hub will always delay one uframe to send > > > > > data > > > > > */ > > > > > - for (j =3D 0; j < sch_ep->cs_count; j++) { > > > > > - tmp =3D tt->fs_bus_bw[base + j] + sch_ep- > > > > > > bw_cost_per_microframe; > > > > > > > > > > + for (j =3D 0; j < sch_ep->num_budget_microframes; > > > > > j++) { > > > > > + tmp =3D tt->fs_bus_bw[base + j] + sch_ep- > > > > > > bw_budget_table[j]; > > > > > > > > I'm worrying about this case with two endpoints, > > > > * EP1OUT: isochronous, maxpacket=3D192: bw_budget_table[] =3D { 188= , > > > > 188, > > > > 0, ... } > > > > * EP2IN: interrupt, maxpacket=3D64: bw_budget_table[] =3D { 0, 0, 6= 4, > > > > 64, > > > > ... } > > > > (Is this correct bw_budget_table contents for those eps?) > > > > > > Yes, ep1out isoc use two uframe, ep2in intr use a extra cs; > > > > > > > > I'm not sure if it's okay for those two endpoints to be allocated > > > > on the same u-frame slot. > > > > Can you please check if this is okay for xhci-mtk? > > > > > > Already test it this afternoon, can transfer data rightly on our > > > dvt > > > env. > > > > > > > (I feel like I already asked the same questions many times.) > > > > > > Yes, as said before, prefer to use bw_budget_table[], if there is > > > issue, we can fix it by building this table. > > > > So do you mean such an allocation shouldn't be a problem by IP > > design? > Yes, at least on our dvt platform Did you check that your side also has a similar allocation (SSPLIT-all sits between SSPLIT-start ~ -end for another ep)? My audio headset doesn't work properly with this scheme. > > > > > This patch starts to allow such an allocation (again). > > But i remember my earlier tests showed that when those two eps > > in the above example are allocated on the same u-frame slot, > > xhci-mtk puts "SSPLIT for EP2" between > > "SSPLIT-start and SSPLIT-end for EP1OUT transaction", > > which is a spec violation. > > Which section in usb2.0 spec? I think that's just a basic rule - if software wants to send 192 bytes through a full-speed bus, HC should send OUT/DATA 192 bytes continuously without inserting any other packets during that 192 bytes. and usb2 11.14.2 mentions that TT has separated Start-Split and Complete-Split buffers but not tracked each transaction per endpoint basis. > > > Hub will generate bit stuffing errors on the > > full-speed bus. > which platform? I remember it was mt8173. And for bit stuffing errors I mentioned in the earlier mail. when I read the spec again, 11.21 mentions that bit stuffing error is generated when _a microframe_ should be passed without corresponding SSPLIT-mid/end. So this is not the case and also I'm not sure what will happen on the full-speed bus, sorry. In my case what I can be sure of is that the audio output was broken with those allotments. What is the xhci-mtk's policy when there are more than two EPs marked as the same u-frame offset like in the above example? > > > > > > > > > > > Thanks > > > > > > > > > > > > > if (tmp > FS_PAYLOAD_MAX) > > > > > return -ESCH_BW_OVERFLOW; > > > > > } > > > > > @@ -534,21 +534,18 @@ static void update_sch_tt(struct > > > > > mu3h_sch_ep_info *sch_ep, bool used) > > > > > { > > > > > struct mu3h_sch_tt *tt =3D sch_ep->sch_tt; > > > > > u32 base, num_esit; > > > > > - int bw_updated; > > > > > int i, j; > > > > > > > > > > num_esit =3D XHCI_MTK_MAX_ESIT / sch_ep->esit; > > > > > > > > > > - if (used) > > > > > - bw_updated =3D sch_ep->bw_cost_per_microframe; > > > > > - else > > > > > - bw_updated =3D -sch_ep->bw_cost_per_microframe; > > > > > - > > > > > for (i =3D 0; i < num_esit; i++) { > > > > > base =3D sch_ep->offset + i * sch_ep->esit; > > > > > > > > > > - for (j =3D 0; j < sch_ep->cs_count; j++) > > > > > - tt->fs_bus_bw[base + j] +=3D bw_updated; > > > > > + for (j =3D 0; j < sch_ep->num_budget_microframes; > > > > > j++) > > > > > + if (used) > > > > > + tt->fs_bus_bw[base + j] +=3D > > > > > sch_ep- > > > > > > bw_budget_table[j]; > > > > > > > > > > + else > > > > > + tt->fs_bus_bw[base + j] -=3D > > > > > sch_ep- > > > > > > bw_budget_table[j]; > > > > > > > > > > } > > > > > > > > > > if (used) > > > > > -- > > > > > 2.18.0 > > > > >