Skip to content

Commit

Permalink
Merge branch irq/generic_handle_domain_irq-core into irq/irqchip-next
Browse files Browse the repository at this point in the history
Simplify the handling of interrupts that require an IRQ domain
resolution:
- domains now cache the irqdata instead of the irq number
- consistent behaviour wrt RCU
- single lookup for architectures using sparse IRQs
- reduced boilerplate code in drivers.

* irq/generic_handle_domain_irq-core: (26 commits)
  irqchip: Bulk conversion to generic_handle_domain_irq()
  genirq: Move non-irqdomain handle_domain_irq() handling into ARM's handle_IRQ()
  genirq: Add generic_handle_domain_irq() helper
  irqchip/nvic: Convert from handle_IRQ() to handle_domain_irq()
  irqdesc: Fix __handle_domain_irq() comment
  genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co
  irqdomain: Introduce irq_resolve_mapping()
  irqdomain: Protect the linear revmap with RCU
  irqdomain: Cache irq_data instead of a virq number in the revmap
  irqdomain: Use struct_size() helper when allocating irqdomain
  irqdomain: Make normal and nomap irqdomains exclusive
  powerpc: Move the use of irq_domain_add_nomap() behind a config option
  irqdomain: Reimplement irq_linear_revmap() with irq_find_mapping()
  irqdomain: Kill irq_domain_add_legacy_isa
  powerpc: Drop dependency between asm/irq.h and linux/irqdomain.h
  powerpc: Convert irq_domain_add_legacy_isa use to irq_domain_add_legacy
  scsi/ibmvscsi: Directly include linux/{of.h,irqdomain.h}
  powerpc: Add missing linux/{of.h,irqdomain.h} include directives
  MIPS: Do not include linux/irqdomain.h from asm/irq.h
  MIPS: Add missing linux/irqdomain.h includes
  ...
  • Loading branch information
Marc Zyngier committed Jun 11, 2021
2 parents cd273da + 046a6ee commit c64638d
Show file tree
Hide file tree
Showing 90 changed files with 346 additions and 314 deletions.
1 change: 0 additions & 1 deletion Documentation/core-api/irq/irq-domain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ Legacy

irq_domain_add_simple()
irq_domain_add_legacy()
irq_domain_add_legacy_isa()
irq_domain_create_simple()
irq_domain_create_legacy()

Expand Down
22 changes: 21 additions & 1 deletion arch/arm/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,27 @@ int arch_show_interrupts(struct seq_file *p, int prec)
*/
void handle_IRQ(unsigned int irq, struct pt_regs *regs)
{
__handle_domain_irq(NULL, irq, false, regs);
struct pt_regs *old_regs = set_irq_regs(regs);
struct irq_desc *desc;

irq_enter();

/*
* Some hardware gives randomly wrong interrupts. Rather
* than crashing, do something sensible.
*/
if (unlikely(!irq || irq >= nr_irqs))
desc = NULL;
else
desc = irq_to_desc(irq);

if (likely(desc))
handle_irq_desc(desc);
else
ack_bad_irq(irq);

irq_exit();
set_irq_regs(old_regs);
}

/*
Expand Down
1 change: 0 additions & 1 deletion arch/mips/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <linux/linkage.h>
#include <linux/smp.h>
#include <linux/irqdomain.h>

#include <asm/mipsmtregs.h>

Expand Down
1 change: 1 addition & 0 deletions arch/mips/lantiq/xway/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/spinlock.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/of.h>

#include <lantiq_soc.h>
#include <xway_dma.h>
Expand Down
1 change: 1 addition & 0 deletions arch/mips/pci/pci-rt3883.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_pci.h>
Expand Down
1 change: 1 addition & 0 deletions arch/mips/pci/pci-xtalk-bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/platform_data/xtalk-bridge.h>
#include <linux/nvmem-consumer.h>
#include <linux/crc16.h>
#include <linux/irqdomain.h>

#include <asm/pci/bridge.h>
#include <asm/paccess.h>
Expand Down
1 change: 1 addition & 0 deletions arch/mips/sgi-ip27/ip27-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/bitops.h>
Expand Down
1 change: 1 addition & 0 deletions arch/mips/sgi-ip30/ip30-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/percpu.h>
#include <linux/spinlock.h>
#include <linux/tick.h>
Expand Down
1 change: 0 additions & 1 deletion arch/nios2/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
#define NIOS2_CPU_NR_IRQS 32

#include <asm-generic/irq.h>
#include <linux/irqdomain.h>

#endif
1 change: 1 addition & 0 deletions arch/nios2/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/of.h>

static u32 ienable;
Expand Down
5 changes: 2 additions & 3 deletions arch/powerpc/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/*
*/

#include <linux/irqdomain.h>
#include <linux/threads.h>
#include <linux/list.h>
#include <linux/radix-tree.h>
Expand All @@ -23,8 +22,8 @@ extern atomic_t ppc_n_lost_interrupts;
/* Total number of virq in the platform */
#define NR_IRQS CONFIG_NR_IRQS

/* Same thing, used by the generic IRQ code */
#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
/* Number of irqs reserved for a legacy isa controller */
#define NR_IRQS_LEGACY 16

extern irq_hw_number_t virq_to_hw(unsigned int virq);

Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/kernel/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/extable.h>
#include <linux/ftrace.h>
#include <linux/memblock.h>
#include <linux/of.h>

#include <asm/interrupt.h>
#include <asm/machdep.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/kvm/book3s_hv_uvmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
#include <linux/migrate.h>
#include <linux/kvm_host.h>
#include <linux/ksm.h>
#include <linux/of.h>
#include <asm/ultravisor.h>
#include <asm/mman.h>
#include <asm/kvm_ppc.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/kvm/book3s_xive.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/percpu.h>
#include <linux/cpumask.h>
#include <linux/uaccess.h>
#include <linux/irqdomain.h>
#include <asm/kvm_book3s.h>
#include <asm/kvm_ppc.h>
#include <asm/hvcall.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/kvm/book3s_xive_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/file.h>
#include <linux/irqdomain.h>
#include <asm/uaccess.h>
#include <asm/kvm_book3s.h>
#include <asm/kvm_ppc.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/mm/book3s64/radix_pgtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/sched/mm.h>
#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/mm.h>
#include <linux/hugetlb.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/cell/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ config PPC_IBM_CELL_BLADE
config AXON_MSI
bool
depends on PPC_IBM_CELL_BLADE && PCI_MSI
select IRQ_DOMAIN_NOMAP
default y

menu "Cell Broadband Engine options"
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/cell/pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/types.h>
#include <linux/export.h>
#include <asm/io.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/embedded6xx/flipper-pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <asm/io.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/powermac/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ config PPC_PMAC32_PSURGE
bool "Support for powersurge upgrade cards" if EXPERT
depends on SMP && PPC32 && PPC_PMAC
select PPC_SMP_MUXED_IPI
select IRQ_DOMAIN_NOMAP
default y
help
The powersurge cpu boards can be used in the generation
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/ps3/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ config PPC_PS3
select USB_OHCI_BIG_ENDIAN_MMIO
select USB_EHCI_BIG_ENDIAN_MMIO
select HAVE_PCI
select IRQ_DOMAIN_NOMAP
help
This option enables support for the Sony PS3 game console
and other platforms using the PS3 hypervisor. Enabling this
Expand Down
5 changes: 3 additions & 2 deletions arch/powerpc/platforms/ps3/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>

#include <asm/machdep.h>
#include <asm/udbg.h>
Expand Down Expand Up @@ -45,7 +46,7 @@
* implementation equates HV plug value to Linux virq value, constrains each
* interrupt to have a system wide unique plug number, and limits the range
* of the plug values to map into the first dword of the bitmaps. This
* gives a usable range of plug values of {NUM_ISA_INTERRUPTS..63}. Note
* gives a usable range of plug values of {NR_IRQS_LEGACY..63}. Note
* that there is no constraint on how many in this set an individual thread
* can acquire.
*
Expand Down Expand Up @@ -721,7 +722,7 @@ static unsigned int ps3_get_irq(void)
}

#if defined(DEBUG)
if (unlikely(plug < NUM_ISA_INTERRUPTS || plug > PS3_PLUG_MAX)) {
if (unlikely(plug < NR_IRQS_LEGACY || plug > PS3_PLUG_MAX)) {
dump_bmp(&per_cpu(ps3_private, 0));
dump_bmp(&per_cpu(ps3_private, 1));
BUG();
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/platforms/pseries/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <linux/kobject.h>
#include <linux/dma-map-ops.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/stat.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/sysdev/ehv_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/sysdev/fsl_mpic_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/irq.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>

#include <asm/io.h>
#include <asm/irq.h>
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ void i8259_init(struct device_node *node, unsigned long intack_addr)
raw_spin_unlock_irqrestore(&i8259_lock, flags);

/* create a legacy host */
i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
i8259_host = irq_domain_add_legacy(node, NR_IRQS_LEGACY, 0, 0,
&i8259_host_ops, NULL);
if (i8259_host == NULL) {
printk(KERN_ERR "i8259: failed to allocate irq host !\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
/* Find an mpic associated with a given linux interrupt */
static struct mpic *mpic_find(unsigned int irq)
{
if (irq < NUM_ISA_INTERRUPTS)
if (irq < NR_IRQS_LEGACY)
return NULL;

return irq_get_chip_data(irq);
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/sysdev/tsi108_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ void __init tsi108_pci_int_init(struct device_node *node)
{
DBG("Tsi108_pci_int_init: initializing PCI interrupts\n");

pci_irq_host = irq_domain_add_legacy_isa(node, &pci_irq_domain_ops, NULL);
pci_irq_host = irq_domain_add_legacy(node, NR_IRQS_LEGACY, 0, 0,
&pci_irq_domain_ops, NULL);
if (pci_irq_host == NULL) {
printk(KERN_ERR "pci_irq_host: failed to allocate irq domain!\n");
return;
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/sysdev/xics/icp-hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/irq.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/cpu.h>
#include <linux/of.h>

Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/sysdev/xics/icp-opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/irq.h>
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/cpu.h>
#include <linux/of.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/xics/xics-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void xics_migrate_irqs_away(void)
struct ics *ics;

/* We can't set affinity on ISA interrupts */
if (virq < NUM_ISA_INTERRUPTS)
if (virq < NR_IRQS_LEGACY)
continue;
/* We only need to migrate enabled IRQS */
if (!desc->action)
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/sysdev/xive/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ config PPC_XIVE
bool
select PPC_SMP_MUXED_IPI
select HARDIRQS_SW_RESEND
select IRQ_DOMAIN_NOMAP

config PPC_XIVE_NATIVE
bool
Expand Down
10 changes: 4 additions & 6 deletions drivers/irqchip/exynos-combiner.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ static void combiner_handle_cascade_irq(struct irq_desc *desc)
{
struct combiner_chip_data *chip_data = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int cascade_irq, combiner_irq;
unsigned int combiner_irq;
unsigned long status;
int ret;

chained_irq_enter(chip, desc);

Expand All @@ -80,12 +81,9 @@ static void combiner_handle_cascade_irq(struct irq_desc *desc)
goto out;

combiner_irq = chip_data->hwirq_offset + __ffs(status);
cascade_irq = irq_find_mapping(combiner_irq_domain, combiner_irq);

if (unlikely(!cascade_irq))
ret = generic_handle_domain_irq(combiner_irq_domain, combiner_irq);
if (unlikely(ret))
handle_bad_irq(desc);
else
generic_handle_irq(cascade_irq);

out:
chained_irq_exit(chip, desc);
Expand Down
7 changes: 2 additions & 5 deletions drivers/irqchip/irq-al-fic.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,15 @@ static void al_fic_irq_handler(struct irq_desc *desc)
struct irq_chip *irqchip = irq_desc_get_chip(desc);
struct irq_chip_generic *gc = irq_get_domain_generic_chip(domain, 0);
unsigned long pending;
unsigned int irq;
u32 hwirq;

chained_irq_enter(irqchip, desc);

pending = readl_relaxed(fic->base + AL_FIC_CAUSE);
pending &= ~gc->mask_cache;

for_each_set_bit(hwirq, &pending, NR_FIC_IRQS) {
irq = irq_find_mapping(domain, hwirq);
generic_handle_irq(irq);
}
for_each_set_bit(hwirq, &pending, NR_FIC_IRQS)
generic_handle_domain_irq(domain, hwirq);

chained_irq_exit(irqchip, desc);
}
Expand Down
Loading

0 comments on commit c64638d

Please sign in to comment.