Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp16969608ybl; Wed, 1 Jan 2020 18:31:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyDC4eBTwtvgqoCVzxVJPXeMlFN4Fx2qMrPUtORNqeUGhAf973b1eu5IDDnSlMGu9gZrhbU X-Received: by 2002:a05:6830:1e67:: with SMTP id m7mr86490055otr.262.1577932287913; Wed, 01 Jan 2020 18:31:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577932287; cv=none; d=google.com; s=arc-20160816; b=mlv4IiKVFZDA6y0t26uuhj09c9HlGROCVvpTEeWY8Z41M2ZzgXRwJYZFtBdAYmIZ7Z MH5UXhL8picXCf0BEKes6X4PKW4/a2z/MGciYDh946of7z4Ce944uqv2tI/2ra8V22Di qj8ofJvWvtU83JCBZFScLWunFVux+L8qw6maQs0VvDKycDaRcpMKdVFXNSo6m8CwcliF StDC4xoSbB7R1EbDWKLS9cN/7La6vGc3R67m7rgW+cFcJqODRyX3A+faxDuGom5FzTLh tHnhIQY1RCY3L152tXX1A2MPHw5Pqq9WruoI/ZYKrKzAovKeTvAxqjdH0FVeMeZI0x9R sfAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=yoxrbA9+84xv2WlxStVen7VxfCsQXuQA611fO80T0fc=; b=MGoJDWjLC5HVh9+WGpRrSiD/bacGAZYAmMqktcIBkebayZpqUOJQVsigzEPkG5AqpL 4R89ibJVSF62LbXZpgneG3vxScTPfVfR581cV8I9WWo1b9DK2Qv9KSl65KMjEgwkIZ+q ONcDQk96Sm38Dvsl8fqrMujcEnYP0NAQ2YepjNRAuNwal9/9Ha8qxsQw4xVJBUfeHRTq 8qmYt7peQaCobBTsaM9LveARESPUi47+KEiZDqU5qwmxcEPagsOHguc5jQyboAI/pkAg JXuvI1wNTFrHBhkGXJqBaDKY5J6VoB5SGgYoSwVHii1szqRQo+ICAT1qO8hIsJbhnPOf Xw7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si21093824otf.84.2020.01.01.18.31.15; Wed, 01 Jan 2020 18:31:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727538AbgABCaf (ORCPT + 99 others); Wed, 1 Jan 2020 21:30:35 -0500 Received: from netrider.rowland.org ([192.131.102.5]:38463 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727509AbgABCaf (ORCPT ); Wed, 1 Jan 2020 21:30:35 -0500 Received: (qmail 30587 invoked by uid 500); 1 Jan 2020 21:30:34 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 1 Jan 2020 21:30:34 -0500 Date: Wed, 1 Jan 2020 21:30:34 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Guenter Roeck cc: Greg Kroah-Hartman , USB list , Kernel development list , Michael Grzeschik , Subject: Re: [PATCH] usb: chipidea: host: Disable port power only if previously enabled In-Reply-To: <1fd709ce-04a3-4183-da39-c1921ec69ce7@roeck-us.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Jan 2020, Guenter Roeck wrote: > On 12/29/19 8:40 AM, Alan Stern wrote: > > On Sun, 29 Dec 2019, Guenter Roeck wrote: > > > >> On Sat, Dec 28, 2019 at 02:33:01PM -0500, Alan Stern wrote: > >>> > >>> Let's try a slightly different approach. What happens with this patch? > >>> > >>> Alan Stern > >>> > >>> > >>> Index: usb-devel/drivers/usb/core/hub.c > >>> =================================================================== > >>> --- usb-devel.orig/drivers/usb/core/hub.c > >>> +++ usb-devel/drivers/usb/core/hub.c > >>> @@ -1065,6 +1065,7 @@ static void hub_activate(struct usb_hub > >>> if (type == HUB_INIT) { > >>> delay = hub_power_on_good_delay(hub); > >>> > >>> + hub->power_bits[0] = ~0UL; /* All ports on */ > >>> hub_power_on(hub, false); > >>> INIT_DELAYED_WORK(&hub->init_work, hub_init_func2); > >>> queue_delayed_work(system_power_efficient_wq, > >>> > >> > >> That doesn't make a difference - the traceback is still seen with this patch > >> applied. > > > > Can you trace what's going on? Does this code pathway now end up > > calling ehci_port_power() for each root-hub port, and from there down > > into the chipidea driver? If not, can you find where it gets > > sidetracked? > > > > A complete traceback is attached below, so, yes, I think it is safe to say that > ehci_port_power() is called unconditionally for each root-hub port on shutdown. I was really asking about hub activation and powering-up, but you found the answer to that too, so okay. > The only mystery to me was why ehci_port_power() isn't called to enable port power > when the port comes up. As it turns out, HCS_PPC(ehci->hcs_params) is false on my > simulated hardware, and thus ehci_port_power(..., true) is not called from > ehci_hub_control(). > > Given that, it may well be that the problem is not seen on "real" hardware, > at least not with real mcimx7d-sabre hardware, if the hub on that hardware does > support power control. To test this idea, I modified qemu to claim hub power > control support by setting the "power control support" capability bit. With > that, the traceback is gone. > > Any suggestion how to proceed ? Given that HCS_PPC(ehci_hcs_params) is false, I would say that ehci_turn_off_all_ports() shouldn't call ehci_port_power(). You should add that test there. (Although to tell the truth, I'm not really sure we need to test HCS_PPC anywhere...) Did you check what happens without the patch I sent you? I would like to know if that patch really does make a difference. If we don't send the Set-Port-Feature(power) request during hub activation without the patch then it does need to be merged. Alan Stern