|
The Pedigree Project 0.1
|
#include <SplitIrqHandler.h>
Inheritance diagram for SplitIrqHandler:
Collaboration diagram for SplitIrqHandler:Classes | |
| struct | Registration |
Public Types | |
| enum class | HardStageDisposition : size_t { NotHandled , Handled , Deferred } |
Protected Member Functions | |
| SplitIrqHandler (const String &name) | |
| bool | initialiseSplitIrq () |
| irq_id_t | registerIsaSplitIrq (IrqManager &manager, uint8_t irq, const IrqPolicy &policy) |
| irq_id_t | registerPciSplitIrq (IrqManager &manager, Device &device, const IrqPolicy &policy) |
| bool | shutdownSplitIrq () |
| virtual HardStageDisposition | hardIrq (irq_id_t number, InterruptState &state, size_t &work)=0 |
| virtual void | threadedIrq (size_t work)=0 |
| virtual bool | quiesceIrqSources ()=0 |
| virtual void | rearmIrqSources (size_t work)=0 |
Private Member Functions | |
| ::HardIrqDisposition | irq (irq_id_t number, InterruptState &state) final |
| void | dispatchThreaded () |
| bool | publishWork (size_t work) |
| SplitIrqHandler (const SplitIrqHandler &)=delete | |
| SplitIrqHandler & | operator= (const SplitIrqHandler &)=delete |
| virtual | ~HardIrqHandler () |
Private Member Functions inherited from IrqHandlerBase | |
| virtual | ~IrqHandlerBase () |
Static Private Member Functions | |
| static void | dispatchThreaded (void *context, uint8_t line, size_t cookie) |
Private Attributes | |
| Registration | m_Registrations [MaxRegistrations] |
| size_t | m_RegistrationCount |
| Atomic< size_t > | m_LifecycleBusy |
| Atomic< size_t > | m_AcceptingRegistrations |
| ThreadedIrqDispatcher | m_Dispatcher |
| Spinlock | m_StateLock |
| bool | m_Quiescing |
| Atomic< size_t > | m_Stopping |
| Atomic< size_t > | m_PublicationFailures |
| Atomic< size_t > | m_DeferredIrqs |
| Atomic< size_t > | m_CompletedBatches |
| size_t | m_PendingWork |
| bool | m_Started |
Static Private Attributes | |
| static constexpr size_t | MaxRegistrations = 16 |
Owns a coalescing worker for an IRQ handler.
The hard callback is limited to claiming and quiescing the device source, capturing any data which cannot wait, and returning Deferred with a work bitmask. The worker receives only that bitmask: InterruptState never escapes the hard callback. If exact event counts matter, the hard callback must put them in a preallocated device-owned ring and the worker must drain it.
A Deferred result means the device source is already safe for the machine IRQ line to remain enabled. Level-triggered devices must mask or acknowledge their own source in hardIrq(). threadedIrq() drains the source but must not unmask it; the base calls rearmIrqSources() only while rearm is serialised against shutdown.
Definition at line 41 of file SplitIrqHandler.h.
|
strong |
Definition at line 43 of file SplitIrqHandler.h.
|
explicitprotected |
Definition at line 41 of file SplitIrqHandler.cc.
|
protectedvirtual |
Definition at line 63 of file SplitIrqHandler.cc.
|
private |
Definition at line 263 of file SplitIrqHandler.cc.
|
staticprivate |
Definition at line 259 of file SplitIrqHandler.cc.
|
protectedpure virtual |
Runs in hard IRQ context and must be bounded and nonblocking.
Implemented in HostedTimer.
Referenced by irq().
Here is the caller graph for this function:
|
protected |
Starts the owned worker before any device IRQ source is enabled.
Definition at line 73 of file SplitIrqHandler.cc.
References ThreadedIrqDispatcher::initialise().
Referenced by HostedTimer::initialise3().
Here is the caller graph for this function:
|
finalprivatevirtual |
Handles an IRQ synchronously in hard interrupt context.
Implements HardIrqHandler.
Definition at line 246 of file SplitIrqHandler.cc.
References hardIrq(), and KeepMasked.
Referenced by registerIsaSplitIrq().
Here is the caller graph for this function:
|
private |
Definition at line 277 of file SplitIrqHandler.cc.
|
protectedpure virtual |
Prevents new device interrupts before registry admission is closed. This runs in thread context and must be idempotent across failed retries.
Implemented in HostedTimer.
Referenced by shutdownSplitIrq().
Here is the caller graph for this function:
|
protectedpure virtual |
Rearms drained device sources unless shutdown has begun.
This runs in thread context with interrupts disabled and is serialised against quiesceIrqSources(). It must be bounded and nonblocking.
Implemented in HostedTimer.
|
protected |
Registers this handler after its owned worker is running.
Definition at line 105 of file SplitIrqHandler.cc.
References irq(), and IrqManager::registerHardIsaIrqHandler().
Referenced by HostedTimer::initialise3().
Here is the caller graph for this function:
|
protected |
Definition at line 131 of file SplitIrqHandler.cc.
|
protected |
Quiesces the hardware, closes every hard callback, drains accepted work, then joins the worker.
The derived owner must call this while its fields and the scheduler are alive. Calls from hard/atomic context or the owned worker are rejected before any lifecycle state changes.
Definition at line 157 of file SplitIrqHandler.cc.
References ProcessorBase::getInterrupts(), ProcessorBase::information(), ThreadedIrqDispatcher::isCurrentWorker(), quiesceIrqSources(), ThreadedIrqDispatcher::shutdown(), and IrqManager::unregisterHandler().
Referenced by HostedTimer::initialise3(), and HostedTimer::uninitialise().
Here is the caller graph for this function:
|
protectedpure virtual |
Runs in ordinary thread context and may use blocking APIs. The owned worker normally calls it; teardown may call it synchronously after the worker is joined to drain a rejected publication. It must not re-enable an interrupt source.
Implemented in HostedTimer.
|
private |
Definition at line 125 of file SplitIrqHandler.h.
|
private |
Definition at line 132 of file SplitIrqHandler.h.
|
private |
Definition at line 131 of file SplitIrqHandler.h.
|
private |
Definition at line 126 of file SplitIrqHandler.h.
|
private |
Definition at line 124 of file SplitIrqHandler.h.
|
private |
Definition at line 133 of file SplitIrqHandler.h.
|
private |
Definition at line 130 of file SplitIrqHandler.h.
|
private |
Definition at line 128 of file SplitIrqHandler.h.
|
private |
Definition at line 123 of file SplitIrqHandler.h.
|
private |
Definition at line 122 of file SplitIrqHandler.h.
|
private |
Definition at line 134 of file SplitIrqHandler.h.
|
private |
Definition at line 127 of file SplitIrqHandler.h.
|
private |
Definition at line 129 of file SplitIrqHandler.h.
|
staticconstexprprivate |
Definition at line 109 of file SplitIrqHandler.h.