public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dong, Eric" <eric.dong@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [PATCH] UefiCpuPkg/CommonFeature: Skip locking when the feature is disabled
Date: Wed, 7 Nov 2018 02:19:41 +0000	[thread overview]
Message-ID: <ED077930C258884BBCB450DB737E662259D3A0BF@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20181106090620.126784-1-ruiyu.ni@intel.com>

Hi Ray,

I think we should add comments to mention that if the Lock bit is already set, driver can't disable it. So driver can directly return success if state is FALSE.

With that comments, Reviewed-by: Eric Dong <eric.dong@intel.com>

Thanks,
Eric

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Tuesday, November 6, 2018 5:06 PM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [PATCH] UefiCpuPkg/CommonFeature: Skip locking when the
> feature is disabled
> 
> 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
> --
> 2.16.1.windows.1



      parent reply	other threads:[~2018-11-07  2:20 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
2018-11-07  2:19 ` Dong, Eric [this message]

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=ED077930C258884BBCB450DB737E662259D3A0BF@shsmsx102.ccr.corp.intel.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