Ard,

EFI_MEMORY_WP is for cache.

UefiSpec.h
//
// Note: UEFI spec 2.5 and following: use EFI_MEMORY_RO as write-protected 
physical memory
// protection attribute. Also, EFI_MEMORY_WP means cacheability attribute.
//
#define EFI_MEMORY_WP               0x0000000000001000ULL

Thanks,
Star
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Thursday, November 16, 2017 5:25 PM
To: Wang, Jian J <jian.j.w...@intel.com>
Cc: edk2-devel@lists.01.org; Yao, Jiewen <jiewen....@intel.com>; Zeng, Star 
<star.z...@intel.com>; Laszlo Ersek <ler...@redhat.com>
Subject: Re: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging 
capabilities

On 16 November 2017 at 07:26, Jian J Wang <jian.j.w...@intel.com> wrote:
> Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as really set 
> attributes and change memory paging attribute accordingly.
> But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by value from 
> Capabilities in GCD memory map. This might cause boot problems. 
> Clearing all paging related capabilities can workaround it. The code 
> added in this patch is supposed to be removed once the usage of 
> EFI_MEMORY_DESCRIPTOR.Attribute is clarified in UEFI spec and adopted 
> by both EDK-II Core and all supported OSs.
>
> Cc: Jiewen Yao <jiewen....@intel.com>
> Cc: Star Zeng <star.z...@intel.com>
> Cc: Laszlo Ersek <ler...@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.w...@intel.com>
> ---
>  MdeModulePkg/Core/Dxe/Mem/Page.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c 
> b/MdeModulePkg/Core/Dxe/Mem/Page.c
> index c9219cc068..783b576e35 100644
> --- a/MdeModulePkg/Core/Dxe/Mem/Page.c
> +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
> @@ -1829,6 +1829,23 @@ CoreGetMemoryMap (
>    //
>    BufferSize = ((UINT8 *)MemoryMap - (UINT8 *)MemoryMapStart);
>
> +  //
> +  // WORKAROUND: Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as 
> really
> +  //             set attributes and change memory paging attribute 
> accordingly.
> +  //             But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by
> +  //             value from Capabilities in GCD memory map. This might cause
> +  //             boot problems. Clearing all paging related capabilities can
> +  //             workaround it. Following code is supposed to be removed once
> +  //             the usage of EFI_MEMORY_DESCRIPTOR.Attribute is clarified in
> +  //             UEFI spec and adopted by both EDK-II Core and all supported
> +  //             OSs.
> +  //
> +  while (MemoryMapStart < MemoryMap) {
> +    MemoryMapStart->Attribute &= ~(UINT64)(EFI_MEMORY_RP | EFI_MEMORY_RO |
> +                                           EFI_MEMORY_XP);

Why is EFI_MEMORY_WP missing here?

> +    MemoryMapStart = NEXT_MEMORY_DESCRIPTOR(MemoryMapStart, Size);  }
> +
>    Status = EFI_SUCCESS;
>
>  Done:
> --
> 2.14.1.windows.1
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to