aboutsummaryrefslogtreecommitdiff
path: root/target/i386/hyperv.c
diff options
context:
space:
mode:
authorRoman Kagan <rkagan@virtuozzo.com>2018-09-21 11:18:34 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-19 13:44:13 +0200
commit09cfb2f6350512eb3ef7e9e2136daabbcf265880 (patch)
treee12884b3ba451fb1c1260b0bfcca1191342f9e4c /target/i386/hyperv.c
parentb56920245c1f708976b6f1bf8ddc4a1e9bd33059 (diff)
hyperv: address HvSintRoute by X86CPU pointer
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 <rkagan@virtuozzo.com> Message-Id: <20180921081836.29230-7-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/hyperv.c')
-rw-r--r--target/i386/hyperv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c
index 11fd1add2c..0ce8a7aa2f 100644
--- a/target/i386/hyperv.c
+++ b/target/i386/hyperv.c
@@ -18,7 +18,7 @@
struct HvSintRoute {
uint32_t sint;
- uint32_t vp_index;
+ X86CPU *cpu;
int gsi;
EventNotifier sint_set_notifier;
EventNotifier sint_ack_notifier;
@@ -97,6 +97,12 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint,
HvSintRoute *sint_route;
EventNotifier *ack_notifier;
int r, gsi;
+ X86CPU *cpu;
+
+ cpu = hyperv_find_vcpu(vp_index);
+ if (!cpu) {
+ return NULL;
+ }
sint_route = g_new0(HvSintRoute, 1);
r = event_notifier_init(&sint_route->sint_set_notifier, false);
@@ -128,7 +134,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint,
sint_route->gsi = gsi;
sint_route->sint_ack_clb = sint_ack_clb;
sint_route->sint_ack_clb_data = sint_ack_clb_data;
- sint_route->vp_index = vp_index;
+ sint_route->cpu = cpu;
sint_route->sint = sint;
return sint_route;