mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
HV:Treewide:Update the type of vcpu id as uint16_t
In the hypervisor, virtual cpu id is defined as "int" or "uint32_t" type in the hypervisor. So there are some sign conversion issues about virtual cpu id (vcpu_id) reported by static analysis tool. Sign conversion violates the rules of MISRA C:2012. BTW, virtual cpu id has different names (vcpu_id, cpu_id, logical_id) for different modules of HV, its type is defined as "int" or "uint32_t" in the HV. cpu_id type and logical_id type clean up will be done in other patchs. V1-->V2: More clean up the type of vcpu id; "%hu" is for vcpu id in the print function. Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
This commit is contained in:
@@ -372,7 +372,7 @@ int64_t hcall_notify_req_finish(uint64_t vmid, uint64_t vcpu_id)
|
||||
dev_dbg(ACRN_DBG_HYCALL, "[%d] NOTIFY_FINISH for vcpu %d",
|
||||
vmid, vcpu_id);
|
||||
|
||||
vcpu = vcpu_from_vid(target_vm, vcpu_id);
|
||||
vcpu = vcpu_from_vid(target_vm, (uint16_t)vcpu_id);
|
||||
if (vcpu == NULL) {
|
||||
pr_err("%s, failed to get VCPU %d context from VM %d\n",
|
||||
__func__, vcpu_id, target_vm->attr.id);
|
||||
|
@@ -25,11 +25,11 @@ static void fire_vhm_interrupt(void)
|
||||
vlapic_intr_edge(vcpu, VECTOR_VIRT_IRQ_VHM);
|
||||
}
|
||||
|
||||
static void acrn_print_request(int vcpu_id, struct vhm_request *req)
|
||||
static void acrn_print_request(uint16_t vcpu_id, struct vhm_request *req)
|
||||
{
|
||||
switch (req->type) {
|
||||
case REQ_MMIO:
|
||||
dev_dbg(ACRN_DBG_IOREQUEST, "[vcpu_id=%d type=MMIO]", vcpu_id);
|
||||
dev_dbg(ACRN_DBG_IOREQUEST, "[vcpu_id=%hu type=MMIO]", vcpu_id);
|
||||
dev_dbg(ACRN_DBG_IOREQUEST,
|
||||
"gpa=0x%lx, R/W=%d, size=%ld value=0x%lx processed=%lx",
|
||||
req->reqs.mmio_request.address,
|
||||
@@ -39,7 +39,7 @@ static void acrn_print_request(int vcpu_id, struct vhm_request *req)
|
||||
req->processed);
|
||||
break;
|
||||
case REQ_PORTIO:
|
||||
dev_dbg(ACRN_DBG_IOREQUEST, "[vcpu_id=%d type=PORTIO]", vcpu_id);
|
||||
dev_dbg(ACRN_DBG_IOREQUEST, "[vcpu_id=%hu type=PORTIO]", vcpu_id);
|
||||
dev_dbg(ACRN_DBG_IOREQUEST,
|
||||
"IO=0x%lx, R/W=%d, size=%ld value=0x%lx processed=%lx",
|
||||
req->reqs.pio_request.address,
|
||||
@@ -49,7 +49,7 @@ static void acrn_print_request(int vcpu_id, struct vhm_request *req)
|
||||
req->processed);
|
||||
break;
|
||||
default:
|
||||
dev_dbg(ACRN_DBG_IOREQUEST, "[vcpu_id=%d type=%d] NOT support type",
|
||||
dev_dbg(ACRN_DBG_IOREQUEST, "[vcpu_id=%hu type=%d] NOT support type",
|
||||
vcpu_id, req->type);
|
||||
break;
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ int load_guest(struct vm *vm, struct vcpu *vcpu)
|
||||
|
||||
pr_info("%s, Set config according to predefined offset:",
|
||||
__func__);
|
||||
pr_info("VCPU%d Entry: 0x%llx, RSI: 0x%016llx, cr3: 0x%016llx",
|
||||
pr_info("VCPU%hu Entry: 0x%llx, RSI: 0x%016llx, cr3: 0x%016llx",
|
||||
vcpu->vcpu_id, vcpu->entry_addr,
|
||||
cur_context->guest_cpu_regs.regs.rsi,
|
||||
vm->arch_vm.guest_init_pml4);
|
||||
@@ -132,7 +132,7 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
if (is_vcpu_bsp(vcpu)) {
|
||||
/* Set VCPU entry point to kernel entry */
|
||||
vcpu->entry_addr = vm->sw.kernel_info.kernel_entry_addr;
|
||||
pr_info("%s, VM *d VCPU %d Entry: 0x%016llx ",
|
||||
pr_info("%s, VM *d VCPU %hu Entry: 0x%016llx ",
|
||||
__func__, vm->attr.id, vcpu->vcpu_id, vcpu->entry_addr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user