From: Logan Gunthorpe <logang@deltatee.com>
To: Bjorn Helgaas <helgaas@kernel.org>,
Alexander Fomichev <fomichev.ru@gmail.com>
Cc: linux-pci@vger.kernel.org, linux@yadro.com,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-pm@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH RESEND] PCI: disable runtime PM for PLX switches
Date: Wed, 24 Apr 2019 10:01:22 -0600 [thread overview]
Message-ID: <05e3edbe-de1f-e7da-013f-4c4d0c8a07ce@deltatee.com> (raw)
In-Reply-To: <20190424141148.GA244134@google.com>
On 2019-04-24 8:11 a.m., Bjorn Helgaas wrote:
> [+cc Mika for runtime PM of bridges, Logan for switchtec question]
>
> On Wed, Apr 24, 2019 at 01:01:02PM +0300, Alexander Fomichev wrote:
>> On Tue, Apr 23, 2019 at 04:53:40PM -0500, Bjorn Helgaas wrote:
>>> On Mon, Apr 15, 2019 at 09:15:54AM -0500, Bjorn Helgaas wrote:
>>>> On Mon, Apr 15, 2019 at 04:59:03PM +0300, Alexander Fomichev wrote:
>>>>> PLX switches have an issue that their internal registers
>>>>> become inaccessible when runtime PM is enabled. Therefore PLX
>>>>> service tools can't communicate with the hardware. A kernel
>>>>> option "pcie_port_pm=off" can be used as a workaround. But it
>>>>> affects all the devices.
>>>>>
>>>>> So this solution is to add PLX switch devices to the quirk
>>>>> list for disabling runtime PM only for them.
>>>>
>>>> I assume the problem is actually that the config space registers
>>>> are inaccessible when the device is in D3hot?
>>>
>>> Reading this again, I realize you said "internal registers". I
>>> don't know whether that actually means config space registers
>>> (which *should* work even when the device is in D3hot (see the
>>> PCIe reference below and PCI Power Management Spec r1.2, sec
>>> 5.4.1)), or MMIO registers (which are not expected to work while
>>> in D3hot).
>>>
>>> If the service tools read MMIO registers, presumably that goes
>>> through some driver that should be able to manage runtime PM. Or,
>>> if there's no driver, I think your service tool could prevent
>>> runtime power management by changing
>>> /sys/devices/.../power/control to "on" (see
>>> Documentation/power/runtime_pm.txt).
>>
>> You're right. Config space registers are accessible. The driver
>> can't read/write MMIO registers (Device-Specific Registers as
>> they're called by Broadcom).
>
> Ah, perfect. That's exactly what's supposed to happen from a PCI
> hardware point of view. Unfortunately I don't know much about how
> Linux power management works, but Rafael and Mika do.
>
> How do your service tools access these MMIO registers?
>
> - via a PLX driver that provides read/write/ioctl on a char dev?
> - read/write on /sys/devices/pci*/.../resource<x> ?
> - mmap on /sys/devices/pci*/.../resource<x> ?
> - read/write on /dev/mem?
> - mmap on /dev/mem?
> - something else?
>
> I think there are several ways we might be able to fix this:
>
> - Write a driver along the lines of drivers/pci/switch/switchtec.c.
> I don't see any runtime PM stuff in that driver, so maybe it's
> magically taken care of by the PM/PCI core? There might also be
> an issue if both portdrv and your driver want to claim the same
> device. I don't know how switchtec deals with that.
Right, the switchtec device puts all its management MMIO registers
behind a separate PCIe function which lets us bind a different driver
and not conflict with the portdrv. I've noticed the PLX parts have an
extra unused BAR in their upstream port function which means it will be
an annoying hack to write a driver to use it seeing the portdrv needs to
be registered to it.
Logan
prev parent reply other threads:[~2019-04-24 16:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 13:59 [PATCH RESEND] PCI: disable runtime PM for PLX switches Alexander Fomichev
2019-04-15 14:15 ` Bjorn Helgaas
2019-04-23 21:53 ` Bjorn Helgaas
2019-04-24 10:01 ` Alexander Fomichev
2019-04-24 14:11 ` Bjorn Helgaas
2019-04-24 14:58 ` Mika Westerberg
2019-04-24 17:21 ` Bjorn Helgaas
2019-04-24 21:09 ` Rafael J. Wysocki
2019-06-27 11:06 ` Alexander Fomichev
2019-07-17 21:42 ` Bjorn Helgaas
2019-07-18 8:35 ` Rafael J. Wysocki
2019-04-24 16:01 ` Logan Gunthorpe [this message]
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=05e3edbe-de1f-e7da-013f-4c4d0c8a07ce@deltatee.com \
--to=logang@deltatee.com \
--cc=fomichev.ru@gmail.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@yadro.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
/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).