public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hao <kexin.hao@windriver.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: venkatesh.pallipadi@intel.com, bob.picco@hp.com,
	mingo@redhat.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Get irq for hpet timer
Date: Tue, 20 May 2008 17:03:39 +0800	[thread overview]
Message-ID: <1211274219.8718.7.camel@kevin-desktop> (raw)
In-Reply-To: <4831A678.5070208@ladisch.de>

On Mon, 2008-05-19 at 18:10 +0200, Clemens Ladisch wrote:
> Kevin Hao wrote:
> > +	for (irq = find_first_bit(&cap, HPET_MAX_IRQ); irq < HPET_MAX_IRQ;
> > +		irq = find_next_bit(&cap, HPET_MAX_IRQ, 1 + irq)) {
> > +		if (request_irq(irq, hpet_interrupt, irq_flags,
> > +				devp->hd_name, (void *)devp))
> 
> This spams my log with interrupt sharing violations.  As long as we do
> not know that the interrupt slot is empty, we need IRQF_PROBE_SHARED
> here.

Ok, added.

> 
> Another problem: the interrupt controller doesn't get correctly
> initialized for some interrupt line that didn't already have some
> routing:
> | $ cat /proc/interrupts
> |            CPU0
> |   0:         63   IO-APIC-edge      timer
> |   1:         96   IO-APIC-edge      i8042
> |   2:          0    XT-PIC-XT        hpet2
> |   6:          3   IO-APIC-edge      floppy
> |   7:          0   IO-APIC-edge      parport0
> |   8:          3   IO-APIC-edge      rtc
> |   9:          0   IO-APIC-fasteoi   acpi
> | ...
> 
> Additionally, I vaguely remember that on X86, there is some funny stuff
> going on with interrupt lines 0, 2 and 8 which means that the interrupt
> number passed to request_irq() is not necessarily identical to the
> hardware interrupt line.
> 
> I don't know which of these problems is responsible, or if I'm totally
> wrong, but on my machine, interrupts from hpet2 do not arrive.
> 

We can simply skip these special IRQ. :-)
Does anyone has a better solution?

----
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 0fdc627..b04a15d 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -390,6 +390,11 @@ static int hpet_timer_get_irq(struct hpet_dev *devp)
 	struct hpets *hpetp;
 	unsigned long cap, irq_flags;
 	int irq;
+	/*
+	 * skip IRQ0, IRQ2, IRQ8 because which is always used by some
+	 * legacy device
+	 */
+	unsigned long skip_irq = (1 << 0) | (1 << 2) | (1 << 8);
 
 	timer = devp->hd_timer;
 	hpet = devp->hd_hpet;
@@ -411,6 +416,9 @@ static int hpet_timer_get_irq(struct hpet_dev *devp)
 
 	cap = (readq(&timer->hpet_config) & Tn_INT_ROUTE_CAP_MASK)
 				 >> Tn_INT_ROUTE_CAP_SHIFT;
+	cap &= ~skip_irq;
+
+	irq_flags |= IRQF_PROBE_SHARED;
 
 	for (irq = find_first_bit(&cap, HPET_MAX_IRQ); irq < HPET_MAX_IRQ;
 		irq = find_next_bit(&cap, HPET_MAX_IRQ, 1 + irq)) {

---
Best Regards,
Kevin

> 
> Regards,
> Clemens

  parent reply	other threads:[~2008-05-20  9:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16  6:05 [PATCH] x86: Get irq for hpet timer Kevin Hao
2008-05-16  7:53 ` Balaji Rao R
2008-05-16  8:03   ` Kevin Hao
2008-05-16  8:30     ` Balaji Rao
2008-05-16  8:46 ` Clemens Ladisch
2008-05-16  9:14   ` Kevin Hao
2008-05-19 16:10     ` Clemens Ladisch
2008-05-19 21:21       ` Maciej W. Rozycki
2008-05-20  9:03       ` Kevin Hao [this message]
2008-05-20 15:46         ` Maciej W. Rozycki
2008-05-21  8:28           ` Clemens Ladisch
2008-05-22  3:47             ` Maciej W. Rozycki
2008-05-22  7:27               ` Kevin Hao
2008-05-22 15:25                 ` Maciej W. Rozycki
2008-05-28 10:42                   ` Kevin Hao
2008-05-29  3:13                     ` Maciej W. Rozycki
2008-05-29 10:41                       ` Kevin Hao
2008-05-29 14:32                         ` Maciej W. Rozycki
2008-05-30  5:32                           ` Kevin Hao
2008-06-02  9:35                             ` Ingo Molnar

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=1211274219.8718.7.camel@kevin-desktop \
    --to=kexin.hao@windriver.com \
    --cc=bob.picco@hp.com \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.com \
    /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