Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp8663lfv; Tue, 12 Apr 2022 15:06:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysopFY7olK20Kb0WYcGF0sdI5VbXV2foXCss4+ppTzNftXDx7WqalTW1hqQkazag25ns6l X-Received: by 2002:a17:902:c405:b0:158:642f:bb1d with SMTP id k5-20020a170902c40500b00158642fbb1dmr12422434plk.63.1649801182332; Tue, 12 Apr 2022 15:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649801182; cv=none; d=google.com; s=arc-20160816; b=uAUYy+dneH52IYzltZDcx/wbtzukZm2l3dKu7mISpyEjEUMpDD9mgM8t5VLNZjhl9P JPmnJ/ih/rbGh043QtJYaCBbMbLnyzVTcL3l1tnWXCDDmIvFFR/NMC1l/+rEtL5JaNMH Q6r/Vm6eYwN1EQqSe75ldgJ9DKbXF6nrUEjEeUYbXnwMhrtEt8YpVHdHk9aI5cKOZ44D K+BHYC7kmFDdnUVl49u+NIneej3uC+UgtpIg35N3gkKBoT2LDTplmkjf+AtNZhLJIxJb DFJJKXRnt5k+htE1WrwhaDzeKmwkhJGNAL8tUP7HzB7UOyPYzf0cYT2fQXSNNc7T/mE8 Ipcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Ph7916HpL0hTehuNniWIDqy8FPvNJtUfLnhgByeDZ5E=; b=ODfqFeWyjgoSV9OCd0JY1c///qEtS5Xq1b3IgHt2Rvytz2kmNKbdLmUevNbA+ac7wf 18sqIEuzfX7NvWF3afch3W20WVXm4IbB/ZgjrvvQzdDkHKTxIqrioF1q1UwXaH3AitC5 8RQPWluc4yVsJJjL5Zw/pz/dIYujzeqIe2PHlp5oKMhgSNXKma5YmYLx/nlnQpDd1W76 N7/NO/tBchB80LxTb3ikkbToA/RXmrYITAs6rJar+/pnaR6DKwnY1JuK0Y5oJ7Z8VKso zrZlml2WN3Wc7m1nTQE9P8/3CR4URrakBGMn3d4HltOddlBckWEeO01K46rzkCnDhstY ptxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Y33I5cKz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k4-20020aa788c4000000b00505cdd19af1si6166203pff.51.2022.04.12.15.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:06:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Y33I5cKz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5408F1637DC; Tue, 12 Apr 2022 13:56:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344564AbiDKJjO (ORCPT + 99 others); Mon, 11 Apr 2022 05:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344538AbiDKJi4 (ORCPT ); Mon, 11 Apr 2022 05:38:56 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88416403D6; Mon, 11 Apr 2022 02:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649669802; x=1681205802; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=wTaXARG76bTc7Xk8fzK/DUZQvwtaVFIYOuxxY4pKMbc=; b=Y33I5cKz1GPdi7jbdSjnN/rxyvI0tFx2bvgeYMSut+cgutGxXip6Oun7 G1grfbpU5UsrNu2Rl6gwVzJSvQDu82oqq1QoMXpSBCe9xrDtQ1VCuSJwh 8NSTs7YREu6pvuogzUdWxsVcetOzHmV3DUtJqvRRSteHx9vFD7ItEgJLl vtFPsn+EdiSPrXEtcrIRn8drt9SNKDimNMeB01Fs236HM+5SSacke+EUx bCJqme5YErrYpZUdIoQmM1dmXj+dY5jvBoNyzMpYztKGJ/FJeALfF/O6L OMkmeirQbHMIZgWZwLkdPjmWYt1nWY7F0iPiIRmIy4s6VQuqoeNbNu6ej w==; X-IronPort-AV: E=McAfee;i="6400,9594,10313"; a="243960561" X-IronPort-AV: E=Sophos;i="5.90,251,1643702400"; d="scan'208";a="243960561" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2022 02:36:40 -0700 X-IronPort-AV: E=Sophos;i="5.90,251,1643702400"; d="scan'208";a="572050444" Received: from arthur-vostro-3668.sh.intel.com ([10.239.13.120]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2022 02:36:34 -0700 From: Zeng Guang To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, Dave Hansen , Tony Luck , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , Kai Huang Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Robert Hu , Gao Chao , Zeng Guang , Robert Hoo Subject: [PATCH v8 2/9] KVM: VMX: Extend BUILD_CONTROLS_SHADOW macro to support 64-bit variation Date: Mon, 11 Apr 2022 17:04:40 +0800 Message-Id: <20220411090447.5928-3-guang.zeng@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220411090447.5928-1-guang.zeng@intel.com> References: <20220411090447.5928-1-guang.zeng@intel.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Robert Hoo The Tertiary VM-Exec Control, different from previous control fields, is 64 bit. So extend BUILD_CONTROLS_SHADOW() by adding a 'bit' parameter, to support both 32 bit and 64 bit fields' auxiliary functions building. Suggested-by: Sean Christopherson Reviewed-by: Maxim Levitsky Reviewed-by: Sean Christopherson Signed-off-by: Robert Hoo Signed-off-by: Zeng Guang --- arch/x86/kvm/vmx/vmx.h | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index 9c6bfcd84008..122fdbf85a02 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -455,35 +455,35 @@ static inline u8 vmx_get_rvi(void) return vmcs_read16(GUEST_INTR_STATUS) & 0xff; } -#define BUILD_CONTROLS_SHADOW(lname, uname) \ -static inline void lname##_controls_set(struct vcpu_vmx *vmx, u32 val) \ -{ \ - if (vmx->loaded_vmcs->controls_shadow.lname != val) { \ - vmcs_write32(uname, val); \ - vmx->loaded_vmcs->controls_shadow.lname = val; \ - } \ -} \ -static inline u32 __##lname##_controls_get(struct loaded_vmcs *vmcs) \ -{ \ - return vmcs->controls_shadow.lname; \ -} \ -static inline u32 lname##_controls_get(struct vcpu_vmx *vmx) \ -{ \ - return __##lname##_controls_get(vmx->loaded_vmcs); \ -} \ -static inline void lname##_controls_setbit(struct vcpu_vmx *vmx, u32 val) \ -{ \ - lname##_controls_set(vmx, lname##_controls_get(vmx) | val); \ -} \ -static inline void lname##_controls_clearbit(struct vcpu_vmx *vmx, u32 val) \ -{ \ - lname##_controls_set(vmx, lname##_controls_get(vmx) & ~val); \ +#define BUILD_CONTROLS_SHADOW(lname, uname, bits) \ +static inline void lname##_controls_set(struct vcpu_vmx *vmx, u##bits val) \ +{ \ + if (vmx->loaded_vmcs->controls_shadow.lname != val) { \ + vmcs_write##bits(uname, val); \ + vmx->loaded_vmcs->controls_shadow.lname = val; \ + } \ +} \ +static inline u##bits __##lname##_controls_get(struct loaded_vmcs *vmcs) \ +{ \ + return vmcs->controls_shadow.lname; \ +} \ +static inline u##bits lname##_controls_get(struct vcpu_vmx *vmx) \ +{ \ + return __##lname##_controls_get(vmx->loaded_vmcs); \ +} \ +static inline void lname##_controls_setbit(struct vcpu_vmx *vmx, u##bits val) \ +{ \ + lname##_controls_set(vmx, lname##_controls_get(vmx) | val); \ +} \ +static inline void lname##_controls_clearbit(struct vcpu_vmx *vmx, u##bits val) \ +{ \ + lname##_controls_set(vmx, lname##_controls_get(vmx) & ~val); \ } -BUILD_CONTROLS_SHADOW(vm_entry, VM_ENTRY_CONTROLS) -BUILD_CONTROLS_SHADOW(vm_exit, VM_EXIT_CONTROLS) -BUILD_CONTROLS_SHADOW(pin, PIN_BASED_VM_EXEC_CONTROL) -BUILD_CONTROLS_SHADOW(exec, CPU_BASED_VM_EXEC_CONTROL) -BUILD_CONTROLS_SHADOW(secondary_exec, SECONDARY_VM_EXEC_CONTROL) +BUILD_CONTROLS_SHADOW(vm_entry, VM_ENTRY_CONTROLS, 32) +BUILD_CONTROLS_SHADOW(vm_exit, VM_EXIT_CONTROLS, 32) +BUILD_CONTROLS_SHADOW(pin, PIN_BASED_VM_EXEC_CONTROL, 32) +BUILD_CONTROLS_SHADOW(exec, CPU_BASED_VM_EXEC_CONTROL, 32) +BUILD_CONTROLS_SHADOW(secondary_exec, SECONDARY_VM_EXEC_CONTROL, 32) /* * VMX_REGS_LAZY_LOAD_SET - The set of registers that will be updated in the -- 2.27.0