HV: add get_sos_vm api

This patch creates a new get_sos_vm() api to replace get_vm_from_vmid(0U)
because VM 0 might not be SOS VM now;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2019-01-21 15:33:17 +08:00
committed by Eddie Dong
parent f3014a3c89
commit ec199d9609
5 changed files with 15 additions and 7 deletions

View File

@@ -15,14 +15,15 @@ static void fire_vhm_interrupt(void)
* use vLAPIC to inject vector to SOS vcpu 0 if vlapic is enabled
* otherwise, send IPI hardcoded to BOOT_CPU_ID
*/
struct acrn_vm *vm0;
struct acrn_vm *sos_vm;
struct acrn_vcpu *vcpu;
vm0 = get_vm_from_vmid(0U);
sos_vm = get_sos_vm();
if (sos_vm != NULL) {
vcpu = vcpu_from_vid(sos_vm, BOOT_CPU_ID);
vcpu = vcpu_from_vid(vm0, 0U);
vlapic_set_intr(vcpu, acrn_vhm_vector, LAPIC_TRIG_EDGE);
vlapic_set_intr(vcpu, acrn_vhm_vector, LAPIC_TRIG_EDGE);
}
}
#if defined(HV_DEBUG)