From: Tao Ren <rentao.bupt@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
Stephen Boyd <swboyd@chromium.org>,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
openbmc@lists.ozlabs.org, taoren@fb.com
Subject: Re: [PATCH v3] usb: gadget: aspeed: improve vhub port irq handling
Date: Thu, 2 Apr 2020 23:48:27 -0700 [thread overview]
Message-ID: <20200403064826.GA10866@taoren-ubuntu-R90MNF91> (raw)
In-Reply-To: <512d625e45ea953d722bb7ea73c3619730312284.camel@kernel.crashing.org>
On Thu, Apr 02, 2020 at 09:45:38PM +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2020-04-01 at 14:58 -0700, Tao Ren wrote:
> > Hi Ben,
> >
> > Any further comments on the patch?
>
> Ah sorry, nope. Did you check the generated assembly to see if it
> looked any better ? :-)
>
> Otherwise,
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Thanks Ben for the review. Let me see if I can collect some runtime data
on my ast2400 BMC platform. Will update back later.
Cheers,
Tao
>
> >
> > Cheers,
> >
> > Tao
> >
> > On Sun, Mar 15, 2020 at 12:14:30PM -0700, rentao.bupt@gmail.com
> > wrote:
> > > From: Tao Ren <rentao.bupt@gmail.com>
> > >
> > > This patch evaluates vhub ports' irq mask before going through per-
> > > port
> > > irq handling one by one, which helps to speed up irq handling in
> > > case
> > > there is no port interrupt.
> > >
> > > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > > ---
> > > Changes in v3:
> > > - assign istat to (unsigned long) bitmap before calling
> > > "for_each_set_bit_from".
> > > Changes in v2:
> > > - use "for_each_set_bit" to speed up port irq handling.
> > >
> > > drivers/usb/gadget/udc/aspeed-vhub/core.c | 12 +++++++++---
> > > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 8 +++-----
> > > 2 files changed, 12 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > index f8d35dd60c34..555e8645fb1e 100644
> > > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > @@ -134,11 +134,15 @@ static irqreturn_t ast_vhub_irq(int irq, void
> > > *data)
> > > }
> > >
> > > /* Handle device interrupts */
> > > - for (i = 0; i < vhub->max_ports; i++) {
> > > - u32 dev_mask = VHUB_IRQ_DEVICE1 << i;
> > > + if (istat & vhub->port_irq_mask) {
> > > + unsigned long bitmap = istat;
> > > + int offset = VHUB_IRQ_DEV1_BIT;
> > > + int size = VHUB_IRQ_DEV1_BIT + vhub->max_ports;
> > >
> > > - if (istat & dev_mask)
> > > + for_each_set_bit_from(offset, &bitmap, size) {
> > > + i = offset - VHUB_IRQ_DEV1_BIT;
> > > ast_vhub_dev_irq(&vhub->ports[i].dev);
> > > + }
> > > }
> > >
> > > /* Handle top-level vHub EP0 interrupts */
> > > @@ -332,6 +336,8 @@ static int ast_vhub_probe(struct
> > > platform_device *pdev)
> > >
> > > spin_lock_init(&vhub->lock);
> > > vhub->pdev = pdev;
> > > + vhub->port_irq_mask = GENMASK(VHUB_IRQ_DEV1_BIT + vhub-
> > > >max_ports - 1,
> > > + VHUB_IRQ_DEV1_BIT);
> > >
> > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > vhub->regs = devm_ioremap_resource(&pdev->dev, res);
> > > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > > b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > > index fac79ef6d669..23a1ac91f8d2 100644
> > > --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > > +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > > @@ -51,14 +51,11 @@
> > > #define VHUB_CTRL_UPSTREAM_CONNECT (1 << 0)
> > >
> > > /* IER & ISR */
> > > +#define VHUB_IRQ_DEV1_BIT 9
> > > #define VHUB_IRQ_USB_CMD_DEADLOCK (1 << 18)
> > > #define VHUB_IRQ_EP_POOL_NAK (1 << 17)
> > > #define VHUB_IRQ_EP_POOL_ACK_STALL (1 << 16)
> > > -#define VHUB_IRQ_DEVICE5 (1 << 13)
> > > -#define VHUB_IRQ_DEVICE4 (1 << 12)
> > > -#define VHUB_IRQ_DEVICE3 (1 << 11)
> > > -#define VHUB_IRQ_DEVICE2 (1 << 10)
> > > -#define VHUB_IRQ_DEVICE1 (1 << 9)
> > > +#define VHUB_IRQ_DEVICE1 (1 <<
> > > (VHUB_IRQ_DEV1_BIT))
> > > #define VHUB_IRQ_BUS_RESUME (1 << 8)
> > > #define VHUB_IRQ_BUS_SUSPEND (1 << 7)
> > > #define VHUB_IRQ_BUS_RESET (1 << 6)
> > > @@ -402,6 +399,7 @@ struct ast_vhub {
> > > /* Per-port info */
> > > struct ast_vhub_port *ports;
> > > u32 max_ports;
> > > + u32 port_irq_mask;
> > >
> > > /* Generic EP data structures */
> > > struct ast_vhub_ep *epns;
> > > --
> > > 2.17.1
> > >
>
next prev parent reply other threads:[~2020-04-03 6:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-15 19:14 [PATCH v3] usb: gadget: aspeed: improve vhub port irq handling rentao.bupt
2020-04-01 21:58 ` Tao Ren
2020-04-02 10:45 ` Benjamin Herrenschmidt
2020-04-03 6:48 ` Tao Ren [this message]
2020-04-07 6:02 ` Tao Ren
2020-04-07 23:36 ` Benjamin Herrenschmidt
2020-04-08 5:40 ` Tao Ren
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=20200403064826.GA10866@taoren-ubuntu-R90MNF91 \
--to=rentao.bupt@gmail.com \
--cc=andrew@aj.id.au \
--cc=balbi@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=chunfeng.yun@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=swboyd@chromium.org \
--cc=taoren@fb.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 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).