Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1204513rwb; Thu, 22 Sep 2022 11:31:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HblTrWUamBcC/Jc5zyii32nHGvjAucjPe4nbfv5wwWbwzW4J6iLba/u3+rCc7aL0CFWVD X-Received: by 2002:a17:903:244e:b0:178:4f50:1ca0 with SMTP id l14-20020a170903244e00b001784f501ca0mr4527832pls.104.1663871488634; Thu, 22 Sep 2022 11:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663871488; cv=none; d=google.com; s=arc-20160816; b=pWJsXrV9lmEiCLNsxBo6DxNLNMv+FCzdUN87soq9LM9hUVBHqIuUiZCLLiihwK3wkm x+K4Zi2q23/j+5/W+P4WXqrKqJKciP1u3WJt3Tcj5sMVZcboq/2F9/ZJlCx3/LNYUoyH HrpulkNSFceDXpxGN0MY8rNvhPoM/BAnowF3OdtaQdHGQa6nzoH6UCYVHWrvsyfT1guW HfNhD1GJ4vVu6ANj0Z8ljchU9elESJV2zqeXZY1u7iiL2wYE/Hspf2LNxMzLrVg2lOjx 8vCzMOetMeTC+EjhehBPvM1Ml7SO07sa+03y7/No6Eq6FwFPyac5eRIOAkuLgm7yC7kf qegA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Cbx0Pfy+igkX2rpvQCe1pmQbcTt+0mV5cz3f/XRBMqI=; b=O/0R9Ogc+BkxrllI5gcWPf4eG2C9yxH4xU7cYDHzVjETO9++JBRE7udCgxTCoaiDJA sfzSyMm9R9rLqxViyWnOveVXDhelRqO+LKlsBl4ZltLEW+Bmf+i5Uy2AlI0aZ/5PMhSP dyuQbdbkkBEvc5fn3UNRxhDiVP1sST6mQQJMTQIyPQzy6XanEb0sllRre+28nSVv73ne Cdd2MQlSh9bKgm/t//pi2CexKycbj5idXaRJvEYhvlaCTql019U3RMyjc4YmUF1ifpYp WzdGrrZqgoPO/vCsgNc1kWC/RpuTXpvd1YSlt0uDLgOZWlMq3Of6mEqVzxl/Y5I+fCpz R4Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lGEJPom6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k191-20020a6384c8000000b0043be00f7830si6875441pgd.21.2022.09.22.11.31.14; Thu, 22 Sep 2022 11:31:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lGEJPom6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232586AbiIVSX6 (ORCPT + 99 others); Thu, 22 Sep 2022 14:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbiIVSXO (ORCPT ); Thu, 22 Sep 2022 14:23:14 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E9110B585; Thu, 22 Sep 2022 11:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663870932; x=1695406932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JEMsGnsZUhYCBVZocJG3MEHANA4O9MZIjmnjwfXxTVU=; b=lGEJPom6f8fi4vbIJ1Wg5rt7OsCYAe28LCGD2C9fVI9v3tVIhjR/E43C WL/Yuh+fWYxOFK9/htJzHTHhjq45IT6+UxA02OjIoY/XLOk3Ne1g6KzY8 pShDio7eJi7tRhyu7KI+2PMbyBeCPo8uCJulSnV5u5nV2ed6FXKkdjycL 6KD/2bAfkrxKF31dEEFusi+7E70wJOIcPSqN90U0splM9ye/Ee4X+NIiM 76v8poTMI/MEDc/Cc+Y/HDhQ2YIKcEkF+GNrVQnqftCYv2iqgjs6JwyQW wnPQnW3nyE0fqgh//DHm24WsqstbYlOzwoafGGQW0Uf6oYTTvArWsJxoj w==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="326712925" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="326712925" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:26 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="653086838" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:25 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Marc Zyngier , Will Deacon Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: [PATCH v5 23/30] KVM: Eliminate kvm_arch_post_init_vm() Date: Thu, 22 Sep 2022 11:20:52 -0700 Message-Id: <7ea322131782fdeb8df0122c5f4a3b75fcb360b2.1663869838.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 16 +--------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d49396bb6c2e..bf8d3b901725 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11969,11 +11969,6 @@ void kvm_arch_hardware_disable(void) static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE; -int kvm_arch_post_init_vm(struct kvm *kvm) -{ - return kvm_mmu_post_init_vm(kvm); -} - static int __hardware_enable(void) { int cpu = raw_smp_processor_id(); @@ -12032,7 +12027,7 @@ int kvm_arch_add_vm(struct kvm *kvm, int usage_count) goto err; } - r = kvm_arch_post_init_vm(kvm); + r = 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 2c5ca8741ca5..8dfa212b4543 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1451,7 +1451,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 87ee84c09634..2509c2777a49 100644 --- a/virt/kvm/kvm_arch.c +++ b/virt/kvm/kvm_arch.c @@ -14,15 +14,6 @@ static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE; -/* - * Called after the VM is otherwise initialized, but just before adding it to - * the vm_list. - */ -int __weak kvm_arch_post_init_vm(struct kvm *kvm) -{ - return 0; -} - static int __hardware_enable(void) { int cpu = raw_smp_processor_id(); @@ -77,13 +68,8 @@ int __weak kvm_arch_add_vm(struct kvm *kvm, int usage_count) if (atomic_read(&failed)) { r = -EBUSY; - goto err; - } - - r = kvm_arch_post_init_vm(kvm); -err: - if (r) on_each_cpu(hardware_disable, NULL, 1); + } return r; } -- 2.25.1