hyperv: rename vcpu_id to vp_index
In Hyper-V-related code, vCPUs are identified by their VP (virtual processor) index. Since it's customary for "vcpu_id" in QEMU to mean APIC id, rename the respective variables to "vp_index" to make the distinction clear. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> Message-Id: <20180702134156.13404-2-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
696c706642
commit
1b2013ea5d
@ -57,7 +57,7 @@ static void free_sint_route_index(HypervTestDev *dev, int i)
|
|||||||
dev->sint_route[i] = NULL;
|
dev->sint_route[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_sint_route_index(HypervTestDev *dev, uint32_t vcpu_id,
|
static int find_sint_route_index(HypervTestDev *dev, uint32_t vp_index,
|
||||||
uint32_t sint)
|
uint32_t sint)
|
||||||
{
|
{
|
||||||
HvSintRoute *sint_route;
|
HvSintRoute *sint_route;
|
||||||
@ -65,7 +65,7 @@ static int find_sint_route_index(HypervTestDev *dev, uint32_t vcpu_id,
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(dev->sint_route); i++) {
|
for (i = 0; i < ARRAY_SIZE(dev->sint_route); i++) {
|
||||||
sint_route = dev->sint_route[i];
|
sint_route = dev->sint_route[i];
|
||||||
if (sint_route && sint_route->vcpu_id == vcpu_id &&
|
if (sint_route && sint_route->vp_index == vp_index &&
|
||||||
sint_route->sint == sint) {
|
sint_route->sint == sint) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ static int find_sint_route_index(HypervTestDev *dev, uint32_t vcpu_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void hv_synic_test_dev_control(HypervTestDev *dev, uint32_t ctl,
|
static void hv_synic_test_dev_control(HypervTestDev *dev, uint32_t ctl,
|
||||||
uint32_t vcpu_id, uint32_t sint)
|
uint32_t vp_index, uint32_t sint)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
HvSintRoute *sint_route;
|
HvSintRoute *sint_route;
|
||||||
@ -83,19 +83,19 @@ static void hv_synic_test_dev_control(HypervTestDev *dev, uint32_t ctl,
|
|||||||
case HV_TEST_DEV_SINT_ROUTE_CREATE:
|
case HV_TEST_DEV_SINT_ROUTE_CREATE:
|
||||||
i = alloc_sint_route_index(dev);
|
i = alloc_sint_route_index(dev);
|
||||||
assert(i >= 0);
|
assert(i >= 0);
|
||||||
sint_route = kvm_hv_sint_route_create(vcpu_id, sint, NULL);
|
sint_route = kvm_hv_sint_route_create(vp_index, sint, NULL);
|
||||||
assert(sint_route);
|
assert(sint_route);
|
||||||
dev->sint_route[i] = sint_route;
|
dev->sint_route[i] = sint_route;
|
||||||
break;
|
break;
|
||||||
case HV_TEST_DEV_SINT_ROUTE_DESTROY:
|
case HV_TEST_DEV_SINT_ROUTE_DESTROY:
|
||||||
i = find_sint_route_index(dev, vcpu_id, sint);
|
i = find_sint_route_index(dev, vp_index, sint);
|
||||||
assert(i >= 0);
|
assert(i >= 0);
|
||||||
sint_route = dev->sint_route[i];
|
sint_route = dev->sint_route[i];
|
||||||
kvm_hv_sint_route_destroy(sint_route);
|
kvm_hv_sint_route_destroy(sint_route);
|
||||||
free_sint_route_index(dev, i);
|
free_sint_route_index(dev, i);
|
||||||
break;
|
break;
|
||||||
case HV_TEST_DEV_SINT_ROUTE_SET_SINT:
|
case HV_TEST_DEV_SINT_ROUTE_SET_SINT:
|
||||||
i = find_sint_route_index(dev, vcpu_id, sint);
|
i = find_sint_route_index(dev, vp_index, sint);
|
||||||
assert(i >= 0);
|
assert(i >= 0);
|
||||||
sint_route = dev->sint_route[i];
|
sint_route = dev->sint_route[i];
|
||||||
kvm_hv_sint_route_set_sint(sint_route);
|
kvm_hv_sint_route_set_sint(sint_route);
|
||||||
@ -117,8 +117,8 @@ static void hv_test_dev_control(void *opaque, hwaddr addr, uint64_t data,
|
|||||||
case HV_TEST_DEV_SINT_ROUTE_DESTROY:
|
case HV_TEST_DEV_SINT_ROUTE_DESTROY:
|
||||||
case HV_TEST_DEV_SINT_ROUTE_SET_SINT: {
|
case HV_TEST_DEV_SINT_ROUTE_SET_SINT: {
|
||||||
uint8_t sint = data & 0xFF;
|
uint8_t sint = data & 0xFF;
|
||||||
uint8_t vcpu_id = (data >> 8ULL) & 0xFF;
|
uint8_t vp_index = (data >> 8ULL) & 0xFF;
|
||||||
hv_synic_test_dev_control(dev, ctl, vcpu_id, sint);
|
hv_synic_test_dev_control(dev, ctl, vp_index, sint);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -72,7 +72,7 @@ static void kvm_hv_sint_ack_handler(EventNotifier *notifier)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
|
HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint,
|
||||||
HvSintAckClb sint_ack_clb)
|
HvSintAckClb sint_ack_clb)
|
||||||
{
|
{
|
||||||
HvSintRoute *sint_route;
|
HvSintRoute *sint_route;
|
||||||
@ -92,7 +92,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
|
|||||||
event_notifier_set_handler(&sint_route->sint_ack_notifier,
|
event_notifier_set_handler(&sint_route->sint_ack_notifier,
|
||||||
kvm_hv_sint_ack_handler);
|
kvm_hv_sint_ack_handler);
|
||||||
|
|
||||||
gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vcpu_id, sint);
|
gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vp_index, sint);
|
||||||
if (gsi < 0) {
|
if (gsi < 0) {
|
||||||
goto err_gsi;
|
goto err_gsi;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
|
|||||||
}
|
}
|
||||||
sint_route->gsi = gsi;
|
sint_route->gsi = gsi;
|
||||||
sint_route->sint_ack_clb = sint_ack_clb;
|
sint_route->sint_ack_clb = sint_ack_clb;
|
||||||
sint_route->vcpu_id = vcpu_id;
|
sint_route->vp_index = vp_index;
|
||||||
sint_route->sint = sint;
|
sint_route->sint = sint;
|
||||||
|
|
||||||
return sint_route;
|
return sint_route;
|
||||||
|
@ -23,7 +23,7 @@ typedef void (*HvSintAckClb)(HvSintRoute *sint_route);
|
|||||||
|
|
||||||
struct HvSintRoute {
|
struct HvSintRoute {
|
||||||
uint32_t sint;
|
uint32_t sint;
|
||||||
uint32_t vcpu_id;
|
uint32_t vp_index;
|
||||||
int gsi;
|
int gsi;
|
||||||
EventNotifier sint_set_notifier;
|
EventNotifier sint_set_notifier;
|
||||||
EventNotifier sint_ack_notifier;
|
EventNotifier sint_ack_notifier;
|
||||||
@ -32,7 +32,7 @@ struct HvSintRoute {
|
|||||||
|
|
||||||
int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit);
|
int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit);
|
||||||
|
|
||||||
HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
|
HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint,
|
||||||
HvSintAckClb sint_ack_clb);
|
HvSintAckClb sint_ack_clb);
|
||||||
|
|
||||||
void kvm_hv_sint_route_destroy(HvSintRoute *sint_route);
|
void kvm_hv_sint_route_destroy(HvSintRoute *sint_route);
|
||||||
|
Loading…
Reference in New Issue
Block a user