From: Bjorn Helgaas <helgaas@kernel.org>
To: "Yong, Jonathan" <jonathan.yong@intel.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com
Subject: Re: [PATCH] PCI: PTM preliminary implementation
Date: Sat, 30 Apr 2016 07:19:44 -0500 [thread overview]
Message-ID: <20160430121944.GB10197@localhost> (raw)
In-Reply-To: <20160429162026.GC949@localhost>
On Fri, Apr 29, 2016 at 11:20:26AM -0500, Bjorn Helgaas wrote:
> On Tue, Apr 19, 2016 at 06:29:18AM +0000, Yong, Jonathan wrote:
> > ...
> > +static ssize_t ptm_status_show(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(dev);
> > + u16 word;
> > + int pos;
> > +
> > + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PTM);
> > + if (!pos)
> > + return -ENXIO;
> > +
> > + pci_read_config_word(pdev, pos + PCI_PTM_CONTROL_REG_OFFSET, &word);
>
> This is a 32-bit register; read it as a dword, even though the upper
> bits are currently reserved.
>
> > + 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);
Thinking about this sysfs interface some more... Do you think we
really need a knob in sysfs? What's the use case for it? I suppose
there's potentially a performance impact because we'll send more
messages across the link, but I'd be surprised if it were measurable.
If it's basically free, there shouldn't be a need to enable/disable it
individually, except maybe to work around hardware bugs. A kernel
boot parameter might be enough for that. Even a kernel boot parameter
should be regarded as a debug/testing tool, not a solution. If we
find broken devices, we should add quirks for them so users don't need
to use a boot parameter.
Bjorn
next prev parent reply other threads:[~2016-04-30 12:19 UTC|newest]
Thread overview: 25+ 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 [this message]
2016-05-10 3:52 ` Yong, Jonathan
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
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=20160430121944.GB10197@localhost \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=jonathan.yong@intel.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).