Subject: [Fwd: Re: hda: lost interrupt starting with 2.6.8]

From: Benjamin Herrenschmidt <[email-masked]>
Date: Sun, 13 Mar 2005 17:47:09 +1100

-------- Forwarded Message --------
From: Vince Weaver <[email-masked]>
To: Benjamin Herrenschmidt <[email-masked]>
Cc: [email-masked] <[email-masked]>
Subject: Re: hda: lost interrupt starting with 2.6.8
Date: Sun, 13 Mar 2005 00:18:38 -0500 (EST)
OK, I've spent most of the day making my poor iBook compile kernels and 
I've tracked down the error.  I can't seem to figure out why it would 
happen on my machine and no one elses, at least unless it's a compiler 
issue (I am using gcc 3.2.2).

Somewhere between 2.6.8-rc1 and 2.6.8-rc2 interrupts just stop getting 
delivered.

I tracked it down to this patch to linux/arch/ppc/syslib/open_pic.c :

  /*
   *  Map an interrupt source to one or more CPUs
   */
-static void openpic_mapirq(u_int irq, u_int physmask, u_int keepmask)
+static void openpic_mapirq(u_int irq, cpumask_t physmask, cpumask_t keepmask)
  {
         if (ISR[irq] == 0)
                 return;
-       if (keepmask != 0)
-               physmask |= openpic_read(&ISR[irq]->Destination) & 
keepmask;
-       openpic_write(&ISR[irq]->Destination, physmask);
+       if (!cpus_empty(keepmask)) {
+               cpumask_t irqdest = { .bits[0] = 
openpic_read(&ISR[irq]->Destination) };
+               cpus_and(irqdest, irqdest, keepmask);
+               cpus_or(physmask, physmask, irqdest);
+       }
+       openpic_write(&ISR[irq]->Destination, cpus_addr(physmask)[0]);
  }

And this one:
-               openpic_mapirq(i, 1<<0, 0);
+               openpic_mapirq(i, CPU_MASK_CPU0, CPU_MASK_NONE);

Using printk's, I can see before the change I properly was writing "1" as 
the second argument to openpic_write, but afterwards it was 0.

It seems as though for some reason CPU_MASK_CPU0 is 0 on my kernel, rather 
than just a 1.

By patching the kernel to force it to write a 1 in openpic_write the 
kernel runs fine...

So, any ideas?  I'll be glad to try out anything else if you'd like me to.

Vince
-- 
Benjamin Herrenschmidt <[email-masked]>