Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1283043rwn; Thu, 8 Sep 2022 17:00:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tz4n6ichWKbFN9t6asdxSVUKzIW0oIs9ULuYGrwWaKCBy1l98YnEVfkP3yPzSvLfegcN6 X-Received: by 2002:a05:6512:1312:b0:492:e14d:54d4 with SMTP id x18-20020a056512131200b00492e14d54d4mr3320521lfu.469.1662681647669; Thu, 08 Sep 2022 17:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662681647; cv=none; d=google.com; s=arc-20160816; b=jBH8o9Gw8XEFJMfvYYEjg92McvJqMshbvBToLLf75pG6XC4/NDtUJck65uLXfPBBUT HnmhuYfD3iES2jYaEUk590GKsfN9E7Zw9MjegysQupXGaQK2yNlrN0z4cmGeIeSe2K0i gubG5e2jZIVOQlNyfDaaKTcM4kXp4bu6+yjk9k0R7JN0yw5y58Plnyf/62NKN5fAI5G+ 4hREopydez9YrV022jfRos18axK1PJols3CfJzNhvohb5B2LzO8mrX8pvpwwPRhEP/Ug 8Ip5+OTcVd6cwhHZEMnEyUBowSiiueZrboXbacF5XBYSM5PgyBtk0adtfZJbCCq+oBsk y3RA== 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=3r0Vu1AujpAaKHiqReav14tP5VG9YmP49gr++YZuEnc=; b=OCT/Apdb3VOTbDXsPGVM5oC1llSOcENLyw6rUM8AjxseqG/8as3i/pR2/pFxR75MPx IhKTiXWqcNBGCm45sWM3uCT+ANhkk2CByghyxif8F7f4FaTqj/42yGJYrZiIERldYbAQ HtnOg7RbrtbiNa8LOuBJioL1f9fDVJqAO5YnODLGrZf7fV3uAhJ4fCGjqoMwN4oH6UOv GMl0+Ss4AiWqgRKUutrkS6nuBp2lA4956gTJlOZBO50OPUhBZmyTZQ7Y09n2FawWzxIO x+LW3Ovws49b8dFQ+hTHdgJEG8C8HJ85kECQPY3SBEjXAjVaFVUBOhIev8Jjw93bhwTa WTQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kNCTQVuM; 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 o25-20020a2e9b59000000b0026bdf42de8bsi125120ljj.203.2022.09.08.17.00.17; Thu, 08 Sep 2022 17:00:47 -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=kNCTQVuM; 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 S230421AbiIHX1l (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 | 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) 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 *caller_name) { int cpu = raw_smp_processor_id(); @@ -11915,7 +11910,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 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 @@ static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE; -__weak int kvm_arch_post_init_vm(struct kvm *kvm) -{ - return 0; -} - static int __hardware_enable(void *caller_name) { int cpu = raw_smp_processor_id(); @@ -79,13 +74,8 @@ __weak int 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