Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Remove MSR_IA32_MISC_ENABLE check
Reviewed-by: Feng TianThanks Feng -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jeff Fan Sent: Wednesday, March 15, 2017 9:55 AM To: edk2-devel@lists.01.org Cc: Anthony PERARD ; Tian, Feng ; Yao, Jiewen Subject: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Remove MSR_IA32_MISC_ENABLE check The architectural MSR MSR_IA32_MISC_ENABLE is not supported by AMD processors. Because reading CPUID.8001H: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 Cc: Jiewen Yao Cc: Feng Tian Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- 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 (0x8001, NULL, NULL, NULL, ); if ((RegEdx & BIT20) != 0) { // XD supported - if ((AsmReadMsr64 (0x01A0) & BIT34) == 0) { -// XD enabled -if ((AsmReadMsr64 (0xC080) & BIT11) != 0) { - // XD activated - PagingContext->ContextData.Ia32.Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED; -} + if ((AsmReadMsr64 (0xC080) & 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 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Remove MSR_IA32_MISC_ENABLE check
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.8001H: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> Cc: Jiewen Yao > Cc: Feng Tian > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jeff Fan Thanks, that works for me. I've tested on AMD and Intel machine, with Xen. Tested-by: Anthony PERARD > --- > 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 (0x8001, NULL, NULL, NULL, ); > if ((RegEdx & BIT20) != 0) { >// XD supported > - if ((AsmReadMsr64 (0x01A0) & BIT34) == 0) { > -// XD enabled > -if ((AsmReadMsr64 (0xC080) & BIT11) != 0) { > - // XD activated > - PagingContext->ContextData.Ia32.Attributes |= > PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED; > -} > + if ((AsmReadMsr64 (0xC080) & 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 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel