mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
HV: Add one hcall to set the upcall vector passed from sos_kernel
Currently the acrn-hypervisor is using the PLATFORM_IPI vector to notify the sos_kernel. And then sos_kernel will handle the notification from acrn hypervisor in PLATFORM_IPI ISR. But as the PLATFORM_IPI ISR can be registered by the other modules, it will have the conflict when trying to register acrn intr ISR. So the HYPERVISOR_CALLBACK_VECTOR will be used instead. In order to switch the notification vector from PLATFORM_IPI to HYPERVISOR_CALLBACK_VECTOR, one API is added so that sos can configure the up-notifier interrrupt vector. Tracked-On: https://github.com/projectacrn/acrn-hypervisor/issues/1325 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
228699131b
commit
a189be26ff
@ -50,6 +50,11 @@ int vmcall_vmexit_handler(struct vcpu *vcpu)
|
||||
ret = hcall_get_api_version(vm, param1);
|
||||
break;
|
||||
|
||||
case HC_SET_CALLBACK_VECTOR:
|
||||
ret = hcall_set_callback_vector(vm, param1);
|
||||
|
||||
break;
|
||||
|
||||
case HC_CREATE_VM:
|
||||
ret = hcall_create_vm(vm, param1);
|
||||
break;
|
||||
|
@ -1036,3 +1036,23 @@ int32_t hcall_vm_intr_monitor(struct vm *vm, uint16_t vmid, uint64_t param)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*@pre Pointer vm shall point to VM0
|
||||
*/
|
||||
int32_t hcall_set_callback_vector(struct vm *vm, uint64_t param)
|
||||
{
|
||||
if (!is_vm0(vm)) {
|
||||
pr_err("%s: Targeting to service vm", __func__);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if ((param > NR_MAX_VECTOR) || (param < VECTOR_DYNAMIC_START)) {
|
||||
pr_err("%s: Invalid passed vector\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
acrn_vhm_vector = param;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -455,6 +455,21 @@ int64_t hcall_save_restore_sworld_ctx(struct vcpu *vcpu);
|
||||
* @}
|
||||
*/ // End of trusty_hypercall
|
||||
|
||||
/**
|
||||
* @brief set upcall notifier vector
|
||||
*
|
||||
* This is the API that helps to switch the notifer vecotr. If this API is
|
||||
* not called, the hypervisor will use the default notifier vector(0xF7)
|
||||
* to notify the SOS kernel.
|
||||
*
|
||||
* @param vm Pointer to VM data structure
|
||||
* @param the expected notifier vector from guest
|
||||
*
|
||||
* @pre Pointer vm shall point to VM0
|
||||
* @return 0 on success, non-zero on error.
|
||||
*/
|
||||
int32_t hcall_set_callback_vector(struct vm *vm, uint64_t param);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/ // End of acrn_hypercall
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define HC_ID_GEN_BASE 0x0UL
|
||||
#define HC_GET_API_VERSION BASE_HC_ID(HC_ID, HC_ID_GEN_BASE + 0x00UL)
|
||||
#define HC_SOS_OFFLINE_CPU BASE_HC_ID(HC_ID, HC_ID_GEN_BASE + 0x01UL)
|
||||
#define HC_SET_CALLBACK_VECTOR BASE_HC_ID(HC_ID, HC_ID_GEN_BASE + 0x02UL)
|
||||
|
||||
/* VM management */
|
||||
#define HC_ID_VM_BASE 0x10UL
|
||||
|
Loading…
Reference in New Issue
Block a user