x86: remove dynamically generated IRQ and exception code
We are interested in supporting some XIP x86 platforms which are unable to fetch CPU instructions from system RAM. This requires refactoring our dynamic IRQ/exc code which currently synthesizes assembly language instructions to create IRQ stubs on-the-fly. Instead, a new approach is taken. Given that the configuration at build time specifies the number of required stubs, use this to generate a build time a set of tiny stub functions which simply push a 'stub id' and then call common dynamic interrupt code. The handler function and handler argument is saved in a table keyed by this stub id. CONFIG_EOI_HANDLER_SUPPORTED removed, the code hasn't been conditionally compiled for some time and in all cases we call _loapic_eoi() when finished with an interrupt. Some other out-of-date verbiage in comments related to supporting non-APIC removed. Previously, when dynamic exceptions were created a pointer would be passed in by the caller reserving ram for the stub code. Since this is no longer feasible, two new Kconfig options have been added. CONFIG_NUM_DYNAMIC_EXC_STUBS and CONFIG_NUM_DYNAMIC_EXC_NO_ERR_STUBS control how many stubs are created for exceptions that push an error code, and no error code, respectively. SW Interrupts are no longer triggered by "int <vector>" hard-coded assembly instructions. Instead this is done by sending a self-directed inter-processor interrupt from the LOAPIC, using a new API loapic_int_vect_trigger(). In this way we get rid of dynamically generated code in irq_test_common.h. All interrupts call _loapic_eoi() when finished, since this is now the right thing to do for all IRQs, including SW interrupts. _irq_handler_set() for x86 no longer requires the old function pointer to be supplied. Change-Id: I78993d3d00dd153c9051c518b417cce8d3acee9e Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
c159380c86
commit
b43758d22a
22 changed files with 605 additions and 1942 deletions
|
@ -342,6 +342,35 @@ void _loapic_int_vec_set(unsigned int irq, /* IRQ number of the interrupt */
|
|||
irq_unlock(oldLevel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Trigger an interrupt from software
|
||||
*
|
||||
* This is the required method to trigger an interrupt from software,
|
||||
* use this instead of hard-coded asm "int <vector>" operations. Sends a
|
||||
* self-directed inter-processor interrupt to the LOAPIC which in turn
|
||||
* triggers the IRQ handler for the specified vector.
|
||||
*
|
||||
* @param vector IRQ vector in the IDT to trigger
|
||||
*/
|
||||
void loapic_int_vec_trigger(unsigned int vector)
|
||||
{
|
||||
uint32_t icr_cmd;
|
||||
|
||||
/*
|
||||
* Bit 14 : level ASSERT (1)
|
||||
* Bit 18-19: Destination shorthand SELF (01)
|
||||
* Bit 15 : trigger mode EDGE (0)
|
||||
*
|
||||
* Destination mode ignored,
|
||||
*/
|
||||
icr_cmd = vector | (1 << 14) | (1 << 18);
|
||||
|
||||
*(volatile int *)(CONFIG_LOAPIC_BASE_ADDRESS + LOAPIC_ICRLO) = icr_cmd;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Enable an individual LOAPIC interrupt (IRQ)
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
* routine _IntVecAlloc() provided by the nanokernel will be used to
|
||||
* perform the the allocation since the local APIC prioritizes interrupts
|
||||
* as assumed by _IntVecAlloc().
|
||||
* b) Provides End of Interrupt (EOI) related information to be used when
|
||||
* generating the interrupt stub code.
|
||||
* c) If an interrupt vector can be allocated, and the <irq> argument is not
|
||||
* b) If an interrupt vector can be allocated, and the <irq> argument is not
|
||||
* equal to NANO_SOFT_IRQ, the IOAPIC redirection table (RED) or the
|
||||
* LOAPIC local vector table (LVT) will be updated with the allocated
|
||||
* interrupt vector.
|
||||
|
@ -67,7 +65,6 @@
|
|||
*
|
||||
* @param irq virtualized IRQ
|
||||
* @param priority get vector from <priority> group
|
||||
* @param eoiRtn pointer to the EOI routine; NULL if none
|
||||
*
|
||||
* @return the allocated interrupt vector
|
||||
*
|
||||
|
@ -79,8 +76,7 @@
|
|||
*/
|
||||
int _SysIntVecAlloc(
|
||||
unsigned int irq, /* virtualized IRQ */
|
||||
unsigned int priority, /* get vector from <priority> group */
|
||||
NANO_EOI_GET_FUNC *eoiRtn /* ptr to EOI routine; NULL if none */
|
||||
unsigned int priority /* get vector from <priority> group */
|
||||
)
|
||||
{
|
||||
int vector;
|
||||
|
@ -118,9 +114,6 @@ int _SysIntVecAlloc(
|
|||
#endif
|
||||
{
|
||||
_SysIntVecProgram(vector, irq);
|
||||
*eoiRtn = (NANO_EOI_GET_FUNC)_loapic_eoi;
|
||||
} else {
|
||||
*eoiRtn = (NANO_EOI_GET_FUNC)NULL;
|
||||
}
|
||||
|
||||
return vector;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue