Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2623151rdg; Mon, 16 Oct 2023 09:40:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFw1CVTuqwqk0nHTfKNCm0lrpMS/fc4h3+rkOd1vWqJF18VOUsXe97tBAPeO7YKMNt6vSV8 X-Received: by 2002:a05:6a20:f3a4:b0:15d:e68d:a850 with SMTP id qr36-20020a056a20f3a400b0015de68da850mr34204305pzb.29.1697474420057; Mon, 16 Oct 2023 09:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697474420; cv=none; d=google.com; s=arc-20160816; b=EBhL7zkPu3IT7Morree4hkvAgxT2rVYa+CCCtvt8VYL8YOlSQqIG5nH0NKs1uM/ggK N9urGYmuTGgz3ysVd8efw9NN2w8YRqPDdnZb9ZlMtF09AwPB/iPtbe97W1AaDFfseEPD UQkKWjpHPqNPx5IJyDctLl8w9ZjPngS3v6au6tHt3j2SD8+PfQrQwQNyKfQU1IGNPZTv mkT5NT+NR9TsDDm4Si+d+RoqEB26D5fSkyVP3WULzDZJYmQyeVeCWpsN3nflkQAbSCag 50NYie5AdSKO8/EgPxU4f2nPQUZjKnUtOXA/yeMDpOGHzYjUXyg6GMekRhy2V9iC8PU+ X3RQ== 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=Wf1rpKMVs9xeENZMO77Hq7r/+pEth2CTFEFWoujIlgs=; fh=lRdU2Q/1zx5DcPdZuWBjshA5VT5Oc9cEhB1tCFiV0Nw=; b=s/2owZBhYh0a6JBugy2BFDi/+/Y9bnN33W9Wo2dHiz7gPvrLV8kOUuEq4IQWB2Hsx+ 38bf7LZzGqjKu9Izeu5LZ4IAJkyiL7j2so+8wte/bQxYvESiRErN3pdci7gi2zYSRHUj ofeMRDk/mh6eej9+axNdbIvJaEl3Y9CyiCtCTtTwnPUBMQ8Ilpe60j4FOX3fNEJ9gjZO CgACN2R/964x2IsLZprdzmXIYbXaEaHRpD6A6lRJSLK0YqumNjIIOdpkUmYdRezUmvdw UhlPLCYF8vKVjmXg/RrMCNQ3EsnlVl3bhIwjrg6et0Rv3QzOvLdZawxS57COxFvBJdW+ l1zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="eDoQo/6U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t6-20020a17090a448600b002748c1bbd79si6339467pjg.6.2023.10.16.09.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:40:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="eDoQo/6U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 969328021E37; Mon, 16 Oct 2023 09:40:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234540AbjJPQjv (ORCPT + 99 others); Mon, 16 Oct 2023 12:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234266AbjJPQiO (ORCPT ); Mon, 16 Oct 2023 12:38:14 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D73A93A9F; Mon, 16 Oct 2023 09:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697473166; x=1729009166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Or0klKfUcIrA1mQXSCa7hlR2Ul9w9VReeeOfg/BuWeE=; b=eDoQo/6Unztv4xA64qP/2JADHfVjmT8mHn7tA3yPh7EnItRNeTLjndyY LsmlMjyUh1/q48yj8tWHsdjXXG/90+Sg1+IU3Pr8hjZt0OLVUxAq1Drua fodabRS71Ee+B0CEky1YSUyshJMBPm+4b8BigSdclKMpk2mc9RWax3rjK yVeTwwQfJPtyAbSb7FSoVJQpVI72eu2Bs9f2fYoCq12jBe1ce7npTslQs usYBDe63Mx5+qxFyRmNxHagQRhByBWWPS4//sEG4QP0X7Zn5ibGygNrJX I2bNflvL2iJBCvQAtvfIzLjNdCNleCgG1gJRTdZsK9jgghF/UOMiaDMjq Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="365825860" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="365825860" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:15:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="1087125953" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="1087125953" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:15:21 -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 , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v16 002/116] KVM: x86/vmx: initialize loaded_vmcss_on_cpu in vmx_hardware_setup() Date: Mon, 16 Oct 2023 09:13:14 -0700 Message-Id: <33f23ae088026a9375e67fdbc5733a3f446ea9db.1697471314.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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:40:17 -0700 (PDT) From: Isaku Yamahata vmx_hardware_disable() accesses loaded_vmcss_on_cpu via hardware_disable_all(). To allow hardware_enable/disable_all() before kvm_init(), initialize it in vmx_hardware_setup() so that tdx module initialization, hardware_setup method, can reference the variable. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/vmx/vmx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index f733629c4706..3627b704ff37 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -8266,8 +8266,12 @@ __init int vmx_hardware_setup(void) { unsigned long host_bndcfgs; struct desc_ptr dt; + int cpu; int r; + /* vmx_hardware_disable() accesses loaded_vmcss_on_cpu. */ + for_each_possible_cpu(cpu) + INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); store_idt(&dt); host_idt_base = dt.address; @@ -8510,11 +8514,8 @@ static int __init vmx_init(void) if (r) goto err_l1d_flush; - for_each_possible_cpu(cpu) { - INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); - + for_each_possible_cpu(cpu) pi_init_cpu(cpu); - } cpu_emergency_register_virt_callback(vmx_emergency_disable); -- 2.25.1