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:
parent
3eb45b9bf6
commit
4afb6666b9
|
@ -987,7 +987,7 @@ vlapic_calcdest(struct vm *vm, uint64_t *dmask, uint32_t dest,
|
|||
*/
|
||||
*dmask = 0UL;
|
||||
vcpu_id = vm_apicid2vcpu_id(vm, (uint8_t)dest);
|
||||
if (vcpu_id < phys_cpu_num) {
|
||||
if (vcpu_id < vm->hw.created_vcpus) {
|
||||
bitmap_set_lock(vcpu_id, dmask);
|
||||
}
|
||||
} else {
|
||||
|
@ -1619,9 +1619,6 @@ vlapic_reset(struct acrn_vlapic *vlapic)
|
|||
void
|
||||
vlapic_init(struct acrn_vlapic *vlapic)
|
||||
{
|
||||
ASSERT(vlapic->vcpu->vcpu_id < phys_cpu_num,
|
||||
"%s: vcpu_id is not initialized", __func__);
|
||||
|
||||
/*
|
||||
* If the vlapic is configured in x2apic mode then it will be
|
||||
* accessed in the critical section via the MSR emulation code.
|
||||
|
@ -1848,7 +1845,7 @@ vlapic_set_local_intr(struct vm *vm, uint16_t vcpu_id_arg, uint32_t vector)
|
|||
int error;
|
||||
uint16_t vcpu_id = vcpu_id_arg;
|
||||
|
||||
if ((vcpu_id != BROADCAST_CPU_ID) && (vcpu_id >= phys_cpu_num)) {
|
||||
if ((vcpu_id != BROADCAST_CPU_ID) && (vcpu_id >= vm->hw.created_vcpus)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ int prepare_vm0(void)
|
|||
}
|
||||
|
||||
/* Allocate all cpus to vm0 at the beginning */
|
||||
for (i = 0U; i < phys_cpu_num; i++) {
|
||||
for (i = 0U; i < vm0_desc.vm_hw_num_cores; i++) {
|
||||
err = prepare_vcpu(vm, i);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue