Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp880021rwb; Wed, 16 Nov 2022 08:51:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf78FoOh/yD2xXrtKJ9EVfnfxrIQdfA+jWRAZHUZhhI02HT/IKBsur+srE41h9ldF0mf8wkf X-Received: by 2002:a17:902:e94d:b0:188:8dc6:4eae with SMTP id b13-20020a170902e94d00b001888dc64eaemr9823935pll.2.1668617515845; Wed, 16 Nov 2022 08:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668617515; cv=none; d=google.com; s=arc-20160816; b=GIaUI1QvdHROy7QDNmKDi0TBhuJYxir1h8S6/M3sjC3OWMeWnIyDalQJZPM7pds1t+ QyqMCod6rMLErGWuClI9TOdXi6vXRctESHJAybnnJTiEXStHn1AaJTYeMc2KzpQYwAZB i3BKPr40Bs5hfS3zVzCgxzNfww8AbOQ4jNJjyHUXKgiWppOyHH4gizMBeuUV76LOLsSt q+K+XB2SuUCcxpsmILVZ80pxwUW4/nso1AeTOlbi3mlrneuN0c6npCyBTGapgQFwguoL qwqlels++PCQqJ4Z96+yeiz8u5WDAaXn3FpeynANEV04T7IvpICAxVfKQNoShiXnsOgk Ksrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=JwCVog+BdH1vajhB+dJh45OhhCBetRg+pizZ/BvmIXI=; b=mmjH6SgB23ILcwgn1+toA4IodL5Xiw6yiTdynnSU51SDUR42a4iEu0fjVmHQAgORxu o/cPIPCtK1YSXXacouQe4uJv8yN0kuhEMrksBjd4Rm1DD+DaM+3XjwIqk7iJIFbSLxCB SNYmebZyvBEpSGV6/9smHCQTUcVu9qZlj8KpqWZinb4b8oLBLn7ywW/UeMH1RG9uMrN7 pN2G0O6wEMBtfh9Zy86mFBHV2V94hKwNxSJ7paseo2K3bBRgXpyVKAV2A6+RnN+kPsKA htW0klLbfgqUcytEoqDiaKeH4N4+0mqfjksZfCXb8sMjHdXNETlgR0lLHjThAYsMnRr+ RGuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="vKfW/nDm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds14-20020a17090b08ce00b00213213d63bbsi2093634pjb.41.2022.11.16.08.51.44; Wed, 16 Nov 2022 08:51:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="vKfW/nDm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233608AbiKPQkU (ORCPT + 91 others); Wed, 16 Nov 2022 11:40:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234355AbiKPQjr (ORCPT ); Wed, 16 Nov 2022 11:39:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B1C606B6; Wed, 16 Nov 2022 08:35:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC7EBB81DFA; Wed, 16 Nov 2022 16:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 428B7C433C1; Wed, 16 Nov 2022 16:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668616519; bh=7lFiLHolyMGn6ahDnXfEkllCx/9ERpAkWUrxM/p/G9s=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=vKfW/nDmof5x1qGUsktU3mydNWRx1u9bhEjDkmydS/VWh2/xpfykSTgYa0kamGUhs bcf4kbzL85OpNgLTrOvOh2UUslQaypX7mNoM45JtDtpIR9zGOMomS1Wbgw/7SKDPN4 tmmP8HT71SQQ/UEzl1sAGcxs9eJGv6KNlSc2olb8MF1WxILw0MgJgAWcPuFl5kwj+D z1yQ/14WNHo/iN+pJsOviHJqamoR8SJpWPJkbpE+qQ1QygN0RcDV4cGduF02vI7YZw lK5hdTJWQSFr8k6/I1uRD95isxwVgodYtg33kYJPfe+evfsZclOWu/OCv1fd5mGqma E+ENti03HPFZQ== Date: Wed, 16 Nov 2022 10:35:17 -0600 From: Bjorn Helgaas To: Thomas Gleixner Cc: LKML , x86@kernel.org, Joerg Roedel , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , "Ahmed S. Darwish" , Reinette Chatre , Michael Ellerman , Christophe Leroy , linuxppc-dev@lists.ozlabs.org Subject: Re: [patch 28/39] PCI/MSI: Move pci_irq_get_affinity() to api.c Message-ID: <20221116163517.GA1116781@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111122015.214792769@linutronix.de> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 11, 2022 at 02:54:59PM +0100, Thomas Gleixner wrote: > From: Ahmed S. Darwish > > To distangle the maze in msi.c, all exported device-driver MSI APIs are > now to be grouped in one file, api.c. > > Move pci_irq_get_affinity() and let its kernel-doc match rest of the > file. > > Signed-off-by: Ahmed S. Darwish > Signed-off-by: Thomas Gleixner Acked-by: Bjorn Helgaas One nit below. > --- > drivers/pci/msi/api.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > drivers/pci/msi/msi.c | 38 -------------------------------------- > 2 files changed, 43 insertions(+), 38 deletions(-) > --- > diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c > index 653a61868ae6..473df7ba0584 100644 > --- a/drivers/pci/msi/api.c > +++ b/drivers/pci/msi/api.c > @@ -9,6 +9,7 @@ > */ > > #include > +#include > > #include "msi.h" > > @@ -251,6 +252,48 @@ int pci_irq_vector(struct pci_dev *dev, unsigned int nr) > EXPORT_SYMBOL(pci_irq_vector); > > /** > + * pci_irq_get_affinity() - Get a device interrupt vector affinity > + * @dev: the PCI device to operate on > + * @nr: device-relative interrupt vector index (0-based); has different > + * meanings, depending on interrupt mode > + * MSI-X the index in the MSI-X vector table > + * MSI the index of the enabled MSI vectors > + * INTx must be 0 > + * > + * Return: MSI/MSI-X vector affinity, NULL if @nr is out of range or if > + * the MSI(-X) vector was allocated without explicit affinity > + * requirements (e.g., by pci_enable_msi(), pci_enable_msix_range(), or > + * pci_alloc_irq_vectors() without the %PCI_IRQ_AFFINITY flag). Return a > + * generic set of CPU ids representing all possible CPUs available > + * during system boot if the device is in legacy INTx mode. s/ids/IDs/ > + */ > +const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) > +{ > + int idx, irq = pci_irq_vector(dev, nr); > + struct msi_desc *desc; > + > + if (WARN_ON_ONCE(irq <= 0)) > + return NULL; > + > + desc = irq_get_msi_desc(irq); > + /* Non-MSI does not have the information handy */ > + if (!desc) > + return cpu_possible_mask; > + > + /* MSI[X] interrupts can be allocated without affinity descriptor */ > + if (!desc->affinity) > + return NULL; > + > + /* > + * MSI has a mask array in the descriptor. > + * MSI-X has a single mask. > + */ > + idx = dev->msi_enabled ? nr : 0; > + return &desc->affinity[idx].mask; > +} > +EXPORT_SYMBOL(pci_irq_get_affinity); > + > +/** > * pci_free_irq_vectors() - Free previously allocated IRQs for a device > * @dev: the PCI device to operate on > * > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c > index 6fa90d07d2e4..d78646d1c116 100644 > --- a/drivers/pci/msi/msi.c > +++ b/drivers/pci/msi/msi.c > @@ -854,44 +854,6 @@ int __pci_enable_msix_range(struct pci_dev *dev, > } > } > > -/** > - * pci_irq_get_affinity - return the affinity of a particular MSI vector > - * @dev: PCI device to operate on > - * @nr: device-relative interrupt vector index (0-based). > - * > - * @nr has the following meanings depending on the interrupt mode: > - * MSI-X: The index in the MSI-X vector table > - * MSI: The index of the enabled MSI vectors > - * INTx: Must be 0 > - * > - * Return: A cpumask pointer or NULL if @nr is out of range > - */ > -const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) > -{ > - int idx, irq = pci_irq_vector(dev, nr); > - struct msi_desc *desc; > - > - if (WARN_ON_ONCE(irq <= 0)) > - return NULL; > - > - desc = irq_get_msi_desc(irq); > - /* Non-MSI does not have the information handy */ > - if (!desc) > - return cpu_possible_mask; > - > - /* MSI[X] interrupts can be allocated without affinity descriptor */ > - if (!desc->affinity) > - return NULL; > - > - /* > - * MSI has a mask array in the descriptor. > - * MSI-X has a single mask. > - */ > - idx = dev->msi_enabled ? nr : 0; > - return &desc->affinity[idx].mask; > -} > -EXPORT_SYMBOL(pci_irq_get_affinity); > - > struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc) > { > return to_pci_dev(desc->dev); >