Find the answer to your Linux question:
Results 1 to 2 of 2
Hi everyone, I'm working on a driver for a network card. The first time I insert it (insmod) it loads up and registers a PCI MSI (message signaled interrupt). The ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    6

    Interrupts stop working after device driver is removed and reinserted


    Hi everyone,
    I'm working on a driver for a network card. The first time I insert it (insmod) it loads up and registers a PCI MSI (message signaled interrupt). The code looks something like this:

    pci_register_driver( ... );
    pci_enable_msi( ... );
    request_irq( ... );


    When I generate interrupts, the handler catches them and everything works. If I remove the module, this code executes:


    free_irq( ... );
    pci_disable_msi ( ... );
    pci_disable_device( ... );

    Everything seems to work, but, if I reinsert the module, I get no errors, but interrupts are no longer caught/handled.

    If I look in /proc/interrupts, it seems that the interrupts are't even being generated anymore. However, 3 times out of 4, when I remove the driver a second time, I get an unhandled IRQ error on the linux kernel, which suggests that the hardware is working, but that the kernel is masking these interrupts.

    Any ideas why?

    Thanks
    M

  2. #2
    Just Joined!
    Join Date
    May 2012
    Posts
    6
    In case anyone comes looking, I figured it out.

    Looking at the output from lspci, I noticed that the BusMaster bit in the control word was being turned off when the driver unloads. As it turns out, BusMastering is required for generating MSIs.

    Adding the following line to my init code fixed the problem.

    pci_set_master( ... );

    The funny thing is I was waiting to get IRQs working first before working on the DMA stuff. If I had just started work on DMA I would have done a set_master and everything would have worked!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •