HV: Introduce one new API send_single_init

This API is only for kick vcpu out of non-root mode when
RTVM poweroff by itself. And the first caller will soon come
along with the next patch.

Tracked-On: #2865
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Kaige Fu 2019-03-19 09:56:28 +00:00 committed by ACRN System Integration
parent 8ad5adced7
commit ef9be0208a
2 changed files with 27 additions and 0 deletions

View File

@ -268,3 +268,23 @@ void send_single_ipi(uint16_t pcpu_id, uint32_t vector)
pr_err("pcpu_id %d not in active!", pcpu_id);
}
}
/**
* @pre pcpu_id < CONFIG_MAX_PCPU_NUM
* @pre target pCPU must be in active state
*
* @return None
*/
void send_single_init(uint16_t pcpu_id)
{
union apic_icr icr;
if (is_pcpu_active(pcpu_id)) {
icr.value_32.hi_32 = per_cpu(lapic_id, pcpu_id);
icr.value_32.lo_32 = (INTR_LAPIC_ICR_PHYSICAL << 11U) | (INTR_LAPIC_ICR_INIT << 8U);
msr_write(MSR_IA32_EXT_APIC_ICR, icr.value);
} else {
ASSERT(false, "pCPU%u not in active", pcpu_id);
}
}

View File

@ -124,6 +124,13 @@ void send_dest_ipi_mask(uint32_t dest_mask, uint32_t vector);
*/
void send_single_ipi(uint16_t pcpu_id, uint32_t vector);
/**
* @brief Send an INIT signal to a single pCPU
*
* @param[in] pcpu_id The id of destination physical cpu
*/
void send_single_init(uint16_t pcpu_id);
void suspend_lapic(void);
void resume_lapic(void);