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 93700CA9EAF for ; Thu, 24 Oct 2019 10:27:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69CA920684 for ; Thu, 24 Oct 2019 10:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409094AbfJXK16 (ORCPT ); Thu, 24 Oct 2019 06:27:58 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:52626 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409083AbfJXK14 (ORCPT ); Thu, 24 Oct 2019 06:27:56 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=shannon.zhao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Tg2twD8_1571912871; Received: from localhost(mailfrom:shannon.zhao@linux.alibaba.com fp:SMTPD_---0Tg2twD8_1571912871) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Oct 2019 18:27:52 +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 5/7] KVM: arch_timer: Add hyp uninitialize function Date: Thu, 24 Oct 2019 18:27:48 +0800 Message-Id: <1571912870-18471-6-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 arch_timer setup by kvm_timer_hyp_init. Signed-off-by: Shannon Zhao --- include/kvm/arm_arch_timer.h | 1 + virt/kvm/arm/arch_timer.c | 13 +++++++++++++ virt/kvm/arm/arm.c | 1 + 3 files changed, 15 insertions(+) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index d120e6c..3cb3a01 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -68,6 +68,7 @@ struct arch_timer_cpu { }; int kvm_timer_hyp_init(bool); +void kvm_timer_hyp_uninit(void); int kvm_timer_enable(struct kvm_vcpu *vcpu); int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index f5a5d51..7dafa97 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -991,6 +991,19 @@ int kvm_timer_hyp_init(bool has_gic) return err; } +void kvm_timer_hyp_uninit(void) +{ + struct arch_timer_kvm_info *info = arch_timer_get_kvm_info(); + + cpuhp_remove_state(CPUHP_AP_KVM_ARM_TIMER_STARTING); + if (info->physical_irq > 0) { + on_each_cpu(disable_percpu_irq, (void *)host_ptimer_irq, 1); + free_percpu_irq(host_ptimer_irq, kvm_get_running_vcpus()); + } + on_each_cpu(disable_percpu_irq, (void *)host_vtimer_irq, 1); + free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus()); +} + void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = vcpu_timer(vcpu); diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 0c60074..feb6649 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_timer_hyp_uninit(); kvm_vgic_hyp_uninit(); hyp_cpu_pm_exit(); } -- 1.8.3.1 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,URIBL_BLOCKED,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 9273BCA9EBE for ; Thu, 24 Oct 2019 12:25:14 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 4C0BB21872 for ; Thu, 24 Oct 2019 12:25:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C0BB21872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 03D274A838; Thu, 24 Oct 2019 08:25:14 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nnrUfvoISghP; Thu, 24 Oct 2019 08:25:13 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B7DB84A8BA; Thu, 24 Oct 2019 08:25:10 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 995304A523 for ; Thu, 24 Oct 2019 06:27:56 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zX0qSXtpgtXR for ; Thu, 24 Oct 2019 06:27:55 -0400 (EDT) Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 5A2FA4A5D5 for ; Thu, 24 Oct 2019 06:27:55 -0400 (EDT) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R171e4; CH=green; DM=||false|; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04395; MF=shannon.zhao@linux.alibaba.com; NM=1; PH=DS; RN=8; SR=0; TI=SMTPD_---0Tg2twD8_1571912871; Received: from localhost(mailfrom:shannon.zhao@linux.alibaba.com fp:SMTPD_---0Tg2twD8_1571912871) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Oct 2019 18:27:52 +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 Subject: [PATCH RFC 5/7] KVM: arch_timer: Add hyp uninitialize function Date: Thu, 24 Oct 2019 18:27:48 +0800 Message-Id: <1571912870-18471-6-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> X-Mailman-Approved-At: Thu, 24 Oct 2019 08:25:09 -0400 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu When KVM ARM exits, it needs to cleanup arch_timer setup by kvm_timer_hyp_init. Signed-off-by: Shannon Zhao --- include/kvm/arm_arch_timer.h | 1 + virt/kvm/arm/arch_timer.c | 13 +++++++++++++ virt/kvm/arm/arm.c | 1 + 3 files changed, 15 insertions(+) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index d120e6c..3cb3a01 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -68,6 +68,7 @@ struct arch_timer_cpu { }; int kvm_timer_hyp_init(bool); +void kvm_timer_hyp_uninit(void); int kvm_timer_enable(struct kvm_vcpu *vcpu); int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index f5a5d51..7dafa97 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -991,6 +991,19 @@ int kvm_timer_hyp_init(bool has_gic) return err; } +void kvm_timer_hyp_uninit(void) +{ + struct arch_timer_kvm_info *info = arch_timer_get_kvm_info(); + + cpuhp_remove_state(CPUHP_AP_KVM_ARM_TIMER_STARTING); + if (info->physical_irq > 0) { + on_each_cpu(disable_percpu_irq, (void *)host_ptimer_irq, 1); + free_percpu_irq(host_ptimer_irq, kvm_get_running_vcpus()); + } + on_each_cpu(disable_percpu_irq, (void *)host_vtimer_irq, 1); + free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus()); +} + void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = vcpu_timer(vcpu); diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 0c60074..feb6649 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_timer_hyp_uninit(); kvm_vgic_hyp_uninit(); hyp_cpu_pm_exit(); } -- 1.8.3.1 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 ACFBFCA9EAF for ; Thu, 24 Oct 2019 10:29:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C43E20684 for ; Thu, 24 Oct 2019 10:29:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZDIqIVYs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C43E20684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1O0kHRg6ihydcM1gvfwTarc7RKrWcc+NCd110eDvz/k=; b=ZDIqIVYstZbLc7t9at7qv4ND1p qFrAKxFwxp2/xLPvCDhyfaGjiZ0TeB2Iq62iJqmoszyVBXP/pVU8AlYUEoxxfeCx9k1fk9lTxdQ0w sOTnkObwcn4K8t1CDUG4krKB1yfJuvE8MKeK7gbXr5pIzZU9xlT8HTfJQgvZ8vKmBDkocldnpdb2i xjAW9//DwsUXZ/7bQysHsKFUtVJonsSLqWg5/nhYr56AkRkFq38T1jgGlRzEEU4UzSQ1BzPYCxgHu Bmdt0tfMHnSucWUFUTUplrELNAnku2HunHw1vsvdjsh5FNTWU/WnfJrkXXKGyQbOkHSqBMMXi9Pbs 52LfpGAA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNaMY-0005qZ-3W; Thu, 24 Oct 2019 10:29:02 +0000 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNaLT-0004t5-JF for linux-arm-kernel@lists.infradead.org; Thu, 24 Oct 2019 10:28:03 +0000 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R171e4; CH=green; DM=||false|; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04395; MF=shannon.zhao@linux.alibaba.com; NM=1; PH=DS; RN=8; SR=0; TI=SMTPD_---0Tg2twD8_1571912871; Received: from localhost(mailfrom:shannon.zhao@linux.alibaba.com fp:SMTPD_---0Tg2twD8_1571912871) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Oct 2019 18:27:52 +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 Subject: [PATCH RFC 5/7] KVM: arch_timer: Add hyp uninitialize function Date: Thu, 24 Oct 2019 18:27:48 +0800 Message-Id: <1571912870-18471-6-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191024_032755_801530_6D74C362 X-CRM114-Status: UNSURE ( 8.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org When KVM ARM exits, it needs to cleanup arch_timer setup by kvm_timer_hyp_init. Signed-off-by: Shannon Zhao --- include/kvm/arm_arch_timer.h | 1 + virt/kvm/arm/arch_timer.c | 13 +++++++++++++ virt/kvm/arm/arm.c | 1 + 3 files changed, 15 insertions(+) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index d120e6c..3cb3a01 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -68,6 +68,7 @@ struct arch_timer_cpu { }; int kvm_timer_hyp_init(bool); +void kvm_timer_hyp_uninit(void); int kvm_timer_enable(struct kvm_vcpu *vcpu); int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index f5a5d51..7dafa97 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -991,6 +991,19 @@ int kvm_timer_hyp_init(bool has_gic) return err; } +void kvm_timer_hyp_uninit(void) +{ + struct arch_timer_kvm_info *info = arch_timer_get_kvm_info(); + + cpuhp_remove_state(CPUHP_AP_KVM_ARM_TIMER_STARTING); + if (info->physical_irq > 0) { + on_each_cpu(disable_percpu_irq, (void *)host_ptimer_irq, 1); + free_percpu_irq(host_ptimer_irq, kvm_get_running_vcpus()); + } + on_each_cpu(disable_percpu_irq, (void *)host_vtimer_irq, 1); + free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus()); +} + void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = vcpu_timer(vcpu); diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 0c60074..feb6649 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_timer_hyp_uninit(); kvm_vgic_hyp_uninit(); hyp_cpu_pm_exit(); } -- 1.8.3.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel