Merge tag 'irqchip-4.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/urgent

Pull irqchip updates for 4.15, take #4 from Marc Zyngier

- A core irq fix for legacy cases where the irq trigger is not reported
by firmware

- A couple of GICv3/4 fixes (Kconfig, of-node refcount, error handling)

- Trivial pr_err fixes

+47 -10
+7
drivers/irqchip/Kconfig
··· 41 41 42 42 config ARM_GIC_V3_ITS 43 43 bool 44 + select GENERIC_MSI_IRQ_DOMAIN 45 + default ARM_GIC_V3 46 + 47 + config ARM_GIC_V3_ITS_PCI 48 + bool 49 + depends on ARM_GIC_V3_ITS 44 50 depends on PCI 45 51 depends on PCI_MSI 52 + default ARM_GIC_V3_ITS 46 53 47 54 config ARM_NVIC 48 55 bool
+2 -1
drivers/irqchip/Makefile
··· 30 30 obj-$(CONFIG_ARCH_REALVIEW) += irq-gic-realview.o 31 31 obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o 32 32 obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-common.o 33 - obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o irq-gic-v3-its-pci-msi.o irq-gic-v3-its-platform-msi.o irq-gic-v4.o 33 + obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o irq-gic-v3-its-platform-msi.o irq-gic-v4.o 34 + obj-$(CONFIG_ARM_GIC_V3_ITS_PCI) += irq-gic-v3-its-pci-msi.o 34 35 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o 35 36 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o 36 37 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
+7 -4
drivers/irqchip/irq-gic-v3.c
··· 1103 1103 int nr_parts; 1104 1104 struct partition_affinity *parts; 1105 1105 1106 - parts_node = of_find_node_by_name(gic_node, "ppi-partitions"); 1106 + parts_node = of_get_child_by_name(gic_node, "ppi-partitions"); 1107 1107 if (!parts_node) 1108 1108 return; 1109 1109 1110 1110 nr_parts = of_get_child_count(parts_node); 1111 1111 1112 1112 if (!nr_parts) 1113 - return; 1113 + goto out_put_node; 1114 1114 1115 1115 parts = kzalloc(sizeof(*parts) * nr_parts, GFP_KERNEL); 1116 1116 if (WARN_ON(!parts)) 1117 - return; 1117 + goto out_put_node; 1118 1118 1119 1119 for_each_child_of_node(parts_node, child_part) { 1120 1120 struct partition_affinity *part; ··· 1181 1181 1182 1182 gic_data.ppi_descs[i] = desc; 1183 1183 } 1184 + 1185 + out_put_node: 1186 + of_node_put(parts_node); 1184 1187 } 1185 1188 1186 1189 static void __init gic_of_setup_kvm_info(struct device_node *node) ··· 1524 1521 1525 1522 err = gic_validate_dist_version(acpi_data.dist_base); 1526 1523 if (err) { 1527 - pr_err("No distributor detected at @%p, giving up", 1524 + pr_err("No distributor detected at @%p, giving up\n", 1528 1525 acpi_data.dist_base); 1529 1526 goto out_dist_unmap; 1530 1527 }
+6 -1
drivers/irqchip/irq-gic-v4.c
··· 177 177 .map = map, 178 178 }, 179 179 }; 180 + int ret; 180 181 181 182 /* 182 183 * The host will never see that interrupt firing again, so it ··· 185 184 */ 186 185 irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); 187 186 188 - return irq_set_vcpu_affinity(irq, &info); 187 + ret = irq_set_vcpu_affinity(irq, &info); 188 + if (ret) 189 + irq_clear_status_flags(irq, IRQ_DISABLE_UNLAZY); 190 + 191 + return ret; 189 192 } 190 193 191 194 int its_get_vlpi(int irq, struct its_vlpi_map *map)
+2 -2
drivers/irqchip/irq-s3c24xx.c
··· 156 156 irq_set_handler(data->irq, handle_level_irq); 157 157 break; 158 158 default: 159 - pr_err("No such irq type %d", type); 159 + pr_err("No such irq type %d\n", type); 160 160 return -EINVAL; 161 161 } 162 162 ··· 204 204 break; 205 205 206 206 default: 207 - pr_err("No such irq type %d", type); 207 + pr_err("No such irq type %d\n", type); 208 208 return -EINVAL; 209 209 } 210 210
+10 -1
include/linux/irq.h
··· 211 211 * IRQD_MANAGED_SHUTDOWN - Interrupt was shutdown due to empty affinity 212 212 * mask. Applies only to affinity managed irqs. 213 213 * IRQD_SINGLE_TARGET - IRQ allows only a single affinity target 214 + * IRQD_DEFAULT_TRIGGER_SET - Expected trigger already been set 214 215 */ 215 216 enum { 216 217 IRQD_TRIGGER_MASK = 0xf, ··· 232 231 IRQD_IRQ_STARTED = (1 << 22), 233 232 IRQD_MANAGED_SHUTDOWN = (1 << 23), 234 233 IRQD_SINGLE_TARGET = (1 << 24), 234 + IRQD_DEFAULT_TRIGGER_SET = (1 << 25), 235 235 }; 236 236 237 237 #define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors) ··· 262 260 __irqd_to_state(d) |= IRQD_AFFINITY_SET; 263 261 } 264 262 263 + static inline bool irqd_trigger_type_was_set(struct irq_data *d) 264 + { 265 + return __irqd_to_state(d) & IRQD_DEFAULT_TRIGGER_SET; 266 + } 267 + 265 268 static inline u32 irqd_get_trigger_type(struct irq_data *d) 266 269 { 267 270 return __irqd_to_state(d) & IRQD_TRIGGER_MASK; 268 271 } 269 272 270 273 /* 271 - * Must only be called inside irq_chip.irq_set_type() functions. 274 + * Must only be called inside irq_chip.irq_set_type() functions or 275 + * from the DT/ACPI setup code. 272 276 */ 273 277 static inline void irqd_set_trigger_type(struct irq_data *d, u32 type) 274 278 { 275 279 __irqd_to_state(d) &= ~IRQD_TRIGGER_MASK; 276 280 __irqd_to_state(d) |= type & IRQD_TRIGGER_MASK; 281 + __irqd_to_state(d) |= IRQD_DEFAULT_TRIGGER_SET; 277 282 } 278 283 279 284 static inline bool irqd_is_level_type(struct irq_data *d)
+1
include/linux/irqchip/arm-gic-v4.h
··· 109 109 int its_unmap_vlpi(int irq); 110 110 int its_prop_update_vlpi(int irq, u8 config, bool inv); 111 111 112 + struct irq_domain_ops; 112 113 int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops); 113 114 114 115 #endif
+12 -1
kernel/irq/manage.c
··· 1246 1246 * set the trigger type must match. Also all must 1247 1247 * agree on ONESHOT. 1248 1248 */ 1249 - unsigned int oldtype = irqd_get_trigger_type(&desc->irq_data); 1249 + unsigned int oldtype; 1250 + 1251 + /* 1252 + * If nobody did set the configuration before, inherit 1253 + * the one provided by the requester. 1254 + */ 1255 + if (irqd_trigger_type_was_set(&desc->irq_data)) { 1256 + oldtype = irqd_get_trigger_type(&desc->irq_data); 1257 + } else { 1258 + oldtype = new->flags & IRQF_TRIGGER_MASK; 1259 + irqd_set_trigger_type(&desc->irq_data, oldtype); 1260 + } 1250 1261 1251 1262 if (!((old->flags & new->flags) & IRQF_SHARED) || 1252 1263 (oldtype != (new->flags & IRQF_TRIGGER_MASK)) ||