| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * irq.h: in kernel interrupt controller related definitions |
|---|
| 3 | 4 | * Copyright (c) 2007, Intel Corporation. |
|---|
| 4 | 5 | * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 15 | | - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 16 | | - * Place - Suite 330, Boston, MA 02111-1307 USA. |
|---|
| 17 | 6 | * Authors: |
|---|
| 18 | 7 | * Yaozu (Eddie) Dong <Eddie.dong@intel.com> |
|---|
| 19 | | - * |
|---|
| 20 | 8 | */ |
|---|
| 21 | 9 | |
|---|
| 22 | 10 | #ifndef __IRQ_H |
|---|
| .. | .. |
|---|
| 28 | 16 | #include <linux/spinlock.h> |
|---|
| 29 | 17 | |
|---|
| 30 | 18 | #include <kvm/iodev.h> |
|---|
| 31 | | -#include "ioapic.h" |
|---|
| 32 | 19 | #include "lapic.h" |
|---|
| 33 | 20 | |
|---|
| 34 | 21 | #define PIC_NUM_PINS 16 |
|---|
| .. | .. |
|---|
| 78 | 65 | int kvm_pic_read_irq(struct kvm *kvm); |
|---|
| 79 | 66 | void kvm_pic_update_irq(struct kvm_pic *s); |
|---|
| 80 | 67 | |
|---|
| 81 | | -static inline int pic_in_kernel(struct kvm *kvm) |
|---|
| 82 | | -{ |
|---|
| 83 | | - int mode = kvm->arch.irqchip_mode; |
|---|
| 84 | | - |
|---|
| 85 | | - /* Matches smp_wmb() when setting irqchip_mode */ |
|---|
| 86 | | - smp_rmb(); |
|---|
| 87 | | - return mode == KVM_IRQCHIP_KERNEL; |
|---|
| 88 | | -} |
|---|
| 89 | | - |
|---|
| 90 | 68 | static inline int irqchip_split(struct kvm *kvm) |
|---|
| 91 | 69 | { |
|---|
| 92 | 70 | int mode = kvm->arch.irqchip_mode; |
|---|
| .. | .. |
|---|
| 105 | 83 | return mode == KVM_IRQCHIP_KERNEL; |
|---|
| 106 | 84 | } |
|---|
| 107 | 85 | |
|---|
| 86 | +static inline int pic_in_kernel(struct kvm *kvm) |
|---|
| 87 | +{ |
|---|
| 88 | + return irqchip_kernel(kvm); |
|---|
| 89 | +} |
|---|
| 90 | + |
|---|
| 108 | 91 | static inline int irqchip_in_kernel(struct kvm *kvm) |
|---|
| 109 | 92 | { |
|---|
| 110 | 93 | int mode = kvm->arch.irqchip_mode; |
|---|
| .. | .. |
|---|
| 114 | 97 | return mode != KVM_IRQCHIP_NONE; |
|---|
| 115 | 98 | } |
|---|
| 116 | 99 | |
|---|
| 117 | | -bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args); |
|---|
| 118 | 100 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); |
|---|
| 119 | 101 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); |
|---|
| 120 | 102 | void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); |
|---|
| .. | .. |
|---|
| 126 | 108 | |
|---|
| 127 | 109 | int kvm_setup_default_irq_routing(struct kvm *kvm); |
|---|
| 128 | 110 | int kvm_setup_empty_irq_routing(struct kvm *kvm); |
|---|
| 111 | +int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, |
|---|
| 112 | + struct kvm_lapic_irq *irq, |
|---|
| 113 | + struct dest_map *dest_map); |
|---|
| 129 | 114 | |
|---|
| 130 | 115 | #endif |
|---|