From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C19FC48BE0 for ; Thu, 10 Jun 2021 23:37:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61AB661407 for ; Thu, 10 Jun 2021 23:37:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61AB661407 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=XnuuGb/pEU3GyiqGIHzKy/2RyaIBwkyom4d9GzHMLWY=; b=N9T9H+yn9yGtCu VRq3ukaHJoGHTrLjz/ErRkfOISwAZVratzwpTyUchLMtBXNyPywGzxy+8atm6t6kDL6eTuy0WRDmm WAQpsrXyr7GyVWnTe6xl8PZ/O36kIbmXutcOxttplk/TBP7Fp41YnVl5zZh0IH03DwAqhCTYACfrN NFdHN4hZPgCXuuf87MtWTSxKYkejVl+Rgs0L1kVRL70VDmWl8+wq9Us7YianrPmoYE+XaSn+aGhsx hFtXw6YhhtAImnIWU77MXVO7lAyJgBY6qSNU53D3+o8AuKxTT/pE7MqWWtrE5ILBnCwwwiGOdskY5 ElJv9Qnsm/b7c+AQi57Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrUAc-002uv9-92; Thu, 10 Jun 2021 23:33:06 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrUAW-002utn-6s for linux-arm-kernel@lists.infradead.org; Thu, 10 Jun 2021 23:33:01 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06CB7613F5; Thu, 10 Jun 2021 23:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623367979; bh=5Ko7Rq/QR9NVEAWeDUO4huuw6PedGgRkrSNCex35rf8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=GFK+Ul2jFGh65k/v5b7T9VsTFqtyubnntXYtmjh6kR8nK+TxY2ds5yqtq2V08LKDj Jl0zV1OTPmvXQqCQB6VVpr6M9jhOwodVjP+9UoGCY8/sHeksReku3w85KqebVhV3vv Sv1/7sZGyV8KeErIK2/o/b3dynhaNkGB7LcDctQLVHPrzgdwQrQWZdOvgwVna21e/s ApbU+aSnuJ9kGZNkRzDZq7xdqzLdVgRrrnKg1t+csR+ZwSsRVQ0kBG8NUr483maZKQ qQAblClE2Ot+PHlkeVdoXdlWlI8MjeuyRlUGNYegFov/osj5jV5y7MmOTi5r9lpqR3 onyU7ipt8xQWw== Date: Thu, 10 Jun 2021 18:32:57 -0500 From: Bjorn Helgaas To: Sandor Bodo-Merle Cc: Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Pali =?iso-8859-1?Q?Roh=E1r?= Subject: Re: [PATCH 1/2] PCI: iproc: fix the base vector number allocation for multi-MSI Message-ID: <20210610233257.GA2794291@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210606123044.31250-1-sbodomerle@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210610_163300_329759_B3472DC3 X-CRM114-Status: GOOD ( 19.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Jun 06, 2021 at 02:30:43PM +0200, Sandor Bodo-Merle wrote: > Commit fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") > introduced multi-MSI support with a broken allocation mechanism (it failed > to reserve the proper number of bits from the inner domain). Natural > alignment of the base vector number was also not guaranteed. > = > Fixes: fc54bae28818 ("PCI: iproc: Allow allocation of multiple MSIs") > Reported-by: Pali Roh=E1r > Signed-off-by: Sandor Bodo-Merle Looks good to me; thanks for splitting this. I think Lorenzo will take care of this and maybe he'll also adjust the subject to match the other patch, e.g., - PCI: iproc: fix the base vector number allocation for multi-MSI + PCI: iproc: Fix multi-MSI base vector number allocation > --- > drivers/pci/controller/pcie-iproc-msi.c | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > = > diff --git a/drivers/pci/controller/pcie-iproc-msi.c b/drivers/pci/contro= ller/pcie-iproc-msi.c > index eede4e8f3f75..557d93dcb3bc 100644 > --- a/drivers/pci/controller/pcie-iproc-msi.c > +++ b/drivers/pci/controller/pcie-iproc-msi.c > @@ -252,18 +252,18 @@ static int iproc_msi_irq_domain_alloc(struct irq_do= main *domain, > = > mutex_lock(&msi->bitmap_lock); > = > - /* Allocate 'nr_cpus' number of MSI vectors each time */ > - hwirq =3D bitmap_find_next_zero_area(msi->bitmap, msi->nr_msi_vecs, 0, > - msi->nr_cpus, 0); > - if (hwirq < msi->nr_msi_vecs) { > - bitmap_set(msi->bitmap, hwirq, msi->nr_cpus); > - } else { > - mutex_unlock(&msi->bitmap_lock); > - return -ENOSPC; > - } > + /* > + * Allocate 'nr_irqs' multiplied by 'nr_cpus' number of MSI vectors > + * each time > + */ > + hwirq =3D bitmap_find_free_region(msi->bitmap, msi->nr_msi_vecs, > + order_base_2(msi->nr_cpus * nr_irqs)); > = > mutex_unlock(&msi->bitmap_lock); > = > + if (hwirq < 0) > + return -ENOSPC; > + > for (i =3D 0; i < nr_irqs; i++) { > irq_domain_set_info(domain, virq + i, hwirq + i, > &iproc_msi_bottom_irq_chip, > @@ -284,7 +284,8 @@ static void iproc_msi_irq_domain_free(struct irq_doma= in *domain, > mutex_lock(&msi->bitmap_lock); > = > hwirq =3D hwirq_to_canonical_hwirq(msi, data->hwirq); > - bitmap_clear(msi->bitmap, hwirq, msi->nr_cpus); > + bitmap_release_region(msi->bitmap, hwirq, > + order_base_2(msi->nr_cpus * nr_irqs)); > = > mutex_unlock(&msi->bitmap_lock); > = > -- = > 2.31.0 > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel