mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-06 16:15:00 +00:00
Debug: Add one hypercall to quary hardware info
acrntrace/log kernel modules will use this hypercall to fetch pcpu num of hardware platform. Then, initialize driver accordingly. Tracked-On: #1775;#1776 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Reviewed-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
@@ -122,6 +122,34 @@ static int32_t hcall_setup_hv_npk_log(struct acrn_vm *vm, uint64_t param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get hardware related info
|
||||
*
|
||||
* @param vm Pointer to vm data structure
|
||||
* @param param Guest physical address pointing to struct acrn_hw_info
|
||||
*
|
||||
* @pre vm shall point to VM0
|
||||
* @pre param shall be a valid physical address
|
||||
*
|
||||
* @retval 0 on success
|
||||
* @retval -1 in case of error
|
||||
*/
|
||||
static int32_t hcall_get_hw_info(struct acrn_vm *vm, uint64_t param)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
struct acrn_hw_info hw_info;
|
||||
|
||||
(void)memset((void *)&hw_info, 0U, sizeof(hw_info));
|
||||
|
||||
hw_info.cpu_num = phys_cpu_num;
|
||||
ret = copy_to_gpa(vm, &hw_info, param, sizeof(hw_info));
|
||||
if (ret != 0) {
|
||||
pr_err("%s: Unable to copy param to vm", __func__);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Setup hypervisor debug infrastructure, such as share buffer, NPK log and profiling.
|
||||
*
|
||||
@@ -151,6 +179,10 @@ int32_t hcall_debug(struct acrn_vm *vm, uint64_t param1, uint64_t param2, uint64
|
||||
ret = hcall_profiling_ops(vm, param1, param2);
|
||||
break;
|
||||
|
||||
case HC_GET_HW_INFO:
|
||||
ret = hcall_get_hw_info(vm, param1);
|
||||
break;
|
||||
|
||||
default:
|
||||
pr_err("op %d: Invalid hypercall\n", hypcall_id);
|
||||
ret = -EPERM;
|
||||
|
||||
Reference in New Issue
Block a user