Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4466710ioa; Wed, 27 Apr 2022 04:37:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXXgLuPD4syLr6zKnZZxgCpKWRt/dWzfXAl8a7jvigRl7ESIau4VZLr5TQSQLKENGnXrko X-Received: by 2002:a17:902:cf0b:b0:151:9d28:f46f with SMTP id i11-20020a170902cf0b00b001519d28f46fmr27757913plg.53.1651059462880; Wed, 27 Apr 2022 04:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651059462; cv=none; d=google.com; s=arc-20160816; b=XywD3BzzIeNABa8rUaugXSRUt3xtuhJk/IbjaYyWO9OSUsTlOnolvUcZr2zdWhIRWb FWri8qRQ6S+WNijvpFwCNU1fbyggK+5pOTsdWVxPzUfAxPKvscQBGPCDHGXMQ6Lx0aXV 5kxGWZMI5vr2cbC07oveg+TvMEWMz1CS1H3ZGFUPkTJTRmcLdKLosSsakHVpCDbYlY32 IgqSKwNJ1yLhFiQ+FTh9XS3ZMB4NpgMKoq0iJlvcKtbRjIcd9jLUH2SqZeq4uyr9gqIt FErGvtn2LXwwN9JPQ5HPeaRudE9AcoR5NpU5aGJODxqrpO5AcegBrfYalihbNJ0XUMLe fCSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UNHdrjqb66Ge2kiekerZftbLp2HvuAgEFOoqtJP/uSs=; b=TgnBoZTT+/3/KtPzjK8YOT8MFnNgF8mqge1qTk3LiYAPEJsG8/YYagfeM+SmsXjRAY 41lIHhGeghOV7Ylj3D1NGJn3XYE6jdzoOcMb2c6NtxaCB5XVUwMqdbtyEaMOtO9nLeFB faEBVnI5TAq/4RCMnnEMH30/E1EvqV0dMQCud/FiflhucHVSxa0b102QisJP21e/Qg1Z rRGyDnneXqbm+HuOYBEUZigk1u+xDWfUZ/Zuq+6QI8MuvNK3Vf5GtHaZV7SXASm8I6/a 4uQD1RswoXQdFbdY2TrUxshQMTgriNXuC14ZpGT2btMxxPfudVfzNjLY0iWA2GZWXtuY DjPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vmBx/0DX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l4-20020a170903244400b0015cf9502127si1525342pls.267.2022.04.27.04.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vmBx/0DX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E96C2390558; Wed, 27 Apr 2022 03:27:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbiD0JXv (ORCPT + 99 others); Wed, 27 Apr 2022 05:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiD0JXo (ORCPT ); Wed, 27 Apr 2022 05:23:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 359E728CCD7; Wed, 27 Apr 2022 02:20:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6A6A5CE2374; Wed, 27 Apr 2022 09:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09843C385AA; Wed, 27 Apr 2022 09:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651051168; bh=HIdipye8XY4XJUHqzpT0yQSXh7I0e/okAWw7hKJ13UE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vmBx/0DX90m5KTtHB+w8zpIdg4qGatAJ0cvzFfvUc84VJSvC4JJv5e2YaDS43ZXl6 IjVQntN7YjLMNTFdvji87ACH+A0bnpI1inpd5ldFuoODcoC81rn6+BQdFfp+S36eIa yiuicq7ZbYD6CIYgS9flYQ1VbA6QE2ygqPUXTX3c= Date: Wed, 27 Apr 2022 11:19:25 +0200 From: Greg Kroah-Hartman To: Jung Daehwan Cc: Mathias Nyman , "open list:USB XHCI DRIVER" , open list , Howard Yen , Jack Pham , Puma Hsu , "J . Avila" , sc.suh@samsung.com, Krzysztof Kozlowski Subject: Re: [PATCH v4 2/5] usb: host: add xhci hooks for xhci-exynos Message-ID: References: <1650964728-175347-1-git-send-email-dh10.jung@samsung.com> <1650964728-175347-3-git-send-email-dh10.jung@samsung.com> <20220427090617.GA145620@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220427090617.GA145620@ubuntu> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 On Wed, Apr 27, 2022 at 06:06:17PM +0900, Jung Daehwan wrote: > On Tue, Apr 26, 2022 at 12:19:17PM +0200, Greg Kroah-Hartman wrote: > > On Tue, Apr 26, 2022 at 06:18:45PM +0900, Daehwan Jung wrote: > > > To enable supporting for USB offload, define "offload" in usb controller > > > node of device tree. "offload" value can be used to determine which type > > > of offload was been enabled in the SoC. > > > > > > For example: > > > > > > &usbdrd_dwc3 { > > > ... > > > /* support usb offloading, 0: disabled, 1: audio */ > > > offload = <1>; > > > ... > > > }; > > > > > > There are several vendor_ops introduced by this patch: > > > > > > struct xhci_vendor_ops - function callbacks for vendor specific operations > > > { > > > @vendor_init: > > > - called for vendor init process during xhci-plat-hcd > > > probe. > > > @vendor_cleanup: > > > - called for vendor cleanup process during xhci-plat-hcd > > > remove. > > > @is_usb_offload_enabled: > > > - called to check if usb offload enabled. > > > @alloc_dcbaa: > > > - called when allocating vendor specific dcbaa during > > > memory initializtion. > > > @free_dcbaa: > > > - called to free vendor specific dcbaa when cleanup the > > > memory. > > > @alloc_transfer_ring: > > > - called when vendor specific transfer ring allocation is required > > > @free_transfer_ring: > > > - called to free vendor specific transfer ring > > > @sync_dev_ctx: > > > - called when synchronization for device context is required > > > } > > > > > > The xhci hooks with prefix "xhci_vendor_" on the ops in xhci_vendor_ops. > > > For example, vendor_init ops will be invoked by xhci_vendor_init() hook, > > > is_usb_offload_enabled ops will be invoked by > > > xhci_vendor_is_usb_offload_enabled(), and so on. > > > > > > Signed-off-by: Daehwan Jung > > > Signed-off-by: J. Avila > > > Signed-off-by: Puma Hsu > > > Signed-off-by: Howard Yen > > > --- > > > drivers/usb/host/xhci-hub.c | 5 ++ > > > drivers/usb/host/xhci-mem.c | 131 +++++++++++++++++++++++++++++++---- > > > drivers/usb/host/xhci-plat.c | 44 +++++++++++- > > > drivers/usb/host/xhci-plat.h | 8 +++ > > > drivers/usb/host/xhci.c | 80 ++++++++++++++++++++- > > > drivers/usb/host/xhci.h | 46 ++++++++++++ > > > 6 files changed, 296 insertions(+), 18 deletions(-) > > > > Why do you need to "override" anything? Why can't these just be added > > to the current xhci_plat_priv structure and used that way like the > > current xhci platform interface works? > > > > "override" means above xhci hooks? Above hooks are for ring management. > In fact, xhci platform doesn't care ring management. That's why I've added hooks > not used xhci_plat_priv. Why not add ring management ability to the platform interface instead? That's what you want to control here, in your platform driver, right? > > > diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c > > > index 841617952ac7..e07c9c132061 100644 > > > --- a/drivers/usb/host/xhci-hub.c > > > +++ b/drivers/usb/host/xhci-hub.c > > > @@ -535,8 +535,13 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) > > > cmd->status == COMP_COMMAND_RING_STOPPED) { > > > xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); > > > ret = -ETIME; > > > + goto cmd_cleanup; > > > } > > > > > > + ret = xhci_vendor_sync_dev_ctx(xhci, slot_id); > > > + if (ret) > > > + xhci_warn(xhci, "Sync device context failed, ret=%d\n", ret); > > > > Shouldn't the function have spit out an error if there was a problem? > > It just reads and sync information about device context. That's why I think > it's not critical to go error routime. But it needs to discuss. Ok, it looks like this follows the other ways this driver works, that's fine. > > And no documentiaon for these global function? > > > > I thought there's no need to add documentation. They are just functions to call > vendor ops and there's documentation of vendor ops above. I could add it if needed. Always try to add documentation for when you want others to use the new functions, as it helps explain how to use them. thanks, greg k-h