direct-io.hg

view xen/include/asm-x86/hvm/irq.h @ 15388:50358c4b37f4

hvm: Support injection of virtual NMIs and clean up ExtInt handling in general.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jun 20 11:50:16 2007 +0100 (2007-06-20)
parents e825954d4179
children d7e3224b661a
line source
1 /******************************************************************************
2 * irq.h
3 *
4 * Interrupt distribution and delivery logic.
5 *
6 * Copyright (c) 2006, K A Fraser, XenSource Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place - Suite 330, Boston, MA 02111-1307 USA.
20 */
22 #ifndef __ASM_X86_HVM_IRQ_H__
23 #define __ASM_X86_HVM_IRQ_H__
25 #include <xen/types.h>
26 #include <xen/spinlock.h>
27 #include <asm/hvm/hvm.h>
28 #include <asm/hvm/vpic.h>
29 #include <asm/hvm/vioapic.h>
30 #include <public/hvm/save.h>
32 struct hvm_irq {
33 /*
34 * Virtual interrupt wires for a single PCI bus.
35 * Indexed by: device*4 + INTx#.
36 */
37 struct hvm_hw_pci_irqs pci_intx;
39 /*
40 * Virtual interrupt wires for ISA devices.
41 * Indexed by ISA IRQ (assumes no ISA-device IRQ sharing).
42 */
43 struct hvm_hw_isa_irqs isa_irq;
45 /*
46 * PCI-ISA interrupt router.
47 * Each PCI <device:INTx#> is 'wire-ORed' into one of four links using
48 * the traditional 'barber's pole' mapping ((device + INTx#) & 3).
49 * The router provides a programmable mapping from each link to a GSI.
50 */
51 struct hvm_hw_pci_link pci_link;
53 /* Virtual interrupt and via-link for paravirtual platform driver. */
54 uint32_t callback_via_asserted;
55 union {
56 enum {
57 HVMIRQ_callback_none,
58 HVMIRQ_callback_gsi,
59 HVMIRQ_callback_pci_intx
60 } callback_via_type;
61 };
62 union {
63 uint32_t gsi;
64 struct { uint8_t dev, intx; } pci;
65 } callback_via;
67 /* Number of INTx wires asserting each PCI-ISA link. */
68 u8 pci_link_assert_count[4];
70 /*
71 * Number of wires asserting each GSI.
72 *
73 * GSIs 0-15 are the ISA IRQs. ISA devices map directly into this space
74 * except ISA IRQ 0, which is connected to GSI 2.
75 * PCI links map into this space via the PCI-ISA bridge.
76 *
77 * GSIs 16+ are used only be PCI devices. The mapping from PCI device to
78 * GSI is as follows: ((device*4 + device/8 + INTx#) & 31) + 16
79 */
80 u8 gsi_assert_count[VIOAPIC_NUM_PINS];
82 /*
83 * GSIs map onto PIC/IO-APIC in the usual way:
84 * 0-7: Master 8259 PIC, IO-APIC pins 0-7
85 * 8-15: Slave 8259 PIC, IO-APIC pins 8-15
86 * 16+ : IO-APIC pins 16+
87 */
89 /* Last VCPU that was delivered a LowestPrio interrupt. */
90 u8 round_robin_prev_vcpu;
91 };
93 #define hvm_pci_intx_gsi(dev, intx) \
94 (((((dev)<<2) + ((dev)>>3) + (intx)) & 31) + 16)
95 #define hvm_pci_intx_link(dev, intx) \
96 (((dev) + (intx)) & 3)
98 #define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2)
100 /* Modify state of a PCI INTx wire. */
101 void hvm_pci_intx_assert(
102 struct domain *d, unsigned int device, unsigned int intx);
103 void hvm_pci_intx_deassert(
104 struct domain *d, unsigned int device, unsigned int intx);
106 /* Modify state of an ISA device's IRQ wire. */
107 void hvm_isa_irq_assert(
108 struct domain *d, unsigned int isa_irq);
109 void hvm_isa_irq_deassert(
110 struct domain *d, unsigned int isa_irq);
112 void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq);
114 void hvm_set_callback_irq_level(void);
115 void hvm_set_callback_via(struct domain *d, uint64_t via);
117 /* Check/Acknowledge next pending interrupt. */
118 enum hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v);
119 int hvm_vcpu_ack_pending_irq(
120 struct vcpu *v, enum hvm_intack type, int *vector);
122 int get_isa_irq_vector(struct vcpu *vcpu, int irq, enum hvm_intack src);
123 int is_isa_irq_masked(struct vcpu *v, int isa_irq);
125 #endif /* __ASM_X86_HVM_IRQ_H__ */