From: Yijing Wang <wangyijing@huawei.com> To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, Russell King <linux@arm.linux.org.uk>, Paul.Mundt@huawei.com, Marc Zyngier <marc.zyngier@arm.com>, linux-pci@vger.kernel.org, "James E.J. Bottomley" <jejb@parisc-linux.org>, virtualization@lists.linux-foundation.org, Xinwei Hu <huxinwei@huawei.com>, Yijing Wang <wangyijing@huawei.com>, Hanjun Guo <guohanjun@huawei.com>, Bjorn Helgaas <bhelgaas@google.com>, Wuyun <wuyun.wu@huawei.com>, arnab.basu@freescale.com, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 05/11] PCI/MSI: Move populate_msi_sysfs() out of msi_capability_init() Date: Sat, 26 Jul 2014 11:08:42 +0800 [thread overview] Message-ID: <1406344128-27055-6-git-send-email-wangyijing@huawei.com> (raw) In-Reply-To: <1406344128-27055-1-git-send-email-wangyijing@huawei.com> Because some Non-PCI devices don't need to create sysfs object, so move populate_msi_sysfs() out of generic MSI function msi/x_capability_init(). Signed-off-by: Yijing Wang <wangyijing@huawei.com> --- drivers/pci/msi.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 116383c..21b16e0 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -646,13 +646,6 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) return ret; } - ret = populate_msi_sysfs(dev); - if (ret) { - msi_mask_irq(entry, mask, ~mask); - free_msi_irqs(dev); - return ret; - } - /* Set MSI enabled bits */ pci_intx_for_msi(dev, 0); msi_set_enable(dev, 1); @@ -760,10 +753,6 @@ static int msix_capability_init(struct pci_dev *dev, void __iomem *base, msix_program_entries(dev, entries); - ret = populate_msi_sysfs(dev); - if (ret) - goto out_free; - /* Set MSI-X enabled bits and unmask the function */ pci_intx_for_msi(dev, 0); dev->msix_enabled = 1; @@ -789,7 +778,6 @@ out_avail: ret = avail; } -out_free: free_msi_irqs(dev); return ret; @@ -939,7 +927,7 @@ EXPORT_SYMBOL(pci_msix_vec_count); int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) { int status, nr_entries; - int i, j; + int i, j, ret; void __iomem *base; u16 control; @@ -980,6 +968,14 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) return -ENOMEM; status = msix_capability_init(dev, base, entries, nvec); + if (!status) { + ret = populate_msi_sysfs(dev); + if (ret) { + dev->msix_enabled = 0; + pci_intx_for_msi(dev, 1); + free_msi_irqs(dev); + } + } return status; } EXPORT_SYMBOL(pci_enable_msix); @@ -1109,6 +1105,15 @@ int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec) } } while (rc); + rc = populate_msi_sysfs(dev); + if (rc) { + msi_set_enable(dev, 0); + pci_intx_for_msi(dev, 1); + dev->msi_enabled = 0; + free_msi_irqs(dev); + return rc; + } + return nvec; } EXPORT_SYMBOL(pci_enable_msi_range); -- 1.7.1
WARNING: multiple messages have this Message-ID (diff)
From: Yijing Wang <wangyijing@huawei.com> To: linux-kernel@vger.kernel.org Cc: Xinwei Hu <huxinwei@huawei.com>, Wuyun <wuyun.wu@huawei.com>, Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org, Paul.Mundt@huawei.com, "James E.J. Bottomley" <jejb@parisc-linux.org>, Marc Zyngier <marc.zyngier@arm.com>, linux-arm-kernel@lists.infradead.org, Russell King <linux@arm.linux.org.uk>, linux-arch@vger.kernel.org, arnab.basu@freescale.com, virtualization@lists.linux-foundation.org, Hanjun Guo <guohanjun@huawei.com>, Yijing Wang <wangyijing@huawei.com> Subject: [RFC PATCH 05/11] PCI/MSI: Move populate_msi_sysfs() out of msi_capability_init() Date: Sat, 26 Jul 2014 11:08:42 +0800 [thread overview] Message-ID: <1406344128-27055-6-git-send-email-wangyijing@huawei.com> (raw) Message-ID: <20140726030842.S1j54diNqfYPOufISll9MIpDF7n87t1KhdxrU0-KjdU@z> (raw) In-Reply-To: <1406344128-27055-1-git-send-email-wangyijing@huawei.com> Because some Non-PCI devices don't need to create sysfs object, so move populate_msi_sysfs() out of generic MSI function msi/x_capability_init(). Signed-off-by: Yijing Wang <wangyijing@huawei.com> --- drivers/pci/msi.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 116383c..21b16e0 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -646,13 +646,6 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) return ret; } - ret = populate_msi_sysfs(dev); - if (ret) { - msi_mask_irq(entry, mask, ~mask); - free_msi_irqs(dev); - return ret; - } - /* Set MSI enabled bits */ pci_intx_for_msi(dev, 0); msi_set_enable(dev, 1); @@ -760,10 +753,6 @@ static int msix_capability_init(struct pci_dev *dev, void __iomem *base, msix_program_entries(dev, entries); - ret = populate_msi_sysfs(dev); - if (ret) - goto out_free; - /* Set MSI-X enabled bits and unmask the function */ pci_intx_for_msi(dev, 0); dev->msix_enabled = 1; @@ -789,7 +778,6 @@ out_avail: ret = avail; } -out_free: free_msi_irqs(dev); return ret; @@ -939,7 +927,7 @@ EXPORT_SYMBOL(pci_msix_vec_count); int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) { int status, nr_entries; - int i, j; + int i, j, ret; void __iomem *base; u16 control; @@ -980,6 +968,14 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) return -ENOMEM; status = msix_capability_init(dev, base, entries, nvec); + if (!status) { + ret = populate_msi_sysfs(dev); + if (ret) { + dev->msix_enabled = 0; + pci_intx_for_msi(dev, 1); + free_msi_irqs(dev); + } + } return status; } EXPORT_SYMBOL(pci_enable_msix); @@ -1109,6 +1105,15 @@ int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec) } } while (rc); + rc = populate_msi_sysfs(dev); + if (rc) { + msi_set_enable(dev, 0); + pci_intx_for_msi(dev, 1); + dev->msi_enabled = 0; + free_msi_irqs(dev); + return rc; + } + return nvec; } EXPORT_SYMBOL(pci_enable_msi_range); -- 1.7.1
next prev parent reply other threads:[~2014-07-26 3:08 UTC|newest] Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-26 3:08 [RFC PATCH 00/11] Refactor MSI to support Non-PCI device Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 01/11] PCI/MSI: Use pci_dev->msi_cap instead of msi_desc->msi_attrib.pos Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 02/11] PCI/MSI: Use new MSI type macro instead of PCI MSI flags Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 03/11] PCI/MSI: Refactor pci_dev_msi_enabled() Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-08-05 22:35 ` Stuart Yoder 2014-08-05 22:35 ` Stuart Yoder 2014-08-06 1:23 ` Yijing Wang 2014-08-06 1:23 ` Yijing Wang 2014-08-20 5:57 ` Bharat.Bhushan 2014-08-20 5:57 ` Bharat.Bhushan 2014-08-20 6:30 ` Yijing Wang 2014-08-20 6:30 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 04/11] PCI/MSI: Move MSIX table address mapping out of msix_capability_init Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-07-26 3:08 ` Yijing Wang [this message] 2014-07-26 3:08 ` [RFC PATCH 05/11] PCI/MSI: Move populate_msi_sysfs() out of msi_capability_init() Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 06/11] PCI/MSI: Save MSI irq in PCI MSI layer Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 07/11] PCI/MSI: Mask MSI-X entry in msix_setup_entries() Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 08/11] PCI/MSI: Introduce new struct msi_irqs and struct msi_ops Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 09/11] PCI/MSI: refactor PCI MSI driver Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-08-20 6:06 ` Bharat.Bhushan 2014-08-20 6:06 ` Bharat.Bhushan 2014-08-20 6:34 ` Yijing Wang 2014-08-20 6:34 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 10/11] PCI/MSI: Split the generic MSI code into new file Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-08-20 6:18 ` Bharat.Bhushan 2014-08-20 6:18 ` Bharat.Bhushan 2014-08-20 6:43 ` Yijing Wang 2014-08-20 6:43 ` Yijing Wang 2014-07-26 3:08 ` [RFC PATCH 11/11] x86/MSI: Refactor x86 MSI code Yijing Wang 2014-07-26 3:08 ` Yijing Wang 2014-08-20 6:20 ` Bharat.Bhushan 2014-08-20 6:20 ` Bharat.Bhushan 2014-08-20 7:01 ` Yijing Wang 2014-07-29 14:08 ` [RFC PATCH 00/11] Refactor MSI to support Non-PCI device Arnd Bergmann 2014-07-29 14:08 ` Arnd Bergmann 2014-07-30 2:45 ` Yijing Wang 2014-07-30 2:45 ` Yijing Wang 2014-07-30 6:47 ` Jiang Liu 2014-07-30 6:47 ` Jiang Liu 2014-07-30 7:20 ` Yijing Wang 2014-08-01 13:16 ` Arnd Bergmann 2014-08-01 13:16 ` Arnd Bergmann 2014-08-04 3:32 ` Yijing Wang 2014-08-04 3:32 ` Yijing Wang 2014-08-04 14:45 ` Arnd Bergmann 2014-08-05 2:20 ` Yijing Wang 2014-08-05 2:20 ` Yijing Wang 2014-08-01 13:52 ` Arnd Bergmann 2014-08-01 13:52 ` Arnd Bergmann 2014-08-04 6:43 ` Yijing Wang 2014-08-04 6:43 ` Yijing Wang 2014-08-04 14:59 ` Arnd Bergmann 2014-08-04 14:59 ` Arnd Bergmann 2014-08-05 2:12 ` Yijing Wang 2014-08-05 2:12 ` Yijing Wang 2014-08-01 10:27 ` arnab.basu 2014-08-04 3:03 ` Yijing Wang 2014-08-04 3:03 ` Yijing Wang 2014-08-20 5:44 ` Bharat.Bhushan 2014-08-20 5:44 ` Bharat.Bhushan 2014-08-20 6:28 ` Yijing Wang 2014-08-20 6:28 ` Yijing Wang 2014-08-20 7:41 ` Bharat.Bhushan 2014-08-20 7:41 ` Bharat.Bhushan 2014-08-20 7:55 ` Yijing Wang 2014-09-03 7:15 ` Yijing Wang
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=1406344128-27055-6-git-send-email-wangyijing@huawei.com \ --to=wangyijing@huawei.com \ --cc=Paul.Mundt@huawei.com \ --cc=arnab.basu@freescale.com \ --cc=bhelgaas@google.com \ --cc=guohanjun@huawei.com \ --cc=huxinwei@huawei.com \ --cc=jejb@parisc-linux.org \ --cc=linux-arch@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ --cc=marc.zyngier@arm.com \ --cc=virtualization@lists.linux-foundation.org \ --cc=wuyun.wu@huawei.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: linkBe 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).