folks,

I think I found the missed piece which brokes my device.

Right now octeon increases ncpus after octciu_intr_establish() is called,
and kn@ patch moves increases of ncpus into cpuattach() which happens before
octciu_intr_establish(), so inside that it routes irq into different cpu and
it somehow affects my setup.

Attached version of the patch removes that routing irq to different cpus
which actually doesn't work now because ncpus is 1 and % 1 is always 0.

I tested it on my device and it works like a charm.

Feedback? Objection? OK?


Index: sys/arch/mips64/mips64/cpu.c
===================================================================
RCS file: /home/cvs/src/sys/arch/mips64/mips64/cpu.c,v
diff -u -p -r1.85 cpu.c
--- sys/arch/mips64/mips64/cpu.c        5 Jun 2025 09:29:54 -0000       1.85
+++ sys/arch/mips64/mips64/cpu.c        1 Apr 2026 16:02:05 -0000
@@ -99,6 +99,7 @@ cpuattach(struct device *parent, struct 
                ci->ci_next = cpu_info_list->ci_next;
                cpu_info_list->ci_next = ci;
                ci->ci_flags |= CPUF_PRESENT;
+               ncpus++;
        }
 #else
        ci = &cpu_info_primary;
Index: sys/arch/octeon/dev/octciu.c
===================================================================
RCS file: /home/cvs/src/sys/arch/octeon/dev/octciu.c,v
diff -u -p -r1.19 octciu.c
--- sys/arch/octeon/dev/octciu.c        11 Dec 2022 05:31:05 -0000      1.19
+++ sys/arch/octeon/dev/octciu.c        1 Apr 2026 16:04:03 -0000
@@ -250,12 +250,6 @@ octciu_intr_establish(int irq, int level
                panic("%s: illegal irq %d", __func__, irq);
 #endif
 
-#ifdef MULTIPROCESSOR
-       /* Span work queue interrupts across CPUs. */
-       if (IS_WORKQ_IRQ(irq))
-               cpuid = irq % ncpus;
-#endif
-
        flags = (level & IPL_MPSAFE) ? CIH_MPSAFE : 0;
        level &= ~IPL_MPSAFE;
 
Index: sys/arch/octeon/octeon/machdep.c
===================================================================
RCS file: /home/cvs/src/sys/arch/octeon/octeon/machdep.c,v
diff -u -p -r1.137 machdep.c
--- sys/arch/octeon/octeon/machdep.c    24 Oct 2023 13:20:10 -0000      1.137
+++ sys/arch/octeon/octeon/machdep.c    1 Apr 2026 16:02:05 -0000
@@ -802,7 +802,7 @@ static u_int64_t
 get_ncpusfound(void)
 {
        uint64_t core_mask;
-       uint64_t i, ncpus = 0;
+       uint64_t i, n = 0;
        int chipid;
 
        chipid = octeon_get_chipid();
@@ -818,9 +818,9 @@ get_ncpusfound(void)
 
        /* There has to be 1-to-1 mapping between cpuids and coreids. */
        for (i = 0; i < OCTEON_MAXCPUS && (core_mask & (1ul << i)) != 0; i++)
-               ncpus++;
+               n++;
 
-       return ncpus;
+       return n;
 }
 
 static enum octeon_board
@@ -1333,8 +1333,6 @@ hw_cpu_hatch(struct cpu_info *ci)
 
        ci->ci_flags |= CPUF_RUNNING;
        membar_sync();
-
-       ncpus++;
 
        spl0();
        (void)updateimask(0);


-- 
wbr, Kirill

Reply via email to