HV: Add helper function send_single_nmi

This patch adds a helper function send_single_nmi. The fisrt caller
will soon come with the following patch.

Tracked-On: #3886
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
This commit is contained in:
Kaige Fu 2019-12-05 16:27:37 +00:00 committed by wenlingz
parent 525d4d3cd0
commit 2777f23075
2 changed files with 24 additions and 0 deletions

View File

@ -288,3 +288,18 @@ void send_single_init(uint16_t pcpu_id)
msr_write(MSR_IA32_EXT_APIC_ICR, icr.value); msr_write(MSR_IA32_EXT_APIC_ICR, icr.value);
} }
/**
* @pre pcpu_id < CONFIG_MAX_PCPU_NUM
*
* @return None
*/
void send_single_nmi(uint16_t pcpu_id)
{
union apic_icr icr;
icr.value_32.hi_32 = per_cpu(lapic_id, pcpu_id);
icr.value_32.lo_32 = (INTR_LAPIC_ICR_PHYSICAL << 11U) | (INTR_LAPIC_ICR_NMI << 8U);
msr_write(MSR_IA32_EXT_APIC_ICR, icr.value);
}

View File

@ -183,4 +183,13 @@ void send_single_ipi(uint16_t pcpu_id, uint32_t vector);
*/ */
void send_single_init(uint16_t pcpu_id); void send_single_init(uint16_t pcpu_id);
/**
* @brief Send an NMI signal to a single pCPU
*
* @param[in] pcpu_id The id of destination physical cpu
*
* @return None
*/
void send_single_nmi(uint16_t pcpu_id);
#endif /* INTR_LAPIC_H */ #endif /* INTR_LAPIC_H */