public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <linux-pm-devel@lists.sourceforge.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jeff Garzik <jgarzik@mandrakesoft.com>
Subject: Re: PCI power management
Date: Thu, 19 Apr 2001 15:14:53 +0200	[thread overview]
Message-ID: <20010419131453.12448@mailhost.mipsys.com> (raw)
In-Reply-To: <E14qE0V-00078Y-00@the-village.bc.nu>
In-Reply-To: <E14qE0V-00078Y-00@the-village.bc.nu>

>>  - Some devices just can't be brought back to life from D3 state without
>> a PCI reset (ATI Rage M3 for example) and that require some arch specific
>> support (when it's possible at all).
>
>Putting on a driver author hat what I want is
>
>	pci_power_on_generic
>	pci_power_off_generic
>	pci_power_on_null
>	pci_power_off_null
>
>At which point most driver writers are having to do no thinking at all about
>their device. The PCI layer just requires they pick a function and stick it
>in the struct pci_device. 

Could you elaborate about the difference between generic and null
functions ? I'm not sure I understand what you mean...

Note that in the case of chips like the Rage M3, the driver is the only
one to know if it will be able to bring back the card from a power off
state or not. It's the only one to know if it can reconfigure the card
completely without having a BIOS run before it.

I would suggest a call that looks like

pci_power_off(uint mask);

where mask is

  PCI_POWER_MASK_D1 = 0x00000001
  PCI_POWER_MASK_D2 = 0x00000002
  PCI_POWER_MASK_D3 = 0x00000004
  PCI_POWER_MASK_NOCLOCK = 0x00000008
  PCI_POWER_MASK_NOPOWER = 0x00000010

The driver sets the mask to whatever state it supports getting the card
from. We can #define a PCI_POWER_MASK_STD (that would be a D1+D2+D3) for
"generic" drivers that don't really know anything but to follow the HW
PCI power management capabilities.

This function would be routed to an arch function, that will in turn
either call the lower-level PCI code to set D1, D2 or D3 mode (the best
supported) or will suspend the card's clock or power if it can and the
driver accept it.

Typically, on a PowerMac, this function could keep track of which cards
are in D2 or D3 mode (or which drivers allowed for clock suspend) and
would stop the PCI clock once they all asked for it. 

>This doesnt help you. You need device specific support in each case where
>bus mastering is occuring and a bus master error could be fatal if missed.
>For example on i2o I can easily have 4Mbytes of outstanding I/O between the
>message layer and disk, all of which is bus mastering. Only the driver
>actually
>knows when its idle.

Right. That's a driver issue. The problem would go away if all drivers
properly block their IO queues and wait for all IO to complete when
notified of sleep

>X has hooks for this in XFree 4

The last time I looked at it, those were rather APM-specific. But well, I
guess it's easy to update them. What I'm thinknig about is the kernel
side, that is a generic, non-APM or non-ACPI specific way of notifying
userland process that request for it. Some kind of interface allowing
userland to register PM notifiers and have the kernel PM thread be
blocked until the userland code "acked" the message.

Well, maybe there is already something I missed...

Ben.




  reply	other threads:[~2001-04-19 13:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.10.10104181150530.7690-100000@nobelium.transmeta.com>
2001-04-19  8:25 ` PCI power management Jeff Garzik
2001-04-19 10:08   ` Benjamin Herrenschmidt
2001-04-19 10:38     ` CaT
2001-04-19 12:10       ` Benjamin Herrenschmidt
2001-04-19 12:57     ` Alan Cox
2001-04-19 13:14       ` Benjamin Herrenschmidt [this message]
2001-04-19 13:33         ` Alan Cox
2001-04-19 13:43           ` Benjamin Herrenschmidt
2001-04-20  0:05     ` Patrick Mochel
2001-04-20 12:06       ` Benjamin Herrenschmidt
2001-04-20 12:40         ` Jeff Garzik
2001-04-20 12:56           ` Benjamin Herrenschmidt
2001-04-21  9:09             ` Russell King
2001-04-19 10:18   ` Benjamin Herrenschmidt
2001-04-19 13:24     ` Jeff Garzik
2001-04-20  0:11       ` [Linux-pm-devel] " Patrick Mochel
2001-04-19 23:03   ` Patrick Mochel
2004-08-02 21:33 pci " Erik Rigtorp
2004-08-02 23:45 ` Brian Gerst

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=20010419131453.12448@mailhost.mipsys.com \
    --to=benh@kernel.crashing.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm-devel@lists.sourceforge.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