Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAAE2C433F5 for ; Thu, 9 Dec 2021 00:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241375AbhLIAOa (ORCPT ); Wed, 8 Dec 2021 19:14:30 -0500 Received: from gate.crashing.org ([63.228.1.57]:42469 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238478AbhLIAO2 (ORCPT ); Wed, 8 Dec 2021 19:14:28 -0500 Received: from ip6-localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 1B905TbW017335; Wed, 8 Dec 2021 18:05:29 -0600 Message-ID: <391323f136e49387797d43e89b6e42cd95d916c2.camel@kernel.crashing.org> Subject: Re: [PATCH v3 2/4] usb: aspeed-vhub: fix remote wakeup failure in iKVM use case From: Benjamin Herrenschmidt To: Neal Liu , Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Cai Huoqing , Tao Ren , Julia Lawall , kernel test robot , Sasha Levin , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Cc: BMC-SW@aspeedtech.com Date: Thu, 09 Dec 2021 11:05:28 +1100 In-Reply-To: <20211208100545.1441397-3-neal_liu@aspeedtech.com> References: <20211208100545.1441397-1-neal_liu@aspeedtech.com> <20211208100545.1441397-3-neal_liu@aspeedtech.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-12-08 at 18:05 +0800, Neal Liu wrote: > Signaling remote wakeup if an emulated USB device has any activity > if the device is allowed by host. > > Signed-off-by: Neal Liu I still think it should fundamentally be the device making that decision, but since they don't, this is an acceptable workaround, but please, don't write the MMIO on every EP queue. Either keep track of the bus being suspended, or turn on the AUTO bit in HW when wakeup_en is set. Cheers, Ben. > --- > drivers/usb/gadget/udc/aspeed-vhub/epn.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c > b/drivers/usb/gadget/udc/aspeed-vhub/epn.c > index 917892ca8753..ccc239b5cc17 100644 > --- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c > +++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c > @@ -381,6 +381,11 @@ static int ast_vhub_epn_queue(struct usb_ep* > u_ep, struct usb_request *u_req, > } else > u_req->dma = 0; > > + if (ep->dev->wakeup_en) { > + EPVDBG(ep, "Wakeup host first\n"); > + ast_vhub_hub_wake_all(vhub); > + } > + > EPVDBG(ep, "enqueue req @%p\n", req); > EPVDBG(ep, " l=%d dma=0x%x zero=%d noshort=%d noirq=%d > is_in=%d\n", > u_req->length, (u32)u_req->dma, u_req->zero,