summary refs log tree commit diff stats
path: root/hw/hyperv/hyperv.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-05-02 17:48:26 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-05-03 15:47:48 +0200
commit48663349813144224d2b1cb6a85a893c2aa901ad (patch)
tree9d9dd390767b7f1755f2dd79db4fcb516c933a50 /hw/hyperv/hyperv.c
parentfe5943fecc7c9a55d975e9e55caf527057a94c37 (diff)
downloadfocaccia-qemu-48663349813144224d2b1cb6a85a893c2aa901ad.tar.gz
focaccia-qemu-48663349813144224d2b1cb6a85a893c2aa901ad.zip
kvm: move target-dependent interrupt routing out of kvm-all.c
Let hw/hyperv/hyperv.c and hw/intc/s390_flic.c handle (respectively)
SynIC and adapter routes, removing the code from target-independent
files.  This also removes the only occurrence of AdapterInfo outside
s390 code, so remove that from typedefs.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/hyperv/hyperv.c')
-rw-r--r--hw/hyperv/hyperv.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
index 3ea54ba818..483dcca308 100644
--- a/hw/hyperv/hyperv.c
+++ b/hw/hyperv/hyperv.c
@@ -373,6 +373,31 @@ int hyperv_set_event_flag(HvSintRoute *sint_route, unsigned eventno)
     return ret;
 }
 
+static int kvm_irqchip_add_hv_sint_route(KVMState *s, uint32_t vcpu, uint32_t sint)
+{
+    struct kvm_irq_routing_entry kroute = {};
+    int virq;
+
+    if (!kvm_gsi_routing_enabled()) {
+        return -ENOSYS;
+    }
+    virq = kvm_irqchip_get_virq(s);
+    if (virq < 0) {
+        return virq;
+    }
+
+    kroute.gsi = virq;
+    kroute.type = KVM_IRQ_ROUTING_HV_SINT;
+    kroute.flags = 0;
+    kroute.u.hv_sint.vcpu = vcpu;
+    kroute.u.hv_sint.sint = sint;
+
+    kvm_add_routing_entry(s, &kroute);
+    kvm_irqchip_commit_routes(s);
+
+    return virq;
+}
+
 HvSintRoute *hyperv_sint_route_new(uint32_t vp_index, uint32_t sint,
                                    HvSintMsgCb cb, void *cb_data)
 {