From nobody Mon Apr 6 09:43:48 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72B03C54EE9 for ; Thu, 8 Sep 2022 23:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbiIHX1l (ORCPT ); Thu, 8 Sep 2022 19:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbiIHX0n (ORCPT ); Thu, 8 Sep 2022 19:26:43 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB1FE7F8B; Thu, 8 Sep 2022 16:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662679577; x=1694215577; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UEVrSJBp6rdD40rMz/X3mQD/s7hSMW7ttIkeZZoCFOA=; b=kNCTQVuMEWnu1eX4oy/GT+z8B5aIo/5N3d5B8C2SVj2Ase7uLl/ElYAE pQt9Yu97hSqhJvqvNbw9GfPuvgkcrLjChqCKE+hZIYsaCmwQWjKW1EzLR XHe3LlKEGn02tVn3Ts82YxhRDmu7KTGye8aET/YnBHKTyi4jAaxrInuJX n3WDzB4WXR0AHVLbR7tS5+7Z+3IT0BUBgdJcp9N7viuLnaQDceSmRMGGe n7N0+dW3uJGpfrIBcGVR93nmJwWE+CDABbFiiZRazaPTeyW0NQOT7oF1A X6wrLjn416OZ3E5akbnFJJt4JBFPPDRHsdBvrQY0TY6DmEi9EG5dqRCJg Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="298687027" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="298687027" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 16:26:13 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="610863260" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 16:26:13 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Will Deacon , Yuan Yao Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen Subject: [PATCH v4 19/26] KVM: Eliminate kvm_arch_post_init_vm() Date: Thu, 8 Sep 2022 16:25:35 -0700 Message-Id: <7bbbbda4f6eacf76a3c664613d5db0558e1f94c9.1662679124.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Isaku Yamahata Now kvm_arch_post_init_vm() is used only by x86 kvm_arch_add_vm(). Other arch doesn't define it. Merge x86 kvm_arch_post_init_vm() into x86 kvm_arch_add_vm() and eliminate kvm_arch_post_init_vm(). Suggested-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/x86.c | 7 +------ include/linux/kvm_host.h | 1 - virt/kvm/kvm_arch.c | 12 +----------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index feee7739219e..6dcc6ed90421 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11847,11 +11847,6 @@ void kvm_arch_hardware_disable(void) =20 static cpumask_t cpus_hardware_enabled =3D CPU_MASK_NONE; =20 -int kvm_arch_post_init_vm(struct kvm *kvm) -{ - return kvm_mmu_post_init_vm(kvm); -} - static int __hardware_enable(void *caller_name) { int cpu =3D raw_smp_processor_id(); @@ -11915,7 +11910,7 @@ int kvm_arch_add_vm(struct kvm *kvm, int usage_coun= t) goto err; } =20 - r =3D kvm_arch_post_init_vm(kvm); + r =3D kvm_mmu_post_init_vm(kvm); err: if (r) on_each_cpu(hardware_disable, NULL, 1); diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 74cae99fbf09..d0b5fdb084f4 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1446,7 +1446,6 @@ bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu); bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu); -int kvm_arch_post_init_vm(struct kvm *kvm); int kvm_arch_add_vm(struct kvm *kvm, int usage_count); int kvm_arch_del_vm(int usage_count); void kvm_arch_pre_destroy_vm(struct kvm *kvm); diff --git a/virt/kvm/kvm_arch.c b/virt/kvm/kvm_arch.c index 9476c500d571..9bf7b3920c44 100644 --- a/virt/kvm/kvm_arch.c +++ b/virt/kvm/kvm_arch.c @@ -14,11 +14,6 @@ =20 static cpumask_t cpus_hardware_enabled =3D CPU_MASK_NONE; =20 -__weak int kvm_arch_post_init_vm(struct kvm *kvm) -{ - return 0; -} - static int __hardware_enable(void *caller_name) { int cpu =3D raw_smp_processor_id(); @@ -79,13 +74,8 @@ __weak int kvm_arch_add_vm(struct kvm *kvm, int usage_co= unt) =20 if (atomic_read(&failed)) { r =3D -EBUSY; - goto err; - } - - r =3D kvm_arch_post_init_vm(kvm); -err: - if (r) on_each_cpu(hardware_disable, NULL, 1); + } return r; } =20 --=20 2.25.1