The Pedigree Project 0.1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
VirtIrqManager Class Reference
+ Inheritance diagram for VirtIrqManager:
+ Collaboration diagram for VirtIrqManager:

Classes

struct  PciLine
 

Public Member Functions

bool initialise ()
 
bool initialiseThreaded ()
 
bool shutdownThreaded ()
 
void handle (InterruptState &state)
 
irq_id_t registerIsaIrqHandler (uint8_t irq, IrqHandler *handler, const IrqPolicy &policy) override
 
irq_id_t registerPciIrqHandler (IrqHandler *handler, Device *device, const IrqPolicy &policy) override
 
irq_id_t registerPciMessageIrqHandler (IrqHandler *handler, Device *device, const IrqPolicy &intxFallbackPolicy) override
 
bool registerPciMsixIrqHandlers (Device *device, IrqHandler *const *handlers, size_t count, irq_id_t *ids, bool &fallbackSafe, const size_t *processors=nullptr) override
 
irq_id_t registerHardIsaIrqHandler (uint8_t irq, HardIrqHandler *handler, const IrqPolicy &policy) override
 
irq_id_t registerHardPciIrqHandler (HardIrqHandler *handler, Device *device, const IrqPolicy &policy) override
 
irq_id_t registerHardPciMessageIrqHandler (HardIrqHandler *handler, Device *device, const IrqPolicy &intxFallbackPolicy) override
 
irq_id_t registerSchedulerIrqHandler (uint8_t irq, SchedulerIrqHandler *handler, const IrqPolicy &policy) override
 
bool unregisterSchedulerIrqHandler (irq_id_t id, SchedulerIrqHandler *handler) override
 
bool unregisterHandler (irq_id_t id, IrqHandlerBase *handler) override
 
void enable (uint8_t irq, bool enabled) override
 
- Public Member Functions inherited from IrqManager
virtual size_t snapshotIrqLines (IrqLineDiagnosticSnapshot *out, size_t capacity) const
 
virtual void tick ()
 
virtual bool control (uint8_t irq, ControlCode code, size_t argument)
 

Static Public Member Functions

static VirtIrqManager & instance ()
 

Private Member Functions

irq_id_t registerPciHandler (IrqHandlerBase *handler, Device *device, const IrqPolicy &policy, bool hard)
 
irq_id_t registerPciMessageHandler (IrqHandlerBase *handler, Device *device, bool hard, bool &allowFallback)
 
size_t pciLine (uint32_t irq) const
 
uint8_t pciRegistryLine (size_t slot) const
 
uint32_t acknowledge ()
 
void complete (uint32_t acknowledgeValue)
 
bool setEnabled (uint32_t irq, bool enabled)
 
void setLevel (uint32_t irq)
 
void setEdge (uint32_t irq)
 
bool initialiseMsi ()
 
bool initialiseV2 ()
 
bool initialiseV3 ()
 

Static Private Member Functions

static void dispatchPciLine (void *context, uint8_t line, size_t cookie)
 

Private Attributes

HardIrqHandler * m_Hard [MaxIrqs]
 
SchedulerIrqHandler * m_Scheduler [MaxIrqs]
 
IrqHandlerRegistry m_PciHandlers
 
ThreadedIrqDispatcher m_PciDispatcher
 
Spinlock m_PciLock
 
PciLine m_PciLines [MaxPciLines]
 
GicIts m_Its
 
uint32_t m_Version
 
uint32_t m_IrqCount
 
uint32_t m_MsiFirst
 
uint32_t m_MsiLast
 
uint64_t m_MsiAddress
 
bool m_MsiReady
 
bool m_Initialised
 

Static Private Attributes

static constexpr size_t MaxIrqs = 256
 
static constexpr size_t MaxPciLines = 16
 
static VirtIrqManager m_Instance
 

Additional Inherited Members

- Public Types inherited from IrqManager
enum  ControlCode { MitigationThreshold }
 
- Protected Member Functions inherited from IrqManager
 IrqManager ()
 
virtual ~IrqManager ()
 

Detailed Description

Definition at line 19 of file kernel/machine/mach_virt/IrqManager.h.

Constructor & Destructor Documentation

◆ VirtIrqManager()

VirtIrqManager::VirtIrqManager ( )
private

Definition at line 82 of file mach_virt/IrqManager.cc.

Member Function Documentation

◆ acknowledge()

uint32_t VirtIrqManager::acknowledge ( )
private

Definition at line 990 of file mach_virt/IrqManager.cc.

◆ complete()

void VirtIrqManager::complete ( uint32_t  acknowledgeValue)
private

Definition at line 1002 of file mach_virt/IrqManager.cc.

◆ dispatchPciLine()

void VirtIrqManager::dispatchPciLine ( void *  context,
uint8_t  line,
size_t  cookie 
)
staticprivate

Definition at line 955 of file mach_virt/IrqManager.cc.

◆ enable()

void VirtIrqManager::enable ( uint8_t  irq,
bool  enabled 
)
overridevirtual

Implements IrqManager.

Definition at line 297 of file mach_virt/IrqManager.cc.

◆ handle()

void VirtIrqManager::handle ( InterruptState &  state)

Definition at line 1014 of file mach_virt/IrqManager.cc.

◆ initialise()

bool VirtIrqManager::initialise ( )

Definition at line 98 of file mach_virt/IrqManager.cc.

◆ initialiseMsi()

bool VirtIrqManager::initialiseMsi ( )
private

Definition at line 260 of file mach_virt/IrqManager.cc.

◆ initialiseThreaded()

bool VirtIrqManager::initialiseThreaded ( )

Definition at line 110 of file mach_virt/IrqManager.cc.

◆ initialiseV2()

bool VirtIrqManager::initialiseV2 ( )
private

Definition at line 131 of file mach_virt/IrqManager.cc.

◆ initialiseV3()

bool VirtIrqManager::initialiseV3 ( )
private

Definition at line 158 of file mach_virt/IrqManager.cc.

◆ instance()

VirtIrqManager & VirtIrqManager::instance ( )
static

Definition at line 78 of file mach_virt/IrqManager.cc.

◆ pciLine()

size_t VirtIrqManager::pciLine ( uint32_t  irq) const
private

Definition at line 305 of file mach_virt/IrqManager.cc.

◆ pciRegistryLine()

uint8_t VirtIrqManager::pciRegistryLine ( size_t  slot) const
private

Definition at line 314 of file mach_virt/IrqManager.cc.

◆ registerHardIsaIrqHandler()

irq_id_t VirtIrqManager::registerHardIsaIrqHandler ( uint8_t  irq,
HardIrqHandler *  handler,
const IrqPolicy &  policy 
)
overridevirtual

Register an ISA handler which must run in hard IRQ context.

Implements IrqManager.

Definition at line 744 of file mach_virt/IrqManager.cc.

References ProcessorBase::getInterrupts(), and ProcessorBase::setInterrupts().

◆ registerHardPciIrqHandler()

irq_id_t VirtIrqManager::registerHardPciIrqHandler ( HardIrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  policy 
)
overridevirtual

Register a PCI handler which must run in hard IRQ context.

Implements IrqManager.

Definition at line 761 of file mach_virt/IrqManager.cc.

Referenced by registerHardPciMessageIrqHandler().

+ Here is the caller graph for this function:

◆ registerHardPciMessageIrqHandler()

irq_id_t VirtIrqManager::registerHardPciMessageIrqHandler ( HardIrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  intxFallbackPolicy 
)
overridevirtual

Prefer a PCI message interrupt for a hard handler, with an INTx fallback.

Reimplemented from IrqManager.

Definition at line 766 of file mach_virt/IrqManager.cc.

References registerHardPciIrqHandler().

◆ registerIsaIrqHandler()

irq_id_t VirtIrqManager::registerIsaIrqHandler ( uint8_t  irq,
IrqHandler *  handler,
const IrqPolicy &  policy 
)
overridevirtual

Register an ISA irq

Parameters
[in]irqthe ISA irq number (from 0 to 15)
[in]handlerpointer to the IrqHandler class
[in]policyelectrical, acknowledgement, and completion policy
Returns
the irq's identifier

Implements IrqManager.

Definition at line 301 of file mach_virt/IrqManager.cc.

◆ registerPciHandler()

irq_id_t VirtIrqManager::registerPciHandler ( IrqHandlerBase *  handler,
Device *  device,
const IrqPolicy &  policy,
bool  hard 
)
private

Definition at line 318 of file mach_virt/IrqManager.cc.

◆ registerPciIrqHandler()

irq_id_t VirtIrqManager::registerPciIrqHandler ( IrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  policy 
)
overridevirtual

Register a PCI irq

Implements IrqManager.

Definition at line 380 of file mach_virt/IrqManager.cc.

Referenced by registerPciMessageIrqHandler().

+ Here is the caller graph for this function:

◆ registerPciMessageHandler()

irq_id_t VirtIrqManager::registerPciMessageHandler ( IrqHandlerBase *  handler,
Device *  device,
bool  hard,
bool &  allowFallback 
)
private

Definition at line 385 of file mach_virt/IrqManager.cc.

◆ registerPciMessageIrqHandler()

irq_id_t VirtIrqManager::registerPciMessageIrqHandler ( IrqHandler *  handler,
Device *  pDevice,
const IrqPolicy &  intxFallbackPolicy 
)
overridevirtual

Prefer a PCI message interrupt, falling back to INTx with the given policy.

Reimplemented from IrqManager.

Definition at line 526 of file mach_virt/IrqManager.cc.

References registerPciIrqHandler().

◆ registerPciMsixIrqHandlers()

bool VirtIrqManager::registerPciMsixIrqHandlers ( Device *  device,
IrqHandler *const *  handlers,
size_t  count,
irq_id_t *  ids,
bool &  fallbackSafe,
const size_t *  processors = nullptr 
)
overridevirtual

Register distinct MSI-X entries as one group. Failure permits a fallback only when fallbackSafe is true. Optional dense processor indices are placement hints; platforms without affinity support may retain their default destination.

Reimplemented from IrqManager.

Definition at line 533 of file mach_virt/IrqManager.cc.

References IrqHandler::acceptsSpuriousInterrupts(), IrqHandlerRegistry::invalidateThreadedLine(), IrqHandlerRegistry::registerThreadedHandler(), and IrqHandlerRegistry::unregisterHandler().

◆ registerSchedulerIrqHandler()

irq_id_t VirtIrqManager::registerSchedulerIrqHandler ( uint8_t  irq,
SchedulerIrqHandler *  handler,
const IrqPolicy &  policy 
)
overridevirtual

Install the platform's dedicated scheduler-timer interrupt source.

Unlike a generic hard handler, this callback is the terminal action for an occurrence and is allowed to abandon its interrupt frame. Platforms which do not provide a direct scheduler route reject the request.

Reimplemented from IrqManager.

Definition at line 773 of file mach_virt/IrqManager.cc.

References ProcessorBase::getInterrupts(), and ProcessorBase::setInterrupts().

◆ setEdge()

void VirtIrqManager::setEdge ( uint32_t  irq)
private

Definition at line 253 of file mach_virt/IrqManager.cc.

◆ setEnabled()

bool VirtIrqManager::setEnabled ( uint32_t  irq,
bool  enabled 
)
private

Definition at line 230 of file mach_virt/IrqManager.cc.

◆ setLevel()

void VirtIrqManager::setLevel ( uint32_t  irq)
private

Definition at line 246 of file mach_virt/IrqManager.cc.

◆ shutdownThreaded()

bool VirtIrqManager::shutdownThreaded ( )

Definition at line 114 of file mach_virt/IrqManager.cc.

◆ unregisterHandler()

bool VirtIrqManager::unregisterHandler ( irq_id_t  Id,
IrqHandlerBase *  handler 
)
overridevirtual

Unregister a previously registered IrqHandler.

A successful return is an ownership barrier: no callback can begin or remain active for the handler. A callback cannot synchronously remove itself, and an atomic context cannot wait for an active callback; those requests return false.

Parameters
[in]Idthe irq's identifier
Returns
true if removal completed synchronously

Implements IrqManager.

Definition at line 806 of file mach_virt/IrqManager.cc.

References Dec, ProcessorBase::executionContext(), ProcessorBase::getInterrupts(), IrqHandlerRegistry::invalidateThreadedLine(), ThreadedIrqDispatcher::isCurrentWorker(), ProcessorBase::setInterrupts(), and IrqHandlerRegistry::unregisterHandler().

◆ unregisterSchedulerIrqHandler()

bool VirtIrqManager::unregisterSchedulerIrqHandler ( irq_id_t  Id,
SchedulerIrqHandler *  handler 
)
overridevirtual

Stop admitting future callbacks for the exact scheduler source. The source must be quiesced first unless removal synchronously masks its controller line. Its handler has static machine lifetime because an already-admitted callback may not return.

Reimplemented from IrqManager.

Definition at line 790 of file mach_virt/IrqManager.cc.

References ProcessorBase::getInterrupts(), and ProcessorBase::setInterrupts().

Member Data Documentation

◆ m_Hard

HardIrqHandler* VirtIrqManager::m_Hard[MaxIrqs]
private

Definition at line 88 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_Initialised

bool VirtIrqManager::m_Initialised
private

Definition at line 101 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_Instance

VirtIrqManager VirtIrqManager::m_Instance
staticprivate

Definition at line 103 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_IrqCount

uint32_t VirtIrqManager::m_IrqCount
private

Definition at line 96 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_Its

GicIts VirtIrqManager::m_Its
private

Definition at line 94 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_MsiAddress

uint64_t VirtIrqManager::m_MsiAddress
private

Definition at line 99 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_MsiFirst

uint32_t VirtIrqManager::m_MsiFirst
private

Definition at line 97 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_MsiLast

uint32_t VirtIrqManager::m_MsiLast
private

Definition at line 98 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_MsiReady

bool VirtIrqManager::m_MsiReady
private

Definition at line 100 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_PciDispatcher

ThreadedIrqDispatcher VirtIrqManager::m_PciDispatcher
private

Definition at line 91 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_PciHandlers

IrqHandlerRegistry VirtIrqManager::m_PciHandlers
private

Definition at line 90 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_PciLines

PciLine VirtIrqManager::m_PciLines[MaxPciLines]
private

Definition at line 93 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_PciLock

Spinlock VirtIrqManager::m_PciLock
private

Definition at line 92 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_Scheduler

SchedulerIrqHandler* VirtIrqManager::m_Scheduler[MaxIrqs]
private

Definition at line 89 of file kernel/machine/mach_virt/IrqManager.h.

◆ m_Version

uint32_t VirtIrqManager::m_Version
private

Definition at line 95 of file kernel/machine/mach_virt/IrqManager.h.

◆ MaxIrqs

constexpr size_t VirtIrqManager::MaxIrqs = 256
staticconstexprprivate

Definition at line 50 of file kernel/machine/mach_virt/IrqManager.h.

◆ MaxPciLines

constexpr size_t VirtIrqManager::MaxPciLines = 16
staticconstexprprivate

Definition at line 51 of file kernel/machine/mach_virt/IrqManager.h.


The documentation for this class was generated from the following files: