~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/kvm/ioapic.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __KVM_IO_APIC_H
  3 #define __KVM_IO_APIC_H
  4 
  5 #include <linux/kvm_host.h>
  6 #include <kvm/iodev.h>
  7 #include "irq.h"
  8 
  9 struct kvm;
 10 struct kvm_vcpu;
 11 
 12 #define IOAPIC_NUM_PINS  KVM_IOAPIC_NUM_PINS
 13 #define MAX_NR_RESERVED_IOAPIC_PINS KVM_MAX_IRQ_ROUTES
 14 #define IOAPIC_VERSION_ID 0x11  /* IOAPIC version */
 15 #define IOAPIC_EDGE_TRIG  0
 16 #define IOAPIC_LEVEL_TRIG 1
 17 
 18 #define IOAPIC_DEFAULT_BASE_ADDRESS  0xfec00000
 19 #define IOAPIC_MEM_LENGTH            0x100
 20 
 21 /* Direct registers. */
 22 #define IOAPIC_REG_SELECT  0x00
 23 #define IOAPIC_REG_WINDOW  0x10
 24 
 25 /* Indirect registers. */
 26 #define IOAPIC_REG_APIC_ID 0x00 /* x86 IOAPIC only */
 27 #define IOAPIC_REG_VERSION 0x01
 28 #define IOAPIC_REG_ARB_ID  0x02 /* x86 IOAPIC only */
 29 
 30 /*ioapic delivery mode*/
 31 #define IOAPIC_FIXED                    0x0
 32 #define IOAPIC_LOWEST_PRIORITY          0x1
 33 #define IOAPIC_PMI                      0x2
 34 #define IOAPIC_NMI                      0x4
 35 #define IOAPIC_INIT                     0x5
 36 #define IOAPIC_EXTINT                   0x7
 37 
 38 #define RTC_GSI 8
 39 
 40 struct dest_map {
 41         /* vcpu bitmap where IRQ has been sent */
 42         DECLARE_BITMAP(map, KVM_MAX_VCPU_IDS);
 43 
 44         /*
 45          * Vector sent to a given vcpu, only valid when
 46          * the vcpu's bit in map is set
 47          */
 48         u8 vectors[KVM_MAX_VCPU_IDS];
 49 };
 50 
 51 
 52 struct rtc_status {
 53         int pending_eoi;
 54         struct dest_map dest_map;
 55 };
 56 
 57 union kvm_ioapic_redirect_entry {
 58         u64 bits;
 59         struct {
 60                 u8 vector;
 61                 u8 delivery_mode:3;
 62                 u8 dest_mode:1;
 63                 u8 delivery_status:1;
 64                 u8 polarity:1;
 65                 u8 remote_irr:1;
 66                 u8 trig_mode:1;
 67                 u8 mask:1;
 68                 u8 reserve:7;
 69                 u8 reserved[4];
 70                 u8 dest_id;
 71         } fields;
 72 };
 73 
 74 struct kvm_ioapic {
 75         u64 base_address;
 76         u32 ioregsel;
 77         u32 id;
 78         u32 irr;
 79         u32 pad;
 80         union kvm_ioapic_redirect_entry redirtbl[IOAPIC_NUM_PINS];
 81         unsigned long irq_states[IOAPIC_NUM_PINS];
 82         struct kvm_io_device dev;
 83         struct kvm *kvm;
 84         spinlock_t lock;
 85         struct rtc_status rtc_status;
 86         struct delayed_work eoi_inject;
 87         u32 irq_eoi[IOAPIC_NUM_PINS];
 88         u32 irr_delivered;
 89 };
 90 
 91 #ifdef DEBUG
 92 #define ASSERT(x)                                                       \
 93 do {                                                                    \
 94         if (!(x)) {                                                     \
 95                 printk(KERN_EMERG "assertion failed %s: %d: %s\n",      \
 96                        __FILE__, __LINE__, #x);                         \
 97                 BUG();                                                  \
 98         }                                                               \
 99 } while (0)
100 #else
101 #define ASSERT(x) do { } while (0)
102 #endif
103 
104 static inline int ioapic_in_kernel(struct kvm *kvm)
105 {
106         return irqchip_kernel(kvm);
107 }
108 
109 void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu);
110 void kvm_ioapic_update_eoi(struct kvm_vcpu *vcpu, int vector,
111                         int trigger_mode);
112 int kvm_ioapic_init(struct kvm *kvm);
113 void kvm_ioapic_destroy(struct kvm *kvm);
114 int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
115                        int level, bool line_status);
116 void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id);
117 void kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state);
118 void kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state);
119 void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu,
120                            ulong *ioapic_handled_vectors);
121 void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu,
122                             ulong *ioapic_handled_vectors);
123 #endif
124 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php