On 11/06/18 10:06, Ruiyu Ni wrote:
> Today's code unconditionally sets the IA32_FEATURE_CONTROL.Lock to 1
> no matter the feature is enabled or not.
> 
> The patch fixes this issue by only setting the Lock bit to 1 when
> the feature is enabled.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <[email protected]>
> Cc: Eric Dong <[email protected]>
> Cc: Laszlo Ersek <[email protected]>
> ---
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c 
> b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> index 8c1eb5eb4f..0b85f25f90 100644
> --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Features in MSR_IA32_FEATURE_CONTROL register.
>  
> -  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD 
> License
>    which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -184,6 +184,14 @@ LockFeatureControlRegisterInitialize (
>  {
>    MSR_IA32_FEATURE_CONTROL_REGISTER    *MsrRegister;
>  
> +  //
> +  // When Lock Feature Control Register feature is disabled,
> +  // just skip the MSR lock bit setting.
> +  //
> +  if (!State) {
> +    return RETURN_SUCCESS;
> +  }
> +
>    //
>    // The scope of Lock bit in the MSR_IA32_FEATURE_CONTROL is core for
>    // below processor type, only program MSR_IA32_FEATURE_CONTROL for thread 
> 0 in each
> 

I'll defer to Eric on this, as OVMF does not use this lib instance.

(In fact, no platform in the edk2 tree seems to.)

Thanks,
Laszlo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to