public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Andrew Fish <afish@apple.com>
Subject: Re: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU address size
Date: Wed, 29 Aug 2018 01:54:11 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A0931E3CDAD@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20180827075330.269224-8-ruiyu.ni@intel.com>

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Monday, August 27, 2018 3:53 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A; Andrew Fish
> Subject: [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU
> address size
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1119
> 
> Today's implementation unconditionally reports CPU address size
> as 36 through CPU HOB. But when WinHost is running at 64bit,
> the system memory might be allocated above 2^36.
> 
> It causes system asserts when DxeCore code tries to find the
> corresponding GCD entry for a given valid address.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> ---
>  EmulatorPkg/AutoScanPei/AutoScanPei.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/EmulatorPkg/AutoScanPei/AutoScanPei.c
> b/EmulatorPkg/AutoScanPei/AutoScanPei.c
> index 78a40db3a2..bf9958a4a9 100644
> --- a/EmulatorPkg/AutoScanPei/AutoScanPei.c
> +++ b/EmulatorPkg/AutoScanPei/AutoScanPei.c
> @@ -1,6 +1,6 @@
>  /*++ @file
> 
> -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
>  Portions copyright (c) 2011, Apple Inc. All rights reserved.
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
> @@ -51,7 +51,8 @@ Returns:
>    EFI_PHYSICAL_ADDRESS        MemoryBase;
>    UINTN                       Index;
>    EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;
> -
> +  UINTN                       HighBitSet;
> +  UINT8                       SizeOfMemorySpace;
> 
>    DEBUG ((EFI_D_ERROR, "Emu Autoscan PEIM Loaded\n"));
> 
> @@ -66,7 +67,8 @@ Returns:
>               );
>    ASSERT_EFI_ERROR (Status);
> 
> -  Index = 0;
> +  SizeOfMemorySpace = 0;
> +  Index             = 0;
>    do {
>      Status = Thunk->MemoryAutoScan (Index, &MemoryBase, &MemorySize);
>      if (!EFI_ERROR (Status)) {
> @@ -96,6 +98,12 @@ Returns:
>          MemoryBase,
>          MemorySize
>          );
> +      HighBitSet        = HighBitSet64 (MemoryBase + MemorySize);
> +      SizeOfMemorySpace = MAX (SizeOfMemorySpace, (UINT8)HighBitSet + 1);
> +      DEBUG ((
> +        DEBUG_INFO, "Emu Memory Discoverred[%d]: Base = %016lx / Size
> = %016x\n",
> +        Index, MemoryBase, MemorySize
> +        ));
>      }
>      Index++;
>    } while (!EFI_ERROR (Status));
> @@ -103,7 +111,8 @@ Returns:
>    //
>    // Build the CPU hob with 36-bit addressing and 16-bits of IO space.
>    //
> -  BuildCpuHob (36, 16);
> +  DEBUG ((DEBUG_INFO, "Emu SizeOfMemorySpace = %d\n",
> SizeOfMemorySpace));
> +  BuildCpuHob (SizeOfMemorySpace, 16);

Hi Ray,

Just a question, I saw the implementation in Nt32Pkg just hard-code the
address size to 52 to support both 32-bit and 64-bit. Is there a concern
for hard coding it to 52?

Best Regards,
Hao Wu

> 
>    return Status;
>  }
> --
> 2.16.1.windows.1



  reply	other threads:[~2018-08-29  1:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27  7:53 [PATCH 00/10] Quality improvement for EmulatorPkg Win Host Ruiyu Ni
2018-08-27  7:53 ` [PATCH 01/10] EmulatorPkg/EmuGopDxe: Fix TxtInEx.SetState SCT conformance failure Ruiyu Ni
2018-08-27  7:53 ` [PATCH 02/10] EmulatorPkg/EmuGopDxe: Clear screen to black in GOP.SetMode Ruiyu Ni
2018-08-27  7:53 ` [PATCH 03/10] EmulatorPkg/Win: Use FrameBufferBltLib for BLT operation Ruiyu Ni
2018-08-27  7:53 ` [PATCH 04/10] EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState Ruiyu Ni
2018-08-27  7:53 ` [PATCH 05/10] EmulatorPkg/Win: Do not zero out file content Ruiyu Ni
2018-08-29  1:51   ` Wu, Hao A
2018-08-27  7:53 ` [PATCH 06/10] EmulatorPkg/Win: Enable 64bit (SEC, PEI, DXE all run at 64bit) Ruiyu Ni
2018-08-27  7:53 ` [PATCH 07/10] EmulatorPkg/AutoScanPei: Report the correct CPU address size Ruiyu Ni
2018-08-29  1:54   ` Wu, Hao A [this message]
2018-08-29  2:53     ` Ni, Ruiyu
2018-08-27  7:53 ` [PATCH 08/10] EmulatorPkg/Win: Add VS2017 project file Ruiyu Ni
2018-08-27  7:53 ` [PATCH 09/10] EmulatorPkg: Use MdeModulePkg/Bds module Ruiyu Ni
2018-08-27  7:53 ` [PATCH 10/10] EmulatorPkg: IoThunk->Close() is called too early, may causing hang Ruiyu Ni
2018-08-29  1:58 ` [PATCH 00/10] Quality improvement for EmulatorPkg Win Host Wu, Hao A
2018-08-29  3:41   ` Ni, Ruiyu

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=B80AF82E9BFB8E4FBD8C89DA810C6A0931E3CDAD@SHSMSX104.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