[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 27/48] hyperv: synic: only setup ack notifier if ther
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 27/48] hyperv: synic: only setup ack notifier if there's a callback |
Date: |
Thu, 18 Oct 2018 22:31:54 +0200 |
From: Roman Kagan <address@hidden>
There's no point setting up an sint ack notifier if no callback is
specified.
Signed-off-by: Roman Kagan <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target/i386/hyperv.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c
index 47368b7..acdb0ca 100644
--- a/target/i386/hyperv.c
+++ b/target/i386/hyperv.c
@@ -77,15 +77,14 @@ static void kvm_hv_sint_ack_handler(EventNotifier *notifier)
HvSintRoute *sint_route = container_of(notifier, HvSintRoute,
sint_ack_notifier);
event_notifier_test_and_clear(notifier);
- if (sint_route->sint_ack_clb) {
- sint_route->sint_ack_clb(sint_route);
- }
+ sint_route->sint_ack_clb(sint_route);
}
HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index, uint32_t sint,
HvSintAckClb sint_ack_clb)
{
HvSintRoute *sint_route;
+ EventNotifier *ack_notifier;
int r, gsi;
sint_route = g_new0(HvSintRoute, 1);
@@ -94,13 +93,15 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index,
uint32_t sint,
goto err;
}
- r = event_notifier_init(&sint_route->sint_ack_notifier, false);
- if (r) {
- goto err_sint_set_notifier;
- }
+ ack_notifier = sint_ack_clb ? &sint_route->sint_ack_notifier : NULL;
+ if (ack_notifier) {
+ r = event_notifier_init(ack_notifier, false);
+ if (r) {
+ goto err_sint_set_notifier;
+ }
- event_notifier_set_handler(&sint_route->sint_ack_notifier,
- kvm_hv_sint_ack_handler);
+ event_notifier_set_handler(ack_notifier, kvm_hv_sint_ack_handler);
+ }
gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vp_index, sint);
if (gsi < 0) {
@@ -109,7 +110,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index,
uint32_t sint,
r = kvm_irqchip_add_irqfd_notifier_gsi(kvm_state,
&sint_route->sint_set_notifier,
- &sint_route->sint_ack_notifier,
gsi);
+ ack_notifier, gsi);
if (r) {
goto err_irqfd;
}
@@ -123,8 +124,10 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vp_index,
uint32_t sint,
err_irqfd:
kvm_irqchip_release_virq(kvm_state, gsi);
err_gsi:
- event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
- event_notifier_cleanup(&sint_route->sint_ack_notifier);
+ if (ack_notifier) {
+ event_notifier_set_handler(ack_notifier, NULL);
+ event_notifier_cleanup(ack_notifier);
+ }
err_sint_set_notifier:
event_notifier_cleanup(&sint_route->sint_set_notifier);
err:
@@ -139,8 +142,10 @@ void kvm_hv_sint_route_destroy(HvSintRoute *sint_route)
&sint_route->sint_set_notifier,
sint_route->gsi);
kvm_irqchip_release_virq(kvm_state, sint_route->gsi);
- event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
- event_notifier_cleanup(&sint_route->sint_ack_notifier);
+ if (sint_route->sint_ack_clb) {
+ event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
+ event_notifier_cleanup(&sint_route->sint_ack_notifier);
+ }
event_notifier_cleanup(&sint_route->sint_set_notifier);
g_free(sint_route);
}
--
1.8.3.1
- [Qemu-devel] [PULL 21/48] hw: edu: drop DO_UPCAST, (continued)
- [Qemu-devel] [PULL 21/48] hw: edu: drop DO_UPCAST, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 25/48] hyperv_testdev: drop unnecessary includes, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 10/48] target-i386: add i440fx 0xcf8 port as coalesced_pio, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 17/48] vl: refactor -rtc option references, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 15/48] i386: hvf: Remove hvf_disabled, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 14/48] i386: hvf: Fix register refs if REX is present, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 24/48] hyperv_testdev: refactor for better maintainability, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 23/48] scsi-disk: fix rerror/werror=ignore, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 22/48] scsi-disk: fix double completion of failing passthrough requests, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 26/48] hyperv: cosmetic: g_malloc -> g_new, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 27/48] hyperv: synic: only setup ack notifier if there's a callback,
Paolo Bonzini <=
- [Qemu-devel] [PULL 29/48] hyperv: address HvSintRoute by X86CPU pointer, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 35/48] default-configs: collect CONFIG_HYPERV* in hyperv.mak, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 37/48] hyperv:synic: split capability testing and setting, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 33/48] hyperv: make hyperv_vp_index inline, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 39/48] hyperv: only add SynIC in compatible configurations, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 34/48] hyperv: factor out arch-independent API into hw/hyperv, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 41/48] hyperv: add synic message delivery, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 30/48] hyperv: make HvSintRoute reference-counted, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 42/48] hyperv: add synic event flag signaling, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 28/48] hyperv: allow passing arbitrary data to sint ack callback, Paolo Bonzini, 2018/10/18