[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9f8585cd-9c99-b8bd-8400-0fa922b0d361@intel.com>
Date: Sat, 18 Sep 2021 00:13:54 +0800
From: Zeng Guang <guang.zeng@...el.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"Luck, Tony" <tony.luck@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Kim Phillips <kim.phillips@....com>,
Jarkko Sakkinen <jarkko@...nel.org>,
Jethro Beekman <jethro@...tanix.com>,
"Huang, Kai" <kai.huang@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Hu, Robert" <robert.hu@...el.com>,
"Gao, Chao" <chao.gao@...el.com>,
Robert Hoo <robert.hu@...ux.intel.com>
Subject: Re: [PATCH v4 2/6] KVM: VMX: Extend BUILD_CONTROLS_SHADOW macro to
support 64-bit variation
On 9/11/2021 5:28 AM, Sean Christopherson wrote:
> On Mon, Aug 09, 2021, Zeng Guang wrote:
>> +static inline u##bits lname##_controls_get(struct vcpu_vmx *vmx) \
>> +{ \
>> + return vmx->loaded_vmcs->controls_shadow.lname; \
>> +} \
> This conflicts with commit 389ab25216c9 ("KVM: nVMX: Pull KVM L0's desired controls
> directly from vmcs01"), I believe the correct resolution is:
>
> ---
> arch/x86/kvm/vmx/vmx.h | 59 ++++++++++++++++++++++--------------------
> 1 file changed, 31 insertions(+), 28 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> index 4858c5fd95f2..1ae43afe52a7 100644
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -408,35 +408,38 @@ 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)
>
> static inline void vmx_register_cache_reset(struct kvm_vcpu *vcpu)
> {
> --
I will rebase it. Thanks.
Powered by blists - more mailing lists