linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Stig Telfer <linuxppc@lizardlogic.co.uk>
To: linuxppc-embedded@ozlabs.org
Subject: Xilinx PIC and kernel interrupt handler
Date: Mon, 31 Jul 2006 14:50:40 +0100	[thread overview]
Message-ID: <76f51967dc88fd0821a524d69fdc3e1c@lizardlogic.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

Hi -

There appears to be a kernel bug in the 2.4 and 2.6.17.7 kernel trees 
relating to reading the interrupt vector from the Xilinx PIC 
(xilinx_pic_get_irq() in xilinx_pic.c).  As I see it, here's the 
problem: If no interrupt is pending, the register should read all ones. 
  However, the IVR is only as wide as the number of interrupt sources.  
The routine mistakenly assumes sign extension and checks for a 32-bit 
read of -1 instead of a read of w bits where w is the number of 
connected interrupt sources.

The 2.6 version also has a search-and-replace glitch relating to 
removal of the reversal of bit numbering.  I have attached a two line 
patch (for 2.6.17.7) that makes the IVR comparison against the right 
bit pattern and removes the remnants of the former bit-reversal code.

Share and enjoy,
Stig Telfer


[-- Attachment #2: xilinx_pic.patch --]
[-- Type: application/octet-stream, Size: 475 bytes --]

diff -Naurb linux-2.6.17.7/arch/ppc/syslib/xilinx_pic.c linux-2.6.17.7-stig/arch/ppc/syslib/xilinx_pic.c
--- linux-2.6.17.7/arch/ppc/syslib/xilinx_pic.c	2006-07-25 04:36:01.000000000 +0100
+++ linux-2.6.17.7-stig/arch/ppc/syslib/xilinx_pic.c	2006-07-31 14:20:04.000000000 +0100
@@ -97,8 +97,8 @@
 	 */
 
 	irq = intc_in_be32(intc + IVR);
-	if (irq != -1)
-		irq = irq;
+	if (irq == (1 << XPAR_INTC_MAX_NUM_INTR_INPUTS) - 1)
+		irq = -1;
 
 	pr_debug("get_irq: %d\n", irq);
 

             reply	other threads:[~2006-07-31 14:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31 13:50 Stig Telfer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-07-31 18:06 Xilinx PIC and kernel interrupt handler Martin, Tim
2006-07-31 19:07 ` Stig Telfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76f51967dc88fd0821a524d69fdc3e1c@lizardlogic.co.uk \
    --to=linuxppc@lizardlogic.co.uk \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).