Lines Matching refs:kvm
31 struct kvm *kvm, int irq_source_id, int level, in kvm_set_pic_irq() argument
34 struct kvm_pic *pic = kvm->arch.vpic; in kvm_set_pic_irq()
39 struct kvm *kvm, int irq_source_id, int level, in kvm_set_ioapic_irq() argument
42 struct kvm_ioapic *ioapic = kvm->arch.vioapic; in kvm_set_ioapic_irq()
47 int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, in kvm_irq_delivery_to_apic() argument
55 if (kvm_irq_delivery_to_apic_fast(kvm, src, irq, &r, dest_map)) in kvm_irq_delivery_to_apic()
66 kvm_for_each_vcpu(i, vcpu, kvm) { in kvm_irq_delivery_to_apic()
95 lowest = kvm_get_vcpu(kvm, idx); in kvm_irq_delivery_to_apic()
104 void kvm_set_msi_irq(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e, in kvm_set_msi_irq() argument
111 trace_kvm_msi_set_irq(msg.address_lo | (kvm->arch.x2apic_format ? in kvm_set_msi_irq()
114 irq->dest_id = x86_msi_msg_get_destid(&msg, kvm->arch.x2apic_format); in kvm_set_msi_irq()
125 static inline bool kvm_msi_route_invalid(struct kvm *kvm, in kvm_msi_route_invalid() argument
128 return kvm->arch.x2apic_format && (e->msi.address_hi & 0xff); in kvm_msi_route_invalid()
132 struct kvm *kvm, int irq_source_id, int level, bool line_status) in kvm_set_msi() argument
136 if (kvm_msi_route_invalid(kvm, e)) in kvm_set_msi()
142 kvm_set_msi_irq(kvm, e, &irq); in kvm_set_msi()
144 return kvm_irq_delivery_to_apic(kvm, NULL, &irq, NULL); in kvm_set_msi()
149 struct kvm *kvm, int irq_source_id, int level, in kvm_hv_set_sint() argument
155 return kvm_hv_synic_set_irq(kvm, e->hv_sint.vcpu, e->hv_sint.sint); in kvm_hv_set_sint()
160 struct kvm *kvm, int irq_source_id, int level, in kvm_arch_set_irq_inatomic() argument
169 return kvm_hv_set_sint(e, kvm, irq_source_id, level, in kvm_arch_set_irq_inatomic()
174 if (kvm_msi_route_invalid(kvm, e)) in kvm_arch_set_irq_inatomic()
177 kvm_set_msi_irq(kvm, e, &irq); in kvm_arch_set_irq_inatomic()
179 if (kvm_irq_delivery_to_apic_fast(kvm, NULL, &irq, &r, NULL)) in kvm_arch_set_irq_inatomic()
188 return kvm_xen_set_evtchn_fast(&e->xen_evtchn, kvm); in kvm_arch_set_irq_inatomic()
197 int kvm_request_irq_source_id(struct kvm *kvm) in kvm_request_irq_source_id() argument
199 unsigned long *bitmap = &kvm->arch.irq_sources_bitmap; in kvm_request_irq_source_id()
202 mutex_lock(&kvm->irq_lock); in kvm_request_irq_source_id()
215 mutex_unlock(&kvm->irq_lock); in kvm_request_irq_source_id()
220 void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id) in kvm_free_irq_source_id() argument
225 mutex_lock(&kvm->irq_lock); in kvm_free_irq_source_id()
231 clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap); in kvm_free_irq_source_id()
232 if (!irqchip_kernel(kvm)) in kvm_free_irq_source_id()
235 kvm_ioapic_clear_all(kvm->arch.vioapic, irq_source_id); in kvm_free_irq_source_id()
236 kvm_pic_clear_all(kvm->arch.vpic, irq_source_id); in kvm_free_irq_source_id()
238 mutex_unlock(&kvm->irq_lock); in kvm_free_irq_source_id()
241 void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq, in kvm_register_irq_mask_notifier() argument
244 mutex_lock(&kvm->irq_lock); in kvm_register_irq_mask_notifier()
246 hlist_add_head_rcu(&kimn->link, &kvm->arch.mask_notifier_list); in kvm_register_irq_mask_notifier()
247 mutex_unlock(&kvm->irq_lock); in kvm_register_irq_mask_notifier()
250 void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, in kvm_unregister_irq_mask_notifier() argument
253 mutex_lock(&kvm->irq_lock); in kvm_unregister_irq_mask_notifier()
255 mutex_unlock(&kvm->irq_lock); in kvm_unregister_irq_mask_notifier()
256 synchronize_srcu(&kvm->irq_srcu); in kvm_unregister_irq_mask_notifier()
259 void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, in kvm_fire_mask_notifiers() argument
265 idx = srcu_read_lock(&kvm->irq_srcu); in kvm_fire_mask_notifiers()
266 gsi = kvm_irq_map_chip_pin(kvm, irqchip, pin); in kvm_fire_mask_notifiers()
268 hlist_for_each_entry_rcu(kimn, &kvm->arch.mask_notifier_list, link) in kvm_fire_mask_notifiers()
271 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_fire_mask_notifiers()
274 bool kvm_arch_can_set_irq_routing(struct kvm *kvm) in kvm_arch_can_set_irq_routing() argument
276 return irqchip_in_kernel(kvm); in kvm_arch_can_set_irq_routing()
279 int kvm_set_routing_entry(struct kvm *kvm, in kvm_set_routing_entry() argument
289 if (irqchip_split(kvm)) in kvm_set_routing_entry()
317 if (kvm_msi_route_invalid(kvm, e)) in kvm_set_routing_entry()
329 return kvm_xen_setup_evtchn(kvm, e, ue); in kvm_set_routing_entry()
338 bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq, in kvm_intr_is_single_vcpu() argument
345 if (kvm_intr_is_single_vcpu_fast(kvm, irq, dest_vcpu)) in kvm_intr_is_single_vcpu()
348 kvm_for_each_vcpu(i, vcpu, kvm) { in kvm_intr_is_single_vcpu()
392 int kvm_setup_default_irq_routing(struct kvm *kvm) in kvm_setup_default_irq_routing() argument
394 return kvm_set_irq_routing(kvm, default_routing, in kvm_setup_default_irq_routing()
398 void kvm_arch_post_irq_routing_update(struct kvm *kvm) in kvm_arch_post_irq_routing_update() argument
400 if (!irqchip_split(kvm)) in kvm_arch_post_irq_routing_update()
402 kvm_make_scan_ioapic_request(kvm); in kvm_arch_post_irq_routing_update()
408 struct kvm *kvm = vcpu->kvm; in kvm_scan_ioapic_routes() local
414 idx = srcu_read_lock(&kvm->irq_srcu); in kvm_scan_ioapic_routes()
415 table = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu); in kvm_scan_ioapic_routes()
417 kvm->arch.nr_reserved_ioapic_pins); in kvm_scan_ioapic_routes()
425 kvm_set_msi_irq(vcpu->kvm, entry, &irq); in kvm_scan_ioapic_routes()
434 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_scan_ioapic_routes()
437 void kvm_arch_irq_routing_update(struct kvm *kvm) in kvm_arch_irq_routing_update() argument
440 kvm_hv_irq_routing_update(kvm); in kvm_arch_irq_routing_update()