[PATCH 08/23] KVM: arm64: Move kvm_vgic_destroy to kvm_irqchip_flow
Marc Zyngier
maz at kernel.org
Thu Sep 3 11:25:55 EDT 2020
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 at 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(-)
diff --git a/arch/arm64/include/asm/kvm_irq.h b/arch/arm64/include/asm/kvm_irq.h
index 7a70bb803560..f83594257bc4 100644
--- a/arch/arm64/include/asm/kvm_irq.h
+++ b/arch/arm64/include/asm/kvm_irq.h
@@ -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
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 41f98564f507..09b4bcb2c805 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -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]) {
diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
index 6b8f0518c074..4e2c23a7dab1 100644
--- a/arch/arm64/kvm/vgic/vgic-init.c
+++ b/arch/arm64/kvm/vgic/vgic-init.c
@@ -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);
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 8d30fc645148..e8bdc304ec9b 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -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);
--
2.27.0
More information about the linux-arm-kernel
mailing list