@@ -18,6 +18,7 @@ enum kvm_irqchip_type {
#define irqchip_is_gic_v3(k) ((k)->arch.irqchip_type == IRQCHIP_GICv3)
struct kvm_irqchip_flow {
+ void (*irqchip_destroy)(struct kvm *);
};
/*
@@ -46,4 +47,7 @@ struct kvm_irqchip_flow {
#define __vcpu_irqchip_action_ret(v, ...) \
__kvm_irqchip_action_ret((v)->kvm, __VA_ARGS__)
+#define kvm_irqchip_destroy(k) \
+ __kvm_irqchip_action((k), destroy, (k))
+
#endif
@@ -143,7 +143,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
{
int i;
- kvm_vgic_destroy(kvm);
+ kvm_irqchip_destroy(kvm);
for (i = 0; i < KVM_MAX_VCPUS; ++i) {
if (kvm->vcpus[i]) {
@@ -12,7 +12,10 @@
#include <asm/kvm_mmu.h>
#include "vgic.h"
+static void kvm_vgic_destroy(struct kvm *kvm);
+
static struct kvm_irqchip_flow vgic_irqchip_flow = {
+ .irqchip_destroy = kvm_vgic_destroy,
};
/*
@@ -341,7 +344,7 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
vgic_v4_teardown(kvm);
}
-void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
+static void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
{
struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
@@ -368,7 +371,7 @@ static void __kvm_vgic_destroy(struct kvm *kvm)
kvm_vgic_dist_destroy(kvm);
}
-void kvm_vgic_destroy(struct kvm *kvm)
+static void kvm_vgic_destroy(struct kvm *kvm)
{
mutex_lock(&kvm->lock);
__kvm_vgic_destroy(kvm);
@@ -337,8 +337,6 @@ extern struct static_key_false vgic_v3_cpuif_trap;
int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write);
int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu);
int kvm_vgic_create(struct kvm *kvm, u32 type);
-void kvm_vgic_destroy(struct kvm *kvm);
-void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu);
int kvm_vgic_map_resources(struct kvm *kvm);
int kvm_vgic_hyp_init(void);
void kvm_vgic_init_cpu_hardware(void);
Let's start the VGIC split by moving the act of destroying it, as it is simple and doesn't require much effort. Whilst we're at it, make kvm_vgic_vcpu_destroy() static, as it isn't called from anywhere else. Signed-off-by: Marc Zyngier <maz@kernel.org> --- arch/arm64/include/asm/kvm_irq.h | 4 ++++ arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/vgic/vgic-init.c | 7 +++++-- include/kvm/arm_vgic.h | 2 -- 4 files changed, 10 insertions(+), 5 deletions(-)