[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1571912870-18471-5-git-send-email-shannon.zhao@linux.alibaba.com>
Date: Thu, 24 Oct 2019 18:27:47 +0800
From: Shannon Zhao <shannon.zhao@...ux.alibaba.com>
To: kvmarm@...ts.cs.columbia.edu, maz@...nel.org, james.morse@....com,
suzuki.poulose@....com, christoffer.dall@....com
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: [PATCH RFC 4/7] KVM: vgic: Add hyp uninitialize function
When KVM ARM exits, it needs to cleanup vgic setup by kvm_vgic_hyp_init.
Signed-off-by: Shannon Zhao <shannon.zhao@...ux.alibaba.com>
---
include/kvm/arm_vgic.h | 1 +
virt/kvm/arm/arm.c | 1 +
virt/kvm/arm/vgic/vgic-init.c | 7 +++++++
3 files changed, 9 insertions(+)
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index af4f09c..7f44ebb 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -339,6 +339,7 @@ struct vgic_cpu {
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_hyp_uninit(void);
void kvm_vgic_init_cpu_hardware(void);
int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index da32c9b..0c60074 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1724,6 +1724,7 @@ int kvm_arch_init(void *opaque)
void kvm_arch_exit(void)
{
kvm_perf_teardown();
+ kvm_vgic_hyp_uninit();
hyp_cpu_pm_exit();
}
diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
index 6f50c42..cd48047 100644
--- a/virt/kvm/arm/vgic/vgic-init.c
+++ b/virt/kvm/arm/vgic/vgic-init.c
@@ -550,3 +550,10 @@ int kvm_vgic_hyp_init(void)
kvm_get_running_vcpus());
return ret;
}
+
+void kvm_vgic_hyp_uninit(void)
+{
+ cpuhp_remove_state(CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING);
+ free_percpu_irq(kvm_vgic_global_state.maint_irq,
+ kvm_get_running_vcpus());
+}
--
1.8.3.1
Powered by blists - more mailing lists