public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/riscv-intc: Mark INTC nodes for secondary CPUs as initialized.
@ 2023-09-26 10:28 Dmitry Dunaev
  2023-09-26 10:36 ` Anup Patel
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Dmitry Dunaev @ 2023-09-26 10:28 UTC (permalink / raw)
  Cc: dunaich, Dmitry Dunaev, Thomas Gleixner, Marc Zyngier,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-kernel,
	linux-riscv

The current Linux driver irq-riscv-intc initialize IRQ domain only once,
when init function called on primary hart. In other cases no IRQ domain is
created and no operation on interrupt-controller node is performed.
This is cause of that no common Linux driver can use per-cpu interrupts
mapped to several CPUs because fwnode of secondary cores INTC is not
marked as initialized. This device is always will be marked as deferred.
For example the system with devicetree

    cpu0: cpu@0 {
        cpu0_intc: interrupt-controller {
            interrupt-controller;
            compatible = riscv,cpu-intc;
        };
    };

    cpu1: cpu@1 {
        cpu1_intc: interrupt-controller {
            interrupt-controller;
            compatible = riscv,cpu-intc;
        };
    };

    buserr {
        compatible = riscv,buserr;
        interrupts-extended = <&cpu0_intc 16 &cpu1_intc 16>;
    };

will always report 'buserr' node as deferred without calling any
bus probe function.

This patch will mark all secondary nodes passed to irq-riscv-intc
driver init function as initialized to be able to act as correct
IRQ phandle node.

Signed-off-by: Dmitry Dunaev <dunaev@tecon.ru>
---
 drivers/irqchip/irq-riscv-intc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c
index 4adeee1bc391..c01a4e8d4983 100644
--- a/drivers/irqchip/irq-riscv-intc.c
+++ b/drivers/irqchip/irq-riscv-intc.c
@@ -155,8 +155,10 @@ static int __init riscv_intc_init(struct device_node *node,
 	 * for each INTC DT node. We only need to do INTC initialization
 	 * for the INTC DT node belonging to boot CPU (or boot HART).
 	 */
-	if (riscv_hartid_to_cpuid(hartid) != smp_processor_id())
+	if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) {
+		fwnode_dev_initialized(of_node_to_fwnode(node), true);
 		return 0;
+	}
 
 	return riscv_intc_init_common(of_node_to_fwnode(node));
 }
@@ -179,8 +181,10 @@ static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header,
 	 * for each INTC. We only do INTC initialization
 	 * for the INTC belonging to the boot CPU (or boot HART).
 	 */
-	if (riscv_hartid_to_cpuid(rintc->hart_id) != smp_processor_id())
+	if (riscv_hartid_to_cpuid(rintc->hart_id) != smp_processor_id()) {
+		fwnode_dev_initialized(of_node_to_fwnode(node), true);
 		return 0;
+	}
 
 	fn = irq_domain_alloc_named_fwnode("RISCV-INTC");
 	if (!fn) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-07 12:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26 10:28 [PATCH] irqchip/riscv-intc: Mark INTC nodes for secondary CPUs as initialized Dmitry Dunaev
2023-09-26 10:36 ` Anup Patel
2023-10-04 10:18   ` Marc Zyngier
2023-10-04 14:59     ` Anup Patel
2023-10-04 15:32       ` Marc Zyngier
2023-10-04 16:08         ` Anup Patel
2023-09-26 20:44 ` kernel test robot
2023-10-07 12:00 ` [irqchip: irq/irqchip-fixes] irqchip/riscv-intc: Mark all INTC nodes " irqchip-bot for Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox