Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp47873pxb; Thu, 7 Jan 2021 19:00:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiefI/KWd5obQT3vOIgsgQYznKjQJHKfrpUXhvuk1KvhCWb30J7JuoZ1+vEQBxsB+3GzFW X-Received: by 2002:a17:906:6a8a:: with SMTP id p10mr1200355ejr.169.1610074828778; Thu, 07 Jan 2021 19:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610074828; cv=none; d=google.com; s=arc-20160816; b=BIOQA3MDIB3baqCLc2U+PNyqcYk4AuvjtLXYNSqhXvzrmnSyo/9yqpg3AlbzcT+2g4 SyXbgh6No1YxAyP8vgjl/mqjXPUSFktmr/8TO92emidZIP1X2DnMaT+ilwKV0N83jsWo /R5RV38EvcoUfEwG9hc9BS5Fa8T8FkcvEiptyxktiKZoh5RSJNVZ9TWj+Vn8mDtZoel6 V3PCfPGErGHZ69jn177Tpl7beWgMvd+qh6aOTXqBCyx+/Ts9UIUg0u8H+3hDYpbxOIux 6XSUnbp7Vok5xaCuRP0mpNfuMk8ryGhwVgvxezFJ6UqKzhHiUWIgZ/IXT/bAM8xe0ktE 1MOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3O9zuZkl9ZCDWe21i1b+VXFMIgQt5YzM+o0I5kD2q18=; b=rKtTBpUI0VBX+yGYW18P0WssUGWDGq/mRTDOtSpRCjj84goWotkJ3MsJmirJaAjajd kG0R5Fl+aBaZIS+UNeUCSAGDVtN1hq/X9nhIPGye2Zg4J4/Ck2ygOGyrSggEwhKbkj83 yNIkF5NmwBaJ7YXEyYtOGhUYFuueF+g/dRDT3Yk/U2d99qZkm0gjBP983qu7yi3gwkxZ ZezSDiOZlNTlIZZetdocixRFASoL8+krRiYgsgezEsOj0FT02PT0Vzf3CpxmZH7GvC84 M8TB7tWq6X0nYxlkb894HPJMIpeGl7/w+wJxX7KXu9vdm+Jsbstqaaj1jKLw9ftquy2+ yO2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EsLZpaTi; 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 ks23si2996737ejb.424.2021.01.07.19.00.04; Thu, 07 Jan 2021 19:00:28 -0800 (PST) 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=EsLZpaTi; 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 S1726358AbhAHC5S (ORCPT + 99 others); Thu, 7 Jan 2021 21:57:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726474AbhAHC5S (ORCPT ); Thu, 7 Jan 2021 21:57:18 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464D8C0612F5 for ; Thu, 7 Jan 2021 18:56:38 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id u4so3647740pjn.4 for ; Thu, 07 Jan 2021 18:56:38 -0800 (PST) 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; bh=3O9zuZkl9ZCDWe21i1b+VXFMIgQt5YzM+o0I5kD2q18=; b=EsLZpaTiHt45R+RX9vSof5hFiKU/thtsi7O0RCTnt7lezGkxOIc+1P6/BWbTv9yESI p8CTkQQLqtCqTaS8bEbkrsgrOkCPgzXnm3odm7+DBejXM4P1aP388fNOcOrFZZMUuiYH eiJqFXqS2CE+gC5m/PJv6Yjwm0TbnubxcYJ2U= 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; bh=3O9zuZkl9ZCDWe21i1b+VXFMIgQt5YzM+o0I5kD2q18=; b=Bj+zclVRLrVtTXiQASkQjshNWSYWmXR6pZJhQk+ulfPwMqxWGDbOepB7n/If2NuhrH 1eCfwfv/SSTa6A1nYkFLmV1yR12V0OrdAAg3+CZ6agkj9Mzv3IMZRq/il+/C7ZQZgUxC 07vbLzs20kuc1uercq657AXqbfXwcFnSpva/w4EDDdB0oafif0s2inikLM9SX81vonm5 k+yaf3VBTHnyVFr6gYUEtXQtVUcWPHSXEbpCqPKF/tRcul2u9f1K5pRsjgAeOTSijGxk mDykscro8iQaT8yZwWH0LNl7HSi3oi7+rD9ZXDaSCoYZKDAqgivFpJPoq0TFhQZSKKL5 FTqQ== X-Gm-Message-State: AOAM5339EHeSKoI0IQIcDi6Xld84JiDcNnOeX00XcmM2EKLRVmoXthGj Xgk8q/efQCravyCS1Jmt5Ic8PlOGV4DmK8Rn48VwLg== X-Received: by 2002:a17:90a:2e83:: with SMTP id r3mr1457895pjd.112.1610074597749; Thu, 07 Jan 2021 18:56:37 -0800 (PST) MIME-Version: 1.0 References: <20201229142406.v5.1.Id0d31b5f3ddf5e734d2ab11161ac5821921b1e1e@changeid> <2aea44f0-85e7-fd55-2c35-c1d994f20e03@linux.intel.com> In-Reply-To: <2aea44f0-85e7-fd55-2c35-c1d994f20e03@linux.intel.com> From: Ikjoon Jang Date: Fri, 8 Jan 2021 10:56:26 +0800 Message-ID: Subject: Re: [PATCH v5] usb: xhci-mtk: fix unreleased bandwidth data To: Mathias Nyman Cc: "moderated list:ARM/Mediatek SoC support" , linux-usb@vger.kernel.org, Chunfeng Yun , Tianping Fang , Zhanyong Wang , Greg Kroah-Hartman , Mathias Nyman , Matthias Brugger , "moderated list:ARM/Mediatek SoC support" , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 7, 2021 at 7:07 PM Mathias Nyman wrote: > > On 29.12.2020 8.24, Ikjoon Jang wrote: > > xhci-mtk has hooks on add_endpoint() and drop_endpoint() from xhci > > to handle its own sw bandwidth managements and stores bandwidth data > > into internal table every time add_endpoint() is called, > > so when bandwidth allocation fails at one endpoint, all earlier > > allocation from the same interface could still remain at the table. > > > > This patch adds two more hooks from check_bandwidth() and > > reset_bandwidth(), and make mtk-xhci to releases all failed endpoints > > from reset_bandwidth(). > > > > Fixes: 08e469de87a2 ("usb: xhci-mtk: supports bandwidth scheduling with multi-TT") > > Signed-off-by: Ikjoon Jang > > > > ... > > > > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > > index d4a8d0efbbc4..e1fcd3cf723f 100644 > > --- a/drivers/usb/host/xhci.c > > +++ b/drivers/usb/host/xhci.c > > @@ -2882,6 +2882,12 @@ static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) > > xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); > > virt_dev = xhci->devs[udev->slot_id]; > > > > + if (xhci->quirks & XHCI_MTK_HOST) { > > + ret = xhci_mtk_check_bandwidth(hcd, udev); > > + if (ret < 0) > > + return ret; > > + } > > + > > Just noticed that XHCI_MTK_HOST quirk is only set in xhci-mtk.c. > xhci-mtk.c calls xhci_init_driver(..., xhci_mtk_overrides) with a .reset override function. > > why not add override functions for .check_bandwidth and .reset_bandwidth to xhci_mtk_overrides instead? > > Another patch to add similar overrides for .add_endpoint and .drop_endpoint should probably be > done so that we can get rid of the xhci_mtk_add/drop_ep_quirk() calls in xhci.c as well Yes, I agree. Let me submit another patch adding more overridables to xhci_driver_overrides. Thanks. > > Thanks > -Mathias >