All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yong, Jonathan" <jonathan.yong@intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com
Subject: Re: [PATCH] PCI: PTM preliminary implementation
Date: Tue, 10 May 2016 11:52:53 +0800	[thread overview]
Message-ID: <57315B15.5030709@intel.com> (raw)
In-Reply-To: <20160429162026.GC949@localhost>

On 04/30/2016 00:20, Bjorn Helgaas wrote:

>> +	return sprintf(buf, "%u\n", word & PCI_PTM_CTRL_ENABLE ? 1 : 0);
>> +}
>> +
>> +static ssize_t ptm_status_store(struct device *dev,
>> +	struct device_attribute *attr, const char *buf, size_t count)
>> +{
>> +	struct pci_dev *pdev = to_pci_dev(dev);
>> +	unsigned long val;
>> +	ssize_t ret;
>> +
>> +	ret = kstrtoul(buf, 0, &val);
>> +	if (ret)
>> +		return ret;
>> +	if (val)
>> +		return pci_enable_ptm(pdev);
>> +	pci_disable_ptm(pdev);
>> +	return 0;
>> +}
>> +
>> +static DEVICE_ATTR_RW(ptm_status);
>> +
>> +void pcie_ptm_remove_sysfs_dev_files(struct pci_dev *dev)
>> +{
>> +	if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM))
>> +		return;
>> +	device_remove_file(&dev->dev, &dev_attr_ptm_status);
>> +}
>
> This is called in the device remove path.  Obviously we want to
> remove the sysfs file.  But we currently don't do anything to the PTM
> capability itself.
>
> What happens if the device has PTM enabled, we hotplug remove it
> (using the sysfs interface so the device stays physically present and
> powered up), manually disable PTM on the upstream switch, then hotplug
> add the device back?  If the switch has PTM disabled but the device
> has PTM enabled, that sounds like an illegal configuration.
>
> Is this scenario possible?  Maybe the hotplug remove would power off
> the device?  I guess the current pci_ptm_init() path actually would
> disable PTM on the new device because it's disabled on the upstream
> switch.
>
> But since PTM is autonomous once enabled, I would assume the new
> device (with PTM enabled) could send PTM messages upstream, and it
> sounds (per sec 6.22.3) like those would be treated as Unsupported
> Requests, which means we'd report errors.
>
> I think we might want to disable PTM before we remove a device.
>

I'm not familiar with PCI hotplug, release_slot in acpiphp_core.c?

  parent reply	other threads:[~2016-05-10  3:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19  6:29 [RFC v4] PCI: PTM Driver Yong, Jonathan
2016-04-19  6:29 ` [PATCH] PCI: PTM preliminary implementation Yong, Jonathan
2016-04-29 16:20   ` Bjorn Helgaas
2016-04-30 12:19     ` Bjorn Helgaas
2016-05-10  3:52     ` Yong, Jonathan [this message]
2016-05-08  2:38   ` Bjorn Helgaas
2016-05-09  3:11     ` Yong, Jonathan
2016-05-09 13:35       ` Bjorn Helgaas
2016-04-27 23:18 ` [RFC v4] PCI: PTM Driver Yong, Jonathan
2016-04-29 14:17 ` Bjorn Helgaas
2016-05-03  9:02   ` Yong, Jonathan
2016-05-03 14:55     ` Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2016-04-19  6:24 Yong, Jonathan
2016-04-19  6:24 ` [PATCH] PCI: PTM preliminary implementation Yong, Jonathan
2016-03-23  4:04 [RFC v3] PCI: PTM Driver Yong, Jonathan
2016-03-23  4:04 ` [PATCH] PCI: PTM preliminary implementation Yong, Jonathan
2016-04-12  4:23   ` Bjorn Helgaas
2016-04-12  4:48     ` Bjorn Helgaas
2016-03-23  2:47 [RFC v2] PCI: PTM Driver Yong, Jonathan
2016-03-23  2:47 ` [PATCH] PCI: PTM preliminary implementation Yong, Jonathan
2016-03-23  3:11   ` kbuild test robot
2016-03-23  3:57   ` kbuild test robot
2016-03-11  7:26 [RFC] PCI: PTM Driver Yong, Jonathan
2016-03-11  7:26 ` [PATCH] PCI: PTM preliminary implementation Yong, Jonathan
2016-03-11 15:53   ` Bjorn Helgaas
2016-03-14  7:44     ` Yong, Jonathan
2016-03-14 15:42       ` Bjorn Helgaas
2016-03-15  8:27         ` Yong, Jonathan
2016-03-15 13:36           ` Bjorn Helgaas
2016-02-29  7:29 [RFC] PCI: PTM Driver Yong, Jonathan
2016-02-29  7:29 ` [PATCH] PCI: PTM preliminary implementation Yong, Jonathan

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=57315B15.5030709@intel.com \
    --to=jonathan.yong@intel.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.