mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
HV:treewide:Update cpu_id type as uint_16
There are extra type conversion in the HV since cpu_id type is uint32_t and the return value type of get_cpu_id is uint16_t. BTW, the name of cpu_id is not clear enough to express its usage. So the following updates are made in this patch: Update cpu_id type as unit_16 to reduce type casting; Update related temporary variables type; Update related print argument; Change the input parameter name of interrupt_init as cpu_id to keep align with function implement; Rename cpu_id as pcpu_id as needed. Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -31,22 +31,22 @@ struct vcpu *get_ever_run_vcpu(uint16_t pcpu_id)
|
||||
* for physical CPU 1 : vcpu->pcpu_id = 1, vcpu->vcpu_id = 1, vmid = 1;
|
||||
*
|
||||
***********************************************************************/
|
||||
int create_vcpu(uint16_t cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
||||
int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
||||
{
|
||||
struct vcpu *vcpu;
|
||||
|
||||
ASSERT(vm != NULL, "");
|
||||
ASSERT(rtn_vcpu_handle != NULL, "");
|
||||
|
||||
pr_info("Creating VCPU %d", cpu_id);
|
||||
pr_info("Creating VCPU %hu", pcpu_id);
|
||||
|
||||
/* Allocate memory for VCPU */
|
||||
vcpu = calloc(1, sizeof(struct vcpu));
|
||||
ASSERT(vcpu != NULL, "");
|
||||
|
||||
/* Initialize the physical CPU ID for this VCPU */
|
||||
vcpu->pcpu_id = cpu_id;
|
||||
per_cpu(ever_run_vcpu, cpu_id) = vcpu;
|
||||
vcpu->pcpu_id = pcpu_id;
|
||||
per_cpu(ever_run_vcpu, pcpu_id) = vcpu;
|
||||
|
||||
/* Initialize the parent VM reference */
|
||||
vcpu->vm = vm;
|
||||
@@ -72,7 +72,7 @@ int create_vcpu(uint16_t cpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle)
|
||||
ASSERT(vcpu->vcpu_id < vm->hw.num_vcpus,
|
||||
"Allocated vcpu_id is out of range!");
|
||||
|
||||
per_cpu(vcpu, cpu_id) = vcpu;
|
||||
per_cpu(vcpu, pcpu_id) = vcpu;
|
||||
|
||||
pr_info("PCPU%d is working as VM%d VCPU%d, Role: %s",
|
||||
vcpu->pcpu_id, vcpu->vm->attr.id, vcpu->vcpu_id,
|
||||
|
Reference in New Issue
Block a user