RE: [PATCH v3 2/4] usb: aspeed-vhub: fix remote wakeup failure in iKVM use case

From: Neal Liu
Date: Wed Dec 08 2021 - 21:37:22 EST


> -----Original Message-----
> From: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Sent: Thursday, December 9, 2021 8:05 AM
> To: Neal Liu <neal_liu@xxxxxxxxxxxxxx>; Felipe Balbi <balbi@xxxxxxxxxx>;
> Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; Joel Stanley
> <joel@xxxxxxxxx>; Andrew Jeffery <andrew@xxxxxxxx>; Cai Huoqing
> <caihuoqing@xxxxxxxxx>; Tao Ren <rentao.bupt@xxxxxxxxx>; Julia Lawall
> <julia.lawall@xxxxxxxx>; kernel test robot <lkp@xxxxxxxxx>; Sasha Levin
> <sashal@xxxxxxxxxx>; linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-aspeed@xxxxxxxxxxxxxxxx
> Cc: BMC-SW <BMC-SW@xxxxxxxxxxxxxx>
> Subject: Re: [PATCH v3 2/4] usb: aspeed-vhub: fix remote wakeup failure in
> iKVM use case
>
> 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 <neal_liu@xxxxxxxxxxxxxx>
>
> 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.
>

I'm confused. Signaling Wakeup when wakeup_en is set if it has any ep activities is not exactly what you said?
wakeup_en is set only if host allows this device have wakeup capability and bus being suspended.
Normal ep activities would not write the MMIO because wakeup_en is not set.
Thanks

-Neal

> > ---
> > 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,