Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1080650ybh; Wed, 11 Mar 2020 17:12:04 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtohQP8+GxamqmkfRXYQEWHhItVurKLggLrZBc6LI8Yt1um6Km+q7Bm5iFF5kJtClSJB3+Z X-Received: by 2002:aca:56c2:: with SMTP id k185mr790587oib.141.1583971924535; Wed, 11 Mar 2020 17:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583971924; cv=none; d=google.com; s=arc-20160816; b=vgY9nQASJfErBkewBeyK8/DneqPHRk2UZrhKX9IBbY07IhXX5hft6k72wIzQW7E9FP ZGZFiZiO3vi9glVbQW69UtM4Xy7AHCPm4mZIguFxwyxMBc3YXBaRb6ApYl93LOQ44bXx uHnkUY1wp9cpiKFbknQtfzq4GuyAEPVNWg3BRzh4Z8zfMPWgBJkeDv1a2hkrNOqLQ7YB hUsCMWlWF/OfXZv07fGT8toFTPtLk9LWwbVn/aoSjtSnR24pdtajOa6V3nCNZkwqeagZ LFybv1AwRU/aK8uxriElKW8xWSBxk0mHnLIFdonfYvsQ80z8Av5HjGtroM/YPmIjIeqi K1gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9ApGOF5PBkyoeBPogSoc/7/ab/yJXEM4Uq6xzW0uckE=; b=W/gAoF+tt/FEo9wBUP5cKABFYCVmuiMl1Jp3FXrsOvkQEFw2VrW4674HF+Vh+z38b0 Tht3zWw4sFpQKHcaamDswlVy+otKYms7Bsc/sg0H/Av8TUYNOpwJBgxFebBkFTXkO1e0 X0QxkVxqM9PQmGvfrDWnywqPG+hNl1LPWIhoJ8AkjrltyHBpA4ve0YgEvPsQg+j8wUJe agtvRkUesEe5zvAwdSfmPEwd6ZMo1szUbvOFiRBXjt17EI6v6RAHDSZJbLH1iMvvaSWL bF1sldGNIm5XkVhvivlfwpnqdeHoGr63lG++PkCV08j0m6uqEFjuNFTDmhwnVIEStaWj ZhZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qa/JjpNb"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u135si1856092oif.248.2020.03.11.17.10.55; Wed, 11 Mar 2020 17:12:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="qa/JjpNb"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731508AbgCLAJl (ORCPT + 99 others); Wed, 11 Mar 2020 20:09:41 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39632 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbgCLAJl (ORCPT ); Wed, 11 Mar 2020 20:09:41 -0400 Received: by mail-pl1-f193.google.com with SMTP id j20so1873770pll.6; Wed, 11 Mar 2020 17:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9ApGOF5PBkyoeBPogSoc/7/ab/yJXEM4Uq6xzW0uckE=; b=qa/JjpNbOa07fUsB4jPdLDm52/jZZEQRH9wlnggCo8DYirC2AP/CxM7bIpeGf+pTsZ Uv9+2rKZqzD67ItMqFhBlkKxIM3pO4GTO/b21mX73+MdeJ8hXW9aA30m/c7gsxNFkmvY 2l3HzKT7rZseU2snFyYgrJqHPN997zzhpWRiGk0t+jriJZeQ3BOe/fmG//AR7IdLhdFr uQzd7AOSjXIYBl7IBeG3pQGBBvzaLhYsBEqU4s+4zR1iUyentr12iqjc2dKsAzemOigy iZ6MrnT4onYr65Ude8HVtSsE4M05XvWBLKobbUKLxWtQ+JleX207ym20znvdc2QktO4I g/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9ApGOF5PBkyoeBPogSoc/7/ab/yJXEM4Uq6xzW0uckE=; b=YUG1Kq1UZ+prDqZwEjuFB0cFS+/Z+xMDNN/06MwmJmi9uLavE6pEYQJMbSsl+cBWQc 9byuM/Pu3yNbdwayZE4Ih7fQBKQaRU0KqhOuWktZ0uT0zROjaligoNrGhoeL2WwqPAm7 pNGzUnxTJjmgVSOJabrPvzkDhGlM0y2SNedAyCwL3WYxOqG9iyYyCrygDQdtssdlthRJ ZWeMWoMrXDqQ67GbU48FQ6/nsPtmuhCwC9p3UXzGG27CeLzvWulEGRm2upgkI1+n/9mc CN5NV2JZmjAlOO/loQDTLhQakmD0R7xoOOn7SJkh8+XtXAkC2MzwJdDIZOoFpr9P/bXj G27A== X-Gm-Message-State: ANhLgQ1J8Hj/svtUJQ+mbd5lKDpstkXGE9+JsemWRlDdz1HtYczHh2Pa f0WIaI30Y16BJn7CsTK7pN0= X-Received: by 2002:a17:902:d88d:: with SMTP id b13mr5144514plz.228.1583971779921; Wed, 11 Mar 2020 17:09:39 -0700 (PDT) Received: from taoren-ubuntu-R90MNF91 (c-24-4-25-55.hsd1.ca.comcast.net. [24.4.25.55]) by smtp.gmail.com with ESMTPSA id e11sm9957036pfj.95.2020.03.11.17.09.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Mar 2020 17:09:39 -0700 (PDT) Date: Wed, 11 Mar 2020 17:09:31 -0700 From: Tao Ren To: Benjamin Herrenschmidt Cc: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Chunfeng Yun , Stephen Boyd , 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 v2] usb: gadget: aspeed: improve vhub port irq handling Message-ID: <20200312000930.GA3956@taoren-ubuntu-R90MNF91> References: <20200305234746.1002-1-rentao.bupt@gmail.com> <481e9b7d40c51505518a34ddc2515d3200dbf158.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <481e9b7d40c51505518a34ddc2515d3200dbf158.camel@kernel.crashing.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ben, On Wed, Mar 11, 2020 at 12:31:22PM +1100, Benjamin Herrenschmidt wrote: > On Thu, 2020-03-05 at 15:47 -0800, rentao.bupt@gmail.com wrote: > > From: Tao Ren > > > > 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 > > --- > > Changes in v2: > > - use "for_each_set_bit" to speed up port irq handling. > > > > drivers/usb/gadget/udc/aspeed-vhub/core.c | 11 ++++++++--- > > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 8 +++----- > > 2 files changed, 11 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..af2dbd405361 100644 > > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c > > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c > > @@ -134,11 +134,14 @@ 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) { > > + 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, (unsigned long *)&istat, size) > > That type cast is very bad. It will not work on big endian for example > (yes this driver isn't used on big endian today but still). > > Please assign istat to an unsigned long (or make it unsigned long to > begin with). Thanks for pointing it out. Will fix it in v3. Cheers, Tao