mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 05:02:24 +00:00
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:
parent
f3014a3c89
commit
ec199d9609
@ -73,6 +73,12 @@ struct acrn_vm *get_vm_from_vmid(uint16_t vm_id)
|
||||
return &vm_array[vm_id];
|
||||
}
|
||||
|
||||
/* return a pointer to the virtual machine structure of SOS VM */
|
||||
struct acrn_vm *get_sos_vm(void)
|
||||
{
|
||||
return sos_vm_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm_config != NULL
|
||||
*/
|
||||
|
@ -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)
|
||||
|
@ -376,7 +376,7 @@ struct acrn_vuart *vuart_console_active(void)
|
||||
|
||||
vm = get_vm_from_vmid(vuart_vmid);
|
||||
#else
|
||||
struct acrn_vm *vm = get_vm_from_vmid(0U);
|
||||
struct acrn_vm *vm = get_sos_vm();
|
||||
#endif
|
||||
|
||||
if (vm != NULL) {
|
||||
|
@ -228,7 +228,7 @@ void vpci_reset_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf,
|
||||
} else {
|
||||
/* Return this PCI device to SOS */
|
||||
if (vdev->vpci->vm == target_vm) {
|
||||
vm = get_vm_from_vmid(0U);
|
||||
vm = get_sos_vm();
|
||||
|
||||
if (vm != NULL) {
|
||||
vdev->vpci = &vm->vpci;
|
||||
|
@ -314,6 +314,7 @@ extern struct acrn_vm_config vm_configs[];
|
||||
bool is_sos_vm(const struct acrn_vm *vm);
|
||||
uint16_t find_free_vm_id(void);
|
||||
struct acrn_vm *get_vm_from_vmid(uint16_t vm_id);
|
||||
struct acrn_vm *get_sos_vm(void);
|
||||
|
||||
#ifdef CONFIG_PARTITION_MODE
|
||||
struct vm_config_arraies {
|
||||
|
Loading…
Reference in New Issue
Block a user