Skip to contentSkip to conversation

UIO: don't check irq_enabled flag in uio_cif irq handler

PATCH Manuel Traut 2 participants 2 messages Oct 28, 2008 – Oct 29, 2008 Userspace I/O (UIO)

lore
Share & tools
lore
#0 lore raw

Below patch ignores INT1_ENABLED flag in the uio_cif irq handler.

On a Hilscher DeviceNet Slave card, the INT_ENABLE flag is (probably) reseted by the firmware. Without this patch, every interrupt produced by this card is dropped.

This patch is tested and works with a DeviceNet Slave and a Profibus Slave card.

drivers/uio/uio_cif.c +2 -3
@@ -18,7 +18,6 @@
 #define PLX9030_INTCSR		0x4C
 #define INTSCR_INT1_ENABLE	0x01
 #define INTSCR_INT1_STATUS	0x04
-#define INT1_ENABLED_AND_ACTIVE	(INTSCR_INT1_ENABLE | INTSCR_INT1_STATUS)
 
 #define PCI_SUBVENDOR_ID_PEP	0x1518
 #define CIF_SUBDEVICE_PROFIBUS	0x430
@@ -30,8 +29,8 @@
 	void __iomem *plx_intscr = dev_info->mem[0].internal_addr
 					+ PLX9030_INTCSR;
 
-	if ((ioread8(plx_intscr) & INT1_ENABLED_AND_ACTIVE)
-	    != INT1_ENABLED_AND_ACTIVE)
+	if ((ioread8(plx_intscr) & INT1_STATUS)
+	    != INT1_STATUS)
 		return IRQ_NONE;
 
 	/* Disable interrupt */
#1 lore raw
Quoted 4 lines · Manuel Traut

Below patch ignores INT1_ENABLED flag in the uio_cif irq handler.

On a Hilscher DeviceNet Slave card, the INT_ENABLE flag is (probably) reseted by the firmware.

If this is actually the case, then this definetly a firmware bug. If firmware clears the interrupt enable bit, you have no chance of knowing if the irq was enabled or not. As a consequence, you cannot find out whether your card caused the interrupt or not.
A hardware with such a behaviour is simply not a decent PCI card, which should support shared interrupts.

Send a bug report to the firmware author.

Quoted 2 lines

Without this patch, every interrupt produced by this card is dropped.

Yes, probably you'll need that patch if you want to make a card with such broken behaviour work. But _with_ this patch, you'll run into problems if you have two such PCI cards that share the same interrupt.

I consider this a workaround that might be OK for your usecase, but it's not something that should go to mainline.

So, NAK to this.

Thanks,
Hans

Quoted 26 lines

This patch is tested and works with a DeviceNet Slave and a Profibus Slave card.

drivers/uio/uio_cif.c +2 -3
@@ -18,7 +18,6 @@
 #define PLX9030_INTCSR		0x4C
 #define INTSCR_INT1_ENABLE	0x01
 #define INTSCR_INT1_STATUS	0x04
-#define INT1_ENABLED_AND_ACTIVE	(INTSCR_INT1_ENABLE | INTSCR_INT1_STATUS)
 
 #define PCI_SUBVENDOR_ID_PEP	0x1518
 #define CIF_SUBDEVICE_PROFIBUS	0x430
@@ -30,8 +29,8 @@
 	void __iomem *plx_intscr = dev_info->mem[0].internal_addr
 					+ PLX9030_INTCSR;
 
-	if ((ioread8(plx_intscr) & INT1_ENABLED_AND_ACTIVE)
-	    != INT1_ENABLED_AND_ACTIVE)
+	if ((ioread8(plx_intscr) & INT1_STATUS)
+	    != INT1_STATUS)
 		return IRQ_NONE;
 
 	/* Disable interrupt */