mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
Merge branch 'pci/irq' into next
* pci/irq: PCI: Disable boot interrupt quirk for ASUS M2N-LR nvme/pci: Switch to pci_request_irq() PCI/irq: Add pci_request_irq() and pci_free_irq() helpers genirq: Return the IRQ name from free_irq() genirq: Fix indentation in remove_irq()
This commit is contained in:
commit
13108c625b
6 changed files with 115 additions and 23 deletions
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* PCI IRQ failure handing code
|
||||
* PCI IRQ handling code
|
||||
*
|
||||
* Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
|
||||
* Copyright (C) 2017 Christoph Hellwig.
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
|
|
@ -59,3 +60,61 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev)
|
|||
return PCI_LOST_IRQ_NO_INFORMATION;
|
||||
}
|
||||
EXPORT_SYMBOL(pci_lost_interrupt);
|
||||
|
||||
/**
|
||||
* pci_request_irq - allocate an interrupt line for a PCI device
|
||||
* @dev: PCI device to operate on
|
||||
* @nr: device-relative interrupt vector index (0-based).
|
||||
* @handler: Function to be called when the IRQ occurs.
|
||||
* Primary handler for threaded interrupts.
|
||||
* If NULL and thread_fn != NULL the default primary handler is
|
||||
* installed.
|
||||
* @thread_fn: Function called from the IRQ handler thread
|
||||
* If NULL, no IRQ thread is created
|
||||
* @dev_id: Cookie passed back to the handler function
|
||||
* @fmt: Printf-like format string naming the handler
|
||||
*
|
||||
* This call allocates interrupt resources and enables the interrupt line and
|
||||
* IRQ handling. From the point this call is made @handler and @thread_fn may
|
||||
* be invoked. All interrupts requested using this function might be shared.
|
||||
*
|
||||
* @dev_id must not be NULL and must be globally unique.
|
||||
*/
|
||||
int pci_request_irq(struct pci_dev *dev, unsigned int nr, irq_handler_t handler,
|
||||
irq_handler_t thread_fn, void *dev_id, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
char *devname;
|
||||
|
||||
va_start(ap, fmt);
|
||||
devname = kvasprintf(GFP_KERNEL, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
ret = request_threaded_irq(pci_irq_vector(dev, nr), handler, thread_fn,
|
||||
IRQF_SHARED, devname, dev_id);
|
||||
if (ret)
|
||||
kfree(devname);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(pci_request_irq);
|
||||
|
||||
/**
|
||||
* pci_free_irq - free an interrupt allocated with pci_request_irq
|
||||
* @dev: PCI device to operate on
|
||||
* @nr: device-relative interrupt vector index (0-based).
|
||||
* @dev_id: Device identity to free
|
||||
*
|
||||
* Remove an interrupt handler. The handler is removed and if the interrupt
|
||||
* line is no longer in use by any driver it is disabled. The caller must
|
||||
* ensure the interrupt is disabled on the device before calling this function.
|
||||
* The function does not return until any executing interrupts for this IRQ
|
||||
* have completed.
|
||||
*
|
||||
* This function must not be called from interrupt context.
|
||||
*/
|
||||
void pci_free_irq(struct pci_dev *dev, unsigned int nr, void *dev_id)
|
||||
{
|
||||
kfree(free_irq(pci_irq_vector(dev, nr), dev_id));
|
||||
}
|
||||
EXPORT_SYMBOL(pci_free_irq);
|
||||
|
|
|
|||
|
|
@ -1685,6 +1685,29 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260a, quirk_intel_pcie_pm);
|
|||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm);
|
||||
|
||||
#ifdef CONFIG_X86_IO_APIC
|
||||
static int dmi_disable_ioapicreroute(const struct dmi_system_id *d)
|
||||
{
|
||||
noioapicreroute = 1;
|
||||
pr_info("%s detected: disable boot interrupt reroute\n", d->ident);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dmi_system_id boot_interrupt_dmi_table[] = {
|
||||
/*
|
||||
* Systems to exclude from boot interrupt reroute quirks
|
||||
*/
|
||||
{
|
||||
.callback = dmi_disable_ioapicreroute,
|
||||
.ident = "ASUSTek Computer INC. M2N-LR",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer INC."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "M2N-LR"),
|
||||
},
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
/*
|
||||
* Boot interrupts on some chipsets cannot be turned off. For these chipsets,
|
||||
* remap the original interrupt in the linux kernel to the boot interrupt, so
|
||||
|
|
@ -1693,6 +1716,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm);
|
|||
*/
|
||||
static void quirk_reroute_to_boot_interrupts_intel(struct pci_dev *dev)
|
||||
{
|
||||
dmi_check_system(boot_interrupt_dmi_table);
|
||||
if (noioapicquirk || noioapicreroute)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue