hv:cleanup vcpu_id compare with phys_cpu_num

Currently we compare vcpu_id with phys_cpu_num,
vcpu_id is not related with phys_cpu_num,
this patch cleanup them.

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Mingqiang Chi
2018-10-24 12:03:57 +08:00
committed by Xie, Nanlin
parent 3eb45b9bf6
commit 4afb6666b9
3 changed files with 6 additions and 12 deletions

View File

@@ -640,10 +640,7 @@ static int shell_vcpu_dumpreg(int argc, char **argv)
}
vm_id = (uint16_t)status;
vcpu_id = (uint16_t)atoi(argv[2]);
if (vcpu_id >= phys_cpu_num) {
status = -EINVAL;
goto out;
}
vm = get_vm_from_vmid(vm_id);
if (vm == NULL) {
shell_puts("No vm found in the input <vm_id, vcpu_id>\r\n");
@@ -651,8 +648,8 @@ static int shell_vcpu_dumpreg(int argc, char **argv)
goto out;
}
if (vcpu_id >= CONFIG_MAX_VCPUS_PER_VM) {
shell_puts("No vcpu found in the input <vm_id, vcpu_id>\r\n");
if (vcpu_id >= vm->hw.created_vcpus) {
shell_puts("vcpu id is out of range\r\n");
status = -EINVAL;
goto out;
}