mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 07:35:31 +00:00
hv && config-tool: Add compilation option to disable all interrupts in HV
This patch adds an option CONFIG_KEEP_IRQ_DISABLED to hv (default n) and config-tool so that when this option is 'y', all interrupts in hv root mode will be permanently disabled. With this option to be 'y', all interrupts received in root mode will be handled in external interrupt vmexit after next VM entry. The postpone latency is negligible. This new configuration is a requirement from x86 TEE's secure/non-secure interrupt flow support. Many race conditions can be avoided when keeping IRQ off. v5: Rename CONFIG_ACRN_KEEP_IRQ_DISABLED to CONFIG_KEEP_IRQ_DISABLED v4: Change CPU_IRQ_ENABLE/DISABLE to CPU_IRQ_ENABLE_ON_CONFIG/DISABLE_ON_CONFIG and guard them using CONFIG_ACRN_KEEP_IRQ_DISABLED v3: CONFIG_ACRN_DISABLE_INTERRUPT -> CONFIG_ACRN_KEEP_IRQ_DISABLED Add more comment in commit message Tracked-On: #6571 Signed-off-by: Yifan Liu <yifan1.liu@intel.com> Reviewed-by: Wang, Yu1 <yu1.wang@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -522,16 +522,30 @@ static inline void asm_hlt(void)
|
||||
}
|
||||
|
||||
/* Disables interrupts on the current CPU */
|
||||
#define CPU_IRQ_DISABLE() \
|
||||
#ifdef CONFIG_KEEP_IRQ_DISABLED
|
||||
#define CPU_IRQ_DISABLE_ON_CONFIG() do { } while (0)
|
||||
#else
|
||||
#define CPU_IRQ_DISABLE_ON_CONFIG() \
|
||||
{ \
|
||||
asm volatile ("cli\n" : : : "cc"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Enables interrupts on the current CPU */
|
||||
#define CPU_IRQ_ENABLE() \
|
||||
/* Enables interrupts on the current CPU
|
||||
* If CONFIG_KEEP_IRQ_DISABLED is 'y', all interrupts
|
||||
* received in root mode will be handled in external interrupt
|
||||
* vmexit after next VM entry. The postpone latency is negligible.
|
||||
* Permanently turning off interrupts in root mode can be useful in
|
||||
* many scenarios (e.g., x86_tee).
|
||||
*/
|
||||
#ifdef CONFIG_KEEP_IRQ_DISABLED
|
||||
#define CPU_IRQ_ENABLE_ON_CONFIG() do { } while (0)
|
||||
#else
|
||||
#define CPU_IRQ_ENABLE_ON_CONFIG() \
|
||||
{ \
|
||||
asm volatile ("sti\n" : : : "cc"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This macro writes the stack pointer. */
|
||||
static inline void cpu_sp_write(uint64_t *stack_ptr)
|
||||
@@ -617,7 +631,7 @@ cpu_rdtscp_execute(uint64_t *timestamp_ptr, uint32_t *cpu_id_ptr)
|
||||
#define CPU_INT_ALL_DISABLE(p_rflags) \
|
||||
{ \
|
||||
CPU_RFLAGS_SAVE(p_rflags); \
|
||||
CPU_IRQ_DISABLE(); \
|
||||
CPU_IRQ_DISABLE_ON_CONFIG(); \
|
||||
}
|
||||
|
||||
/* This macro restores the architecture status / state register used to lockout
|
||||
|
||||
Reference in New Issue
Block a user