| 1 | /* |
| 2 | * Accelerated irqchip abstraction |
| 3 | * |
| 4 | * Copyright Microsoft, Corp. 2025 |
| 5 | * |
| 6 | * Authors: Ziqiao Zhou <ziqiaozhou@microsoft.com> |
| 7 | * Magnus Kulke <magnuskulke@microsoft.com> |
| 8 | * |
| 9 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | */ |
| 11 | |
| 12 | #ifndef SYSTEM_ACCEL_IRQ_H |
| 13 | #define SYSTEM_ACCEL_IRQ_H |
| 14 | #include "hw/pci/msi.h" |
| 15 | #include "system/kvm.h" |
| 16 | #include "system/mshv.h" |
| 17 | |
| 18 | static inline bool accel_msi_via_irqfd_enabled(void) |
| 19 | { |
| 20 | return mshv_msi_via_irqfd_enabled() || kvm_msi_via_irqfd_enabled(); |
| 21 | } |
| 22 | |
| 23 | static inline bool accel_irqchip_is_split(void) |
| 24 | { |
| 25 | return mshv_msi_via_irqfd_enabled() || kvm_irqchip_is_split(); |
| 26 | } |
| 27 | |
| 28 | AccelRouteChange accel_irqchip_begin_route_changes(void); |
| 29 | int accel_irqchip_add_msi_route(AccelRouteChange *c, int vector, |
| 30 | PCIDevice *dev); |
| 31 | int accel_irqchip_update_msi_route(int vector, MSIMessage msg, PCIDevice *dev); |
| 32 | void accel_irqchip_commit_route_changes(AccelRouteChange *c); |
| 33 | void accel_irqchip_commit_routes(void); |
| 34 | void accel_irqchip_release_virq(int virq); |
| 35 | int accel_irqchip_add_irqfd_notifier_gsi(EventNotifier *n, EventNotifier *rn, |
| 36 | int virq); |
| 37 | int accel_irqchip_remove_irqfd_notifier_gsi(EventNotifier *n, int virq); |
| 38 | #endif |