public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Jeff Fan <jeff.fan@intel.com>
Cc: <edk2-devel@lists.01.org>, Jiewen Yao <jiewen.yao@intel.com>,
	Feng Tian <feng.tian@intel.com>
Subject: Re: [PATCH] UefiCpuPkg/CpuDxe: Remove MSR_IA32_MISC_ENABLE check
Date: Wed, 15 Mar 2017 15:50:19 +0000	[thread overview]
Message-ID: <20170315155019.GB1882@perard.uk.xensource.com> (raw)
In-Reply-To: <20170315015430.4800-1-jeff.fan@intel.com>

On Wed, Mar 15, 2017 at 09:54:30AM +0800, Jeff Fan wrote:
> The architectural MSR MSR_IA32_MISC_ENABLE is not supported by AMD processors.
> Because reading CPUID.80000001H:EDK[20] is enough to check if XD feature is
> supported or not, we just remove checking MSR_IA32_MISC_ENABLE(0x1A0).
> 
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Feng Tian <feng.tian@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan <jeff.fan@intel.com>

Thanks, that works for me. I've tested on AMD and Intel machine, with
Xen.

Tested-by: Anthony PERARD <anthony.perard@citrix.com>

> ---
>  UefiCpuPkg/CpuDxe/CpuPageTable.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> index 65f607a..ab664b4 100644
> --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> @@ -193,12 +193,9 @@ GetCurrentPagingContext (
>      AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
>      if ((RegEdx & BIT20) != 0) {
>        // XD supported
> -      if ((AsmReadMsr64 (0x000001A0) & BIT34) == 0) {
> -        // XD enabled
> -        if ((AsmReadMsr64 (0xC0000080) & BIT11) != 0) {
> -          // XD activated
> -          PagingContext->ContextData.Ia32.Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED;
> -        }
> +      if ((AsmReadMsr64 (0xC0000080) & BIT11) != 0) {
> +        // XD activated
> +        PagingContext->ContextData.Ia32.Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED;
>        }
>      }
>      if ((RegEdx & BIT26) != 0) {
> -- 
> 2.9.3.windows.2
> 

-- 
Anthony PERARD


  reply	other threads:[~2017-03-15 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  1:54 [PATCH] UefiCpuPkg/CpuDxe: Remove MSR_IA32_MISC_ENABLE check Jeff Fan
2017-03-15 15:50 ` Anthony PERARD [this message]
2017-03-17  2:54 ` Tian, Feng
  -- strict thread matches above, loose matches on Subject: below --
2017-03-15  1:52 Jeff Fan

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=20170315155019.GB1882@perard.uk.xensource.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