public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Ruiyu Ni <ruiyu.ni@intel.com>, edk2-devel@lists.01.org
Cc: Eric Dong <eric.dong@intel.com>
Subject: Re: [PATCH] UefiCpuPkg/CommonFeature: Skip locking when the feature is disabled
Date: Tue, 6 Nov 2018 17:15:14 +0100	[thread overview]
Message-ID: <6fef8dbf-ad9a-d57e-6654-5546d157b8ed@redhat.com> (raw)
In-Reply-To: <20181106090620.126784-1-ruiyu.ni@intel.com>

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 <ruiyu.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
>  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


  reply	other threads:[~2018-11-06 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06  9:06 [PATCH] UefiCpuPkg/CommonFeature: Skip locking when the feature is disabled Ruiyu Ni
2018-11-06 16:15 ` Laszlo Ersek [this message]
2018-11-07  2:19 ` Dong, Eric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6fef8dbf-ad9a-d57e-6654-5546d157b8ed@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox