From: <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, Yijing Wang <wangyijing@huawei.com>
Subject: [PATCH 3/3] PCI/MSI: Refactor msi_bus to support EP enable/disable MSI
Date: Sat, 26 Jul 2014 09:48:36 +0800 [thread overview]
Message-ID: <1406339316-20163-4-git-send-email-wangyijing@huawei.com> (raw)
In-Reply-To: <1406339316-20163-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Msi_bus attribute is only valid for bridge device.
We can enable or disable MSI capability for a bus,
if we echo 1/0 > /sys/bus/pci/devices/$EP/msi_bus,
the action will be ignored. Sometime we need to
only enable/disable a device MSI, not all devices share
the same bus.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
drivers/pci/pci-sysfs.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 9ff0a90..b199ad9 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -251,11 +251,9 @@ static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr,
{
struct pci_dev *pdev = to_pci_dev(dev);
- if (!pdev->subordinate)
- return 0;
-
- return sprintf(buf, "%u\n",
- !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI));
+ return sprintf(buf, "%u\n", pdev->subordinate ?
+ !(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI)
+ : !pdev->no_msi);
}
static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
@@ -278,8 +276,10 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
* Maybe devices without subordinate buses shouldn't have this
* attribute in the first place?
*/
- if (!pdev->subordinate)
+ if (!pdev->subordinate) {
+ pdev->no_msi = !val;
return count;
+ }
/* Is the flag going to change, or keep the value it already had? */
if (!(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI) ^
--
1.7.1
next prev parent reply other threads:[~2014-07-26 1:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-26 1:48 [PATCH 0/3] trivial changes for MSI wangyijing
2014-07-26 1:48 ` [PATCH 1/3] PCI/MSI: Clean up the kobject in struct msi_desc wangyijing
2014-07-27 3:18 ` Greg Kroah-Hartman
2014-07-26 1:48 ` [PATCH 2/3] PCI/MSI: Remove msi_desc->msi_attrib.pos wangyijing
2014-07-26 1:48 ` wangyijing [this message]
2014-08-22 7:46 ` [PATCH 0/3] trivial changes for MSI 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=1406339316-20163-4-git-send-email-wangyijing@huawei.com \
--to=wangyijing@huawei.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
/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: link
Be 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).