From: Stefan Smietanowski <stesmi@stesmi.com>
To: Andi Kleen <ak@suse.de>
Cc: Greg KH <gregkh@suse.de>,
Grant Grundler <grundler@parisc-linux.org>,
linux-pci@atrey.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org,
Roland Dreier <roland@topspin.com>,
Arjan van de Ven <arjan@infradead.org>,
Andrew Vasquez <andrew.vasquez@qlogic.com>,
Jeff Garzik <jgarzik@pobox.com>,
"David S. Miller" <davem@davemloft.net>,
tom.l.nguyen@intel.com
Subject: Re: [Penance PATCH] PCI: clean up the MSI code a bit
Date: Fri, 10 Jun 2005 01:49:26 +0200 [thread overview]
Message-ID: <42A8D586.4070903@stesmi.com> (raw)
In-Reply-To: <20050609141534.GF23831@wotan.suse.de>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi.
> Also see the proposals from Jeff/Stefan et.al. for simpler interfaces
> for this. No need to actually make it messy if we have nice helpers.
Could even be simplified one step closer.
My helper could simply be incorporated into pci_enable_msix().
pci_enable_msix(dev)
{
if (is_dev_msi(dev)) {
cur_status=MSI;
pci_disable_msi(dev);
}
else if (is_dev_msix(dev))
return(ALREADY_MSIX);
else
cur_status=OLD_FASHIONED;
if (!__pci_enable_msix(dev))
if (cur_status==MSI)
pci_enable_msi(dev);
}
Add error-checking, etc, etc, etc.
Naturally pci_enable_msix() is renamed to __pci_enable_msix() in my
example. You can also just put it inside here, or whatever.
That way, if you want to enable msix and it fails, it will return
to whatever it was using before pci_enable_msix() was called.
Why this ALSO will work is that msi will already be enabled for devices
that handle it (I'm thinking of this together with making msi default).
That's why we cache the current status, so that we can return the device
to the previous state, be it normal or be it msi mode.
Hm. Can a device that fails MSI (due to any reason - NB not supporting
it or some other reason) go to MSIX mode at all?
If it can't, then it's even shorter.
pci_enable_msix(dev)
{
if (is_dev_msi(dev))
pci_disable_msi(dev);
else if (is_dev_msix(dev))
return(ALREADY_MSIX);
else
return(MSIX_NOT_AVAILABLE);
if (!__pci_enable_msix(dev))
pci_enable_msi(dev);
}
That way noone needs to explicitly turn off msi as it's done
automatically instead and the device will after this call
always be in either MSIX, MSI or NORMAL IRQ mode, and
always in the "best" mode the device, motherboard, bios, NB,
whatever combination is available.
// Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
iD8DBQFCqNWGBrn2kJu9P78RAjvUAJsFS2yj15j34CWKyh3CJ9iSDMydpACfc2a5
MA7LncSpbj6tQHigOFmFmrQ=
=4bMK
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2005-06-09 23:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-08 6:35 [Penance PATCH] PCI: clean up the MSI code a bit Greg KH
2005-06-08 13:41 ` Andi Kleen
2005-06-08 17:14 ` Grant Grundler
2005-06-08 17:45 ` Greg KH
2005-06-09 14:15 ` Andi Kleen
2005-06-09 23:49 ` Stefan Smietanowski [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-06-08 17:34 Nguyen, Tom L
2005-06-10 0:12 Nguyen, Tom L
2005-06-10 15:55 ` Stefan Smietanowski
2005-06-13 16:15 Nguyen, Tom L
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=42A8D586.4070903@stesmi.com \
--to=stesmi@stesmi.com \
--cc=ak@suse.de \
--cc=andrew.vasquez@qlogic.com \
--cc=arjan@infradead.org \
--cc=davem@davemloft.net \
--cc=gregkh@suse.de \
--cc=grundler@parisc-linux.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=roland@topspin.com \
--cc=tom.l.nguyen@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