On Tue, Jun 06, 2017 at 09:19:36PM +0300, Roman Kagan wrote: > Use X86CPU pointer to refer to the respective HvSintRoute instead of > vp_index. This is more convenient and also paves the way for future > enhancements. > > Signed-off-by: Roman Kagan <rka...@virtuozzo.com> [...] > @@ -101,16 +101,18 @@ static void hv_test_dev_control(void *opaque, hwaddr > addr, uint64_t data, > uint8_t sint = data & 0xFF; > uint8_t vcpu_id = (data >> 8ULL) & 0xFF;
vcpu_id risks being confused KVM's vcpu_id (which is the CPU APIC ID in x86). If you are already touching this code, this could be renamed to vp_index to avoid confusion. > uint8_t ctl = (data >> 16ULL) & 0xFF; > + X86CPU *cpu = hyperv_find_vcpu(vcpu_id); > + assert(cpu); > > switch (ctl) { > case HV_TEST_DEV_SINT_ROUTE_CREATE: > - sint_route_create(dev, vcpu_id, sint); > + sint_route_create(dev, cpu, sint); > break; > case HV_TEST_DEV_SINT_ROUTE_DESTROY: > - sint_route_destroy(dev, vcpu_id, sint); > + sint_route_destroy(dev, cpu, sint); > break; > case HV_TEST_DEV_SINT_ROUTE_SET_SINT: > - sint_route_set_sint(dev, vcpu_id, sint); > + sint_route_set_sint(dev, cpu, sint); > break; > default: > break; -- Eduardo