From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: David Hawkins <dwh@ovro.caltech.edu>
Cc: Jeff Hane <jeff.hane@maxim-ic.com>,
	"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
Subject: Re: PCI interrupt question
Date: Fri, 04 Dec 2009 20:05:53 +1100	[thread overview]
Message-ID: <1259917553.2076.1270.camel@pasglop> (raw)
In-Reply-To: <4B1816F9.1020601@ovro.caltech.edu>
On Thu, 2009-12-03 at 11:52 -0800, David Hawkins wrote:
> 
> Really? I thought the pci_dev structures represent the
> devices found on the PCI bus, and the IRQ line in
> that structure was merely copied from the configuration
> space registers. 
No, it's not. In fact it's mostly irrelevant. It has room for only 8
bits and we commonly manipulate a lot more interrupts on some modern
systems.
Linux will obtain from the device-tree the routing for the interrupt
line(s) of the device. If you don't have a node for the device (which is
allowed for PCI), linux will use the INTERRUPT_PIN register to query
which interrupt line is the device output, and will use the host bridge
device-tree node "interrupt-map" property to find where it's connected
to on the PIC.
It will then map that to a linux virtual IRQ number which is what you
find in pci_dev. At least that's how it works on powerpc :-)
> When you request that interrupt, the
> code would have to remap it to a host IRQ line, which
> it would use the DTS for. (But I'm just speculating).
No, it's already remapped in pci_dev. The mapping happen when the PCI
devices are discovered by the kernel.
> Bottom line is; if the IRQ field of lspci is 0, then you
> need to figure out that problem first :)
I wouldn't trust lspci too much, I'm not sure we bother writing back the
number to the PCI_INTERRUPT_LINE register anymore anyways.
If your pci_dev->irq is non-0 then Linux found -something- but it might
not be right, it depends on your device-tree.
Cheers,
Ben.
next prev parent reply	other threads:[~2009-12-04  9:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03  6:21 PCI interrupt question Jeff Hane
2009-12-03  7:31 ` Stefan Roese
2009-12-03 17:11 ` David Hawkins
2009-12-03 19:39   ` Jeff Hane
2009-12-03 19:44     ` Ira W. Snyder
2009-12-03 19:52     ` David Hawkins
2009-12-03 19:59       ` Ira W. Snyder
2009-12-03 20:03         ` David Hawkins
2009-12-03 21:28       ` Wolfgang Denk
2009-12-03 21:38         ` David Hawkins
2009-12-04  9:05       ` Benjamin Herrenschmidt [this message]
2009-12-04  4:52     ` Stefan Roese
2009-12-04  9:02     ` Benjamin Herrenschmidt
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=1259917553.2076.1270.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=dwh@ovro.caltech.edu \
    --cc=jeff.hane@maxim-ic.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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).