Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner: "This updated pull request does not contain the last few GIC related patches which were reported to cause a regression. There is a fix available, but I let it breed for a couple of days first. The irq departement provides: - new infrastructure to support non PCI based MSI interrupts - a couple of new irq chip drivers - the usual pile of fixlets and updates to irq chip drivers - preparatory changes for removal of the irq argument from interrupt flow handlers - preparatory changes to remove IRQF_VALID" * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (129 commits) irqchip/imx-gpcv2: IMX GPCv2 driver for wakeup sources irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2 irqchip: Add documentation for the bcm2836 interrupt controller irqchip/bcm2835: Add support for being used as a second level controller irqchip/bcm2835: Refactor handle_IRQ() calls out of MAKE_HWIRQ PCI: xilinx: Fix typo in function name irqchip/gic: Ensure gic_cpu_if_up/down() programs correct GIC instance irqchip/gic: Only allow the primary GIC to set the CPU map PCI/MSI: pci-xgene-msi: Consolidate chained IRQ handler install/remove unicore32/irq: Prepare puv3_gpio_handler for irq argument removal tile/pci_gx: Prepare trio_handle_level_irq for irq argument removal m68k/irq: Prepare irq handlers for irq argument removal C6X/megamode-pic: Prepare megamod_irq_cascade for irq argument removal blackfin: Prepare irq handlers for irq argument removal arc/irq: Prepare idu_cascade_isr for irq argument removal sparc/irq: Use access helper irq_data_get_affinity_mask() sparc/irq: Use helper irq_data_get_irq_handler_data() parisc/irq: Use access helper irq_data_get_affinity_mask() mn10300/irq: Use access helper irq_data_get_affinity_mask() irqchip/i8259: Prepare i8259_irq_dispatch for irq argument removal ...
This commit is contained in:
@@ -39,14 +39,13 @@ struct irq_domain * __weak arch_get_pci_msi_domain(struct pci_dev *dev)
|
||||
|
||||
static struct irq_domain *pci_msi_get_domain(struct pci_dev *dev)
|
||||
{
|
||||
struct irq_domain *domain = NULL;
|
||||
struct irq_domain *domain;
|
||||
|
||||
if (dev->bus->msi)
|
||||
domain = dev->bus->msi->domain;
|
||||
if (!domain)
|
||||
domain = arch_get_pci_msi_domain(dev);
|
||||
domain = dev_get_msi_domain(&dev->dev);
|
||||
if (domain)
|
||||
return domain;
|
||||
|
||||
return domain;
|
||||
return arch_get_pci_msi_domain(dev);
|
||||
}
|
||||
|
||||
static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
@@ -116,7 +115,7 @@ int __weak arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
if (type == PCI_CAP_ID_MSI && nvec > 1)
|
||||
return 1;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, dev) {
|
||||
ret = arch_setup_msi_irq(dev, entry);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -136,7 +135,7 @@ void default_teardown_msi_irqs(struct pci_dev *dev)
|
||||
int i;
|
||||
struct msi_desc *entry;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list)
|
||||
for_each_pci_msi_entry(entry, dev)
|
||||
if (entry->irq)
|
||||
for (i = 0; i < entry->nvec_used; i++)
|
||||
arch_teardown_msi_irq(entry->irq + i);
|
||||
@@ -153,7 +152,7 @@ static void default_restore_msi_irq(struct pci_dev *dev, int irq)
|
||||
|
||||
entry = NULL;
|
||||
if (dev->msix_enabled) {
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, dev) {
|
||||
if (irq == entry->irq)
|
||||
break;
|
||||
}
|
||||
@@ -193,7 +192,8 @@ u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
|
||||
|
||||
mask_bits &= ~mask;
|
||||
mask_bits |= flag;
|
||||
pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits);
|
||||
pci_write_config_dword(msi_desc_to_pci_dev(desc), desc->mask_pos,
|
||||
mask_bits);
|
||||
|
||||
return mask_bits;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ static void msix_mask_irq(struct msi_desc *desc, u32 flag)
|
||||
|
||||
static void msi_set_mask_bit(struct irq_data *data, u32 flag)
|
||||
{
|
||||
struct msi_desc *desc = irq_data_get_msi(data);
|
||||
struct msi_desc *desc = irq_data_get_msi_desc(data);
|
||||
|
||||
if (desc->msi_attrib.is_msix) {
|
||||
msix_mask_irq(desc, flag);
|
||||
@@ -267,13 +267,15 @@ void default_restore_msi_irqs(struct pci_dev *dev)
|
||||
{
|
||||
struct msi_desc *entry;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list)
|
||||
for_each_pci_msi_entry(entry, dev)
|
||||
default_restore_msi_irq(dev, entry->irq);
|
||||
}
|
||||
|
||||
void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
|
||||
{
|
||||
BUG_ON(entry->dev->current_state != PCI_D0);
|
||||
struct pci_dev *dev = msi_desc_to_pci_dev(entry);
|
||||
|
||||
BUG_ON(dev->current_state != PCI_D0);
|
||||
|
||||
if (entry->msi_attrib.is_msix) {
|
||||
void __iomem *base = entry->mask_base +
|
||||
@@ -283,7 +285,6 @@ void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
|
||||
msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR);
|
||||
msg->data = readl(base + PCI_MSIX_ENTRY_DATA);
|
||||
} else {
|
||||
struct pci_dev *dev = entry->dev;
|
||||
int pos = dev->msi_cap;
|
||||
u16 data;
|
||||
|
||||
@@ -303,7 +304,9 @@ void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
|
||||
|
||||
void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
|
||||
{
|
||||
if (entry->dev->current_state != PCI_D0) {
|
||||
struct pci_dev *dev = msi_desc_to_pci_dev(entry);
|
||||
|
||||
if (dev->current_state != PCI_D0) {
|
||||
/* Don't touch the hardware now */
|
||||
} else if (entry->msi_attrib.is_msix) {
|
||||
void __iomem *base;
|
||||
@@ -314,7 +317,6 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
|
||||
writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR);
|
||||
writel(msg->data, base + PCI_MSIX_ENTRY_DATA);
|
||||
} else {
|
||||
struct pci_dev *dev = entry->dev;
|
||||
int pos = dev->msi_cap;
|
||||
u16 msgctl;
|
||||
|
||||
@@ -348,21 +350,22 @@ EXPORT_SYMBOL_GPL(pci_write_msi_msg);
|
||||
|
||||
static void free_msi_irqs(struct pci_dev *dev)
|
||||
{
|
||||
struct list_head *msi_list = dev_to_msi_list(&dev->dev);
|
||||
struct msi_desc *entry, *tmp;
|
||||
struct attribute **msi_attrs;
|
||||
struct device_attribute *dev_attr;
|
||||
int i, count = 0;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list)
|
||||
for_each_pci_msi_entry(entry, dev)
|
||||
if (entry->irq)
|
||||
for (i = 0; i < entry->nvec_used; i++)
|
||||
BUG_ON(irq_has_action(entry->irq + i));
|
||||
|
||||
pci_msi_teardown_msi_irqs(dev);
|
||||
|
||||
list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) {
|
||||
list_for_each_entry_safe(entry, tmp, msi_list, list) {
|
||||
if (entry->msi_attrib.is_msix) {
|
||||
if (list_is_last(&entry->list, &dev->msi_list))
|
||||
if (list_is_last(&entry->list, msi_list))
|
||||
iounmap(entry->mask_base);
|
||||
}
|
||||
|
||||
@@ -387,18 +390,6 @@ static void free_msi_irqs(struct pci_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static struct msi_desc *alloc_msi_entry(struct pci_dev *dev)
|
||||
{
|
||||
struct msi_desc *desc = kzalloc(sizeof(*desc), GFP_KERNEL);
|
||||
if (!desc)
|
||||
return NULL;
|
||||
|
||||
INIT_LIST_HEAD(&desc->list);
|
||||
desc->dev = dev;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
static void pci_intx_for_msi(struct pci_dev *dev, int enable)
|
||||
{
|
||||
if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
|
||||
@@ -433,7 +424,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
|
||||
|
||||
if (!dev->msix_enabled)
|
||||
return;
|
||||
BUG_ON(list_empty(&dev->msi_list));
|
||||
BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));
|
||||
|
||||
/* route the table */
|
||||
pci_intx_for_msi(dev, 0);
|
||||
@@ -441,7 +432,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
|
||||
PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);
|
||||
|
||||
arch_restore_msi_irqs(dev);
|
||||
list_for_each_entry(entry, &dev->msi_list, list)
|
||||
for_each_pci_msi_entry(entry, dev)
|
||||
msix_mask_irq(entry, entry->masked);
|
||||
|
||||
pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
|
||||
@@ -486,7 +477,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
|
||||
int count = 0;
|
||||
|
||||
/* Determine how many msi entries we have */
|
||||
list_for_each_entry(entry, &pdev->msi_list, list)
|
||||
for_each_pci_msi_entry(entry, pdev)
|
||||
++num_msi;
|
||||
if (!num_msi)
|
||||
return 0;
|
||||
@@ -495,7 +486,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
|
||||
msi_attrs = kzalloc(sizeof(void *) * (num_msi + 1), GFP_KERNEL);
|
||||
if (!msi_attrs)
|
||||
return -ENOMEM;
|
||||
list_for_each_entry(entry, &pdev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, pdev) {
|
||||
msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
|
||||
if (!msi_dev_attr)
|
||||
goto error_attrs;
|
||||
@@ -553,7 +544,7 @@ static struct msi_desc *msi_setup_entry(struct pci_dev *dev, int nvec)
|
||||
struct msi_desc *entry;
|
||||
|
||||
/* MSI Entry Initialization */
|
||||
entry = alloc_msi_entry(dev);
|
||||
entry = alloc_msi_entry(&dev->dev);
|
||||
if (!entry)
|
||||
return NULL;
|
||||
|
||||
@@ -584,7 +575,7 @@ static int msi_verify_entries(struct pci_dev *dev)
|
||||
{
|
||||
struct msi_desc *entry;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, dev) {
|
||||
if (!dev->no_64bit_msi || !entry->msg.address_hi)
|
||||
continue;
|
||||
dev_err(&dev->dev, "Device has broken 64-bit MSI but arch"
|
||||
@@ -621,7 +612,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
|
||||
mask = msi_mask(entry->msi_attrib.multi_cap);
|
||||
msi_mask_irq(entry, mask, mask);
|
||||
|
||||
list_add_tail(&entry->list, &dev->msi_list);
|
||||
list_add_tail(&entry->list, dev_to_msi_list(&dev->dev));
|
||||
|
||||
/* Configure MSI capability structure */
|
||||
ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
|
||||
@@ -682,7 +673,7 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nvec; i++) {
|
||||
entry = alloc_msi_entry(dev);
|
||||
entry = alloc_msi_entry(&dev->dev);
|
||||
if (!entry) {
|
||||
if (!i)
|
||||
iounmap(base);
|
||||
@@ -699,7 +690,7 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
|
||||
entry->mask_base = base;
|
||||
entry->nvec_used = 1;
|
||||
|
||||
list_add_tail(&entry->list, &dev->msi_list);
|
||||
list_add_tail(&entry->list, dev_to_msi_list(&dev->dev));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -711,7 +702,7 @@ static void msix_program_entries(struct pci_dev *dev,
|
||||
struct msi_desc *entry;
|
||||
int i = 0;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, dev) {
|
||||
int offset = entries[i].entry * PCI_MSIX_ENTRY_SIZE +
|
||||
PCI_MSIX_ENTRY_VECTOR_CTRL;
|
||||
|
||||
@@ -792,7 +783,7 @@ out_avail:
|
||||
struct msi_desc *entry;
|
||||
int avail = 0;
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, dev) {
|
||||
if (entry->irq != 0)
|
||||
avail++;
|
||||
}
|
||||
@@ -881,8 +872,8 @@ void pci_msi_shutdown(struct pci_dev *dev)
|
||||
if (!pci_msi_enable || !dev || !dev->msi_enabled)
|
||||
return;
|
||||
|
||||
BUG_ON(list_empty(&dev->msi_list));
|
||||
desc = list_first_entry(&dev->msi_list, struct msi_desc, list);
|
||||
BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));
|
||||
desc = first_pci_msi_entry(dev);
|
||||
|
||||
pci_msi_set_enable(dev, 0);
|
||||
pci_intx_for_msi(dev, 1);
|
||||
@@ -988,7 +979,7 @@ void pci_msix_shutdown(struct pci_dev *dev)
|
||||
return;
|
||||
|
||||
/* Return the device with MSI-X masked as initial states */
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
for_each_pci_msi_entry(entry, dev) {
|
||||
/* Keep cached states to be restored */
|
||||
__pci_msix_desc_mask_irq(entry, 1);
|
||||
}
|
||||
@@ -1028,7 +1019,6 @@ EXPORT_SYMBOL(pci_msi_enabled);
|
||||
|
||||
void pci_msi_init_pci_dev(struct pci_dev *dev)
|
||||
{
|
||||
INIT_LIST_HEAD(&dev->msi_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1125,6 +1115,19 @@ int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
|
||||
}
|
||||
EXPORT_SYMBOL(pci_enable_msix_range);
|
||||
|
||||
struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
|
||||
{
|
||||
return to_pci_dev(desc->dev);
|
||||
}
|
||||
|
||||
void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
|
||||
{
|
||||
struct pci_dev *dev = msi_desc_to_pci_dev(desc);
|
||||
|
||||
return dev->bus->sysdata;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(msi_desc_to_pci_sysdata);
|
||||
|
||||
#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
|
||||
/**
|
||||
* pci_msi_domain_write_msg - Helper to write MSI message to PCI config space
|
||||
@@ -1133,7 +1136,7 @@ EXPORT_SYMBOL(pci_enable_msix_range);
|
||||
*/
|
||||
void pci_msi_domain_write_msg(struct irq_data *irq_data, struct msi_msg *msg)
|
||||
{
|
||||
struct msi_desc *desc = irq_data->msi_desc;
|
||||
struct msi_desc *desc = irq_data_get_msi_desc(irq_data);
|
||||
|
||||
/*
|
||||
* For MSI-X desc->irq is always equal to irq_data->irq. For
|
||||
@@ -1257,12 +1260,19 @@ struct irq_domain *pci_msi_create_irq_domain(struct device_node *node,
|
||||
struct msi_domain_info *info,
|
||||
struct irq_domain *parent)
|
||||
{
|
||||
struct irq_domain *domain;
|
||||
|
||||
if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS)
|
||||
pci_msi_domain_update_dom_ops(info);
|
||||
if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
|
||||
pci_msi_domain_update_chip_ops(info);
|
||||
|
||||
return msi_create_irq_domain(node, info, parent);
|
||||
domain = msi_create_irq_domain(node, info, parent);
|
||||
if (!domain)
|
||||
return NULL;
|
||||
|
||||
domain->bus_token = DOMAIN_BUS_PCI_MSI;
|
||||
return domain;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user