From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 389FACA9EAF for ; Thu, 24 Oct 2019 10:27:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AED520684 for ; Thu, 24 Oct 2019 10:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409091AbfJXK14 (ORCPT ); Thu, 24 Oct 2019 06:27:56 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:54197 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390754AbfJXK1x (ORCPT ); Thu, 24 Oct 2019 06:27:53 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R791e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=shannon.zhao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Tg31GPl_1571912869; Received: from localhost(mailfrom:shannon.zhao@linux.alibaba.com fp:SMTPD_---0Tg31GPl_1571912869) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Oct 2019 18:27:50 +0800 From: Shannon Zhao To: kvmarm@lists.cs.columbia.edu, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, christoffer.dall@arm.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RFC 4/7] KVM: vgic: Add hyp uninitialize function Date: Thu, 24 Oct 2019 18:27:47 +0800 Message-Id: <1571912870-18471-5-git-send-email-shannon.zhao@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1571912870-18471-1-git-send-email-shannon.zhao@linux.alibaba.com> References: <1571912870-18471-1-git-send-email-shannon.zhao@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When KVM ARM exits, it needs to cleanup vgic setup by kvm_vgic_hyp_init. Signed-off-by: Shannon Zhao --- 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