Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch irq/affinity-nosmp into irq/plic-masking

* irq/affinity-nosmp:
: .
: non-SMP IRQ affinity fixes courtesy of Samuel Holland:
:
: "This series solves some inconsistency with how IRQ affinity masks are
: handled between SMP and non-SMP configurations.
:
: In non-SMP configs, an IRQ's true affinity is always cpumask_of(0), so
: irq_{,data_}get_affinity_mask now return that, instead of returning an
: uninitialized per-IRQ cpumask. This change makes iterating over the
: affinity mask do the right thing in both SMP and non-SMP configurations.
:
: To accomplish that:
: - patches 1-3 disable some library code that was broken anyway on !SMP
: - patches 4-7 refactor the code so that irq_{,data_}get_affinity_mask
: can return a const cpumask, since that is what cpumask_of provides
: - patch 8 drops the per-IRQ cpumask and replaces it with cpumask_of(0)"
: .
PCI: hv: Take a const cpumask in hv_compose_msi_req_get_cpu()
genirq: Provide an IRQ affinity mask in non-SMP configs
genirq: Return a const cpumask from irq_data_get_affinity_mask
genirq: Add and use an irq_data_update_affinity helper
genirq: Refactor accessors to use irq_data_get_affinity_mask
genirq: Drop redundant irq_init_effective_affinity
genirq: GENERIC_IRQ_EFFECTIVE_AFF_MASK depends on SMP
genirq: GENERIC_IRQ_IPI depends on SMP
irqchip/mips-gic: Only register IPI domain when SMP is enabled

Signed-off-by: Marc Zyngier <maz@kernel.org>

+143 -97
+1 -1
arch/alpha/kernel/irq.c
··· 60 60 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); 61 61 last_cpu = cpu; 62 62 63 - cpumask_copy(irq_data_get_affinity_mask(data), cpumask_of(cpu)); 63 + irq_data_update_affinity(data, cpumask_of(cpu)); 64 64 chip->irq_set_affinity(data, cpumask_of(cpu), false); 65 65 return 0; 66 66 }
+1 -1
arch/arm/mach-hisi/Kconfig
··· 40 40 select HAVE_ARM_ARCH_TIMER 41 41 select MCPM if SMP 42 42 select MCPM_QUAD_CLUSTER if SMP 43 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 43 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 44 44 help 45 45 Support for Hisilicon HiP04 SoC family 46 46
+1 -1
arch/ia64/kernel/iosapic.c
··· 834 834 if (iosapic_intr_info[irq].count == 0) { 835 835 #ifdef CONFIG_SMP 836 836 /* Clear affinity */ 837 - cpumask_setall(irq_get_affinity_mask(irq)); 837 + irq_data_update_affinity(irq_get_irq_data(irq), cpu_all_mask); 838 838 #endif 839 839 /* Clear the interrupt information */ 840 840 iosapic_intr_info[irq].dest = 0;
+2 -2
arch/ia64/kernel/irq.c
··· 57 57 void set_irq_affinity_info (unsigned int irq, int hwid, int redir) 58 58 { 59 59 if (irq < NR_IRQS) { 60 - cpumask_copy(irq_get_affinity_mask(irq), 61 - cpumask_of(cpu_logical_id(hwid))); 60 + irq_data_update_affinity(irq_get_irq_data(irq), 61 + cpumask_of(cpu_logical_id(hwid))); 62 62 irq_redir[irq] = (char) (redir & 0xff); 63 63 } 64 64 }
+2 -2
arch/ia64/kernel/msi_ia64.c
··· 37 37 msg.data = data; 38 38 39 39 pci_write_msi_msg(irq, &msg); 40 - cpumask_copy(irq_data_get_affinity_mask(idata), cpumask_of(cpu)); 40 + irq_data_update_affinity(idata, cpumask_of(cpu)); 41 41 42 42 return 0; 43 43 } ··· 132 132 msg.address_lo |= MSI_ADDR_DEST_ID_CPU(cpu_physical_id(cpu)); 133 133 134 134 dmar_msi_write(irq, &msg); 135 - cpumask_copy(irq_data_get_affinity_mask(data), mask); 135 + irq_data_update_affinity(data, mask); 136 136 137 137 return 0; 138 138 }
+2 -2
arch/mips/cavium-octeon/octeon-irq.c
··· 263 263 264 264 #ifdef CONFIG_SMP 265 265 int cpu; 266 - struct cpumask *mask = irq_data_get_affinity_mask(data); 266 + const struct cpumask *mask = irq_data_get_affinity_mask(data); 267 267 int weight = cpumask_weight(mask); 268 268 struct octeon_ciu_chip_data *cd = irq_data_get_irq_chip_data(data); 269 269 ··· 758 758 { 759 759 int cpu = smp_processor_id(); 760 760 cpumask_t new_affinity; 761 - struct cpumask *mask = irq_data_get_affinity_mask(data); 761 + const struct cpumask *mask = irq_data_get_affinity_mask(data); 762 762 763 763 if (!cpumask_test_cpu(cpu, mask)) 764 764 return;
+1 -1
arch/parisc/kernel/irq.c
··· 315 315 { 316 316 #ifdef CONFIG_SMP 317 317 struct irq_data *d = irq_get_irq_data(irq); 318 - cpumask_copy(irq_data_get_affinity_mask(d), cpumask_of(cpu)); 318 + irq_data_update_affinity(d, cpumask_of(cpu)); 319 319 #endif 320 320 321 321 return per_cpu(cpu_data, cpu).txn_addr;
+4 -3
arch/sh/kernel/irq.c
··· 230 230 struct irq_data *data = irq_get_irq_data(irq); 231 231 232 232 if (irq_data_get_node(data) == cpu) { 233 - struct cpumask *mask = irq_data_get_affinity_mask(data); 233 + const struct cpumask *mask = irq_data_get_affinity_mask(data); 234 234 unsigned int newcpu = cpumask_any_and(mask, 235 235 cpu_online_mask); 236 236 if (newcpu >= nr_cpu_ids) { 237 237 pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n", 238 238 irq, cpu); 239 239 240 - cpumask_setall(mask); 240 + irq_set_affinity(irq, cpu_all_mask); 241 + } else { 242 + irq_set_affinity(irq, mask); 241 243 } 242 - irq_set_affinity(irq, mask); 243 244 } 244 245 } 245 246 }
+1 -1
arch/x86/hyperv/irqdomain.c
··· 192 192 struct pci_dev *dev; 193 193 struct hv_interrupt_entry out_entry, *stored_entry; 194 194 struct irq_cfg *cfg = irqd_cfg(data); 195 - cpumask_t *affinity; 195 + const cpumask_t *affinity; 196 196 int cpu; 197 197 u64 status; 198 198
+4 -3
arch/xtensa/kernel/irq.c
··· 169 169 170 170 for_each_active_irq(i) { 171 171 struct irq_data *data = irq_get_irq_data(i); 172 - struct cpumask *mask; 172 + const struct cpumask *mask; 173 173 unsigned int newcpu; 174 174 175 175 if (irqd_is_per_cpu(data)) ··· 185 185 pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n", 186 186 i, cpu); 187 187 188 - cpumask_setall(mask); 188 + irq_set_affinity(i, cpu_all_mask); 189 + } else { 190 + irq_set_affinity(i, mask); 189 191 } 190 - irq_set_affinity(i, mask); 191 192 } 192 193 } 193 194 #endif /* CONFIG_HOTPLUG_CPU */
+1 -1
drivers/iommu/hyperv-iommu.c
··· 194 194 u32 vector; 195 195 struct irq_cfg *cfg; 196 196 int ioapic_id; 197 - struct cpumask *affinity; 197 + const struct cpumask *affinity; 198 198 int cpu; 199 199 struct hv_interrupt_entry entry; 200 200 struct hyperv_root_ir_data *data = irq_data->chip_data;
+10 -9
drivers/irqchip/Kconfig
··· 8 8 config ARM_GIC 9 9 bool 10 10 select IRQ_DOMAIN_HIERARCHY 11 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 11 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 12 12 13 13 config ARM_GIC_PM 14 14 bool ··· 34 34 bool 35 35 select IRQ_DOMAIN_HIERARCHY 36 36 select PARTITION_PERCPU 37 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 37 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 38 38 39 39 config ARM_GIC_V3_ITS 40 40 bool ··· 76 76 bool 77 77 select GENERIC_IRQ_CHIP 78 78 select PCI_MSI if PCI 79 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 79 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 80 80 81 81 config ALPINE_MSI 82 82 bool ··· 112 112 bool 113 113 select GENERIC_IRQ_CHIP 114 114 select IRQ_DOMAIN 115 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 115 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 116 116 117 117 config BCM7038_L1_IRQ 118 118 tristate "Broadcom STB 7038-style L1/L2 interrupt controller driver" ··· 120 120 default ARCH_BRCMSTB || BMIPS_GENERIC 121 121 select GENERIC_IRQ_CHIP 122 122 select IRQ_DOMAIN 123 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 123 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 124 124 125 125 config BCM7120_L2_IRQ 126 126 tristate "Broadcom STB 7120-style L2 interrupt controller driver" ··· 177 177 config IRQ_MIPS_CPU 178 178 bool 179 179 select GENERIC_IRQ_CHIP 180 - select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING 180 + select GENERIC_IRQ_IPI if SMP && SYS_SUPPORTS_MULTITHREADING 181 181 select IRQ_DOMAIN 182 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 182 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 183 183 184 184 config CLPS711X_IRQCHIP 185 185 bool ··· 294 294 config XTENSA_MX 295 295 bool 296 296 select IRQ_DOMAIN 297 - select GENERIC_IRQ_EFFECTIVE_AFF_MASK 297 + select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP 298 298 299 299 config XILINX_INTC 300 300 bool "Xilinx Interrupt Controller IP" ··· 322 322 323 323 config MIPS_GIC 324 324 bool 325 - select GENERIC_IRQ_IPI 325 + select GENERIC_IRQ_IPI if SMP 326 + select IRQ_DOMAIN_HIERARCHY 326 327 select MIPS_CM 327 328 328 329 config INGENIC_IRQ
+2 -2
drivers/irqchip/irq-bcm6345-l1.c
··· 216 216 enabled = intc->cpus[old_cpu]->enable_cache[word] & mask; 217 217 if (enabled) 218 218 __bcm6345_l1_mask(d); 219 - cpumask_copy(irq_data_get_affinity_mask(d), dest); 219 + irq_data_update_affinity(d, dest); 220 220 if (enabled) 221 221 __bcm6345_l1_unmask(d); 222 222 } else { 223 - cpumask_copy(irq_data_get_affinity_mask(d), dest); 223 + irq_data_update_affinity(d, dest); 224 224 } 225 225 raw_spin_unlock_irqrestore(&intc->lock, flags); 226 226
+54 -26
drivers/irqchip/irq-mips-gic.c
··· 52 52 53 53 static DEFINE_SPINLOCK(gic_lock); 54 54 static struct irq_domain *gic_irq_domain; 55 - static struct irq_domain *gic_ipi_domain; 56 55 static int gic_shared_intrs; 57 56 static unsigned int gic_cpu_pin; 58 57 static unsigned int timer_cpu_pin; 59 58 static struct irq_chip gic_level_irq_controller, gic_edge_irq_controller; 59 + 60 + #ifdef CONFIG_GENERIC_IRQ_IPI 60 61 static DECLARE_BITMAP(ipi_resrv, GIC_MAX_INTRS); 61 62 static DECLARE_BITMAP(ipi_available, GIC_MAX_INTRS); 63 + #endif /* CONFIG_GENERIC_IRQ_IPI */ 62 64 63 65 static struct gic_all_vpes_chip_data { 64 66 u32 map; ··· 474 472 u32 map; 475 473 476 474 if (hwirq >= GIC_SHARED_HWIRQ_BASE) { 475 + #ifdef CONFIG_GENERIC_IRQ_IPI 477 476 /* verify that shared irqs don't conflict with an IPI irq */ 478 477 if (test_bit(GIC_HWIRQ_TO_SHARED(hwirq), ipi_resrv)) 479 478 return -EBUSY; 479 + #endif /* CONFIG_GENERIC_IRQ_IPI */ 480 480 481 481 err = irq_domain_set_hwirq_and_chip(d, virq, hwirq, 482 482 &gic_level_irq_controller, ··· 570 566 .free = gic_irq_domain_free, 571 567 .map = gic_irq_domain_map, 572 568 }; 569 + 570 + #ifdef CONFIG_GENERIC_IRQ_IPI 573 571 574 572 static int gic_ipi_domain_xlate(struct irq_domain *d, struct device_node *ctrlr, 575 573 const u32 *intspec, unsigned int intsize, ··· 676 670 .match = gic_ipi_domain_match, 677 671 }; 678 672 673 + static int gic_register_ipi_domain(struct device_node *node) 674 + { 675 + struct irq_domain *gic_ipi_domain; 676 + unsigned int v[2], num_ipis; 677 + 678 + gic_ipi_domain = irq_domain_add_hierarchy(gic_irq_domain, 679 + IRQ_DOMAIN_FLAG_IPI_PER_CPU, 680 + GIC_NUM_LOCAL_INTRS + gic_shared_intrs, 681 + node, &gic_ipi_domain_ops, NULL); 682 + if (!gic_ipi_domain) { 683 + pr_err("Failed to add IPI domain"); 684 + return -ENXIO; 685 + } 686 + 687 + irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); 688 + 689 + if (node && 690 + !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { 691 + bitmap_set(ipi_resrv, v[0], v[1]); 692 + } else { 693 + /* 694 + * Reserve 2 interrupts per possible CPU/VP for use as IPIs, 695 + * meeting the requirements of arch/mips SMP. 696 + */ 697 + num_ipis = 2 * num_possible_cpus(); 698 + bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis); 699 + } 700 + 701 + bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); 702 + 703 + return 0; 704 + } 705 + 706 + #else /* !CONFIG_GENERIC_IRQ_IPI */ 707 + 708 + static inline int gic_register_ipi_domain(struct device_node *node) 709 + { 710 + return 0; 711 + } 712 + 713 + #endif /* !CONFIG_GENERIC_IRQ_IPI */ 714 + 679 715 static int gic_cpu_startup(unsigned int cpu) 680 716 { 681 717 /* Enable or disable EIC */ ··· 736 688 static int __init gic_of_init(struct device_node *node, 737 689 struct device_node *parent) 738 690 { 739 - unsigned int cpu_vec, i, gicconfig, v[2], num_ipis; 691 + unsigned int cpu_vec, i, gicconfig; 740 692 unsigned long reserved; 741 693 phys_addr_t gic_base; 742 694 struct resource res; 743 695 size_t gic_len; 696 + int ret; 744 697 745 698 /* Find the first available CPU vector. */ 746 699 i = 0; ··· 829 780 return -ENXIO; 830 781 } 831 782 832 - gic_ipi_domain = irq_domain_add_hierarchy(gic_irq_domain, 833 - IRQ_DOMAIN_FLAG_IPI_PER_CPU, 834 - GIC_NUM_LOCAL_INTRS + gic_shared_intrs, 835 - node, &gic_ipi_domain_ops, NULL); 836 - if (!gic_ipi_domain) { 837 - pr_err("Failed to add IPI domain"); 838 - return -ENXIO; 839 - } 840 - 841 - irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); 842 - 843 - if (node && 844 - !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { 845 - bitmap_set(ipi_resrv, v[0], v[1]); 846 - } else { 847 - /* 848 - * Reserve 2 interrupts per possible CPU/VP for use as IPIs, 849 - * meeting the requirements of arch/mips SMP. 850 - */ 851 - num_ipis = 2 * num_possible_cpus(); 852 - bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis); 853 - } 854 - 855 - bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); 783 + ret = gic_register_ipi_domain(node); 784 + if (ret) 785 + return ret; 856 786 857 787 board_bind_eic_interrupt = &gic_bind_eic_interrupt; 858 788
+1 -1
drivers/parisc/iosapic.c
··· 677 677 if (dest_cpu < 0) 678 678 return -1; 679 679 680 - cpumask_copy(irq_data_get_affinity_mask(d), cpumask_of(dest_cpu)); 680 + irq_data_update_affinity(d, cpumask_of(dest_cpu)); 681 681 vi->txn_addr = txn_affinity_addr(d->irq, dest_cpu); 682 682 683 683 spin_lock_irqsave(&iosapic_lock, flags);
+6 -6
drivers/pci/controller/pci-hyperv.c
··· 642 642 struct hv_retarget_device_interrupt *params; 643 643 struct tran_int_desc *int_desc; 644 644 struct hv_pcibus_device *hbus; 645 - struct cpumask *dest; 645 + const struct cpumask *dest; 646 646 cpumask_var_t tmp; 647 647 struct pci_bus *pbus; 648 648 struct pci_dev *pdev; ··· 1613 1613 } 1614 1614 1615 1615 static u32 hv_compose_msi_req_v1( 1616 - struct pci_create_interrupt *int_pkt, struct cpumask *affinity, 1616 + struct pci_create_interrupt *int_pkt, const struct cpumask *affinity, 1617 1617 u32 slot, u8 vector, u8 vector_count) 1618 1618 { 1619 1619 int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE; ··· 1635 1635 * Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten 1636 1636 * by subsequent retarget in hv_irq_unmask(). 1637 1637 */ 1638 - static int hv_compose_msi_req_get_cpu(struct cpumask *affinity) 1638 + static int hv_compose_msi_req_get_cpu(const struct cpumask *affinity) 1639 1639 { 1640 1640 return cpumask_first_and(affinity, cpu_online_mask); 1641 1641 } 1642 1642 1643 1643 static u32 hv_compose_msi_req_v2( 1644 - struct pci_create_interrupt2 *int_pkt, struct cpumask *affinity, 1644 + struct pci_create_interrupt2 *int_pkt, const struct cpumask *affinity, 1645 1645 u32 slot, u8 vector, u8 vector_count) 1646 1646 { 1647 1647 int cpu; ··· 1660 1660 } 1661 1661 1662 1662 static u32 hv_compose_msi_req_v3( 1663 - struct pci_create_interrupt3 *int_pkt, struct cpumask *affinity, 1663 + struct pci_create_interrupt3 *int_pkt, const struct cpumask *affinity, 1664 1664 u32 slot, u32 vector, u8 vector_count) 1665 1665 { 1666 1666 int cpu; ··· 1697 1697 struct hv_pci_dev *hpdev; 1698 1698 struct pci_bus *pbus; 1699 1699 struct pci_dev *pdev; 1700 - struct cpumask *dest; 1700 + const struct cpumask *dest; 1701 1701 struct compose_comp_ctxt comp; 1702 1702 struct tran_int_desc *int_desc; 1703 1703 struct msi_desc *msi_desc;
+1 -1
drivers/sh/intc/chip.c
··· 72 72 if (!cpumask_intersects(cpumask, cpu_online_mask)) 73 73 return -1; 74 74 75 - cpumask_copy(irq_data_get_affinity_mask(data), cpumask); 75 + irq_data_update_affinity(data, cpumask); 76 76 77 77 return IRQ_SET_MASK_OK_NOCOPY; 78 78 }
+4 -3
drivers/xen/events/events_base.c
··· 528 528 BUG_ON(irq == -1); 529 529 530 530 if (IS_ENABLED(CONFIG_SMP) && force_affinity) { 531 - cpumask_copy(irq_get_affinity_mask(irq), cpumask_of(cpu)); 532 - cpumask_copy(irq_get_effective_affinity_mask(irq), 533 - cpumask_of(cpu)); 531 + struct irq_data *data = irq_get_irq_data(irq); 532 + 533 + irq_data_update_affinity(data, cpumask_of(cpu)); 534 + irq_data_update_effective_affinity(data, cpumask_of(cpu)); 534 535 } 535 536 536 537 xen_evtchn_port_bind_to_cpu(evtchn, cpu, info->cpu);
+27 -11
include/linux/irq.h
··· 151 151 #endif 152 152 void *handler_data; 153 153 struct msi_desc *msi_desc; 154 + #ifdef CONFIG_SMP 154 155 cpumask_var_t affinity; 156 + #endif 155 157 #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK 156 158 cpumask_var_t effective_affinity; 157 159 #endif ··· 881 879 return irq_common_data_get_node(d->common); 882 880 } 883 881 884 - static inline struct cpumask *irq_get_affinity_mask(int irq) 882 + static inline 883 + const struct cpumask *irq_data_get_affinity_mask(struct irq_data *d) 884 + { 885 + #ifdef CONFIG_SMP 886 + return d->common->affinity; 887 + #else 888 + return cpumask_of(0); 889 + #endif 890 + } 891 + 892 + static inline void irq_data_update_affinity(struct irq_data *d, 893 + const struct cpumask *m) 894 + { 895 + #ifdef CONFIG_SMP 896 + cpumask_copy(d->common->affinity, m); 897 + #endif 898 + } 899 + 900 + static inline const struct cpumask *irq_get_affinity_mask(int irq) 885 901 { 886 902 struct irq_data *d = irq_get_irq_data(irq); 887 903 888 - return d ? d->common->affinity : NULL; 889 - } 890 - 891 - static inline struct cpumask *irq_data_get_affinity_mask(struct irq_data *d) 892 - { 893 - return d->common->affinity; 904 + return d ? irq_data_get_affinity_mask(d) : NULL; 894 905 } 895 906 896 907 #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK 897 908 static inline 898 - struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d) 909 + const struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d) 899 910 { 900 911 return d->common->effective_affinity; 901 912 } ··· 923 908 { 924 909 } 925 910 static inline 926 - struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d) 911 + const struct cpumask *irq_data_get_effective_affinity_mask(struct irq_data *d) 927 912 { 928 - return d->common->affinity; 913 + return irq_data_get_affinity_mask(d); 929 914 } 930 915 #endif 931 916 932 - static inline struct cpumask *irq_get_effective_affinity_mask(unsigned int irq) 917 + static inline 918 + const struct cpumask *irq_get_effective_affinity_mask(unsigned int irq) 933 919 { 934 920 struct irq_data *d = irq_get_irq_data(irq); 935 921
+2
kernel/irq/Kconfig
··· 24 24 25 25 # Supports effective affinity mask 26 26 config GENERIC_IRQ_EFFECTIVE_AFF_MASK 27 + depends on SMP 27 28 bool 28 29 29 30 # Support for delayed migration from interrupt context ··· 83 82 # Generic IRQ IPI support 84 83 config GENERIC_IRQ_IPI 85 84 bool 85 + depends on SMP 86 86 select IRQ_DOMAIN_HIERARCHY 87 87 88 88 # Generic MSI interrupt support
+5 -3
kernel/irq/chip.c
··· 188 188 189 189 #ifdef CONFIG_SMP 190 190 static int 191 - __irq_startup_managed(struct irq_desc *desc, struct cpumask *aff, bool force) 191 + __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff, 192 + bool force) 192 193 { 193 194 struct irq_data *d = irq_desc_get_irq_data(desc); 194 195 ··· 225 224 } 226 225 #else 227 226 static __always_inline int 228 - __irq_startup_managed(struct irq_desc *desc, struct cpumask *aff, bool force) 227 + __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff, 228 + bool force) 229 229 { 230 230 return IRQ_STARTUP_NORMAL; 231 231 } ··· 254 252 int irq_startup(struct irq_desc *desc, bool resend, bool force) 255 253 { 256 254 struct irq_data *d = irq_desc_get_irq_data(desc); 257 - struct cpumask *aff = irq_data_get_affinity_mask(d); 255 + const struct cpumask *aff = irq_data_get_affinity_mask(d); 258 256 int ret = 0; 259 257 260 258 desc->depth = 0;
+1 -1
kernel/irq/debugfs.c
··· 30 30 static void irq_debug_show_masks(struct seq_file *m, struct irq_desc *desc) 31 31 { 32 32 struct irq_data *data = irq_desc_get_irq_data(desc); 33 - struct cpumask *msk; 33 + const struct cpumask *msk; 34 34 35 35 msk = irq_data_get_affinity_mask(data); 36 36 seq_printf(m, "affinity: %*pbl\n", cpumask_pr_args(msk));
+9 -7
kernel/irq/ipi.c
··· 115 115 int irq_destroy_ipi(unsigned int irq, const struct cpumask *dest) 116 116 { 117 117 struct irq_data *data = irq_get_irq_data(irq); 118 - struct cpumask *ipimask = data ? irq_data_get_affinity_mask(data) : NULL; 118 + const struct cpumask *ipimask; 119 119 struct irq_domain *domain; 120 120 unsigned int nr_irqs; 121 121 122 - if (!irq || !data || !ipimask) 122 + if (!irq || !data) 123 123 return -EINVAL; 124 124 125 125 domain = data->domain; ··· 131 131 return -EINVAL; 132 132 } 133 133 134 - if (WARN_ON(!cpumask_subset(dest, ipimask))) 134 + ipimask = irq_data_get_affinity_mask(data); 135 + if (!ipimask || WARN_ON(!cpumask_subset(dest, ipimask))) 135 136 /* 136 137 * Must be destroying a subset of CPUs to which this IPI 137 138 * was set up to target ··· 163 162 irq_hw_number_t ipi_get_hwirq(unsigned int irq, unsigned int cpu) 164 163 { 165 164 struct irq_data *data = irq_get_irq_data(irq); 166 - struct cpumask *ipimask = data ? irq_data_get_affinity_mask(data) : NULL; 165 + const struct cpumask *ipimask; 167 166 168 - if (!data || !ipimask || cpu >= nr_cpu_ids) 167 + if (!data || cpu >= nr_cpu_ids) 169 168 return INVALID_HWIRQ; 170 169 171 - if (!cpumask_test_cpu(cpu, ipimask)) 170 + ipimask = irq_data_get_affinity_mask(data); 171 + if (!ipimask || !cpumask_test_cpu(cpu, ipimask)) 172 172 return INVALID_HWIRQ; 173 173 174 174 /* ··· 188 186 static int ipi_send_verify(struct irq_chip *chip, struct irq_data *data, 189 187 const struct cpumask *dest, unsigned int cpu) 190 188 { 191 - struct cpumask *ipimask = irq_data_get_affinity_mask(data); 189 + const struct cpumask *ipimask = irq_data_get_affinity_mask(data); 192 190 193 191 if (!chip || !ipimask) 194 192 return -EINVAL;
+1 -9
kernel/irq/manage.c
··· 205 205 pr_warn_once("irq_chip %s did not update eff. affinity mask of irq %u\n", 206 206 chip->name, data->irq); 207 207 } 208 - 209 - static inline void irq_init_effective_affinity(struct irq_data *data, 210 - const struct cpumask *mask) 211 - { 212 - cpumask_copy(irq_data_get_effective_affinity_mask(data), mask); 213 - } 214 208 #else 215 209 static inline void irq_validate_effective_affinity(struct irq_data *data) { } 216 - static inline void irq_init_effective_affinity(struct irq_data *data, 217 - const struct cpumask *mask) { } 218 210 #endif 219 211 220 212 int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, ··· 339 347 return false; 340 348 341 349 cpumask_copy(desc->irq_common_data.affinity, mask); 342 - irq_init_effective_affinity(data, mask); 350 + irq_data_update_effective_affinity(data, mask); 343 351 irqd_set(data, IRQD_AFFINITY_SET); 344 352 return true; 345 353 }