linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Yijing Wang <wangyijing@huawei.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 3/5] PCI/MSI: Change msi_bus attribute to support enable/disable MSI for EP
Date: Mon, 22 Sep 2014 17:03:23 -0600	[thread overview]
Message-ID: <20140922230323.GL1880@google.com> (raw)
In-Reply-To: <1408694880-8260-4-git-send-email-wangyijing@huawei.com>

On Fri, Aug 22, 2014 at 04:07:58PM +0800, Yijing Wang wrote:
> 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 EP device MSI capability,
> not all devices share the same bus.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

What's the purpose of this?  Is this just for debugging?  I assume that if
you have an endpoint that requires MSI to be disabled, you'd have a quirk
to do that, not a sysfs interface.

This should probably be mentioned in
Documentation/ABI/testing/sysfs-bus-pci while you're at it.  I know it's
not there yet, but this seems like a good time to rectify that omission.

> ---
>  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
> 

  reply	other threads:[~2014-09-22 23:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22  8:07 [PATCH v2 0/5] Some cleanup for MSI code Yijing Wang
2014-08-22  8:07 ` [PATCH v2 1/5] PCI/MSI: Clean up the kobject in struct msi_desc Yijing Wang
2014-08-22  8:07 ` [PATCH v2 2/5] PCI/MSI: Remove msi_attrib->pos " Yijing Wang
2014-08-22  8:07 ` [PATCH v2 3/5] PCI/MSI: Change msi_bus attribute to support enable/disable MSI for EP Yijing Wang
2014-09-22 23:03   ` Bjorn Helgaas [this message]
2014-09-23  1:20     ` Yijing Wang
2014-08-22  8:07 ` [PATCH v2 4/5] MSI: Use __get_cached_msi_msg() instead of get_cached_msi_msg() Yijing Wang
2014-09-22 23:08   ` Bjorn Helgaas
2014-09-23  1:22     ` Yijing Wang
2014-08-22  8:08 ` [PATCH v2 5/5] MSI: Use __read_msi_msg() instead of read_msi_msg() Yijing Wang
2014-09-16  6:34   ` Michael Ellerman
2014-09-16  6:47     ` 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=20140922230323.GL1880@google.com \
    --to=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=wangyijing@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: 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).