linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Felipe Balbi <balbi@kernel.org>, linux-usb@vger.kernel.org
Cc: Greg KH <greg@kroah.com>, Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@aj.id.au>
Subject: [v6,2/2] usb/gadget: Add driver for Aspeed SoC virtual hub
Date: Sat, 24 Mar 2018 12:19:39 +1100	[thread overview]
Message-ID: <1521854379.16434.356.camel@kernel.crashing.org> (raw)

On Fri, 2018-03-23 at 09:54 +0200, Felipe Balbi wrote:
> Hi,
> 
> Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> 
> > The Aspeed BMC SoCs support a "virtual hub" function. It provides some
> > HW support for a top-level USB2 hub behind which sit 5 gadget "ports".
> > 
> > This driver adds support for the full functionality, emulating the
> > hub standard requests and exposing 5 UDC gadget drivers corresponding
> > to the ports.
> > 
> > The hub itself has HW provided dedicated EP0 and EP1 (the latter for
> > hub interrupts). It also has dedicated EP0s for each function. For
> > other endpoints, there's a pool of 15 "generic" endpoints that are
> > shared among the ports.
> > 
> > The driver relies on my previous patch adding a "dispose" EP op to
> > handle EP allocation between ports. EPs are allocated from the shared
> > pool in the UDC "match_ep" callback and assigned to the UDC instance
> > (added to the gadget ep_list).
> > 
> > When the composite driver gets unbound, the new hook will allow the UDC
> > to clean things up and return those EPs to the shared pool.
> > 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > ---
> 
> doesn't compile:
> 
> In file included from ./include/linux/bitmap.h:9:0,
>                  from ./include/linux/cpumask.h:12,
>                  from ./arch/x86/include/asm/cpumask.h:5,
>                  from ./arch/x86/include/asm/msr.h:11,
>                  from ./arch/x86/include/asm/processor.h:21,
>                  from ./arch/x86/include/asm/cpufeature.h:5,
>                  from ./arch/x86/include/asm/thread_info.h:53,
>                  from ./include/linux/thread_info.h:38,
>                  from ./arch/x86/include/asm/preempt.h:7,
>                  from ./include/linux/preempt.h:81,
>                  from ./include/linux/spinlock.h:51,
>                  from ./include/linux/seqlock.h:36,
>                  from ./include/linux/time.h:6,
>                  from ./include/linux/stat.h:19,
>                  from ./include/linux/module.h:10,
>                  from drivers/usb/gadget/udc/aspeed-vhub/hub.c:16:
> In function ‘memcpy’,
>     inlined from ‘ast_vhub_rep_desc’ at drivers/usb/gadget/udc/aspeed-vhub/hub.c:276:2:
> ./include/linux/string.h:341:4: error: call to ‘__read_overflow2’ declared with attribute error: detected read beyond size of object passed as 2nd parameter
>     __read_overflow2();

That's really odd... some new gcc thing ? I don't understand where the
overflow would occur... Do you see anything ? Unless my brain is acting
up, there is no overflow and gcc is bogus:

I just hand counted the size of the 3 possible structures "desc" can
point to and compared to the constants used for the size, and it all
fits.

Unfortunately, I can't seem to reproduce with the version of cross
compiler I'm using here, so I'm not sure what construct to use to
make gcc stop erroneously barfing...

Cheers,
Ben.

>     ^~~~~~~~~~~~~~~~~~
> make[4]: *** [scripts/Makefile.build:316: drivers/usb/gadget/udc/aspeed-vhub/hub.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
> make[3]: *** [scripts/Makefile.build:575: drivers/usb/gadget/udc/aspeed-vhub] Error 2
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [scripts/Makefile.build:575: drivers/usb/gadget/udc] Error 2
> make[1]: *** [scripts/Makefile.build:575: drivers/usb/gadget] Error 2
> make: *** [Makefile:1722: drivers/usb/] Error 2
> 
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2018-03-24  1:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24  1:19 Benjamin Herrenschmidt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-03-26  0:25 [v6,2/2] usb/gadget: Add driver for Aspeed SoC virtual hub Benjamin Herrenschmidt
2018-03-25  1:25 Benjamin Herrenschmidt
2018-03-23  7:54 Felipe Balbi
2018-03-23  2:44 Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1521854379.16434.356.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=andrew@aj.id.au \
    --cc=balbi@kernel.org \
    --cc=greg@kroah.com \
    --cc=joel@jms.id.au \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).