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=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 0D250C433E1 for ; Tue, 25 Aug 2020 20:03:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4E222072D for ; Tue, 25 Aug 2020 20:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598385814; bh=bLQ/6Ns9xbbW32dBksiiwUFLCmw1usZgfNu6wzOIRRA=; h=Date:From:To:Cc:Subject:In-Reply-To:List-ID:From; b=GS9i159SQT5fIg8TujaWVSESAvnaA4lPYx26Uw5DXmysCX/Yqbd+q2pd0wHE+uIqm BS8wm4LLJaaRB2SOBR0TiphIVw/00ZPlVfT1NJdCuISuvuQSCCLLiZH+dQRCnqC1TQ uNkjiN08I0OR/k0/RNtLCqStz1HJ8NRSHf5heLyY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbgHYUDd (ORCPT ); Tue, 25 Aug 2020 16:03:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:44224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHYUDb (ORCPT ); Tue, 25 Aug 2020 16:03:31 -0400 Received: from localhost (104.sub-72-107-126.myvzw.com [72.107.126.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ADB662072D; Tue, 25 Aug 2020 20:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598385811; bh=bLQ/6Ns9xbbW32dBksiiwUFLCmw1usZgfNu6wzOIRRA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=l4bpkPmXM7023mZgcud7LiuXiDySo6mIf1kjucmaMFMfdwWuxCgjMXMMeZWTQlTNZ S8ccFLX7/o+uLWvZssFvEMAlrztDO4R5uWWMK5/l+J5KEs2v6I2ftwQ6ue1mdzaRhM G1nZBjJwkbjF80aF+i2KZjX8PiAMGCDb4+gafrqQ= Date: Tue, 25 Aug 2020 15:03:29 -0500 From: Bjorn Helgaas To: Thomas Gleixner Cc: LKML , x86@kernel.org, linux-pci@vger.kernel.org, Joerg Roedel , iommu@lists.linux-foundation.org, linux-hyperv@vger.kernel.org, Haiyang Zhang , Jon Derrick , Lu Baolu , Wei Liu , "K. Y. Srinivasan" , Stephen Hemminger , Steve Wahl , Dimitri Sivanich , Russ Anderson , Bjorn Helgaas , Lorenzo Pieralisi , Konrad Rzeszutek Wilk , xen-devel@lists.xenproject.org, Juergen Gross , Boris Ostrovsky , Stefano Stabellini , Marc Zyngier , Greg Kroah-Hartman , "Rafael J. Wysocki" , Megha Dey , Jason Gunthorpe , Dave Jiang , Alex Williamson , Jacob Pan , Baolu Lu , Kevin Tian , Dan Williams Subject: Re: [patch RFC 13/38] PCI: MSI: Rework pci_msi_domain_calc_hwirq() Message-ID: <20200825200329.GA1923406@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200821002946.594509001@linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 02:24:37AM +0200, Thomas Gleixner wrote: > Retrieve the PCI device from the msi descriptor instead of doing so at the > call sites. I'd like it *better* with "PCI/MSI: " in the subject (to match history and other patches in this series) and "MSI" here in the commit log, but nice cleanup and: Acked-by: Bjorn Helgaas Minor comments below. > Signed-off-by: Thomas Gleixner > Cc: linux-pci@vger.kernel.org > --- > arch/x86/kernel/apic/msi.c | 2 +- > drivers/pci/msi.c | 13 ++++++------- > include/linux/msi.h | 3 +-- > 3 files changed, 8 insertions(+), 10 deletions(-) > > --- a/arch/x86/kernel/apic/msi.c > +++ b/arch/x86/kernel/apic/msi.c > @@ -232,7 +232,7 @@ EXPORT_SYMBOL_GPL(pci_msi_prepare); > > void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) > { > - arg->msi_hwirq = pci_msi_domain_calc_hwirq(arg->msi_dev, desc); > + arg->msi_hwirq = pci_msi_domain_calc_hwirq(desc); I guess it's safe to assume that "arg->msi_dev == msi_desc_to_pci_dev(desc)"? I didn't try to verify that. > } > EXPORT_SYMBOL_GPL(pci_msi_set_desc); > > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -1346,17 +1346,17 @@ void pci_msi_domain_write_msg(struct irq > > /** > * pci_msi_domain_calc_hwirq - Generate a unique ID for an MSI source > - * @dev: Pointer to the PCI device > * @desc: Pointer to the MSI descriptor > * > * The ID number is only used within the irqdomain. > */ > -irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev, > - struct msi_desc *desc) > +irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc) > { > + struct pci_dev *pdev = msi_desc_to_pci_dev(desc); If you named this "struct pci_dev *dev" (not "pdev"), the diff would be a little smaller and it would match other usage in the file. > return (irq_hw_number_t)desc->msi_attrib.entry_nr | > - pci_dev_id(dev) << 11 | > - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; > + pci_dev_id(pdev) << 11 | > + (pci_domain_nr(pdev->bus) & 0xFFFFFFFF) << 27; > } > > static inline bool pci_msi_desc_is_multi_msi(struct msi_desc *desc) > @@ -1406,8 +1406,7 @@ static void pci_msi_domain_set_desc(msi_ > struct msi_desc *desc) > { > arg->desc = desc; > - arg->hwirq = pci_msi_domain_calc_hwirq(msi_desc_to_pci_dev(desc), > - desc); > + arg->hwirq = pci_msi_domain_calc_hwirq(desc); > } > #else > #define pci_msi_domain_set_desc NULL > --- a/include/linux/msi.h > +++ b/include/linux/msi.h > @@ -369,8 +369,7 @@ void pci_msi_domain_write_msg(struct irq > struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode, > struct msi_domain_info *info, > struct irq_domain *parent); > -irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev, > - struct msi_desc *desc); > +irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc); > int pci_msi_domain_check_cap(struct irq_domain *domain, > struct msi_domain_info *info, struct device *dev); > u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev); > 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=-6.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 162FCC433E3 for ; Tue, 25 Aug 2020 20:03:36 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 DB3A72072D for ; Tue, 25 Aug 2020 20:03:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="l4bpkPmX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB3A72072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9C3618769E; Tue, 25 Aug 2020 20:03:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cYUsyzDsBObu; Tue, 25 Aug 2020 20:03:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 82CD287673; Tue, 25 Aug 2020 20:03:34 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 60413C07FF; Tue, 25 Aug 2020 20:03:34 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 12C9BC0051 for ; Tue, 25 Aug 2020 20:03:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 06111882A4 for ; Tue, 25 Aug 2020 20:03:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AILuliA9Zcgu for ; Tue, 25 Aug 2020 20:03:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by hemlock.osuosl.org (Postfix) with ESMTPS id 747868829D for ; Tue, 25 Aug 2020 20:03:31 +0000 (UTC) Received: from localhost (104.sub-72-107-126.myvzw.com [72.107.126.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ADB662072D; Tue, 25 Aug 2020 20:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598385811; bh=bLQ/6Ns9xbbW32dBksiiwUFLCmw1usZgfNu6wzOIRRA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=l4bpkPmXM7023mZgcud7LiuXiDySo6mIf1kjucmaMFMfdwWuxCgjMXMMeZWTQlTNZ S8ccFLX7/o+uLWvZssFvEMAlrztDO4R5uWWMK5/l+J5KEs2v6I2ftwQ6ue1mdzaRhM G1nZBjJwkbjF80aF+i2KZjX8PiAMGCDb4+gafrqQ= Date: Tue, 25 Aug 2020 15:03:29 -0500 From: Bjorn Helgaas To: Thomas Gleixner Subject: Re: [patch RFC 13/38] PCI: MSI: Rework pci_msi_domain_calc_hwirq() Message-ID: <20200825200329.GA1923406@bjorn-Precision-5520> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200821002946.594509001@linutronix.de> Cc: Dimitri Sivanich , linux-hyperv@vger.kernel.org, Steve Wahl , linux-pci@vger.kernel.org, "K. Y. Srinivasan" , Dan Williams , Wei Liu , Stephen Hemminger , Baolu Lu , Marc Zyngier , x86@kernel.org, Jason Gunthorpe , Megha Dey , xen-devel@lists.xenproject.org, Kevin Tian , Konrad Rzeszutek Wilk , Haiyang Zhang , Alex Williamson , Stefano Stabellini , Bjorn Helgaas , Dave Jiang , Boris Ostrovsky , Jon Derrick , Juergen Gross , Russ Anderson , Greg Kroah-Hartman , LKML , iommu@lists.linux-foundation.org, Jacob Pan , "Rafael J. Wysocki" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, Aug 21, 2020 at 02:24:37AM +0200, Thomas Gleixner wrote: > Retrieve the PCI device from the msi descriptor instead of doing so at the > call sites. I'd like it *better* with "PCI/MSI: " in the subject (to match history and other patches in this series) and "MSI" here in the commit log, but nice cleanup and: Acked-by: Bjorn Helgaas Minor comments below. > Signed-off-by: Thomas Gleixner > Cc: linux-pci@vger.kernel.org > --- > arch/x86/kernel/apic/msi.c | 2 +- > drivers/pci/msi.c | 13 ++++++------- > include/linux/msi.h | 3 +-- > 3 files changed, 8 insertions(+), 10 deletions(-) > > --- a/arch/x86/kernel/apic/msi.c > +++ b/arch/x86/kernel/apic/msi.c > @@ -232,7 +232,7 @@ EXPORT_SYMBOL_GPL(pci_msi_prepare); > > void pci_msi_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) > { > - arg->msi_hwirq = pci_msi_domain_calc_hwirq(arg->msi_dev, desc); > + arg->msi_hwirq = pci_msi_domain_calc_hwirq(desc); I guess it's safe to assume that "arg->msi_dev == msi_desc_to_pci_dev(desc)"? I didn't try to verify that. > } > EXPORT_SYMBOL_GPL(pci_msi_set_desc); > > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -1346,17 +1346,17 @@ void pci_msi_domain_write_msg(struct irq > > /** > * pci_msi_domain_calc_hwirq - Generate a unique ID for an MSI source > - * @dev: Pointer to the PCI device > * @desc: Pointer to the MSI descriptor > * > * The ID number is only used within the irqdomain. > */ > -irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev, > - struct msi_desc *desc) > +irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc) > { > + struct pci_dev *pdev = msi_desc_to_pci_dev(desc); If you named this "struct pci_dev *dev" (not "pdev"), the diff would be a little smaller and it would match other usage in the file. > return (irq_hw_number_t)desc->msi_attrib.entry_nr | > - pci_dev_id(dev) << 11 | > - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; > + pci_dev_id(pdev) << 11 | > + (pci_domain_nr(pdev->bus) & 0xFFFFFFFF) << 27; > } > > static inline bool pci_msi_desc_is_multi_msi(struct msi_desc *desc) > @@ -1406,8 +1406,7 @@ static void pci_msi_domain_set_desc(msi_ > struct msi_desc *desc) > { > arg->desc = desc; > - arg->hwirq = pci_msi_domain_calc_hwirq(msi_desc_to_pci_dev(desc), > - desc); > + arg->hwirq = pci_msi_domain_calc_hwirq(desc); > } > #else > #define pci_msi_domain_set_desc NULL > --- a/include/linux/msi.h > +++ b/include/linux/msi.h > @@ -369,8 +369,7 @@ void pci_msi_domain_write_msg(struct irq > struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode, > struct msi_domain_info *info, > struct irq_domain *parent); > -irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev, > - struct msi_desc *desc); > +irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc); > int pci_msi_domain_check_cap(struct irq_domain *domain, > struct msi_domain_info *info, struct device *dev); > u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev); > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu