aboutsummaryrefslogtreecommitdiff
path: root/include/linux/msi.h
AgeCommit message (Collapse)AuthorFilesLines
2014-11-23genirq: Provide default callbacks for msi_domain_opsJiang Liu1-5/+37
Extend struct msi_domain_info and provide default callbacks for msi_domain_ops. Signed-off-by: Jiang Liu <[email protected]> Cc: Tony Luck <[email protected]> Cc: [email protected] Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yijing Wang <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Matthias Brugger <[email protected]> Cc: Alexander Gordeev <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
2014-11-23genirq: Introduce msi_domain_alloc/free_irqs()Jiang Liu1-0/+29
Introduce msi_domain_{alloc|free}_irqs() to alloc/free interrupts from generic MSI irqdomain. Signed-off-by: Jiang Liu <[email protected]> Cc: Tony Luck <[email protected]> Cc: [email protected] Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yijing Wang <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Matthias Brugger <[email protected]> Cc: Alexander Gordeev <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
2014-11-23genirq: Add generic msi irq domain supportJiang Liu1-0/+45
Implement the basic functions for MSI interrupt support with hierarchical interrupt domains. [ tglx: Extracted and combined from several patches ] Signed-off-by: Jiang Liu <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Yijing Wang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2014-11-23PCI/MSI: Introduce helpers to hide struct msi_desc implementation detailsJiang Liu1-0/+19
Introduce helpers to hide struct msi_desc implementation details, so we could easily support non-PCI-compliant MSI devices later by moving msi_list into struct device. Signed-off-by: Jiang Liu <[email protected]> Cc: Tony Luck <[email protected]> Cc: [email protected] Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yijing Wang <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Matthias Brugger <[email protected]> Cc: Alexander Gordeev <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
2014-11-23PCI/MSI: Rename mask/unmask_msi_irq et alThomas Gleixner1-5/+13
mask/unmask_msi_irq and __mask_msi/msix_irq are PCI/MSI specific functions and should be named accordingly. This is a preparatory patch to support MSI on non PCI devices. Rename mask/unmask_msi_irq to pci_msi_mask/unmask_irq and document the functions. Provide conversion helpers. Rename __mask_msi/msix_irq to __pci_msi/msix_desc_mask so its clear that they operated on msi_desc. Fixup the only user outside of pci/msi. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yijing Wang <[email protected]> Cc: Heiko Carstens <[email protected]>
2014-11-23PCI/MSI: Rename write_msi_msg() to pci_write_msi_msg()Jiang Liu1-2/+12
Rename write_msi_msg() to pci_write_msi_msg() to mark it as PCI specific. Signed-off-by: Jiang Liu <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Yijing Wang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2014-11-23PCI/MSI: Rename __read_msi_msg() to __pci_read_msi_msg()Jiang Liu1-2/+3
Rename __read_msi_msg() to __pci_read_msi_msg() and kill unused read_msi_msg(). It's a preparation to separate generic MSI code from PCI core. Signed-off-by: Jiang Liu <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Grant Likely <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Yingjoe Chen <[email protected]> Cc: Yijing Wang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]>
2014-11-12PCI/MSI: Rename "struct msi_chip" to "struct msi_controller"Yijing Wang1-3/+3
"msi_chip" isn't very descriptive, so rename it to "msi_controller". That tells a little more about what it does and is already used in device tree bindings. No functional change. [bhelgaas: changelog, change *only* the struct name so it's reviewable] Suggested-by: Bjorn Helgaas <[email protected]> Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
2014-11-11s390/MSI: Use __msi_mask_irq() instead of default_msi_mask_irq()Yijing Wang1-2/+0
Now only s390/MSI use default_msi_mask_irq() and default_msix_mask_irq(), replace them with the common MSI mask IRQ functions __msi_mask_irq() and __msix_mask_irq(). Remove default_msi_mask_irq() and default_msix_mask_irq(). Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Sebastian Ott <[email protected]> CC: [email protected]
2014-11-11Revert "PCI: Add x86_msi.msi_mask_irq() and msix_mask_irq()"Yijing Wang1-2/+4
The problem fixed by 0e4ccb1505a9 ("PCI: Add x86_msi.msi_mask_irq() and msix_mask_irq()") has been fixed in a simpler way by a previous commit ("PCI/MSI: Add pci_msi_ignore_mask to prevent writes to MSI/MSI-X Mask Bits"). The msi_mask_irq() and msix_mask_irq() x86_msi_ops added by 0e4ccb1505a9 are no longer needed, so revert the commit. default_msi_mask_irq() and default_msix_mask_irq() were added by 0e4ccb1505a9 and are still used by s390, so keep them for now. [bhelgaas: changelog] Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: David Vrabel <[email protected]> CC: Konrad Rzeszutek Wilk <[email protected]> CC: [email protected]
2014-11-06PCI/MSI: Add pci_msi_ignore_mask to prevent writes to MSI/MSI-X Mask BitsYijing Wang1-0/+1
MSI-X vector Mask Bits are in MSI-X Tables in PCI memory space. Xen PV guests can't write to those tables. MSI vector Mask Bits are in PCI configuration space. Xen PV guests can write to config space, but those writes are ignored. Commit 0e4ccb1505a9 ("PCI: Add x86_msi.msi_mask_irq() and msix_mask_irq()") added a way to override default_mask_msi_irqs() and default_mask_msix_irqs() so they can be no-ops in Xen guests, but this is more complicated than necessary. Add "pci_msi_ignore_mask" in the core PCI MSI code. If set, default_mask_msi_irqs() and default_mask_msix_irqs() return without doing anything. This is less flexible, but much simpler. [bhelgaas: changelog] Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: David Vrabel <[email protected]> CC: Konrad Rzeszutek Wilk <[email protected]> CC: [email protected]
2014-10-01PCI/MSI: Remove "pos" from the struct msi_desc msi_attribYijing Wang1-1/+0
"msi_attrib.pos" is only used for MSI (not MSI-X), and we already cache the MSI capability offset in "dev->msi_cap". Remove "pos" from the struct msi_attrib and use "dev->msi_cap" directly. [bhelgaas: changelog, fix whitespace] Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
2014-10-01PCI/MSI: Remove unused kobject from struct msi_descYijing Wang1-2/+0
After commit 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects"), the kobject in struct msi_desc is unused. Remove the unused struct kobject from struct msi_desc. [bhelgaas: changelog] Fixes: 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects") Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]>
2014-10-01PCI/MSI: Remove arch_msi_check_device()Alexander Gordeev1-3/+0
No architectures implement arch_msi_check_device() or the struct msi_chip .check_device() method, so remove them. Remove the "type" parameter to pci_msi_check_device() because it was only used to call arch_msi_check_device() and is no longer needed. [bhelgaas: changelog, split to separate patch] Signed-off-by: Alexander Gordeev <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
2014-07-03PCI/MSI: Cache Multiple Message Capable in struct msi_descYijing Wang1-1/+2
The Multiple Message Capable field in the MSI Message Control register indicates how many vectors the device supports. This field is read-only, so cache it in msi_desc to avoid reading it repeatedly. Since we cache the extracted field (not the entire Message Control register), we can use msi_mask() instead of msi_capable_mask(), which is then unused, so remove it. [bhelgaas: fix whitespace, changelog] Signed-off-by: Yijing Wang <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
2013-12-13PCI: Drop "irq" param from *_restore_msi_irqs()DuanZhenzhong1-2/+2
Change x86_msi.restore_msi_irqs(struct pci_dev *dev, int irq) to x86_msi.restore_msi_irqs(struct pci_dev *dev). restore_msi_irqs() restores multiple MSI-X IRQs, so param 'int irq' is unneeded. This makes code more consistent between vm and bare metal. Dom0 MSI-X restore code can also be optimized as XEN only has a hypercall to restore all MSI-X vectors at one time. Tested-by: Sucheta Chakraborty <[email protected]> Signed-off-by: Zhenzhong Duan <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Konrad Rzeszutek Wilk <[email protected]>
2013-11-14PCI: Fix whitespace, capitalization, and spelling errorsBjorn Helgaas1-5/+5
Fix whitespace, capitalization, and spelling errors. No functional change. I know "busses" is not an error, but "buses" was more common, so I used it consistently. Signed-off-by: Marta Rybczynska <[email protected]> (pci_reset_bridge_secondary_bus()) Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]>
2013-11-06PCI: Add x86_msi.msi_mask_irq() and msix_mask_irq()Konrad Rzeszutek Wilk1-0/+2
Certain platforms do not allow writes in the MSI-X BARs to setup or tear down vector values. To combat against the generic code trying to write to that and either silently being ignored or crashing due to the pagetables being marked R/O this patch introduces a platform override. Note that we keep two separate, non-weak, functions default_mask_msi_irqs() and default_mask_msix_irqs() for the behavior of the arch_mask_msi_irqs() and arch_mask_msix_irqs(), as the default behavior is needed by x86 PCI code. For Xen, which does not allow the guest to write to MSI-X tables - as the hypervisor is solely responsible for setting the vector values - we implement two nops. This fixes a Xen guest crash when passing a PCI device with MSI-X to the guest. See the bugzilla for more details. [bhelgaas: add bugzilla info] Reference: https://bugzilla.kernel.org/show_bug.cgi?id=64581 Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> CC: Sucheta Chakraborty <[email protected]> CC: Zhenzhong Duan <[email protected]>
2013-08-12of: pci: add registry of MSI chipsThomas Petazzoni1-0/+2
This commit adds a very basic registry of msi_chip structures, so that an IRQ controller driver can register an msi_chip, and a PCIe host controller can find it, based on a 'struct device_node'. Signed-off-by: Thomas Petazzoni <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Jason Cooper <[email protected]>
2013-08-12PCI: Introduce new MSI chip infrastructureThierry Reding1-0/+11
The new struct msi_chip is used to associated an MSI controller with a PCI bus. It is automatically handed down from the root to its children during bus enumeration. This patch provides default (weak) implementations for the architecture- specific MSI functions (arch_setup_msi_irq(), arch_teardown_msi_irq() and arch_msi_check_device()) which check if a PCI device's bus has an attached MSI chip and forward the call appropriately. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Thomas Petazzoni <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Tested-by: Daniel Price <[email protected]> Tested-by: Thierry Reding <[email protected]> Signed-off-by: Jason Cooper <[email protected]>
2013-08-12PCI: use weak functions for MSI arch-specific functionsThomas Petazzoni1-1/+7
Until now, the MSI architecture-specific functions could be overloaded using a fairly complex set of #define and compile-time conditionals. In order to prepare for the introduction of the msi_chip infrastructure, it is desirable to switch all those functions to use the 'weak' mechanism. This commit converts all the architectures that were overidding those MSI functions to use the new strategy. Note that we keep two separate, non-weak, functions default_teardown_msi_irqs() and default_restore_msi_irqs() for the default behavior of the arch_teardown_msi_irqs() and arch_restore_msi_irqs(), as the default behavior is needed by x86 PCI code. Signed-off-by: Thomas Petazzoni <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> Tested-by: Daniel Price <[email protected]> Tested-by: Thierry Reding <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: [email protected] Cc: Martin Schwidefsky <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: [email protected] Cc: Russell King <[email protected]> Cc: Tony Luck <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: [email protected] Cc: Ralf Baechle <[email protected]> Cc: [email protected] Cc: David S. Miller <[email protected]> Cc: [email protected] Cc: Chris Metcalf <[email protected]> Signed-off-by: Jason Cooper <[email protected]>
2013-05-28PCI: Allocate only as many MSI vectors as requested by driverAlexander Gordeev1-0/+1
Because of the encoding of the "Multiple Message Capable" and "Multiple Message Enable" fields, a device can only advertise that it's capable of a power-of-two number of vectors, and the OS can only enable a power-of-two number. For example, a device that's limited internally to using 18 vectors would have to advertise that it's capable of 32. The 14 extra vectors consume vector numbers and IRQ descriptors even though the device can't actually use them. This fix introduces a 'msi_desc::nvec_used' field to address this issue. When non-zero, it is the actual number of MSIs the device will send, as requested by the device driver. This value should be used by architectures to set up and tear down only as many interrupt resources as the device will actually use. Note, although the existing 'msi_desc::multiple' field might seem redundant, in fact it is not. The number of MSIs advertised need not be the smallest power-of-two larger than the number of MSIs the device will send. Thus, it is not always possible to derive the former from the latter, so we need to keep them both to handle this case. [bhelgaas: changelog, rename to "nvec_used"] Signed-off-by: Alexander Gordeev <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
2013-04-23PCI: Remove "extern" from function declarationsBjorn Helgaas1-12/+11
We had an inconsistent mix of using and omitting the "extern" keyword on function declarations in header files. This removes them all. Signed-off-by: Bjorn Helgaas <[email protected]>
2011-12-05PCI/sysfs: add per pci device msi[x] irq listing (v5)Neil Horman1-0/+3
This patch adds a per-pci-device subdirectory in sysfs called: /sys/bus/pci/devices/<device>/msi_irqs This sub-directory exports the set of msi vectors allocated by a given pci device, by creating a numbered sub-directory for each vector beneath msi_irqs. For each vector various attributes can be exported. Currently the only attribute is called mode, which tracks the operational mode of that vector (msi vs. msix) Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2010-10-12pci: Cleanup the irq_desc mess in msiThomas Gleixner1-4/+4
Handing down irq_desc to msi just so that msi can access irq_desc.irq_data.msi_desc is a pretty stupid idea. The calling code can hand down a pointer to msi_desc so msi code does not need to know about the irq descriptor at all. Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Acked-by: Jesse Barnes <[email protected]>
2010-10-12pci: Convert msi to new irq_chip functionsThomas Gleixner1-2/+3
Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Acked-by: Jesse Barnes <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Tony Luck <[email protected]> Cc: Russell King <[email protected]>
2010-07-30PCI: MSI: Restore read_msi_msg_desc(); add get_cached_msi_msg_desc()Ben Hutchings1-0/+2
commit 2ca1af9aa3285c6a5f103ed31ad09f7399fc65d7 "PCI: MSI: Remove unsafe and unnecessary hardware access" changed read_msi_msg_desc() to return the last MSI message written instead of reading it from the device, since it may be called while the device is in a reduced power state. However, the pSeries platform code really does need to read messages from the device, since they are initially written by firmware. Therefore: - Restore the previous behaviour of read_msi_msg_desc() - Add new functions get_cached_msi_msg{,_desc}() which return the last MSI message written - Use the new functions where appropriate Acked-by: Michael Ellerman <[email protected]> Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2009-03-20PCI MSI: Add support for multiple MSIMatthew Wilcox1-0/+1
Add the new API pci_enable_msi_block() to allow drivers to request multiple MSI and reimplement pci_enable_msi in terms of pci_enable_msi_block. Ensure that the architecture back ends don't have to know about multiple MSI. Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2009-03-20PCI MSI: Refactor interrupt masking codeMatthew Wilcox1-3/+2
Since most of the callers already know whether they have an MSI or an MSI-X capability, split msi_set_mask_bits() into msi_mask_irq() and msix_mask_irq(). The only callers which don't (mask_msi_irq() and unmask_msi_irq()) can share code in msi_set_mask_bit(). This then becomes the only caller of msix_flush_writes(), so we can inline it. The flushing read can be to any address that belongs to the device, so we can eliminate the calculation too. We can also get rid of maskbits_mask from struct msi_desc and simply recalculate it on the rare occasion that we need it. The single-bit 'masked' element is replaced by a copy of the 32-bit 'masked' register, so this patch does not affect the size of msi_desc. Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2009-03-20PCI MSI: Use mask_pos instead of mask_base when appropriateMatthew Wilcox1-1/+4
MSI interrupts have a mask_pos where MSI-X have a mask_base. Use a transparent union to get rid of some ugly casts. Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2009-03-20PCI MSI: Replace 'type' with 'is_msix'Matthew Wilcox1-2/+2
By changing from a 5-bit field to a 1-bit field, we free up some bits that can be used by a later patch. Also rearrange the fields for better packing on 64-bit platforms (reducing the size of msi_desc from 72 bytes to 64 bytes). Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2008-12-08x86, MSI: pass irq_cfg and irq_descYinghai Lu1-0/+3
Impact: simplify code Pass irq_desc and cfg around, instead of raw IRQ numbers - this way we dont have to look it up again and again. Signed-off-by: Yinghai Lu <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2008-04-29pci/irq: restore mask_bits in msi shutdown -v3Yinghai Lu1-0/+1
[PATCH 1/2] pci/irq: restore mask_bits in msi shutdown -v3 Yinghai found that kexec'ing a RHEL 5.1 kernel with 2.6.25-rc3+ kernels prevents his NIC from working. He bisected to | commit 89d694b9dbe769ca1004e01db0ca43964806a611 | Author: Thomas Gleixner <[email protected]> | Date: Mon Feb 18 18:25:17 2008 +0100 | | genirq: do not leave interupts enabled on free_irq | | The default_disable() function was changed in commit: | | 76d2160147f43f982dfe881404cfde9fd0a9da21 | genirq: do not mask interrupts by default | For MSI, default_shutdown will call mask_bit for msi device. All mask bits will left disabled after free_irq. Then in the kexec case, the next kernel can only use msi_enable bit, so all device's MSI can not be used. So lets to restore the mask bit to its pci reset defined value (enabled) when we disable the kernels use of msi to be a little friendlier to kexec'd kernels. Extend msi_set_mask_bit to msi_set_mask_bits to take mask, so we can fully restore that to 0x00 instead of 0xfe. Signed-off-by: Yinghai Lu <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
2007-05-02MSI: Give archs the option to free all MSI/Xs at once.Michael Ellerman1-0/+1
This patch introduces an optional function, arch_teardown_msi_irqs(), which gives an arch the opportunity to do per-device teardown for MSI/X. If that's not required, the default version simply calls arch_teardown_msi_irq() for each msi irq required. arch_teardown_msi_irqs() is simply passed a pdev, attached to the pdev is a list of msi_descs, it is up to the arch to free the irq associated with each of these as appropriate. For archs that _don't_ implement arch_teardown_msi_irqs(), all msi_descs with irq == 0 are considered unallocated, and the arch teardown routine is not called on them. Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-05-02MSI: Give archs the option to allocate all MSI/Xs at once.Michael Ellerman1-0/+1
This patch introduces an optional function, arch_setup_msi_irqs(), (note the plural) which gives an arch the opportunity to do per-device setup for MSI/X and then allocate all the requested MSI/Xs at once. If that's not required by the arch, the default version simply calls arch_setup_msi_irq() for each MSI irq required. arch_setup_msi_irqs() is passed a pdev, attached to the pdev is a list of msi_descs with irq == 0, it is up to the arch to connect these up to an irq (via set_irq_msi()) or return an error. For convenience the number of vectors and the type are passed also. All msi_descs with irq != 0 are considered allocated, and the arch teardown routine will be called on them when necessary. The existing semantics of pci_enable_msix() are that if the requested number of irqs can not be allocated, the maximum number that _could_ be allocated is returned. To support that, we define that in case of an error from arch_setup_msi_irqs(), the number of msi_descs with irq != 0 are considered allocated, and are counted toward the "max that could be allocated". Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-05-02MSI: Use a list instead of the custom link structureMichael Ellerman1-4/+4
The msi descriptors are linked together with what looks a lot like a linked list, but isn't a struct list_head list. Make it one. The only complication is that previously we walked a list of irqs, and got the descriptor for each with get_irq_msi(). Now we have a list of descriptors and need to get the irq out of it, so it needs to be in the actual struct msi_desc. We use 0 to indicate no irq is setup. Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-05-02MSI: Add an arch_msi_check_device()Michael Ellerman1-0/+1
Add an arch_check_device(), which gives archs a chance to check the input to pci_enable_msi/x. The arch might be interested in the value of nvec so pass it in. Propagate the error value returned from the arch routine out to the caller. Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-03-12[PATCH] msi: Safer state caching.Eric W. Biederman1-5/+3
There are two ways pci_save_state and pci_restore_state are used. As helper functions during suspend/resume, and as helper functions around a hardware reset event. When used as helper functions around a hardware reset event there is no reason to believe the calls will be paired, nor is there a good reason to believe that if we restore the msi state from before the reset that it will match the current msi state. Since arch code may change the msi message without going through the driver, drivers currently do not have enough information to even know when to call pci_save_state to ensure they will have msi state in sync with the other kernel irq reception data structures. It turns out the solution is straight forward, cache the state in the existing msi data structures (not the magic pci saved things) and have the msi code update the cached state each time we write to the hardware. This means we never need to read the hardware to figure out what the hardware state should be. By modifying the caching in this manner we get to remove our save_state routines and only need to provide restore_state routines. The only fields that were at all tricky to regenerate were the msi and msi-x control registers and the way we regenerate them currently is a bit dependent upon assumptions on how we use the allow msi registers to be configured and used making the code a little bit brittle. If we ever change what cases we allow or how we configure the msi bits we can address the fragility then. Signed-off-by: Eric W. Biederman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Auke Kok <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-02-07msi: Make MSI useable more architecturesEric W. Biederman1-1/+1
The arch hooks arch_setup_msi_irq and arch_teardown_msi_irq are now responsible for allocating and freeing the linux irq in addition to setting up the the linux irq to work with the interrupt. arch_setup_msi_irq now takes a pci_device and a msi_desc and returns an irq. With this change in place this code should be useable by all platforms except those that won't let the OS touch the hardware like ppc RTAS. Signed-off-by: Eric W. Biederman <[email protected]> Acked-by: Ingo Molnar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-02-07PCI: cleanup MSI codeSatoru Takeuchi1-2/+1
Cleanup MSI code as follows: - fix some types - fix strange local variable definition - delete unnecessary blank line - add comment to #endif which is far from corresponding #ifdef Signed-off-by: Satoru Takeuchi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-10-04[PATCH] msi: refactor and move the msi irq_chip into the arch codeEric W. Biederman1-0/+49
It turns out msi_ops was simply not enough to abstract the architecture specific details of msi. So I have moved the resposibility of constructing the struct irq_chip to the architectures, and have two architecture specific functions arch_setup_msi_irq, and arch_teardown_msi_irq. For simple architectures those functions can do all of the work. For architectures with platform dependencies they can call into the appropriate platform code. With this msi.c is finally free of assuming you have an apic, and this actually takes less code. The helpers for the architecture specific code are declared in the linux/msi.h to keep them separate from the msi functions used by drivers in linux/pci.h Signed-off-by: Eric W. Biederman <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Tony Luck <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Greg KH <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>