diff options
author | Andre Przywara <andre.przywara@arm.com> | 2014-06-02 10:19:12 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2015-01-20 12:25:26 -0500 |
commit | b26e5fdac43c1b7c394502917e42e3b91f3aa1a3 (patch) | |
tree | 128812f82e426b1d6d460421f9b2efe5b0904779 /include/kvm | |
parent | 05bc8aafe664b3c7507736db305b3d3910ed2f05 (diff) |
arm/arm64: KVM: introduce per-VM ops
Currently we only have one virtual GIC model supported, so all guests
use the same emulation code. With the addition of another model we
end up with different guests using potentially different vGIC models,
so we have to split up some functions to be per VM.
Introduce a vgic_vm_ops struct to hold function pointers for those
functions that are different and provide the necessary code to
initialize them.
Also split up the vgic_init() function to separate out VGIC model
specific functionality into a separate function, which will later be
different for a GICv3 model.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'include/kvm')
-rw-r--r-- | include/kvm/arm_vgic.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 525ce4228495..dd243969bfc3 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
@@ -134,6 +134,15 @@ struct vgic_params { | |||
134 | void __iomem *vctrl_base; | 134 | void __iomem *vctrl_base; |
135 | }; | 135 | }; |
136 | 136 | ||
137 | struct vgic_vm_ops { | ||
138 | bool (*handle_mmio)(struct kvm_vcpu *, struct kvm_run *, | ||
139 | struct kvm_exit_mmio *); | ||
140 | bool (*queue_sgi)(struct kvm_vcpu *, int irq); | ||
141 | void (*add_sgi_source)(struct kvm_vcpu *, int irq, int source); | ||
142 | int (*init_model)(struct kvm *); | ||
143 | int (*map_resources)(struct kvm *, const struct vgic_params *); | ||
144 | }; | ||
145 | |||
137 | struct vgic_dist { | 146 | struct vgic_dist { |
138 | #ifdef CONFIG_KVM_ARM_VGIC | 147 | #ifdef CONFIG_KVM_ARM_VGIC |
139 | spinlock_t lock; | 148 | spinlock_t lock; |
@@ -215,6 +224,8 @@ struct vgic_dist { | |||
215 | 224 | ||
216 | /* Bitmap indicating which CPU has something pending */ | 225 | /* Bitmap indicating which CPU has something pending */ |
217 | unsigned long *irq_pending_on_cpu; | 226 | unsigned long *irq_pending_on_cpu; |
227 | |||
228 | struct vgic_vm_ops vm_ops; | ||
218 | #endif | 229 | #endif |
219 | }; | 230 | }; |
220 | 231 | ||