Skip to contentSkip to conversation

8250 driver interrupt sharing

PATCH In review Thomas Koeller 2 participants 5 messages Oct 28, 2004 – Nov 1, 2004 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 8250 driver interrupt sharing

Hi,

here is a little patch that causes the driver to no longer pretend having handled an interrupt if none of the ports actually interrupted. I am currently doing a port to a platform where I want (actually, have) to share a single interrupt between serial ports and other devices. The patch is against kernel version 2.6.9.

tk

drivers/serial/8250.c 2004-10-28 12:48:19.009864000 +0200 renamed from drivers/serial/8250.c 2004-10-28 12:45:30.103541664 +0200 +3 -2
@@ -1039,6 +1039,7 @@ static irqreturn_t serial8250_interrupt(
        struct irq_info *i = dev_id;
        struct list_head *l, *end = NULL;
        int pass_counter = 0;
+       irqreturn_t ret = IRQ_NONE;
 
        DEBUG_INTR("serial8250_interrupt(%d)...", irq);
 
@@ -1056,6 +1057,7 @@ static irqreturn_t serial8250_interrupt(
                        spin_lock(&up->port.lock);
                        serial8250_handle_port(up, regs);
                        spin_unlock(&up->port.lock);
+                       ret = IRQ_HANDLED;
 
                        end = NULL;
                } else if (end == NULL)
@@ -1074,8 +1076,7 @@ static irqreturn_t serial8250_interrupt(
        spin_unlock(&i->lock);
 
        DEBUG_INTR("end.\n");
-       /* FIXME! Was it really ours? */
-       return IRQ_HANDLED;
+       return ret;
 }
 
 /*
Signature · 9 lines
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================
#1 lore raw
Quoted 5 lines · Thomas Koeller

here is a little patch that causes the driver to no longer pretend having handled an interrupt if none of the ports actually interrupted. I am currently doing a port to a platform where I want (actually, have) to share a single interrupt between serial ports and other devices. The patch is against kernel version 2.6.9.

You can only share serial port interrupts with other devices if the interrupt controller input is level sensitive rather than edge sensitive. If it is edge sensitive, then you'll run into problems.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#2 lore raw
Quoted 10 lines · Russell King
Quoted 5 lines · Thomas Koeller

here is a little patch that causes the driver to no longer pretend having handled an interrupt if none of the ports actually interrupted. I am currently doing a port to a platform where I want (actually, have) to share a single interrupt between serial ports and other devices. The patch is against kernel version 2.6.9.

You can only share serial port interrupts with other devices if the interrupt controller input is level sensitive rather than edge sensitive. If it is edge sensitive, then you'll run into problems.

On my target platform, interrupts are indeed level sensitive, so this should not be a problem (for me).

Does this problem somehow invalidate my patch? Even if interrupts were edge sensitive, returning IRQ_NONE should ok, or not?

tk

Signature · 9 lines
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================
#3 lore raw
Quoted 8 lines · Thomas Koeller
Quoted 7 lines · Russell King
Quoted 5 lines · Thomas Koeller

here is a little patch that causes the driver to no longer pretend having handled an interrupt if none of the ports actually interrupted. I am currently doing a port to a platform where I want (actually, have) to share a single interrupt between serial ports and other devices. The patch is against kernel version 2.6.9.

Quoted 6 lines
Quoted 3 lines

You can only share serial port interrupts with other devices if the interrupt controller input is level sensitive rather than edge sensitive. If it is edge sensitive, then you'll run into problems.

On my target platform, interrupts are indeed level sensitive, so this should not be a problem (for me).

Ok - that's fine.

Quoted 1 line

Does this problem somehow invalidate my patch?

Not really, but if you were using edge triggering, that would invalidate your idea that you could share serial port interrupts reliably with other devices.

Quoted 2 lines

Even if interrupts were edge sensitive, returning IRQ_NONE should ok, or not?

It should be fine.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#4 lore raw
In reply to Thomas Koeller
Quoted 5 lines · Thomas Koeller

here is a little patch that causes the driver to no longer pretend having handled an interrupt if none of the ports actually interrupted. I am currently doing a port to a platform where I want (actually, have) to share a single interrupt between serial ports and other devices. The patch is against kernel version 2.6.9.

Ok, a variant of this has now been applied - using IRQ_RETVAL rather than irqreturn_t + IRQ_NONE + IRQ_HANDLED.

Thanks.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core