Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2010 12:07:27 -0400
From:      Deepa Srinivasan <dsriniv@ncsu.edu>
To:        freebsd-drivers@freebsd.org
Subject:   Requesting an IRQ
Message-ID:  <AANLkTikS%2BtwoJTCm82wgo357Z8%2Bz8Kcp1vji0cmB=KiP@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I'm writing a "pseudo" device driver for FreeBSD 5.0 - i.e. there is no
physical device backing it. But I need to be able to send an interrupt to it
from an underlying hypervisor (KVM). FreeBSD runs as a guest OS. I have done
the same in Linux - wrote a kernel module and used the "request_irq"
function to allocate an unused interrupt number. When the underlying KVM
injects an interrupt into the guest OS, the registered interrupt handler
gets called as expected.

However, in FreeBSD, I cannot find an equivalent function to "request_irq".
Going with the available documentation and sample code, I tried modifying a
PCI driver (this may be overkill for what I'm doing, but still...) and used
the bus_alloc_resource() and bus_setup_intr() functions. In my OS
configuration, this results in the "irq9" being allocated to my driver. But
the same IRQ is also allocated to "acpi0". Now, when I inject an interrupt
from the hypervisor, it immediately causes an "interrupt storm" and I see
this message continuously printed: "interrupt storm detected on irq9;
throttling interrupt source". This happens even without my driver being
loaded. In the KVM hypervisor code, I set the interrupt to "1" and
immediately to "0" and I know for sure that this code path is being
executed.

My question is:
- Is it possible to write a pseudo device driver and use something like the
"request_irq" in Linux to just be able to invoke a callback function in the
driver?
- Is it possible to specify the interrupt number that needs to be allocated
to my device driver so I can ensure that it is not shared with anything
else?


Thanks for any help.

- Deepa



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikS%2BtwoJTCm82wgo357Z8%2Bz8Kcp1vji0cmB=KiP>