From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH 4/5]PCIe native PME support Date: Thu, 20 Aug 2009 22:07:20 +0200 Message-ID: <200908202207.20923.rjw@sisk.pl> References: <1250666659.23178.119.camel@sli10-desk.sh.intel.com> <20090819115811.GD12216@srcf.ucam.org> <20090820031056.GB26357@sli10-desk.sh.intel.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20090820031056.GB26357@sli10-desk.sh.intel.com> Sender: linux-acpi-owner@vger.kernel.org To: Shaohua Li Cc: Matthew Garrett , linux acpi , linux-pm , Alan Stern List-Id: linux-pm@vger.kernel.org On Thursday 20 August 2009, Shaohua Li wrote: > On Wed, Aug 19, 2009 at 07:58:11PM +0800, Matthew Garrett wrote: > > On Wed, Aug 19, 2009 at 03:24:19PM +0800, Shaohua Li wrote: > > > > > +static inline void npme_enable_pme(struct pci_dev *pdev, bool enable) > > > +{ > > > + int pos; > > > + u16 rtctl; > > > + > > > + pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); > > > + > > > + pci_read_config_word(pdev, pos + PCI_EXP_RTCTL, &rtctl); > > > + if (!enable) > > > + rtctl &= ~PCI_EXP_RTCTL_PMEIE; > > > + else > > > + rtctl |= PCI_EXP_RTCTL_PMEIE; > > > + pci_write_config_word(pdev, pos + PCI_EXP_RTCTL, rtctl); > > > +} > > > > This seems to duplicate the existing pci_pme_active() function? > No, these registers are completely different. pci_pme_active is to handle > the PM capability regiser. This routine is to handle the PCI express capability. > > > > +static inline void npme_clear_pme(struct pci_dev *pdev) > > > +{ > > > + int pos; > > > + u32 rtsta; > > > + > > > + pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); > > > + > > > + pci_read_config_dword(pdev, pos + PCI_EXP_RTSTA, &rtsta); > > > + rtsta |= PCI_EXP_RTSTA_PME; > > > + pci_write_config_dword(pdev, pos + PCI_EXP_RTSTA, rtsta); > > > +} > > > > Ditto. > Ditto. > > > > +static bool npme_pme_target(struct pci_dev *target) > > > +{ > > > + bool ret = false; > > > + if (target->dev.bus->pm && target->dev.bus->pm->wakeup_event) > > > + ret = target->dev.bus->pm->wakeup_event(&target->dev); > > > + return ret; > > > +} > > > > Is there any situation in which we wouldn't want to just perform a > > runtime resume of the device here? > The devices pcie-to-pci bridge can send wakeup event, but the event might use > root port or the bridge pci id, so can't directly send the event to the device. > > Surely we can move the logic in my patch 3 here if we don't want to duplicate > code, and then we can directly perform a runtime resume for target devices. Do that, please. Rafael