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

genirq: Introduce irq_chip.irq_compose_msi_msg() to support stacked irqchip

Add callback irq_compose_msi_msg to struct irq_chip, which will be used
to support stacked irqchip.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
Cc: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Jiang Liu and committed by
Thomas Gleixner
515085ef 56e8abab

+31
+5
include/linux/irq.h
··· 29 29 struct module; 30 30 struct irq_desc; 31 31 struct irq_data; 32 + struct msi_msg; 32 33 typedef void (*irq_flow_handler_t)(unsigned int irq, 33 34 struct irq_desc *desc); 34 35 typedef void (*irq_preflow_handler_t)(struct irq_data *data); ··· 321 320 * any other callback related to this irq 322 321 * @irq_release_resources: optional to release resources acquired with 323 322 * irq_request_resources 323 + * @irq_compose_msi_msg: optional to compose message content for MSI 324 324 * @flags: chip specific flags 325 325 */ 326 326 struct irq_chip { ··· 357 355 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 358 356 int (*irq_request_resources)(struct irq_data *data); 359 357 void (*irq_release_resources)(struct irq_data *data); 358 + 359 + void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg); 360 360 361 361 unsigned long flags; 362 362 }; ··· 447 443 extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 448 444 extern void handle_nested_irq(unsigned int irq); 449 445 446 + extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg); 450 447 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY 451 448 extern void irq_chip_ack_parent(struct irq_data *data); 452 449 extern int irq_chip_retrigger_hierarchy(struct irq_data *data);
+26
kernel/irq/chip.c
··· 926 926 return -ENOSYS; 927 927 } 928 928 #endif 929 + 930 + /** 931 + * irq_chip_compose_msi_msg - Componse msi message for a irq chip 932 + * @data: Pointer to interrupt specific data 933 + * @msg: Pointer to the MSI message 934 + * 935 + * For hierarchical domains we find the first chip in the hierarchy 936 + * which implements the irq_compose_msi_msg callback. For non 937 + * hierarchical we use the top level chip. 938 + */ 939 + int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) 940 + { 941 + struct irq_data *pos = NULL; 942 + 943 + #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY 944 + for (; data; data = data->parent_data) 945 + #endif 946 + if (data->chip && data->chip->irq_compose_msi_msg) 947 + pos = data; 948 + if (!pos) 949 + return -ENOSYS; 950 + 951 + pos->chip->irq_compose_msi_msg(pos, msg); 952 + 953 + return 0; 954 + }