Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp263479rwb; Tue, 25 Jul 2023 15:38:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlFDsJhcaZjrT/+dUtMGULKQC/j5tMvm8Xlgv6h8sQx8JV8uEdmF2KcukhIh8FO7BqG809qg X-Received: by 2002:a05:6358:592a:b0:135:4003:7851 with SMTP id g42-20020a056358592a00b0013540037851mr122328rwf.19.1690324722028; Tue, 25 Jul 2023 15:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690324721; cv=none; d=google.com; s=arc-20160816; b=KzMbFouE8yML6TM2i44zeQVNOdApF0yfQmfDeJUrZ72+p/knMgG+FX6Mfgn2gXDtWz FlRHPXyi+/icpcbSCUnI9LlKaOwEh5jGJkMTJD/YJl5t2JsrTK6ms9KC6IH0zWjNqkAB 7b950FeZMU/rNhgxuUH9zNOWPAtcdkm1wi6Ppq/a8+dMOb88zx2cefI2DuM/hBxQ8t/j mLyEcNtK1G9zQz1hvTaxbbuwqqtbkU0+jVEOuInibj62HOrUatJ/TEi6kCuQmbHwShYK yds2Clo7DjDN1GDZadRCv+U207cZYZtWrBMR2UXPQoDvEpv61UoFoada1YOieZz2r91x hG8w== 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=xta9mqgvx562BjTEhn1882WkEXRfEZ8qrKdTUzcJh/0=; fh=juxwNcA6iKwLISFgUCNwdoIYC0NKLUseq3xZdq25RR4=; b=q8BW+U6htgyHSFyiYWBGNGTl9zA6YvlVCQDosPB2rVsUj8DSroUQo0pEmVcZgdbK6s 7PeEbGWtM0Fnti8vMp3w7ClvFtxTApHZwUaNlg2Ac0roK3hnL+u3XcrXyX0akbBaH2pf a/bCPEbEBJ3773SbmIvhP9zUHjptc16Jzx4qTMZNQVIf9Du3CZYxEyrTU1xyo/N4nYmy qVbAiRCZ05SG2RFU3pBlIs9a6zyQEF85n3pPKMGzeB/VqlTcYOMXeZVmTIhsbIp5IkIP 5YvwcWGjx09Di0AC6RD6SEM8bkSecb9UEZV2z5pxmU24MvKR+h0JprY4riFmFMpgs3wZ WRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R7Tss8A+; 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 i3-20020a636d03000000b00563dfad10basi328724pgc.371.2023.07.25.15.38.29; Tue, 25 Jul 2023 15:38:41 -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=R7Tss8A+; 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 S229664AbjGYWPh (ORCPT + 99 others); Tue, 25 Jul 2023 18:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjGYWPf (ORCPT ); Tue, 25 Jul 2023 18:15:35 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F460B6; Tue, 25 Jul 2023 15:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690323334; x=1721859334; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q6K2maaUsjgfiXlRf9woadg1SoAwVb/MVIcmVsQ7T20=; b=R7Tss8A+m1rVbXQ54g1TCaRVSOujtMNkXVuOOZGFihTZrEepGdyxpYnA 5FImPgz6RG5wIPienbXnY6ZYOpLQ96Q5A4p5cxoxTQ1ZqvSNvtWzcZ8I9 cAsl6NF2GG4T9l0P1nggDDi/gm7HWToqpgkCv0i6I9Px4sjEuZeQlxnKb bzOSvhIPSsS6ooi6v2Gg+QCODSIyG8t/M5wdJrJQZQzBXvfQlJwquqFb9 F1pG0n7TNAM1yD3WC6u+e2yVbXcmkhXIuxE9yz0vtElq+ndj8hfh7//Rt jHCkqQkp5TTNtspaJmzibLTg0Ck64Nk0Cniad2yNYmXHZErYN6PK2t5WC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="357863022" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="357863022" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="1056938768" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="1056938768" 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; 25 Jul 2023 15:15:15 -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 v15 002/115] KVM: x86/vmx: initialize loaded_vmcss_on_cpu in vmx_hardware_setup() Date: Tue, 25 Jul 2023 15:13:13 -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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 4d8655a905c4..9b035d5571fe 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -8227,8 +8227,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; @@ -8475,11 +8479,8 @@ static int __init vmx_init(void) vmx_setup_fb_clear_ctrl(); - for_each_possible_cpu(cpu) { - INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); - + for_each_possible_cpu(cpu) pi_init_cpu(cpu); - } #ifdef CONFIG_KEXEC_CORE rcu_assign_pointer(crash_vmclear_loaded_vmcss, -- 2.25.1