From: huang ying <huang.ying.caritas@gmail.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Yan, Zheng" <zheng.z.yan@intel.com>,
bhelgaas@google.com, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, linux-pm@vger.kernel.org,
Lin Ming <ming.m.lin@intel.com>, Zhang Rui <rui.zhang@intel.com>,
ACPI Devel Mailing List <linux-acpi@vger.kernel.org>
Subject: Re: [RFC PATCH] PCIe: Add PCIe runtime D3cold support
Date: Thu, 19 Apr 2012 10:08:08 +0800 [thread overview]
Message-ID: <CAC=cRTMPrSsK5Y8uVxVrtGNqJAGFyRMLU7WsYm185siZd-V_8w@mail.gmail.com> (raw)
In-Reply-To: <201204182251.46335.rjw@sisk.pl>
On Thu, Apr 19, 2012 at 4:51 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Wednesday, April 18, 2012, huang ying wrote:
>> On Wed, Apr 18, 2012 at 5:10 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
>> > On Tuesday, April 17, 2012, huang ying wrote:
>> >> On Tue, Apr 17, 2012 at 5:30 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
>> >> >> >> + return 0;
>> >> >> >> +}
>> >> >> >> +
>> >> >> >> +static int pcie_port_runtime_resume(struct device *dev)
>> >> >> >> +{
>> >> >> >> + struct pci_dev *pdev = to_pci_dev(dev);
>> >> >> >> +
>> >> >> >> + pci_restore_state(pdev);
>> >> >> >> + if (pdev->runtime_d3cold)
>> >> >> >> + msleep(100);
>> >> >> >
>> >> >> > What's _that_ supposed to do?
>> >> >>
>> >> >> When resume from d3cold, PCIe main link will be powered on again, it
>> >> >> will take quite some time before the main link go into L0 state.
>> >> >> Otherwise, accessing devices under the port may return wrong result.
>> >> >
>> >> > OK, but this is generic code and as per the standard the link should have been
>> >> > reestablished at this point already.
>> >> >
>> >> > Please don't put some nonstandard-platform-specific quirks like this into
>> >> > code that's supposed to handle _every_ PCIe system.
>> >>
>> >> After checking PCIe spec, I found that the 100ms here has its standard origin :)
>> >>
>> >> In PCI Express Base Specification Revision 2.0:
>> >>
>> >> Section 6.6.1 Conventional Reset
>> >>
>> >> "
>> >> To allow components to perform internal initialization, system
>> >> software must wait for at least
>> >> 100 ms from the end of a Conventional Reset of one or more devices
>> >> before it is permitted to
>> >> issue Configuration Requests to those devices
>> >> "
>> >>
>> >> But I think we should move the 100ms delay here to PCIe bus code or
>> >> PCIe/ACPI code, because that is needed by all PCIe devices for D3cold
>> >> support.
>> >
>> > I think it should be sufficient to wait for the PME message to arrive at
>> > the root port (which will cause the PME interrupt to appear), at which
>> > point the device that sent it should be able to receive configuration
>> > requests.
>>
>> For remote wake up, it is sufficient. But for host wake up, we still
>> need to wait 100ms.
>
> Yes, we do.
>
>> > At this point, I need to konw what exactly happens when the GPE is triggered
>> > by WAKE#.
>>
>> - Lxx handler will be executed
>> - in Lxx handler, Notify the ACPI handle PCIe port
>> - Linux has registered a handler for the ACPI handle of PCIe port, in
>> the handler, turn on _PR0 and execute _PS0, which will power on the
>> link.
>
> But the handler we have is not the handler we want here.
>
> In fact, there are two handlers, pci_acpi_wake_bus() and pci_acpi_wake_dev()
> and they only do useful things for ACPI_NOTIFY_DEVICE_WAKE. Is that the
> event type we receive from that _Lxx?
I check the DSDT, in _Lxx, there is
Notify (\_SB.PCI0.RP03, 0x02)
That is, the event type is ACPI_NOTIFY_DEVICE_WAKE.
> Even if so, these routines don't seem to be suitable to handle the case at hand.
Yes. Maybe add a flag named like "come_from_d3cold", and if
come_from_d3cold == true, resume the dev itself without checking pme
bits, because the PCIe main link is not available now.
Best Regards,
Huang Ying
next prev parent reply other threads:[~2012-04-19 2:08 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 2:35 [RFC PATCH] PCIe: Add PCIe runtime D3cold support Yan, Zheng
2012-04-13 6:06 ` Alex He
2012-04-13 6:28 ` Yan, Zheng
2012-04-16 8:15 ` huang ying
2012-04-13 19:41 ` Rafael J. Wysocki
2012-04-16 0:48 ` Lin Ming
2012-04-16 16:26 ` Rafael J. Wysocki
2012-04-16 2:23 ` Yan, Zheng
2012-04-16 17:07 ` Rafael J. Wysocki
2012-04-17 2:07 ` huang ying
2012-04-17 20:20 ` Rafael J. Wysocki
2012-04-18 1:19 ` huang ying
2012-04-18 19:51 ` Rafael J. Wysocki
2012-04-17 2:12 ` Yan, Zheng
2012-04-17 5:32 ` huang ying
2012-04-17 20:43 ` Rafael J. Wysocki
2012-04-18 1:22 ` huang ying
2012-04-18 19:52 ` Rafael J. Wysocki
2012-04-17 20:35 ` Rafael J. Wysocki
2012-04-16 7:49 ` Yan, Zheng
2012-04-16 21:11 ` Rafael J. Wysocki
2012-04-16 8:58 ` huang ying
2012-04-16 21:30 ` Rafael J. Wysocki
2012-04-17 2:02 ` huang ying
2012-04-17 21:03 ` Rafael J. Wysocki
2012-04-18 1:45 ` huang ying
2012-04-18 21:00 ` Rafael J. Wysocki
2012-04-19 2:47 ` huang ying
2012-04-19 12:31 ` Rafael J. Wysocki
2012-04-20 0:48 ` huang ying
2012-04-17 5:13 ` huang ying
2012-04-17 21:10 ` Rafael J. Wysocki
2012-04-18 2:01 ` huang ying
2012-04-18 20:51 ` Rafael J. Wysocki
2012-04-19 2:08 ` huang ying [this message]
2012-04-19 12:36 ` Rafael J. Wysocki
2012-04-20 0:53 ` huang ying
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='CAC=cRTMPrSsK5Y8uVxVrtGNqJAGFyRMLU7WsYm185siZd-V_8w@mail.gmail.com' \
--to=huang.ying.caritas@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=rjw@sisk.pl \
--cc=rui.zhang@intel.com \
--cc=zheng.z.yan@intel.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).