From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: kbuild test robot <lkp@intel.com>
Cc: kbuild-all@01.org, linux-usb@vger.kernel.org,
Greg KH <greg@kroah.com>, Joel Stanley <joel.stanley@au1.ibm.com>,
Andrew Jeffery <andrew@aj.id.au>, Felipe Balbi <balbi@kernel.org>
Subject: [v3,2/2] usb/gadget: Add driver for Aspeed SoC virtual hub
Date: Fri, 26 Jan 2018 10:58:56 +1100 [thread overview]
Message-ID: <1516924736.2312.50.camel@kernel.crashing.org> (raw)
On Wed, 2018-01-24 at 11:30 +0800, kbuild test robot wrote:
> Hi Benjamin,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on balbi-usb/next]
> [also build test WARNING on v4.15-rc9 next-20180119]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
This seems to be bogosity in m32r more than problems with the driver...
> url: https://github.com/0day-ci/linux/commits/Benjamin-Herrenschmidt/usb-gadget-Add-an-EP-dispose-callback-for-EP-lifetime-tracking/20180124-065635
> base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
> config: m32r-allyesconfig (attached as .config)
> compiler: m32r-linux-gcc (GCC) 7.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=m32r
>
> All warnings (new ones prefixed by >>):
>
> In file included from arch/m32r/include/uapi/asm/byteorder.h:8:0,
> from arch/m32r/include/asm/bitops.h:22,
> from include/linux/bitops.h:38,
> from include/linux/kernel.h:11,
> from drivers/usb/gadget/udc/aspeed-vhub/core.c:14:
> include/linux/byteorder/big_endian.h:8:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
> #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
> ^~~~~~~
Not sure what that one is, looks like some toolchain or arch problem...
> In file included from include/linux/printk.h:329:0,
> from include/linux/kernel.h:14,
> from drivers/usb/gadget/udc/aspeed-vhub/core.c:14:
> drivers/usb/gadget/udc/aspeed-vhub/core.c: In function 'ast_vhub_irq':
> > > drivers/usb/gadget/udc/aspeed-vhub/core.c:127:16: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' [-Wformat=]
>
> UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
This is rather bogus too. m32r's readl() is returning unsigned long, it
should be unsigned int or u32.
> ^
> include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
> __dynamic_dev_dbg(&descriptor, dev, fmt, \
> ^~~
> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:405:28: note: in expansion of macro 'dev_dbg'
> #define UDCVDBG(u, fmt...) dev_dbg(&(u)->pdev->dev, fmt)
> ^~~~~~~
> drivers/usb/gadget/udc/aspeed-vhub/core.c:127:2: note: in expansion of macro 'UDCVDBG'
> UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
> ^~~~~~~
> drivers/usb/gadget/udc/aspeed-vhub/core.c:127:16: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'long unsigned int' [-Wformat=]
> UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
> ^
> include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
> __dynamic_dev_dbg(&descriptor, dev, fmt, \
> ^~~
> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:405:28: note: in expansion of macro 'dev_dbg'
> #define UDCVDBG(u, fmt...) dev_dbg(&(u)->pdev->dev, fmt)
> ^~~~~~~
> drivers/usb/gadget/udc/aspeed-vhub/core.c:127:2: note: in expansion of macro 'UDCVDBG'
> UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
> ^~~~~~~
> --
> In file included from arch/m32r/include/uapi/asm/byteorder.h:8:0,
> from arch/m32r/include/asm/bitops.h:22,
> from include/linux/bitops.h:38,
> from include/linux/kernel.h:11,
> from drivers/usb/gadget/udc/aspeed-vhub/epn.c:14:
> include/linux/byteorder/big_endian.h:8:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
> #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
> ^~~~~~~
> In file included from include/linux/printk.h:329:0,
> from include/linux/kernel.h:14,
> from drivers/usb/gadget/udc/aspeed-vhub/epn.c:14:
> drivers/usb/gadget/udc/aspeed-vhub/epn.c: In function 'ast_vhub_epn_kick_desc':
> > > drivers/usb/gadget/udc/aspeed-vhub/vhub.h:409:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'long unsigned int' [-Wformat=]
>
> "%s:EP%d " fmt, \
> ^
> include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
> __dynamic_dev_dbg(&descriptor, dev, fmt, \
> ^~~
> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:408:2: note: in expansion of macro 'dev_dbg'
> dev_dbg(&(ep)->vhub->pdev->dev, \
> ^~~~~~~
> drivers/usb/gadget/udc/aspeed-vhub/epn.c:233:2: note: in expansion of macro 'EPVDBG'
> EPVDBG(ep, "HW kicked, d_next=%d dstat=%08x\n",
> ^~~~~~
> drivers/usb/gadget/udc/aspeed-vhub/epn.c:233:44: note: format string is defined here
> EPVDBG(ep, "HW kicked, d_next=%d dstat=%08x\n",
> ~~~^
> %08lx
>
> vim +127 drivers/usb/gadget/udc/aspeed-vhub/core.c
>
> > 14 #include <linux/kernel.h>
> 15 #include <linux/module.h>
> 16 #include <linux/platform_device.h>
> 17 #include <linux/delay.h>
> 18 #include <linux/ioport.h>
> 19 #include <linux/slab.h>
> 20 #include <linux/errno.h>
> 21 #include <linux/list.h>
> 22 #include <linux/interrupt.h>
> 23 #include <linux/proc_fs.h>
> 24 #include <linux/prefetch.h>
> 25 #include <linux/clk.h>
> 26 #include <linux/usb/gadget.h>
> 27 #include <linux/of.h>
> 28 #include <linux/of_gpio.h>
> 29 #include <linux/regmap.h>
> 30 #include <linux/dma-mapping.h>
> 31
> 32 #include "vhub.h"
> 33
> 34 static bool force_usb1 = false;
> 35 static bool no_dma_desc = false;
> 36
> 37 module_param_named(force_usb1, force_usb1, bool, 0644);
> 38 MODULE_PARM_DESC(force_usb1, "Set to true to force to USB1 speed");
> 39 module_param_named(no_dma_desc, no_dma_desc, bool, 0644);
> 40 MODULE_PARM_DESC(no_dma_desc, "Set to true to disable use of DMA descriptors");
> 41
> 42 void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
> 43 int status)
> 44 {
> 45 bool internal = req->internal;
> 46
> 47 EPVDBG(ep, "completing request @%p, status %d\n", req, status);
> 48
> 49 list_del_init(&req->queue);
> 50
> 51 if (req->req.status == -EINPROGRESS)
> 52 req->req.status = status;
> 53
> 54 if (req->req.dma) {
> 55 if (!WARN_ON(!ep->dev))
> 56 usb_gadget_unmap_request(&ep->dev->gadget,
> 57 &req->req, ep->epn.is_in);
> 58 req->req.dma = 0;
> 59 }
> 60
> 61 /*
> 62 * If this isn't an internal EP0 request, call the core
> 63 * to call the gadget completion.
> 64 */
> 65 if (!internal) {
> 66 spin_unlock(&ep->vhub->lock);
> 67 usb_gadget_giveback_request(&ep->ep, &req->req);
> 68 spin_lock(&ep->vhub->lock);
> 69 }
> 70 }
> 71
> 72 void ast_vhub_nuke(struct ast_vhub_ep *ep, int status)
> 73 {
> 74 struct ast_vhub_req *req;
> 75
> 76 EPDBG(ep, "Nuking\n");
> 77
> 78 /* terminate any request in the queue */
> 79 if (list_empty(&ep->queue))
> 80 return;
> 81
> 82 /* Beware, lock will be dropped & req-acquired by done() */
> 83 while (!list_empty(&ep->queue)) {
> 84 req = list_first_entry(&ep->queue, struct ast_vhub_req, queue);
> 85 ast_vhub_done(ep, req, status);
> 86 }
> 87 }
> 88
> 89 struct usb_request *ast_vhub_alloc_request(struct usb_ep *u_ep,
> 90 gfp_t gfp_flags)
> 91 {
> 92 struct ast_vhub_req *req;
> 93
> 94 req = kzalloc(sizeof(*req), gfp_flags);
> 95 if (!req)
> 96 return NULL;
> 97 INIT_LIST_HEAD(&req->queue);
> 98 return &req->req;
> 99 }
> 100
> 101 void ast_vhub_free_request(struct usb_ep *u_ep, struct usb_request *u_req)
> 102 {
> 103 struct ast_vhub_req *req = to_ast_req(u_req);
> 104
> 105 kfree(req);
> 106 }
> 107
> 108 static irqreturn_t ast_vhub_irq (int irq, void *data)
> 109 {
> 110 struct ast_vhub *vhub = data;
> 111 irqreturn_t iret = IRQ_NONE;
> 112 u32 istat;
> 113
> 114 /* Stale interrupt while tearing down */
> 115 if (!vhub->ep0_bufs)
> 116 return IRQ_NONE;
> 117
> 118 spin_lock(&vhub->lock);
> 119
> 120 /* Read and ACK interrupts */
> 121 istat = readl(vhub->regs + AST_VHUB_ISR);
> 122 if (!istat)
> 123 goto bail;
> 124 writel(istat, vhub->regs + AST_VHUB_ISR);
> 125 iret = IRQ_HANDLED;
> 126
> > 127 UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
> 128 istat,
> 129 readl(vhub->regs + AST_VHUB_EP_ACK_ISR),
> 130 readl(vhub->regs + AST_VHUB_EP_NACK_ISR));
> 131
> 132 /* Handle generic EPs first */
> 133 if (istat & VHUB_IRQ_EP_POOL_ACK_STALL) {
> 134 u32 i, ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
> 135 writel(ep_acks, vhub->regs + AST_VHUB_EP_ACK_ISR);
> 136
> 137 /* Check if we have a useful ffs on arm ... */
> 138 for (i = 0; ep_acks && i < AST_VHUB_NUM_GEN_EPs; i++) {
> 139 u32 mask = 1 << i;
> 140 if (ep_acks & mask) {
> 141 ast_vhub_epn_ack_irq(&vhub->epns[i]);
> 142 ep_acks &= ~mask;
> 143 }
> 144 }
> 145 }
> 146
> 147 /* Handle device interrupts */
> 148 if (istat & (VHUB_IRQ_DEVICE1 |
> 149 VHUB_IRQ_DEVICE2 |
> 150 VHUB_IRQ_DEVICE3 |
> 151 VHUB_IRQ_DEVICE4 |
> 152 VHUB_IRQ_DEVICE5)) {
> 153 if (istat & VHUB_IRQ_DEVICE1)
> 154 ast_vhub_dev_irq(&vhub->ports[0].dev);
> 155 if (istat & VHUB_IRQ_DEVICE2)
> 156 ast_vhub_dev_irq(&vhub->ports[1].dev);
> 157 if (istat & VHUB_IRQ_DEVICE3)
> 158 ast_vhub_dev_irq(&vhub->ports[2].dev);
> 159 if (istat & VHUB_IRQ_DEVICE4)
> 160 ast_vhub_dev_irq(&vhub->ports[3].dev);
> 161 if (istat & VHUB_IRQ_DEVICE5)
> 162 ast_vhub_dev_irq(&vhub->ports[4].dev);
> 163 }
> 164
> 165 /* Handle top-level vHub EP0 interrupts */
> 166 if (istat & (VHUB_IRQ_HUB_EP0_OUT_ACK_STALL |
> 167 VHUB_IRQ_HUB_EP0_IN_ACK_STALL |
> 168 VHUB_IRQ_HUB_EP0_SETUP)) {
> 169 if (istat & VHUB_IRQ_HUB_EP0_IN_ACK_STALL)
> 170 ast_vhub_ep0_handle_ack(&vhub->ep0, true);
> 171 if (istat & VHUB_IRQ_HUB_EP0_OUT_ACK_STALL)
> 172 ast_vhub_ep0_handle_ack(&vhub->ep0, false);
> 173 if (istat & VHUB_IRQ_HUB_EP0_SETUP)
> 174 ast_vhub_ep0_handle_setup(&vhub->ep0);
> 175 }
> 176
> 177 /* Various top level bus events */
> 178 if (istat & (VHUB_IRQ_BUS_RESUME |
> 179 VHUB_IRQ_BUS_SUSPEND |
> 180 VHUB_IRQ_BUS_RESET)) {
> 181 if (istat & VHUB_IRQ_BUS_RESUME)
> 182 ast_vhub_hub_resume(vhub);
> 183 if (istat & VHUB_IRQ_BUS_SUSPEND)
> 184 ast_vhub_hub_suspend(vhub);
> 185 if (istat & VHUB_IRQ_BUS_RESET)
> 186 ast_vhub_hub_reset(vhub);
> 187 }
> 188
> 189 bail:
> 190 spin_unlock(&vhub->lock);
> 191 return iret;
> 192 }
> 193
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
---
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
next reply other threads:[~2018-01-25 23:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 23:58 Benjamin Herrenschmidt [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-01-27 11:07 [v3,2/2] usb/gadget: Add driver for Aspeed SoC virtual hub Benjamin Herrenschmidt
2018-01-26 4:55 kbuild test robot
2018-01-24 7:40 kbuild test robot
2018-01-24 3:30 kbuild test robot
2018-01-24 2:27 Benjamin Herrenschmidt
2018-01-24 1:50 kbuild test robot
2018-01-22 22:27 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=1516924736.2312.50.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=andrew@aj.id.au \
--cc=balbi@kernel.org \
--cc=greg@kroah.com \
--cc=joel.stanley@au1.ibm.com \
--cc=kbuild-all@01.org \
--cc=linux-usb@vger.kernel.org \
--cc=lkp@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.