diff options
Diffstat (limited to 'virt/kvm/arm/vgic.h')
-rw-r--r-- | virt/kvm/arm/vgic.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/virt/kvm/arm/vgic.h b/virt/kvm/arm/vgic.h index 1e83bdf5f499..0df74cbb6200 100644 --- a/virt/kvm/arm/vgic.h +++ b/virt/kvm/arm/vgic.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef __KVM_VGIC_H__ | 20 | #ifndef __KVM_VGIC_H__ |
21 | #define __KVM_VGIC_H__ | 21 | #define __KVM_VGIC_H__ |
22 | 22 | ||
23 | #include <kvm/iodev.h> | ||
24 | |||
23 | #define VGIC_ADDR_UNDEF (-1) | 25 | #define VGIC_ADDR_UNDEF (-1) |
24 | #define IS_VGIC_ADDR_UNDEF(_x) ((_x) == VGIC_ADDR_UNDEF) | 26 | #define IS_VGIC_ADDR_UNDEF(_x) ((_x) == VGIC_ADDR_UNDEF) |
25 | 27 | ||
@@ -57,6 +59,14 @@ void vgic_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr); | |||
57 | bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq); | 59 | bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq); |
58 | void vgic_unqueue_irqs(struct kvm_vcpu *vcpu); | 60 | void vgic_unqueue_irqs(struct kvm_vcpu *vcpu); |
59 | 61 | ||
62 | struct kvm_exit_mmio { | ||
63 | phys_addr_t phys_addr; | ||
64 | void *data; | ||
65 | u32 len; | ||
66 | bool is_write; | ||
67 | void *private; | ||
68 | }; | ||
69 | |||
60 | void vgic_reg_access(struct kvm_exit_mmio *mmio, u32 *reg, | 70 | void vgic_reg_access(struct kvm_exit_mmio *mmio, u32 *reg, |
61 | phys_addr_t offset, int mode); | 71 | phys_addr_t offset, int mode); |
62 | bool handle_mmio_raz_wi(struct kvm_vcpu *vcpu, struct kvm_exit_mmio *mmio, | 72 | bool handle_mmio_raz_wi(struct kvm_vcpu *vcpu, struct kvm_exit_mmio *mmio, |
@@ -74,7 +84,7 @@ void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value) | |||
74 | *((u32 *)mmio->data) = cpu_to_le32(value) & mask; | 84 | *((u32 *)mmio->data) = cpu_to_le32(value) & mask; |
75 | } | 85 | } |
76 | 86 | ||
77 | struct kvm_mmio_range { | 87 | struct vgic_io_range { |
78 | phys_addr_t base; | 88 | phys_addr_t base; |
79 | unsigned long len; | 89 | unsigned long len; |
80 | int bits_per_irq; | 90 | int bits_per_irq; |
@@ -82,6 +92,11 @@ struct kvm_mmio_range { | |||
82 | phys_addr_t offset); | 92 | phys_addr_t offset); |
83 | }; | 93 | }; |
84 | 94 | ||
95 | int vgic_register_kvm_io_dev(struct kvm *kvm, gpa_t base, int len, | ||
96 | const struct vgic_io_range *ranges, | ||
97 | int redist_id, | ||
98 | struct vgic_io_device *iodev); | ||
99 | |||
85 | static inline bool is_in_range(phys_addr_t addr, unsigned long len, | 100 | static inline bool is_in_range(phys_addr_t addr, unsigned long len, |
86 | phys_addr_t baseaddr, unsigned long size) | 101 | phys_addr_t baseaddr, unsigned long size) |
87 | { | 102 | { |
@@ -89,14 +104,8 @@ static inline bool is_in_range(phys_addr_t addr, unsigned long len, | |||
89 | } | 104 | } |
90 | 105 | ||
91 | const | 106 | const |
92 | struct kvm_mmio_range *vgic_find_range(const struct kvm_mmio_range *ranges, | 107 | struct vgic_io_range *vgic_find_range(const struct vgic_io_range *ranges, |
93 | struct kvm_exit_mmio *mmio, | 108 | int len, gpa_t offset); |
94 | phys_addr_t offset); | ||
95 | |||
96 | bool vgic_handle_mmio_range(struct kvm_vcpu *vcpu, struct kvm_run *run, | ||
97 | struct kvm_exit_mmio *mmio, | ||
98 | const struct kvm_mmio_range *ranges, | ||
99 | unsigned long mmio_base); | ||
100 | 109 | ||
101 | bool vgic_handle_enable_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, | 110 | bool vgic_handle_enable_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, |
102 | phys_addr_t offset, int vcpu_id, int access); | 111 | phys_addr_t offset, int vcpu_id, int access); |
@@ -107,12 +116,20 @@ bool vgic_handle_set_pending_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, | |||
107 | bool vgic_handle_clear_pending_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, | 116 | bool vgic_handle_clear_pending_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, |
108 | phys_addr_t offset, int vcpu_id); | 117 | phys_addr_t offset, int vcpu_id); |
109 | 118 | ||
119 | bool vgic_handle_set_active_reg(struct kvm *kvm, | ||
120 | struct kvm_exit_mmio *mmio, | ||
121 | phys_addr_t offset, int vcpu_id); | ||
122 | |||
123 | bool vgic_handle_clear_active_reg(struct kvm *kvm, | ||
124 | struct kvm_exit_mmio *mmio, | ||
125 | phys_addr_t offset, int vcpu_id); | ||
126 | |||
110 | bool vgic_handle_cfg_reg(u32 *reg, struct kvm_exit_mmio *mmio, | 127 | bool vgic_handle_cfg_reg(u32 *reg, struct kvm_exit_mmio *mmio, |
111 | phys_addr_t offset); | 128 | phys_addr_t offset); |
112 | 129 | ||
113 | void vgic_kick_vcpus(struct kvm *kvm); | 130 | void vgic_kick_vcpus(struct kvm *kvm); |
114 | 131 | ||
115 | int vgic_has_attr_regs(const struct kvm_mmio_range *ranges, phys_addr_t offset); | 132 | int vgic_has_attr_regs(const struct vgic_io_range *ranges, phys_addr_t offset); |
116 | int vgic_set_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr); | 133 | int vgic_set_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr); |
117 | int vgic_get_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr); | 134 | int vgic_get_common_attr(struct kvm_device *dev, struct kvm_device_attr *attr); |
118 | 135 | ||