Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4117743rwe; Tue, 30 Aug 2022 05:05:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR5cfNH9AZg0npm7vND0M1rRGFTDxkl4206LyqJ83l+eXwv6Dv8RLe0I9Pee2RyQ/MUFbIRm X-Received: by 2002:a17:90a:640d:b0:1fa:ea96:3d10 with SMTP id g13-20020a17090a640d00b001faea963d10mr24371028pjj.74.1661861156371; Tue, 30 Aug 2022 05:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661861156; cv=none; d=google.com; s=arc-20160816; b=kdqWeHkTmDB6/+vdpLwrTAWiZMaimw30Uszd3+W9dWXWh2puyRlGYy4dqFwzNtudDA P3EwuoQO7KmadN/clfiMgdZn7MkICAJkwzFBb/KANOXe4mtmBxJyRsT5v8BgnBgOab0p KmEkr8E/SBMXGXkuU5/NZFsw0myiUpRY5coN4dsCZl2p31d3zd6q1EqmBD8TLax1f30y eJEm+N4vII36iRmS5/ahv8hr8BTYEo39u1G9qMl21bnqE5n5GAMol1YARW3vnF1r9Gg/ 4w3A8I1KtvKDNBeH3RdEJ/PnewzVeLbRyHxGYCYr9AZxk269FFdC4Og1yc+kDslxWYdt qN+g== 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=mz9SRk9DIfbIXnOem5bpwNTu81ZXKUKL1kTQBoHgvy8=; b=LhhOTNSUmHPjOwyTDxYQJ5ACCu6OpUOyn5mUouwLNuh1cEzMshh04fyRrehd3cRwiu WYK8Zsu5TWDgbyj/IuW0Y+L1WGZrYYRm8Avcp8lHQwwDk/1C6KtxsU6zEWXK+N/2IFyU eaIeIlbnIdOLwCobIZiyDuIqtfd9FM0nb2NqaB6KG6EYRKjk24FW11D3k311OHRhlWzq Yak6aI3+cYCi0+TkQ2n1E0VtJMjoT2ahKIyRHp9e5whX9N42W34snpwWcvp9vtBMlbHx epTCCYUCEIpfmJoUDWaeyT71c/7gVTpdoqP8zToy6HTRZWYN6m0lMphfAxqDkLV91rQU A2QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UwtqOZVE; 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 x40-20020a056a0018a800b00536ee478380si1426562pfh.7.2022.08.30.05.05.45; Tue, 30 Aug 2022 05:05:56 -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=UwtqOZVE; 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 S231185AbiH3MDC (ORCPT + 99 others); Tue, 30 Aug 2022 08:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbiH3MCK (ORCPT ); Tue, 30 Aug 2022 08:02:10 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87FFEE48F; Tue, 30 Aug 2022 05:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661860923; x=1693396923; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9TGZpPYVEQBXmvcE4fwjJD774pKDGLk/k27m38LhX3M=; b=UwtqOZVEdZFNShF+2h8j0NeQFtoR3FyrPfkoobxzFDtFqbmEsXuoSoIf At5DURQ8l9h+HBrj2AVaA/UBlghff3rqMYIYCOUT2XSsIcC0fv0tbrHff GSr/k/FTnHYuPcTBOQIPq7Wwd8P8Cyi31OAJSeTHbpRy70R8KXE9TzABj X8G+YBoSPPI52uocWViUg8/RtrwGvL8rXF3AaOK+XylBqpmsbqwqcXbUL jk6SlJICqa5GR6Eg/O4oP0X/GPRwA9BCaikFf9ierJEWyE69xaS9DspU+ NOtBoayzXoy65IMLCG0Ze6ONXxfDG9uxWdNPXFtpeNgPgRZjKx7lzBc3Y A==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="356870993" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="356870993" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 05:02:00 -0700 X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="787469658" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 05:01:59 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , Sean Christopherson , Kai Huang , Chao Gao , Will Deacon Subject: [PATCH v2 15/19] KVM: Eliminate kvm_arch_post_init_vm() Date: Tue, 30 Aug 2022 05:01:30 -0700 Message-Id: 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() int 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 2485f3d792b2..e5f066138ee9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11843,11 +11843,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(); @@ -11910,7 +11905,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 60f4ae9d6f48..8abbf7a1773b 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1445,7 +1445,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 e440d4a99c8a..8f2d920a2a8f 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) { int cpu = raw_smp_processor_id(); @@ -78,13 +73,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