Skip to content

Commit 2777f23

Browse files
KaigeFuwenlingz
authored andcommitted
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>
1 parent 525d4d3 commit 2777f23

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

hypervisor/arch/x86/lapic.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,18 @@ void send_single_init(uint16_t pcpu_id)
288288

289289
msr_write(MSR_IA32_EXT_APIC_ICR, icr.value);
290290
}
291+
292+
/**
293+
* @pre pcpu_id < CONFIG_MAX_PCPU_NUM
294+
*
295+
* @return None
296+
*/
297+
void send_single_nmi(uint16_t pcpu_id)
298+
{
299+
union apic_icr icr;
300+
301+
icr.value_32.hi_32 = per_cpu(lapic_id, pcpu_id);
302+
icr.value_32.lo_32 = (INTR_LAPIC_ICR_PHYSICAL << 11U) | (INTR_LAPIC_ICR_NMI << 8U);
303+
304+
msr_write(MSR_IA32_EXT_APIC_ICR, icr.value);
305+
}

hypervisor/include/arch/x86/lapic.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,13 @@ void send_single_ipi(uint16_t pcpu_id, uint32_t vector);
183183
*/
184184
void send_single_init(uint16_t pcpu_id);
185185

186+
/**
187+
* @brief Send an NMI signal to a single pCPU
188+
*
189+
* @param[in] pcpu_id The id of destination physical cpu
190+
*
191+
* @return None
192+
*/
193+
void send_single_nmi(uint16_t pcpu_id);
194+
186195
#endif /* INTR_LAPIC_H */

0 commit comments

Comments
 (0)