Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

2020-06-19 Thread Dong, Eric

From: devel@edk2.groups.io  On Behalf Of Brian J. Johnson
Sent: Saturday, June 20, 2020 1:29 AM
To: devel@edk2.groups.io; Bi, Dandan ; r...@edk2.groups.io
Cc: Dong, Eric ; Ni, Ray ; Wang, Jian J 
; Wu, Hao A ; Tan, Ming 

Subject: Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate 
NULL class libraries for Memory and serial handlers from 
MdeModulePkg/Universal/StatusCodeHandler modules

On 6/18/20 2:01 AM, Dandan Bi wrote:
Hi All,

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2816

We plan to separate two kinds of NULL class libraries for Memory and serial 
handlers from MdeModulePkg/Universal/StatusCodeHandler/.../ 
StatusCodeHandlerPei/RuntimeDxe/Smm modules.
The benefit we want to gain from this separation is to 1) make the code clear 
and easy to maintain, 2) make platform flexible to choose any handler library 
they need, and it also can reduce image size since the unused handlers can be 
excluded.
If you have any concern or comments for this separation, please let me know.

We plan to add new separated NULL class library MemoryStausCodeHandlerLib and 
SerialStatusCodeHandlerLib with different phase implementation into 
MdeModulePkg\Library\ directory.
The main tree structure may like below:
MdeModulePkg\Library
|--MemoryStausCodeHandlerLib
|--|-- PeiMemoryStausCodeHandlerLib.inf
|--|-- RuntimeDxeMemoryStatusCodeHandlerLib.inf
|--|-- SmmMemoryStausCodeHandlerLib.inf
|--SerialStatusCodeHandlerLib
|--|-- PeiSerialStatusCodeHandlerLib.inf
|--|-- RuntimeDxeSerialStatusCodeHandlerLib.inf
|--|-- SmmSerialStatusCodeHandlerLib.inf


We will update existing platform use cases in edk2 and edk2-platform repo to 
cover the new NULL class library to make sure this change doesn't impact any 
platform.
After this separation, StatusCodeHandler module usage will like below, and it's 
also very flexible for platform to cover more handler libraries to meet their 
requirements.
MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf {
  
NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/PeiMemoryStausCodeHandlerLib.inf
NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/PeiSerialStatusCodeHandlerLib.inf
...
}

MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
  {
  
NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/RuntimeDxeMemoryStausCodeHandlerLib.inf
NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/RuntimeDxeSerialStatusCodeHandlerLib.inf
...
}

MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf {
  

NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/SmmMemoryStausCodeHandlerLib.inf
NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/SmmSerialStatusCodeHandlerLib.inf
...
}


Thanks,
Dandan



Dandan,

We'll have a lot of layers of indirection  The ReportStatusCodeRouter 
modules will call one or more StatusCodeHandlerModules, and the standard 
StatusCodeHandler modules will call multiple StatusCodeHandlerLib libraries.

How about adding StatusCodeHandlerLib support directly to the 
ReportStatusCodeRouter modules?  Then platforms could omit the 
StatusCodeHandler modules if they're only using the open-source code.  That 
sounds like less overhead since fewer modules would be needed



Hi Brain,

You are right. Current design truly has a lot of layers. The 
ReportStatusCodeRouter module provides the register logic and maintain the 
registered status code handlers. Now the platform may have more than one of 
drivers used to register the status code handler.  This RFC used to resolve the 
platform has more than one status code handler drivers' issue. We expect the 
platform only need one wrapper driver in MdeModulePkg to let the status code 
handler library to register its handler on it.

Thanks,

Eric



Thanks,
--

Brian J. Johnson
Enterprise X86 Lab

Hewlett Packard Enterprise

hpe.com<3D%22hpe.com%22>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61543): https://edk2.groups.io/g/devel/message/61543
Mute This Topic: https://groups.io/mt/74953841/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Do not write a local commit template when a global one is defined.

2020-06-19 Thread Ashley E Desimone
Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Prince Agyeman 
Cc: Isaac Oram 
---
 edkrepo/common/common_repo_functions.py | 39 -
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/edkrepo/common/common_repo_functions.py 
b/edkrepo/common/common_repo_functions.py
index 59c198f..313a1ca 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -558,21 +558,34 @@ def update_repo_commit_template(workspace_dir, repo, 
repo_info, config, global_m
 manifest = edk_manifest.ManifestXml(os.path.join(workspace_dir, 'repo', 
'Manifest.xml'))
 templates = manifest.commit_templates
 
+#Check for the presence of a gloablly defined commit template
+global_template_in_use = False
+global_gitconfig_path = 
os.path.normpath(os.path.expanduser("~/.gitconfig"))
+with git.GitConfigParser(global_gitconfig_path, read_only=False) as 
gitglobalconfig:
+if gitglobalconfig.has_option(section='commit', option='template'):
+global_template = gitglobalconfig.get_value(section='commit', 
option='template')
+global_template_in_use = True
+print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote_name))
+
 # Apply the template based on current manifest
 with repo.config_writer() as cw:
-if cw.has_option(section='commit', option='template'):
-current_template = cw.get_value(section='commit', 
option='template').replace('"', '')
-if not 
current_template.startswith(os.path.normpath(global_manifest_directory).replace('\\',
 '/')):
-
print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote_name))
-return
-
-if repo_info.remote_name in templates:
-template_path = 
os.path.normpath(os.path.join(global_manifest_directory, 
templates[repo_info.remote_name]))
-if not os.path.isfile(template_path):
-print(COMMIT_TEMPLATE_NOT_FOUND.format(template_path))
-return
-template_path = template_path.replace('\\', '/')# Convert to 
git approved path
-cw.set_value(section='commit', option='template', 
value='"{}"'.format(template_path))
+if not global_template_in_use:
+if cw.has_option(section='commit', option='template'):
+current_template = cw.get_value(section='commit', 
option='template').replace('"', '')
+if not 
current_template.startswith(os.path.normpath(global_manifest_directory).replace('\\',
 '/')):
+
print(COMMIT_TEMPLATE_CUSTOM_VALUE.format(repo_info.remote_name))
+return
+
+if repo_info.remote_name in templates:
+template_path = 
os.path.normpath(os.path.join(global_manifest_directory, 
templates[repo_info.remote_name]))
+if not os.path.isfile(template_path):
+print(COMMIT_TEMPLATE_NOT_FOUND.format(template_path))
+return
+template_path = template_path.replace('\\', '/')# Convert 
to git approved path
+cw.set_value(section='commit', option='template', 
value='"{}"'.format(template_path))
+else:
+if cw.has_option(section='commit', option='template'):
+cw.remove_option(section='commit', option='template')
 else:
 if cw.has_option(section='commit', option='template'):
 cw.remove_option(section='commit', option='template')
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61542): https://edk2.groups.io/g/devel/message/61542
Mute This Topic: https://groups.io/mt/74995052/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: EdkRepo Sync Fails to Update Local Manifest

2020-06-19 Thread Ashley E Desimone
Only use the new manifests default combination if the
current manifest is not present in the list of new combos

Remove the extranous comparison of repo sources as that
content is checked later in the function.

Signed-off-by: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Erik Bjorge 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
---
 edkrepo/commands/sync_command.py | 45 ++--
 1 file changed, 20 insertions(+), 25 deletions(-)

diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_command.py
index dd7202d..c87861b 100644
--- a/edkrepo/commands/sync_command.py
+++ b/edkrepo/commands/sync_command.py
@@ -38,7 +38,7 @@ from edkrepo.common.common_repo_functions import 
checkout_repos, check_dirty_rep
 from edkrepo.common.common_repo_functions import update_editor_config
 from edkrepo.common.common_repo_functions import update_repo_commit_template, 
get_latest_sha
 from edkrepo.common.common_repo_functions import has_primary_repo_remote, 
fetch_from_primary_repo, in_sync_with_primary
-from edkrepo.common.common_repo_functions import update_hooks, 
combinations_in_manifest
+from edkrepo.common.common_repo_functions import update_hooks, 
combinations_in_manifest
 from edkrepo.common.common_repo_functions import write_included_config, 
remove_included_config
 from edkrepo.common.workspace_maintenance.workspace_maintenance import 
generate_name_for_obsolete_backup
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import 
pull_workspace_manifest_repo
@@ -48,7 +48,7 @@ from edkrepo.common.ui_functions import init_color_console
 from edkrepo.config.config_factory import get_workspace_path, 
get_workspace_manifest, get_edkrepo_global_data_directory
 from edkrepo.config.config_factory import get_workspace_manifest_file
 from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml
-from project_utils.submodule import deinit_submodules, maintain_submodules
+from project_utils.submodule import deinit_submodules, maintain_submodules
 
 
 class SyncCommand(EdkrepoCommand):
@@ -85,7 +85,7 @@ class SyncCommand(EdkrepoCommand):
 current_combo = initial_manifest.general_config.current_combo
 initial_sources = initial_manifest.get_repo_sources(current_combo)
 initial_hooks = initial_manifest.repo_hooks
-initial_combo = current_combo
+initial_combo = current_combo
 
 source_global_manifest_repo = 
find_source_manifest_repo(initial_manifest, config['cfg_file'], 
config['user_cfg_file'], args.source_manifest_repo)
 pull_workspace_manifest_repo(initial_manifest, config['cfg_file'], 
config['user_cfg_file'], args.source_manifest_repo, False)
@@ -102,7 +102,7 @@ class SyncCommand(EdkrepoCommand):
 if not args.update_local_manifest:
 self.__check_for_new_manifest(args, config, initial_manifest, 
workspace_path, global_manifest_directory)
 check_dirty_repos(initial_manifest, workspace_path)
-
+
 # Determine if sparse checkout needs to be disabled for this operation
 sparse_settings = initial_manifest.sparse_settings
 sparse_enabled = sparse_checkout_enabled(workspace_path, 
initial_sources)
@@ -116,7 +116,7 @@ class SyncCommand(EdkrepoCommand):
 reset_sparse_checkout(workspace_path, initial_sources)
 
 # Get the latest manifest if requested
-if args.update_local_manifest:  # NOTE: hyphens in arg name replaced 
with underscores due to argparse
+if args.update_local_manifest:  # NOTE: hyphens in arg name replaced 
with underscores due to argparse
 self.__update_local_manifest(args, config, initial_manifest, 
workspace_path, global_manifest_directory)
 manifest = get_workspace_manifest()
 if args.update_local_manifest:
@@ -130,12 +130,12 @@ class SyncCommand(EdkrepoCommand):
 repo_sources_to_sync = manifest.get_repo_sources(current_combo)
 manifest.write_current_combo(current_combo)
 
-# At this point both new and old manifest files are ready so we can 
deinit any
-# submodules that are removed due to a manifest update.
-if not args.skip_submodule:
-deinit_submodules(workspace_path, initial_manifest, initial_combo,
-  manifest, current_combo, args.verbose)
-
+# At this point both new and old manifest files are ready so we can 
deinit any
+# submodules that are removed due to a manifest update.
+if not args.skip_submodule:
+deinit_submodules(workspace_path, initial_manifest, initial_combo,
+  manifest, current_combo, args.verbose)
+
 sync_error = False
 # Calculate the hooks which need to be updated, added or removed for 
the sync
 if args.update_local_manifest:
@@ -205,15 +205,15 @@ class SyncCommand(EdkrepoCommand):
 print(NO_SYNC_DETACHED_HEAD.format(repo_to_sync.root))
 
 # Update commit messa

Re: [edk2-devel] [PATCH v5 4/4] UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD

2020-06-19 Thread Laszlo Ersek
On 06/19/20 18:56, Garrett Kirkendall wrote:
> AMD does not support MSR_IA32_MISC_ENABLE.  Accessing that register
> causes and exception on AMD processors.  If Execution Disable is
> supported, but if the processor is an AMD processor, skip manipulating
> MSR_IA32_MISC_ENABLE[34] XD Disable bit.
> 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Signed-off-by: Garrett Kirkendall 
> ---
> 
> Notes:
> Tested on Intel hardware with Laszlo Ersek's help
> 
> (1) downloaded two Linux images from provided links.
> (2) Test using a 32-bit guest on an Intel host (standing in your edk2 
> tree, with the patches applied):
> 
> $ build -a IA32 -b DEBUG -p OvmfPkg/OvmfPkgIa32.dsc -t GCC5 -D SMM_REQUIRE
> 
> $ qemu-system-i386 \
> -cpu coreduo,-nx \
> -machine q35,smm=on,accel=kvm \
> -m 4096 \
> -smp 4 \
> -global driver=cfi.pflash01,property=secure,value=on \
> -drive 
> if=pflash,format=raw,unit=0,readonly=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_CODE.fd
>  \
> -drive 
> if=pflash,format=raw,unit=1,snapshot=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_VARS.fd
>  \
> -drive 
> id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-30-efi-systemd-i686.qcow2 
> \
> -device virtio-scsi-pci,id=scsi0 \
> -device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1
> 
> (Once you get a login prompt, feel free to interrupt QEMU with Ctrl-C.)
> 
> (3) Test using a 64-bit guest on an Intel host:
> 
> $ build -a IA32 -a X64 -b DEBUG -p OvmfPkg/OvmfPkgIa32X64.dsc -t GCC5 -D 
> SMM_REQUIRE
> 
> $ qemu-system-x86_64 \
> -cpu host \
> -machine q35,smm=on,accel=kvm \
> -m 4096 \
> -smp 4 \
> -global driver=cfi.pflash01,property=secure,value=on \
> -drive 
> if=pflash,format=raw,unit=0,readonly=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_CODE.fd
>  \
> -drive 
> if=pflash,format=raw,unit=1,snapshot=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_VARS.fd
>  \
> -drive 
> id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-31-efi-grub2-x86_64.qcow2 
> \
> -device virtio-scsi-pci,id=scsi0 \
> -device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1
> 
> Tested on real AMD Hardware
> 
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h |  3 +++
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c |  9 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm   | 19 +--
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm| 20 ++--
>  4 files changed, 46 insertions(+), 5 deletions(-)

This patch is identical to v2, therefore my R-b still applies:

Reviewed-by: Laszlo Ersek 

I've also run test (4), as described here:

  https://edk2.groups.io/g/devel/message/61344
  5f2fd5a9-2107-503a-406b-de08529dcb56@redhat.com">http://mid.mail-archive.com/5f2fd5a9-2107-503a-406b-de08529dcb56@redhat.com

so, for patch#4:

Tested-by: Laszlo Ersek 

Thanks
Laszlo

> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
> index 43f6935cf9dc..993360a8a8c1 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
> @@ -2,6 +2,7 @@
>  SMM profile internal header file.
>  
>  Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2020, AMD Incorporated. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  **/
> @@ -13,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  #include "SmmProfileArch.h"
> @@ -99,6 +101,7 @@ extern SMM_S3_RESUME_STATE   *mSmmS3ResumeState;
>  extern UINTN gSmiExceptionHandlers[];
>  extern BOOLEAN   mXdSupported;
>  X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported;
> +X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported;
>  extern UINTN *mPFEntryCount;
>  extern UINT64(*mLastPFEntryValue)[MAX_PF_ENTRY_COUNT];
>  extern UINT64*(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT];
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> index c47b5573e366..d7ed9ab7a770 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> @@ -2,7 +2,7 @@
>  Enable SMM profile.
>  
>  Copyright (c) 2012 - 2019, Intel Corporation. All rights reserved.
> -Copyright (c) 2017, AMD Incorporated. All rights reserved.
> +Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.
>  
>  SPDX-License-Identifier: BSD-2-Clause-Patent
>  
> @@ -1015,6 +1015,13 @@ CheckFeatureSupported (
>mXdSupported = FALSE;
>PatchInstructionX86 (gPatchXdSupported, mXdSupported, 1);
>  }
> +
> +if (StandardSignatureIsAuthenticAMD ()) {
> +  //
> +  // AMD processors do not support MS

Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 3/3] EdkRepo: Fix submodule failures when switching combos.

2020-06-19 Thread Ashley E Desimone
Pushed as: 2392e3fa84883958822e056ae35f5b4afade5a80

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Bjorge, Erik C
Sent: Wednesday, June 10, 2020 3:14 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E ; Desimone, Nathaniel L 
; Pandya, Puja ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 3/3] EdkRepo: Fix 
submodule failures when switching combos.

When switching combinations or checking out pins the submodule information may 
change or have modifications that will cause errors.
Before changing to a new combination all submodules should be removed.

Cc: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
Cc: Erik Bjorge 
Signed-off-by: Erik Bjorge 
---
 edkrepo/commands/checkout_pin_command.py |  5 ++---  
edkrepo/common/common_repo_functions.py  | 11 ++-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/edkrepo/commands/checkout_pin_command.py 
b/edkrepo/commands/checkout_pin_command.py
index 9d7346a..39c5aeb 100644
--- a/edkrepo/commands/checkout_pin_command.py
+++ b/edkrepo/commands/checkout_pin_command.py
@@ -22,7 +22,7 @@ from 
edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import 
find_source_manifest_repo from edkrepo.config.config_factory import 
get_workspace_path, get_workspace_manifest from 
edkrepo_manifest_parser.edk_manifest import ManifestXml-from 
project_utils.submodule import deinit_submodules, maintain_submodules+from 
project_utils.submodule import deinit_full, maintain_submodules   class 
CheckoutPinCommand(EdkrepoCommand):@@ -71,8 +71,7 @@ class 
CheckoutPinCommand(EdkrepoCommand):
 print(SPARSE_RESET) 
reset_sparse_checkout(workspace_path, manifest_sources) submodule_combo 
= pin.general_config.current_combo-deinit_submodules(workspace_path, 
manifest, manifest.general_config.current_combo,-  pin, 
submodule_combo, args.verbose)+deinit_full(workspace_path, manifest, 
args.verbose) pin_repo_sources = 
pin.get_repo_sources(pin.general_config.current_combo) try: 
checkout_repos(args.verbose, args.override, pin_repo_sources, workspace_path, 
manifest)diff --git a/edkrepo/common/common_repo_functions.py 
b/edkrepo/common/common_repo_functions.py
index 8c79f3d..59c198f 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -68,7 +68,7 @@ from edkrepo_manifest_parser.edk_manifest_validation import 
validate_manifestrep  from edkrepo_manifest_parser.edk_manifest_validation 
import get_manifest_validation_status from 
edkrepo_manifest_parser.edk_manifest_validation import print_manifest_errors 
from edkrepo_manifest_parser.edk_manifest_validation import 
validate_manifestfiles-from project_utils.submodule import deinit_submodules, 
maintain_submodules+from project_utils.submodule import deinit_full, 
maintain_submodules  CLEAR_LINE = '\x1b[K' DEFAULT_REMOTE_NAME = 'origin'@@ 
-498,10 +498,6 @@ def checkout(combination_or_sha, verbose=False, 
override=False, log=None):
 log=log) initial_repo_sources = 
manifest.get_repo_sources(manifest.general_config.current_combo) -# Deinit 
any submodules that have been removed.-deinit_submodules(workspace_path, 
manifest, manifest.general_config.current_combo,-  
manifest, submodule_combo, verbose)- # Disable sparse checkout 
current_repos = initial_repo_sources sparse_enabled = 
sparse_checkout_enabled(workspace_path, initial_repo_sources)@@ -524,6 +520,11 
@@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
 print(SPARSE_RESET) reset_sparse_checkout(workspace_path, 
current_repos) +# Deinit all submodules due to the potential for issues 
when switching+# branches.+if combo_or_sha != 
manifest.general_config.current_combo:+deinit_full(workspace_path, 
manifest, verbose)+ print(CHECKING_OUT_COMBO.format(combo_or_sha))  
try:-- 
2.27.0.windows.1


-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61101): https://edk2.groups.io/g/devel/message/61101
Mute This Topic: https://groups.io/mt/74807390/1860321
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  
[ashley.e.desim...@intel.com] -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61539): https://edk2.groups.io/g/devel/message/61539
Mute This Topic: https://groups.io/mt/74807390/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 2/3] EdkRepo: Adding backwards compatibility for old pin files

2020-06-19 Thread Ashley E Desimone
Pushed as: a1ae934c28b5781b358a270fed77e35d23b205b0

-Original Message-
From: Bjorge, Erik C  
Sent: Wednesday, June 10, 2020 3:14 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E ; Desimone, Nathaniel L 
; Pandya, Puja ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 2/3] EdkRepo: Adding backwards 
compatibility for old pin files

Older pin files used the invalid enable_submodule attribute.  This has been 
fixed for new pin files but we need to be able to support older pin files as 
well.

Cc: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
Cc: Erik Bjorge 
Signed-off-by: Erik Bjorge 
---
 edkrepo_manifest_parser/edk_manifest.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/edkrepo_manifest_parser/edk_manifest.py 
b/edkrepo_manifest_parser/edk_manifest.py
index adf6d52..00ad392 100644
--- a/edkrepo_manifest_parser/edk_manifest.py
+++ b/edkrepo_manifest_parser/edk_manifest.py
@@ -795,7 +795,11 @@ class _RepoSource():
 # If enableSubmodule is not set to True then default to False  
   self.enableSub = (element.attrib['enableSubmodule'].lower() == 'true')   
  except Exception:-self.enableSub = False+try:+
# Adding backwards compatibility with pin files that used incorrect 
attribute+self.enableSub = 
(element.attrib['enable_submodule'].lower() == 'true')+except 
Exception:+self.enableSub = False  if self.branch is 
None and self.commit is None and self.tag is None: raise 
KeyError(ATTRIBUTE_MISSING_ERROR)-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61538): https://edk2.groups.io/g/devel/message/61538
Mute This Topic: https://groups.io/mt/74807386/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 1/3] EdkRepo: Add force flag when removing submodules

2020-06-19 Thread Ashley E Desimone
Pushed as: be6fadb6b0398cbcdf8ddbd40f5c16b67d17e551

-Original Message-
From: Bjorge, Erik C  
Sent: Wednesday, June 10, 2020 3:14 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E ; Desimone, Nathaniel L 
; Pandya, Puja ; Bret 
Barkelew ; Agyeman, Prince 

Subject: [edk2-staging/EdkRepo] [PATCH v2 1/3] EdkRepo: Add force flag when 
removing submodules

Submodules may generate un-tracked or modify files in the repo.  when removing 
the submodule do so even with modifications.

Cc: Ashley E Desimone 
Cc: Nate DeSimone 
Cc: Puja Pandya 
Cc: Bret Barkelew 
Cc: Prince Agyeman 
Cc: Erik Bjorge 
Signed-off-by: Erik Bjorge 
---
 project_utils/submodule.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/project_utils/submodule.py b/project_utils/submodule.py index 
170629b..3d1b620 100644
--- a/project_utils/submodule.py
+++ b/project_utils/submodule.py
@@ -48,14 +48,14 @@ def _deinit(repo, submodules=None, verbose=False):
 verbose- Enable verbose messages """ if submodules is None:-   
 output_data = repo.git.execute(['git', 'submodule', 'deinit', '--all'],+   
 output_data = repo.git.execute(['git', 'submodule', 'deinit', '-f', 
'--all'],with_extended_output=True, 
with_stdout=True) display_git_output(output_data, verbose) else:
 for sub in submodules: if verbose: 
print(strings.SUBMOD_DEINIT_PATH.format(sub.path))-output_data = 
repo.git.execute(['git', 'submodule', 'deinit', '--', sub.path],+
output_data = repo.git.execute(['git', 'submodule', 'deinit', '-f', '--', 
sub.path],
with_extended_output=True, with_stdout=True) 
display_git_output(output_data, verbose) return-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61537): https://edk2.groups.io/g/devel/message/61537
Mute This Topic: https://groups.io/mt/74807384/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

2020-06-19 Thread Andrew Fish via groups.io


> On Jun 19, 2020, at 10:29 AM, Brian J. Johnson  wrote:
> 
> On 6/18/20 2:01 AM, Dandan Bi wrote:
>> Hi All,
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2816 
>> 
>>
>> We plan to separate two kinds of NULL class libraries for Memory and serial 
>> handlers fromMdeModulePkg/Universal/StatusCodeHandler/…/ 
>> StatusCodeHandlerPei/RuntimeDxe/Smm modules.
>> The benefit we want to gain from this separation is to 1) make the code 
>> clear and easy to maintain, 2) make platform flexible to choose any handler 
>> library they need, and it also can reduce image size since the unused 
>> handlers can be excluded.
>> If you have any concern or comments for this separation, please let me know.
>>
>> We plan to add new separated NULL class library MemoryStausCodeHandlerLib 
>> and SerialStatusCodeHandlerLib with different phase implementation into 
>> MdeModulePkg\Library\ directory.
>> The main tree structure may like below:
>> MdeModulePkg\Library
>> |--MemoryStausCodeHandlerLib
>> |--|-- PeiMemoryStausCodeHandlerLib.inf
>> |--|-- RuntimeDxeMemoryStatusCodeHandlerLib.inf
>> |--|-- SmmMemoryStausCodeHandlerLib.inf
>> |--SerialStatusCodeHandlerLib
>> |--|-- PeiSerialStatusCodeHandlerLib.inf
>> |--|-- RuntimeDxeSerialStatusCodeHandlerLib.inf
>> |--|-- SmmSerialStatusCodeHandlerLib.inf
>>
>>
>> We will update existing platform use cases in edk2 and edk2-platform repo to 
>> cover the new NULL class library to make sure this change doesn’t impact any 
>> platform.
>> After this separation, StatusCodeHandler module usage will like below, and 
>> it’s also very flexible for platform to cover more handler libraries to meet 
>> their requirements.
>> MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf {
>>   
>> NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/PeiMemoryStausCodeHandlerLib.inf
>> NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/PeiSerialStatusCodeHandlerLib.inf
>> …
>> }
>>
>> MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
>>   {
>>   
>> NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/RuntimeDxeMemoryStausCodeHandlerLib.inf
>> NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/RuntimeDxeSerialStatusCodeHandlerLib.inf
>> …
>> }
>>
>> MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf {
>>   
>> 
>> NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/SmmMemoryStausCodeHandlerLib.inf
>> NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/SmmSerialStatusCodeHandlerLib.inf
>> …
>> }
>>
>>
>> Thanks,
>> Dandan
> 
> Dandan,
> 
> We'll have a lot of layers of indirection  The ReportStatusCodeRouter 
> modules will call one or more StatusCodeHandlerModules, and the standard 
> StatusCodeHandler modules will call multiple StatusCodeHandlerLib libraries.
> 
> How about adding StatusCodeHandlerLib support directly to the 
> ReportStatusCodeRouter modules?  Then platforms could omit the 
> StatusCodeHandler modules if they're only using the open-source code.  That 
> sounds like less overhead since fewer modules would be needed.
> 
> 

I think the need to execute from ROM makes this tricky. 

It looks to me that it is easy to move from PCD to libs for the 
StatusCodeHandler since registration is basically `RscHandlerPpi->Register 
(SerialStatusCodeReportWorker);`. The issue I see is the ReportStatusCodeRouter 
publishes RscHandlerPpi after the PEIMs constructor has been called and if the 
PEIM. Given globals don’t work when running from ROM you would have to do 
something like publish a HOB in the library constructor and then have the 
GenericStatusCodePeiEntry() walk the HOBs and install the handlers. So I guess 
it is a little easier than I 1st thought when I started writing this mail, but 
it would require a new public API. 

Thanks,

Andrew Fish
> Thanks,
> 
> -- 
> Brian J. Johnson
> Enterprise X86 Lab
> 
> Hewlett Packard Enterprise
> 
> hpe.com 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61536): https://edk2.groups.io/g/devel/message/61536
Mute This Topic: https://groups.io/mt/74953841/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] EDK2 code standard question

2020-06-19 Thread Hernan via groups.io
Hi,

I am a new to this group and I found something I think it is a problem in the 
documentation for code standards of edk2.
Can you help me understand who/how I can request a revision on such detail in 
the documentation?

https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/5_source_files/57_c_programming

Section 5.7.1.10, specifically.

Thanks,

--Hernan



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61534): https://edk2.groups.io/g/devel/message/61534
Mute This Topic: https://groups.io/mt/74985159/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] FmpDevicePkg: Enhance capsule verification with secure boot keys

2020-06-19 Thread Liming Sun
This commit enhances the FmpDevicePkg package to optionally verify
capsule with the secure boot keys when PcdFmpDevicePkcs7CertBufferXdr
is not set and the new PCD variable PcdFmpDeviceAllowSecureBootKeys
is configured. Below is the check logic:
  - Pass if verified with PK key, or PK key not set yet;
  - Deny if verified with the DBX keys;
  - Verified it against the DB keys;

One purpose for this change is to auto-deploy the UEFI secure boot
keys with UEFI capsule. Initially it's done in trusted environment.
Once secure boot is enabled, the same keys will be used to verify
the signed capsules as well for further updates.

Signed-off-by: Liming Sun 
---
 FmpDevicePkg/FmpDevicePkg.dec |   6 +++
 FmpDevicePkg/FmpDxe/FmpDxe.c  | 109 --
 FmpDevicePkg/FmpDxe/FmpDxe.h  |   1 +
 FmpDevicePkg/FmpDxe/FmpDxe.inf|   3 ++
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |   1 +
 5 files changed, 117 insertions(+), 3 deletions(-)

diff --git a/FmpDevicePkg/FmpDevicePkg.dec b/FmpDevicePkg/FmpDevicePkg.dec
index cab63f5..3aeb89c 100644
--- a/FmpDevicePkg/FmpDevicePkg.dec
+++ b/FmpDevicePkg/FmpDevicePkg.dec
@@ -126,6 +126,12 @@
   # @Prompt Firmware Device Image Type ID
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageTypeIdGuid|{0}|VOID*|0x4010
 
+  ## This option is used to verify the capsule using secure boot keys if the
+  # PcdFmpDevicePkcs7CertBufferXdr is not configured. In such case, the check
+  # will pass if secure boot hasn't been enabled yet.
+  # @A flag to tell whether to use secure boot keys when 
PcdFmpDevicePkcs7CertBufferXdr is not set.
+  
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceAllowSecureBootKeys|0x0|UINT8|0x4012
+
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   ## One or more PKCS7 certificates used to verify a firmware device capsule
   #  update image.  Encoded using the Variable-Length Opaque Data format of RFC
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index 5884177..6f82aee 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -682,6 +682,102 @@ GetAllHeaderSize (
   return CalculatedSize;
 }
 
+EFI_STATUS
+CheckTheImageWithSecureBootVariable (
+  IN CONST CHAR16*Name,
+  IN CONST EFI_GUID  *Guid,
+  IN CONST VOID  *Image,
+  IN UINTN   ImageSize
+  )
+{
+  EFI_STATUS  Status;
+  VOID*Data;
+  UINTN   Length;
+  EFI_SIGNATURE_LIST  *CertList;
+  EFI_SIGNATURE_DATA  *CertData;
+  UINTN   CertCount;
+  UINTN   Index;
+
+  Status = GetVariable2 (Name, Guid, &Data, &Length);
+  if (EFI_ERROR (Status)) {
+return EFI_NOT_FOUND;
+  }
+
+  CertList = (EFI_SIGNATURE_LIST *) Data;
+  while ((Length > 0) && (Length >= CertList->SignatureListSize)) {
+if (CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
+  CertData  = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertList +
+sizeof (EFI_SIGNATURE_LIST) + CertList->SignatureHeaderSize);
+  CertCount = (CertList->SignatureListSize - sizeof (EFI_SIGNATURE_LIST) -
+CertList->SignatureHeaderSize) / CertList->SignatureSize;
+
+  for (Index = 0; Index < CertCount; Index++) {
+Status = AuthenticateFmpImage (
+   (EFI_FIRMWARE_IMAGE_AUTHENTICATION *)Image,
+   ImageSize,
+   CertData->SignatureData,
+   CertList->SignatureSize - sizeof (EFI_GUID)
+   );
+if (!EFI_ERROR (Status))
+  goto Done;
+
+CertData = (EFI_SIGNATURE_DATA *) ((UINT8 *) CertData + 
CertList->SignatureSize);
+  }
+}
+
+Length -= CertList->SignatureListSize;
+CertList = (EFI_SIGNATURE_LIST *) ((UINT8 *) CertList + 
CertList->SignatureListSize);
+  }
+
+Done:
+  FreePool (Data);
+  return Status;
+}
+
+EFI_STATUS
+CheckTheImageWithSecureBootKeys (
+  IN  CONST VOID  *Image,
+  IN  UINTN   ImageSize
+  )
+{
+  EFI_STATUS  Status;
+
+  // PK check.
+  Status = CheckTheImageWithSecureBootVariable(
+ EFI_PLATFORM_KEY_NAME,
+ &gEfiGlobalVariableGuid,
+ Image,
+ ImageSize
+ );
+  if (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND) {
+// Return SUCCESS if verified by PK key or PK key not configured.
+DEBUG ((DEBUG_INFO, "FmpDxe: Verified capsule with PK key.\n"));
+return EFI_SUCCESS;
+  }
+
+  // DBX check.
+  Status = CheckTheImageWithSecureBootVariable(
+ EFI_IMAGE_SECURITY_DATABASE1,
+ &gEfiImageSecurityDatabaseGuid,
+ Image,
+ ImageSize
+ );
+  if (!EFI_ERROR (Status)) {
+DEBUG ((DEBUG_INFO, "FmpDxe: Reject capsule with DBX key.\n"));
+return EFI_SECURITY_VIOLATION;
+  }
+
+  // DB check.
+  DEBUG ((DEBUG_INFO, "FmpDxe: Verify capsule with DB key.\n"));
+  Status = CheckTheImageWithSecureBootVariable(
+ EFI_IMAGE_SECURITY_DATABASE,
+ &gEfiImageSecurityDatabaseGuid,
+

Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

2020-06-19 Thread Brian J. Johnson

On 6/18/20 2:01 AM, Dandan Bi wrote:


Hi All,

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2816 



We plan to separate two kinds of NULL class libraries for Memory and 
serial handlers from *MdeModulePkg/Universal/StatusCodeHandler/…/ 
StatusCodeHandlerPei/RuntimeDxe/Smm* modules.


The benefit we want to gain from this separation is to 1) make the 
code clear and easy to maintain, 2) make platform flexible to choose 
any handler library they need, and it also can reduce image size since 
the unused handlers can be excluded.


If you have any concern or comments for this separation, please let me 
know.


We plan to add new separated NULL class library 
*MemoryStausCodeHandlerLib *and*SerialStatusCodeHandlerLib *with 
different phase implementation into *MdeModulePkg\Library\* directory.


The main tree structure may like below:

MdeModulePkg\Library

|--*MemoryStausCodeHandlerLib*

|--|-- PeiMemoryStausCodeHandlerLib.inf

|--|-- RuntimeDxeMemoryStatusCodeHandlerLib.inf

|--|-- SmmMemoryStausCodeHandlerLib.inf

|--*SerialStatusCodeHandlerLib*

|--|-- PeiSerialStatusCodeHandlerLib.inf

|--|-- RuntimeDxeSerialStatusCodeHandlerLib.inf

|--|-- SmmSerialStatusCodeHandlerLib.inf

**

**

We will update existing platform use cases in edk2 and edk2-platform 
repo to cover the new NULL class library to make sure this change 
doesn’t impact any platform.


After this separation, StatusCodeHandler module usage will like below, 
and it’s also very flexible for platform to cover more handler 
libraries to meet their requirements.


MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf {

  

NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/PeiMemoryStausCodeHandlerLib.inf

NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/PeiSerialStatusCodeHandlerLib.inf

    …

}

MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf 
{


  

NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/RuntimeDxeMemoryStausCodeHandlerLib.inf

NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/RuntimeDxeSerialStatusCodeHandlerLib.inf

    …

}

MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf {

  

 
NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/SmmMemoryStausCodeHandlerLib.inf

NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/SmmSerialStatusCodeHandlerLib.inf

    …

}

Thanks,

Dandan



Dandan,

We'll have a lot of layers of indirection  The 
ReportStatusCodeRouter modules will call one or more 
StatusCodeHandlerModules, and the standard StatusCodeHandler modules 
will call multiple StatusCodeHandlerLib libraries.


How about adding StatusCodeHandlerLib support directly to the 
ReportStatusCodeRouter modules?  Then platforms could omit the 
StatusCodeHandler modules if they're only using the open-source code.  
That sounds like less overhead since fewer modules would be needed.


Thanks,

--

*Brian J. Johnson
*Enterprise X86 Lab

Hewlett Packard Enterprise

*hpe.com* <3D"hpe.com">


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61533): https://edk2.groups.io/g/devel/message/61533
Mute This Topic: https://groups.io/mt/74953841/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 1/4] PcAtChipsetPkg: PcAtChipsetPkg.dsc add UefiCpuLib LibraryClass

2020-06-19 Thread Kirkendall, Garrett
In preparation for moving StandardSignatureIsAuthenticAMD to UefiCpuLib
in UefiCpuPkg, PcAtChipset/PcAtChipsetPkg.dsc needs LibraryClass
UefiCpuLib.
LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf will need
UefiCpuLib LibraryClass.  Likely most "real" platforms will be using
BaseX2XApicLib instance which already required UefiCpuLib.

Cc: Ray Ni 
Signed-off-by: Garrett Kirkendall 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc 
b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 01a3ee716a98..b61b7d1f528e 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -2,6 +2,7 @@
 #  PC/AT Chipset Package

 #

 #  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Incorporated. All rights reserved.

 #

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

@@ -39,6 +40,7 @@ [LibraryClasses]
   ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf

   IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf

   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf

+  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf

   
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf

   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf

 

-- 
2.27.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61529): https://edk2.groups.io/g/devel/message/61529
Mute This Topic: https://groups.io/mt/74983840/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 2/4] SourceLevelDebugPkg: SourceLevelDebugPkg.dsc add UefiCpuLib LibraryClass

2020-06-19 Thread Kirkendall, Garrett
In preparation for moving StandardSignatureIsAuthenticAMD to UefiCpuLib
in UefiCpuPkg, SourceLevelDebugPkg/SourceLevelDebugPkg.dsc needs
LibraryClass UefiCpuLib.
LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf will need
UefiCpuLib LibraryClass.  Likely most "real" platforms will be using
BaseX2XApicLib instance which already required UefiCpuLib.

Cc: Hao A Wu 
Signed-off-by: Garrett Kirkendall 
---
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc 
b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index a1a1b81d03cb..20eb10ba07f8 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -2,6 +2,7 @@
 # Source Level Debug Package.

 #

 # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

+# Copyright (c) 2020, AMD Incorporated. All rights reserved.

 #

 #SPDX-License-Identifier: BSD-2-Clause-Patent

 #

@@ -32,6 +33,7 @@ [LibraryClasses.common]
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf

   
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf

   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf

+  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf

   
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf

   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf

   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf

-- 
2.27.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61530): https://edk2.groups.io/g/devel/message/61530
Mute This Topic: https://groups.io/mt/74983841/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 3/4] UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib

2020-06-19 Thread Kirkendall, Garrett
Refactor StandardSignatureIsAuthenticAMD into BaseUefiCpuLib from
separate copies in BaseXApicLib, BaseXApicX2ApicLib, and MpInitLib.
This allows for future use of StandarSignatureIsAuthinticAMD without
creating more instances in other modules.

This function allows IA32/X64 code to determine if it is running on an
AMD brand processor.

UefiCpuLib is already included directly or indirectly in all modified
modules.  Complete move is made in this change.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Garrett Kirkendall 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Eric Dong 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |  7 
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf |  2 ++
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf |  2 ++
 UefiCpuPkg/Include/Library/UefiCpuLib.h  | 14 
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c   | 38 

 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c   | 25 ++---
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 25 ++---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 
 8 files changed, 67 insertions(+), 69 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
index 006b7acbf14e..34d3a7bb4303 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
@@ -4,6 +4,7 @@
 #  The library routines are UEFI specification compliant.

 #

 #  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Inc. All rights reserved.

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -29,6 +30,12 @@ [Sources.IA32]
 [Sources.X64]

   X64/InitializeFpu.nasm

 

+[Sources]

+  BaseUefiCpuLib.c

+

 [Packages]

   MdePkg/MdePkg.dec

   UefiCpuPkg/UefiCpuPkg.dec

+

+[LibraryClasses]

+  BaseLib

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
index bdb2ff372677..561baa44b0e6 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
@@ -5,6 +5,7 @@
 #  where local APIC is disabled.

 #

 #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Inc. All rights reserved.

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -37,6 +38,7 @@ [LibraryClasses]
   TimerLib

   IoLib

   PcdLib

+  UefiCpuLib

 

 [Pcd]

   gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds  ## 
SOMETIMES_CONSUMES

diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf 
b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
index ac1e0a1c9896..1e2a4f8b790f 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
@@ -5,6 +5,7 @@
 #  where local APIC is disabled.

 #

 #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Inc. All rights reserved.

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -37,6 +38,7 @@ [LibraryClasses]
   TimerLib

   IoLib

   PcdLib

+  UefiCpuLib

 

 [Pcd]

   gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds  ## 
SOMETIMES_CONSUMES

diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 82e53bab3a0f..5326e7246301 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h
@@ -5,6 +5,7 @@
   to be UEFI specification compliant.

 

   Copyright (c) 2009, Intel Corporation. All rights reserved.

+  Copyright (c) 2020, AMD Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

 

 **/

@@ -29,4 +30,17 @@ InitializeFloatingPointUnits (
   VOID

   );

 

+/**

+  Determine if the standard CPU signature is "AuthenticAMD".

+

+  @retval TRUE  The CPU signature matches.

+  @retval FALSE The CPU signature does not match.

+

+**/

+BOOLEAN

+EFIAPI

+StandardSignatureIsAuthenticAMD (

+  VOID

+  );

+

 #endif

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
new file mode 100644
index ..c2cc3ff9a709
--- /dev/null
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
@@ -0,0 +1,38 @@
+/** @file

+  This library defines some routines that are generic for IA32 family CPU.

+

+  The library routines are UEFI specification compliant.

+

+  Copyright (c) 2020, AMD Inc. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#include 

+#include 

+

+#include 

+#include 

+

+/**

+  Determine if the standard CPU signature is "AuthenticAMD".

+

+  @retval TRUE  The CPU signature matches.

+  @retval FALSE The CPU signature does not match.

+

+**

[edk2-devel] [PATCH v5 4/4] UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD

2020-06-19 Thread Kirkendall, Garrett
AMD does not support MSR_IA32_MISC_ENABLE.  Accessing that register
causes and exception on AMD processors.  If Execution Disable is
supported, but if the processor is an AMD processor, skip manipulating
MSR_IA32_MISC_ENABLE[34] XD Disable bit.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Garrett Kirkendall 
---

Notes:
Tested on Intel hardware with Laszlo Ersek's help

(1) downloaded two Linux images from provided links.
(2) Test using a 32-bit guest on an Intel host (standing in your edk2 tree, 
with the patches applied):

$ build -a IA32 -b DEBUG -p OvmfPkg/OvmfPkgIa32.dsc -t GCC5 -D SMM_REQUIRE

$ qemu-system-i386 \
-cpu coreduo,-nx \
-machine q35,smm=on,accel=kvm \
-m 4096 \
-smp 4 \
-global driver=cfi.pflash01,property=secure,value=on \
-drive 
if=pflash,format=raw,unit=0,readonly=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_CODE.fd
 \
-drive 
if=pflash,format=raw,unit=1,snapshot=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_VARS.fd
 \
-drive 
id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-30-efi-systemd-i686.qcow2 \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1

(Once you get a login prompt, feel free to interrupt QEMU with Ctrl-C.)

(3) Test using a 64-bit guest on an Intel host:

$ build -a IA32 -a X64 -b DEBUG -p OvmfPkg/OvmfPkgIa32X64.dsc -t GCC5 -D 
SMM_REQUIRE

$ qemu-system-x86_64 \
-cpu host \
-machine q35,smm=on,accel=kvm \
-m 4096 \
-smp 4 \
-global driver=cfi.pflash01,property=secure,value=on \
-drive 
if=pflash,format=raw,unit=0,readonly=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_CODE.fd
 \
-drive 
if=pflash,format=raw,unit=1,snapshot=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_VARS.fd
 \
-drive 
id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-31-efi-grub2-x86_64.qcow2 \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1

Tested on real AMD Hardware

 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h |  3 +++
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c |  9 -
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm   | 19 +--
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm| 20 ++--
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
index 43f6935cf9dc..993360a8a8c1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
@@ -2,6 +2,7 @@
 SMM profile internal header file.

 

 Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.

+Copyright (c) 2020, AMD Incorporated. All rights reserved.

 SPDX-License-Identifier: BSD-2-Clause-Patent

 

 **/

@@ -13,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 

 #include 

 #include 

+#include 

 #include 

 

 #include "SmmProfileArch.h"

@@ -99,6 +101,7 @@ extern SMM_S3_RESUME_STATE   *mSmmS3ResumeState;
 extern UINTN gSmiExceptionHandlers[];

 extern BOOLEAN   mXdSupported;

 X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported;

+X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported;

 extern UINTN *mPFEntryCount;

 extern UINT64(*mLastPFEntryValue)[MAX_PF_ENTRY_COUNT];

 extern UINT64*(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT];

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
index c47b5573e366..d7ed9ab7a770 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
@@ -2,7 +2,7 @@
 Enable SMM profile.

 

 Copyright (c) 2012 - 2019, Intel Corporation. All rights reserved.

-Copyright (c) 2017, AMD Incorporated. All rights reserved.

+Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.

 

 SPDX-License-Identifier: BSD-2-Clause-Patent

 

@@ -1015,6 +1015,13 @@ CheckFeatureSupported (
   mXdSupported = FALSE;

   PatchInstructionX86 (gPatchXdSupported, mXdSupported, 1);

 }

+

+if (StandardSignatureIsAuthenticAMD ()) {

+  //

+  // AMD processors do not support MSR_IA32_MISC_ENABLE

+  //

+  PatchInstructionX86 (gPatchMsrIa32MiscEnableSupported, FALSE, 1);

+}

   }

 

   if (mBtsSupported) {

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm 
b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
index f96de9bdeb43..167f5e14dbd4 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
@@ -1,5 +1,6 @@
 
;-- 
;

 ; Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.

+; Copyright (c) 2020, AMD Incorporated. All rights reserved.

 ; SPDX-License-Identifie

[edk2-devel] [PATCH v5 0/4] AMD processor MSR_IA32_MISC_ENABLE

2020-06-19 Thread Kirkendall, Garrett
AMD processor does not support MSR_IA32_MISC_ENABLE register.  Accessing
this register on AMD causes an unhandled exception in SmmEntry.nasm and
a subsequent failure to boot since this is too early in SMM path for the
exception handler to be loaded.

1. Prepare PcAtChipsetPkg/PcAtChipsetPkg.dsc to move
StandardSignatureIsAuthenticAMD into UefiCpuLib LibraryClass
BaseUefiCpuLib in UefiCpuPkg.

2. To distinguish between AMD and other processors, refactor
StandardSignatureIsAuthenticAMD into BaseUefiCpuLib.  So there is only
one copy in the source.

3. Skip manipulation of MSR_IA32_MISC_ENABLE register if running
on an AMD processor.

Tested on AMD X64 hardware.
OvmfIa32 and OvmfIa32X64 on Intel hardware.

v1: Move StandardSignatureIsAuthenticAMD. Handle MSR_IA32_MISC_ENABLE
v2: Incorporate Laszlo's feedback
v3: Typo, not sent
v4: Patch in to add UefiCpuLib to PcAtChipsetPkg.dsc
v5: Patch in to add UefiCpuLib to SourceLevelDebugPkg.dsc

Garrett Kirkendall (4):
  PcAtChipsetPkg: PcAtChipsetPkg.dsc add UefiCpuLib LibraryClass
  SourceLevelDebugPkg: SourceLevelDebugPkg.dsc add UefiCpuLib
LibraryClass
  UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib
  UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on
AMD

 PcAtChipsetPkg/PcAtChipsetPkg.dsc|  2 ++
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc  |  2 ++
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |  7 
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf |  2 ++
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf |  2 ++
 UefiCpuPkg/Include/Library/UefiCpuLib.h  | 14 
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h   |  3 ++
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c   | 38 

 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c   | 25 ++---
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 25 ++---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c   |  9 -
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 19 --
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm  | 20 +--
 14 files changed, 117 insertions(+), 74 deletions(-)
 create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c

Changes at:
https://github.com/gkirkendall-amd/edk2/tree/smmentry_nasm_skip_msr_xd_bit_on_amd_v5

Pull Request:
https://github.com/tianocore/edk2/pull/715

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Hao A Wu 
Signed-off-by: Garrett Kirkendall 

-- 
2.27.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61528): https://edk2.groups.io/g/devel/message/61528
Mute This Topic: https://groups.io/mt/74983839/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library support for VMGEXIT

2020-06-19 Thread Laszlo Ersek
On 06/19/20 15:50, Tom Lendacky wrote:
> On 6/19/20 2:47 AM, Dong, Eric via groups.io wrote:
>>
>>
>>> -Original Message-
>>> From: devel@edk2.groups.io  On Behalf Of
>>> Lendacky, Thomas
>>> Sent: Thursday, June 18, 2020 10:09 PM
>>> To: Dong, Eric ; devel@edk2.groups.io
>>> Cc: Brijesh Singh ; Ard Biesheuvel
>>> ; Justen, Jordan L ;
>>> Laszlo Ersek ; Gao, Liming ;
>>> Kinney, Michael D ; Ni, Ray
>>> 
>>> Subject: Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library
>>> support for VMGEXIT
>>>
>>> On 6/18/20 2:23 AM, Dong, Eric wrote:
 Hi Tom,

 When use VS2015 to build this code, it reports below error. Please
 help to
>>> fix it.

 k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: error C2220: warning
 treated as error - no 'object' file generated
 k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: warning C4335: Mac
 file format detected: please convert the source file to either DOS or
 UNIX format
>>>
>>> That is strange...  I didn't see this when I ran through the CI. When
>>> I do a file
>>> command against the file it reports:
>>>
>>> UefiCpuPkg/Include/Library/VmgExitLib.h: C source, ASCII text, with CRLF
>>> line terminators
>>>
>>> I'll investigate this and try and figure out what's going on, but if
>>> anyone else
>>> has some ideas, please let me know.
>>
>> Hi Tom,
>>
>> I met this error again when I trig below patch from AMD again for CPU
>> change.
>> "UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib"
> 
> Hmmm... I think we could be running into issues with sending patches
> through our mail servers. Let me send you the patch series directly
> using some changes I made to my git config file to see if that helps.
> Would that be ok?

both sender and recipient git clones should have

[core]
whitespace = cr-at-eol

and the recipient clone should have

[am]
keepcr = true

https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-05

These are also set by "BaseTools/Scripts/SetupGit.py".

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61527): https://edk2.groups.io/g/devel/message/61527
Mute This Topic: https://groups.io/mt/74692413/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD

2020-06-19 Thread Laszlo Ersek
On 06/18/20 17:22, Kirkendall, Garrett wrote:
> AMD does not support MSR_IA32_MISC_ENABLE.  Accessing that register
> causes and exception on AMD processors.  If Execution Disable is
> supported, but if the processor is an AMD processor, skip manipulating
> MSR_IA32_MISC_ENABLE[34] XD Disable bit.
>
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Signed-off-by: Garrett Kirkendall 
> ---
>
> Notes:
> Tested on Intel hardware with Laszlo Ersek's help
>
> (1) downloaded two Linux images from provided links.
> (2) Test using a 32-bit guest on an Intel host (standing in your edk2 
> tree, with the patches applied):
>
> $ build -a IA32 -b DEBUG -p OvmfPkg/OvmfPkgIa32.dsc -t GCC5 -D SMM_REQUIRE
>
> $ qemu-system-i386 \
> -cpu coreduo,-nx \
> -machine q35,smm=on,accel=kvm \
> -m 4096 \
> -smp 4 \
> -global driver=cfi.pflash01,property=secure,value=on \
> -drive 
> if=pflash,format=raw,unit=0,readonly=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_CODE.fd
>  \
> -drive 
> if=pflash,format=raw,unit=1,snapshot=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_VARS.fd
>  \
> -drive 
> id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-30-efi-systemd-i686.qcow2 
> \
> -device virtio-scsi-pci,id=scsi0 \
> -device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1
>
> (Once you get a login prompt, feel free to interrupt QEMU with Ctrl-C.)
>
> (3) Test using a 64-bit guest on an Intel host:
>
> $ build -a IA32 -a X64 -b DEBUG -p OvmfPkg/OvmfPkgIa32X64.dsc -t GCC5 -D 
> SMM_REQUIRE
>
> $ qemu-system-x86_64 \
> -cpu host \
> -machine q35,smm=on,accel=kvm \
> -m 4096 \
> -smp 4 \
> -global driver=cfi.pflash01,property=secure,value=on \
> -drive 
> if=pflash,format=raw,unit=0,readonly=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_CODE.fd
>  \
> -drive 
> if=pflash,format=raw,unit=1,snapshot=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_VARS.fd
>  \
> -drive 
> id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-31-efi-grub2-x86_64.qcow2 
> \
> -device virtio-scsi-pci,id=scsi0 \
> -device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1
>
> Tested on real AMD Hardware
>
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h |  3 +++
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c |  9 -
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm   | 19 +--
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm| 20 ++--
>  4 files changed, 46 insertions(+), 5 deletions(-)

For this patch:

Reviewed-by: Laszlo Ersek 

However, can you please clarify one bit, with regard to testing:

I understand the regression tests in a 32-bit guest on Intel, and in a
64-bit guests on Intel. I also understand the test on a physical AMD
machine (in other words, you built a physical platform firmware for an
AMD board, flashed it, and tested it.)

However, your notes do not seem to mention test (4) that I requested:

"(4) Test using a 64-bit guest on an AMD host -- just repeat step (3) on
an AMD host."

https://edk2.groups.io/g/devel/message/61344

(alternative link:
<5f2fd5a9-2107-503a-406b-de08529dcb56@redhat.com">http://mid.mail-archive.com/5f2fd5a9-2107-503a-406b-de08529dcb56@redhat.com>)

That is also important. Test (3) intentionally uses "-cpu host", so the
guest will see a different CPU model when run on an Intel host (3) vs.
on an AMD host (4). I'd like to know that the patched 64-bit SMI entry
code continues working in both guest environments (i.e. when seeing
either an Intel CPU model or an AMD CPU model).

I did not request the same "duality" with test (2) -- as you see, there
I wrote "-cpu coreduo,-nx"; i.e., Intel only. The reason is that "-cpu
coreduo,-nx" is more or less the only 32-bit SMM environment that I
generally know about, and verify -- I simply do not have a 32-bit AMD
CPU model "baseline" to test against. This is why I didn't request "-cpu
host" in (2), and consequently, why I didn't request (2) to be run on
both AMD and Intel hosts.

So... Can you please run test (4) too -- i.e., 64-bit guest on an AMD
host, with "-cpu host"?

Thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61526): https://edk2.groups.io/g/devel/message/61526
Mute This Topic: https://groups.io/mt/74960777/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 0/2] AMD procesor MSR_IA32_MISC_ENABLE

2020-06-19 Thread Laszlo Ersek
Hi Garrett,

On 06/19/20 03:00, Dong, Eric wrote:
> Hi Garrett,
>
> I create a pull request to verify your changes and it reports some
> errors for your changes.  https://github.com/tianocore/edk2/pull/710
>
> please help to resolve these errors before sending your new version
> changes, also you can create your PR to verify your new changes.

It seems like the standalone "PcAtChipsetPkg.dsc" build failed.

The reason seems to be that PcAtChipsetPkg.dsc contains a lib class
resolution like

  LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf

but does not contain a UefiCpuLib class resolution.

Speaking more generally, the following DSC files reference at least one
of "BaseXApicLib.inf" and "BaseXApicX2ApicLib.inf":

- edk2:

  IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc
  OvmfPkg/OvmfXen.dsc
  PcAtChipsetPkg/PcAtChipsetPkg.dsc
  SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
  UefiCpuPkg/UefiCpuPkg.dsc
  UefiPayloadPkg/UefiPayloadPkgIa32.dsc
  UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc

- edk2-platforms:

  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
  Platform/Intel/QuarkPlatformPkg/Quark.dsc
  Platform/Intel/QuarkPlatformPkg/QuarkMin.dsc
  Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
  Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc

Among these files, the following ones do *not* already have the

  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf

lib class resolution:

- edk2:

  PcAtChipsetPkg/PcAtChipsetPkg.dsc   [found by CI]
  SourceLevelDebugPkg/SourceLevelDebugPkg.dsc

- edk2-platforms:

  [none]

Therefore, this patch set is sound, it is just incomplete. We need two
patches *prepended*: one patch that adds the UefiCpuLib resolution to
"PcAtChipsetPkg/PcAtChipsetPkg.dsc", and another that adds the same
resolution to "SourceLevelDebugPkg/SourceLevelDebugPkg.dsc". Then the
current (v2) patches can be included verbatim as patch v3 #3, and patch
v3 #4.

Garrett: you can also invoke a personal CI run -- just submit a
github.com pull request with your v3 patches, before posting them to the
list. You will not be able to set the "push" label on your PR, so the CI
system will auto-close the PR (without merging it). But, it will tell
you the build result (pass or failure).

Thanks!
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61525): https://edk2.groups.io/g/devel/message/61525
Mute This Topic: https://groups.io/mt/74960774/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library support for VMGEXIT

2020-06-19 Thread Dong, Eric


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Lendacky, Thomas
> Sent: Friday, June 19, 2020 9:51 PM
> To: devel@edk2.groups.io; Dong, Eric 
> Cc: Brijesh Singh ; Ard Biesheuvel
> ; Justen, Jordan L ;
> Laszlo Ersek ; Gao, Liming ;
> Kinney, Michael D ; Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library
> support for VMGEXIT
> 
> On 6/19/20 2:47 AM, Dong, Eric via groups.io wrote:
> >
> >
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of
> >> Lendacky, Thomas
> >> Sent: Thursday, June 18, 2020 10:09 PM
> >> To: Dong, Eric ; devel@edk2.groups.io
> >> Cc: Brijesh Singh ; Ard Biesheuvel
> >> ; Justen, Jordan L
> >> ; Laszlo Ersek ; Gao,
> >> Liming ; Kinney, Michael D
> >> ; Ni, Ray 
> >> Subject: Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement
> >> library support for VMGEXIT
> >>
> >> On 6/18/20 2:23 AM, Dong, Eric wrote:
> >>> Hi Tom,
> >>>
> >>> When use VS2015 to build this code, it reports below error. Please
> >>> help to
> >> fix it.
> >>>
> >>> k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: error C2220:
> >>> warning treated as error - no 'object' file generated
> >>> k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: warning C4335: Mac
> >>> file format detected: please convert the source file to either DOS
> >>> or UNIX format
> >>
> >> That is strange...  I didn't see this when I ran through the CI. When
> >> I do a file command against the file it reports:
> >>
> >> UefiCpuPkg/Include/Library/VmgExitLib.h: C source, ASCII text, with
> >> CRLF line terminators
> >>
> >> I'll investigate this and try and figure out what's going on, but if
> >> anyone else has some ideas, please let me know.
> >
> > Hi Tom,
> >
> > I met this error again when I trig below patch from AMD again for CPU
> change.
> > "UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib"
> 
> Hmmm... I think we could be running into issues with sending patches
> through our mail servers. Let me send you the patch series directly using
> some changes I made to my git config file to see if that helps. Would that be
> ok?

Yes, please do it.

Thanks,
Eric
> 
> Thanks,
> Tom
> 
> >
> > I'm not sure whether this is patch issue, or our internal test sever issue. 
> > I
> have reported this error to our internal team to check also.
> > Please check it from your side and make sure no error from your side. I will
> update the status from my side when I get the update.
> >
> > Thanks,
> > Eric
> >
> >>
> >> Thanks,
> >> Tom
> >>
> >>>
> >>> Thanks,
> >>> Eric
> >>>
>  -Original Message-
>  From: Tom Lendacky 
>  Sent: Friday, June 5, 2020 9:27 PM
>  To: devel@edk2.groups.io
>  Cc: Brijesh Singh ; Ard Biesheuvel
>  ; Dong, Eric ; Justen,
>  Jordan L ; Laszlo Ersek
>  ; Gao, Liming ; Kinney,
>  Michael D ; Ni, Ray 
>  Subject: [PATCH v9 08/46] UefiCpuPkg: Implement library support for
>  VMGEXIT
> 
>  BZ:
> 
> >>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbug
> 
> >>
> zilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2198&data=02%7C01%7Ct
> >> ho
> 
> >>
> mas.lendacky%40amd.com%7Cd75554da4959407c967608d8135877be%7C3dd
> >> 8961fe
> 
> >>
> 4884e608e11a82d994e183d%7C0%7C0%7C637280617975250842&sdata=
> >> fBlK2B
> 
> FkRdAS5EWcM8YShf1ZswfRN%2F41L7XeUsb4ZCs%3D&reserved=0
> 
>  To support handling #VC exceptions and issuing VMGEXIT
>  instructions, create a library with functions that can be used to
>  perform these #VC/VMGEXIT related operations. This includes
> functions for:
>  - Handling #VC exceptions
>  - Preparing for and issuing a VMGEXIT
>  - Performing MMIO-related write operations to support flash
> emulation
>  - Performing AP related boot opeations
> 
>  The base functions in this driver will not do anything and will
>  return an error if a return value is required. It is expected that
>  other packages (like OvmfPkg) will create a version of the library
>  to fully support an SEV-ES guest.
> 
>  Cc: Eric Dong 
>  Cc: Ray Ni 
>  Cc: Laszlo Ersek 
>  Signed-off-by: Tom Lendacky 
>  ---
> UefiCpuPkg/UefiCpuPkg.dec|   3 +
> UefiCpuPkg/UefiCpuPkg.dsc|   2 +
> UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf |  27 +
> UefiCpuPkg/Include/Library/VmgExitLib.h  | 103
> >> +
> UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c   | 121
>  
> UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni |  15 +++
> 6 files changed, 271 insertions(+)
> 
>  diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
>  index df5d02bae6b4..cb92f34b6f55 100644
>  --- a/UefiCpuPkg/UefiCpuPkg.dec
>  +++ b/UefiCpuPkg/UefiCpuPkg.dec
>  @@ -53,6 +53,9 @@ [LibraryClasses

[edk2-devel] [PATCH v4 3/3] UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD

2020-06-19 Thread Kirkendall, Garrett
AMD does not support MSR_IA32_MISC_ENABLE.  Accessing that register
causes and exception on AMD processors.  If Execution Disable is
supported, but if the processor is an AMD processor, skip manipulating
MSR_IA32_MISC_ENABLE[34] XD Disable bit.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Garrett Kirkendall 
---

Notes:
Tested on Intel hardware with Laszlo Ersek's help

(1) downloaded two Linux images from provided links.
(2) Test using a 32-bit guest on an Intel host (standing in your edk2 tree, 
with the patches applied):

$ build -a IA32 -b DEBUG -p OvmfPkg/OvmfPkgIa32.dsc -t GCC5 -D SMM_REQUIRE

$ qemu-system-i386 \
-cpu coreduo,-nx \
-machine q35,smm=on,accel=kvm \
-m 4096 \
-smp 4 \
-global driver=cfi.pflash01,property=secure,value=on \
-drive 
if=pflash,format=raw,unit=0,readonly=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_CODE.fd
 \
-drive 
if=pflash,format=raw,unit=1,snapshot=on,file=Build/OvmfIa32/DEBUG_GCC5/FV/OVMF_VARS.fd
 \
-drive 
id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-30-efi-systemd-i686.qcow2 \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1

(Once you get a login prompt, feel free to interrupt QEMU with Ctrl-C.)

(3) Test using a 64-bit guest on an Intel host:

$ build -a IA32 -a X64 -b DEBUG -p OvmfPkg/OvmfPkgIa32X64.dsc -t GCC5 -D 
SMM_REQUIRE

$ qemu-system-x86_64 \
-cpu host \
-machine q35,smm=on,accel=kvm \
-m 4096 \
-smp 4 \
-global driver=cfi.pflash01,property=secure,value=on \
-drive 
if=pflash,format=raw,unit=0,readonly=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_CODE.fd
 \
-drive 
if=pflash,format=raw,unit=1,snapshot=on,file=Build/Ovmf3264/DEBUG_GCC5/FV/OVMF_VARS.fd
 \
-drive 
id=hdd,if=none,format=qcow2,snapshot=on,file=fedora-31-efi-grub2-x86_64.qcow2 \
-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,drive=hdd,bus=scsi0.0,bootindex=1

Tested on real AMD Hardware

 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h |  3 +++
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c |  9 -
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm   | 19 +--
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm| 20 ++--
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
index 43f6935cf9dc..993360a8a8c1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h
@@ -2,6 +2,7 @@
 SMM profile internal header file.

 

 Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.

+Copyright (c) 2020, AMD Incorporated. All rights reserved.

 SPDX-License-Identifier: BSD-2-Clause-Patent

 

 **/

@@ -13,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 

 #include 

 #include 

+#include 

 #include 

 

 #include "SmmProfileArch.h"

@@ -99,6 +101,7 @@ extern SMM_S3_RESUME_STATE   *mSmmS3ResumeState;
 extern UINTN gSmiExceptionHandlers[];

 extern BOOLEAN   mXdSupported;

 X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported;

+X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported;

 extern UINTN *mPFEntryCount;

 extern UINT64(*mLastPFEntryValue)[MAX_PF_ENTRY_COUNT];

 extern UINT64*(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT];

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
index c47b5573e366..d7ed9ab7a770 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
@@ -2,7 +2,7 @@
 Enable SMM profile.

 

 Copyright (c) 2012 - 2019, Intel Corporation. All rights reserved.

-Copyright (c) 2017, AMD Incorporated. All rights reserved.

+Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.

 

 SPDX-License-Identifier: BSD-2-Clause-Patent

 

@@ -1015,6 +1015,13 @@ CheckFeatureSupported (
   mXdSupported = FALSE;

   PatchInstructionX86 (gPatchXdSupported, mXdSupported, 1);

 }

+

+if (StandardSignatureIsAuthenticAMD ()) {

+  //

+  // AMD processors do not support MSR_IA32_MISC_ENABLE

+  //

+  PatchInstructionX86 (gPatchMsrIa32MiscEnableSupported, FALSE, 1);

+}

   }

 

   if (mBtsSupported) {

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm 
b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
index f96de9bdeb43..167f5e14dbd4 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
@@ -1,5 +1,6 @@
 
;-- 
;

 ; Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.

+; Copyright (c) 2020, AMD Incorporated. All rights reserved.

 ; SPDX-License-Identifie

[edk2-devel] [PATCH v4 0/3] AMD processor MSR_IA32_MISC_ENABLE

2020-06-19 Thread Kirkendall, Garrett
AMD processor does not support MSR_IA32_MISC_ENABLE register.  Accessing
this register on AMD causes an unhandled exception in SmmEntry.nasm and
a subsequent failure to boot since this is too early in SMM path for the
exception handler to be loaded.

1. Prepare PcAtChipsetPkg/PcAtChipsetPkg.dsc to move
StandardSignatureIsAuthenticAMD into UefiCpuLib LibraryClass
BaseUefiCpuLib in UefiCpuPkg.

2. To distinguish between AMD and other processors, refactor
StandardSignatureIsAuthenticAMD into BaseUefiCpuLib.  So there is only
one copy in the source.

3. Skip manipulation of MSR_IA32_MISC_ENABLE register if running
on an AMD processor.

Tested on AMD X64 hardware.
OvmfIa32 and OvmfIa32X64 on Intel hardware.

v1: Move StandardSignatureIsAuthenticAMD. Handle MSR_IA32_MISC_ENABLE
v2: Incorporate Laszlo's feedback
v3: Typo, not sent
V4: Patch in to add UefiCpuLib to PcAtChipsetPkg.dsc

Garrett Kirkendall (3):
  PcAtChipsetPkg: PcAtChipsetPkg.dsc add UefiCpuLib LibraryClass
  UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib
  UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on
AMD

 PcAtChipsetPkg/PcAtChipsetPkg.dsc|  2 ++
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |  7 
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf |  2 ++
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf |  2 ++
 UefiCpuPkg/Include/Library/UefiCpuLib.h  | 14 
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h   |  3 ++
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c   | 38 

 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c   | 25 ++---
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 25 ++---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c   |  9 -
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 19 --
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm  | 20 +--
 13 files changed, 115 insertions(+), 74 deletions(-)
 create mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c

Changes at:
https://github.com/gkirkendall-amd/edk2/tree/smmentry_nasm_skip_msr_xd_bit_on_amd_v4

Pull Request:
https://github.com/tianocore/edk2/pull/712

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Garrett Kirkendall 

-- 
2.27.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61520): https://edk2.groups.io/g/devel/message/61520
Mute This Topic: https://groups.io/mt/74980314/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 2/3] UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib

2020-06-19 Thread Kirkendall, Garrett
Refactor StandardSignatureIsAuthenticAMD into BaseUefiCpuLib from
separate copies in BaseXApicLib, BaseXApicX2ApicLib, and MpInitLib.
This allows for future use of StandarSignatureIsAuthinticAMD without
creating more instances in other modules.

This function allows IA32/X64 code to determine if it is running on an
AMD brand processor.

UefiCpuLib is already included directly or indirectly in all modified
modules.  Complete move is made in this change.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Garrett Kirkendall 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Eric Dong 
---
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |  7 
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf |  2 ++
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf |  2 ++
 UefiCpuPkg/Include/Library/UefiCpuLib.h  | 14 
 UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c   | 38 

 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c   | 25 ++---
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 25 ++---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 
 8 files changed, 67 insertions(+), 69 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
index 006b7acbf14e..34d3a7bb4303 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
@@ -4,6 +4,7 @@
 #  The library routines are UEFI specification compliant.

 #

 #  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Inc. All rights reserved.

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -29,6 +30,12 @@ [Sources.IA32]
 [Sources.X64]

   X64/InitializeFpu.nasm

 

+[Sources]

+  BaseUefiCpuLib.c

+

 [Packages]

   MdePkg/MdePkg.dec

   UefiCpuPkg/UefiCpuPkg.dec

+

+[LibraryClasses]

+  BaseLib

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
index bdb2ff372677..561baa44b0e6 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
@@ -5,6 +5,7 @@
 #  where local APIC is disabled.

 #

 #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Inc. All rights reserved.

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -37,6 +38,7 @@ [LibraryClasses]
   TimerLib

   IoLib

   PcdLib

+  UefiCpuLib

 

 [Pcd]

   gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds  ## 
SOMETIMES_CONSUMES

diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf 
b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
index ac1e0a1c9896..1e2a4f8b790f 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
@@ -5,6 +5,7 @@
 #  where local APIC is disabled.

 #

 #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Inc. All rights reserved.

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

 ##

@@ -37,6 +38,7 @@ [LibraryClasses]
   TimerLib

   IoLib

   PcdLib

+  UefiCpuLib

 

 [Pcd]

   gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds  ## 
SOMETIMES_CONSUMES

diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h 
b/UefiCpuPkg/Include/Library/UefiCpuLib.h
index 82e53bab3a0f..5326e7246301 100644
--- a/UefiCpuPkg/Include/Library/UefiCpuLib.h
+++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h
@@ -5,6 +5,7 @@
   to be UEFI specification compliant.

 

   Copyright (c) 2009, Intel Corporation. All rights reserved.

+  Copyright (c) 2020, AMD Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

 

 **/

@@ -29,4 +30,17 @@ InitializeFloatingPointUnits (
   VOID

   );

 

+/**

+  Determine if the standard CPU signature is "AuthenticAMD".

+

+  @retval TRUE  The CPU signature matches.

+  @retval FALSE The CPU signature does not match.

+

+**/

+BOOLEAN

+EFIAPI

+StandardSignatureIsAuthenticAMD (

+  VOID

+  );

+

 #endif

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
new file mode 100644
index ..c2cc3ff9a709
--- /dev/null
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c
@@ -0,0 +1,38 @@
+/** @file

+  This library defines some routines that are generic for IA32 family CPU.

+

+  The library routines are UEFI specification compliant.

+

+  Copyright (c) 2020, AMD Inc. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#include 

+#include 

+

+#include 

+#include 

+

+/**

+  Determine if the standard CPU signature is "AuthenticAMD".

+

+  @retval TRUE  The CPU signature matches.

+  @retval FALSE The CPU signature does not match.

+

+**

[edk2-devel] [PATCH v4 1/3] PcAtChipsetPkg: PcAtChipsetPkg.dsc add UefiCpuLib LibraryClass

2020-06-19 Thread Kirkendall, Garrett
In preparation for moving StandardSignatureIsAuthenticAMD to UefiCpuLib
in UefiCpuPkg, PcAtChipset/PcAtChipsetPkg.dsc needs LibraryClass
UefiCpuLib.
LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf will need
UefiCpuLib LibraryClass.  Likely most "real" platforms will be using
BaseX2XApicLib instance which already required UefiCpuLib.

Cc: Ray Ni 
Signed-off-by: Garrett Kirkendall 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc 
b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 01a3ee716a98..b61b7d1f528e 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -2,6 +2,7 @@
 #  PC/AT Chipset Package

 #

 #  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.

+#  Copyright (c) 2020, AMD Incorporated. All rights reserved.

 #

 #  SPDX-License-Identifier: BSD-2-Clause-Patent

 #

@@ -39,6 +40,7 @@ [LibraryClasses]
   ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf

   IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf

   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf

+  UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf

   
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf

   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf

 

-- 
2.27.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61521): https://edk2.groups.io/g/devel/message/61521
Mute This Topic: https://groups.io/mt/74980316/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file

2020-06-19 Thread Liming Gao
PR: https://github.com/tianocore/edk2/pull/713

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Liming Gao
> Sent: Friday, June 19, 2020 5:12 PM
> To: Philippe Mathieu-Daudé ; Wasim Khan 
> ; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Varun Sethi 
> 
> Subject: Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file
> 
> Reviewed-by: Liming Gao 
> 
> -Original Message-
> From: Philippe Mathieu-Daudé 
> Sent: 2020年6月1日 19:18
> To: Wasim Khan ; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming 
> ; Varun Sethi 
> Subject: Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file
> 
> On 6/1/20 1:16 PM, Wasim Khan wrote:
> >
> >
> >> -Original Message-
> >> From: Philippe Mathieu-Daudé 
> >> Sent: Monday, June 1, 2020 2:17 PM
> >> To: devel@edk2.groups.io; Wasim Khan 
> >> Cc: michael.d.kin...@intel.com; liming@intel.com; Varun Sethi
> >> 
> >> Subject: Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file
> >>
> >> On 4/20/20 9:48 AM, Wasim Khan wrote:
> >>> ACPI memory mapped configuration space access (MCFG) table requires
> >>> defination of EFI_ACPI_DESCRIPTION_HEADER.
> >>
> >> What about:
> >>
> >> - DynamicTablesPkg/Include/Library/TableHelperLib.h
> >> - DynamicTablesPkg/Include/StandardNameSpaceObjects.h
> >> - EmbeddedPkg/Include/Library/AcpiLib.h
> >
> > EmbeddedPkg/Include/Library/AcpiLib.h  => Acpi10.h is included in this file.
> > For other two, Acpi.h /Acpi10.h has been included in the files where above 
> > header file are used.
> 
> OK, thanks Wasim.
> 
> Reviewed-by: Philippe Mathieu-Daude 
> 
> >
> >>
> >>>
> >>> Signed-off-by: Wasim Khan 
> >>> ---
> >>> Changes in v2: Corrected typo in subject
> >>>
> >>>  .../IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h|
> >> 2 ++
> >>>  1 file changed, 2 insertions(+)
> >>>
> >>> diff --git
> >>>
> >> a/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAcces
> >> s
> >>> Table.h
> >>>
> >> b/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAcces
> >> s
> >>> Table.h
> >>> index 3356ec9..8a4933d 100644
> >>> ---
> >>>
> >> a/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAcces
> >> s
> >>> Table.h
> >>> +++
> >> b/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAc
> >>> +++ cessTable.h
> >>> @@ -10,6 +10,8 @@
> >>>  #ifndef _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_
> >>>  #define _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_
> >>>
> >>> +#include 
> >>> +
> >>>  //
> >>>  // Ensure proper structure formats
> >>>  //
> >>>
> >
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61519): https://edk2.groups.io/g/devel/message/61519
Mute This Topic: https://groups.io/mt/73144786/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library support for VMGEXIT

2020-06-19 Thread Lendacky, Thomas

On 6/19/20 2:47 AM, Dong, Eric via groups.io wrote:




-Original Message-
From: devel@edk2.groups.io  On Behalf Of
Lendacky, Thomas
Sent: Thursday, June 18, 2020 10:09 PM
To: Dong, Eric ; devel@edk2.groups.io
Cc: Brijesh Singh ; Ard Biesheuvel
; Justen, Jordan L ;
Laszlo Ersek ; Gao, Liming ;
Kinney, Michael D ; Ni, Ray 
Subject: Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library
support for VMGEXIT

On 6/18/20 2:23 AM, Dong, Eric wrote:

Hi Tom,

When use VS2015 to build this code, it reports below error. Please help to

fix it.


k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: error C2220: warning
treated as error - no 'object' file generated
k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: warning C4335: Mac
file format detected: please convert the source file to either DOS or
UNIX format


That is strange...  I didn't see this when I ran through the CI. When I do a 
file
command against the file it reports:

UefiCpuPkg/Include/Library/VmgExitLib.h: C source, ASCII text, with CRLF
line terminators

I'll investigate this and try and figure out what's going on, but if anyone else
has some ideas, please let me know.


Hi Tom,

I met this error again when I trig below patch from AMD again for CPU change.
"UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib"


Hmmm... I think we could be running into issues with sending patches 
through our mail servers. Let me send you the patch series directly using 
some changes I made to my git config file to see if that helps. Would that 
be ok?


Thanks,
Tom



I'm not sure whether this is patch issue, or our internal test sever issue. I 
have reported this error to our internal team to check also.
Please check it from your side and make sure no error from your side. I will 
update the status from my side when I get the update.

Thanks,
Eric



Thanks,
Tom



Thanks,
Eric


-Original Message-
From: Tom Lendacky 
Sent: Friday, June 5, 2020 9:27 PM
To: devel@edk2.groups.io
Cc: Brijesh Singh ; Ard Biesheuvel
; Dong, Eric ; Justen,
Jordan L ; Laszlo Ersek
; Gao, Liming ; Kinney,
Michael D ; Ni, Ray 
Subject: [PATCH v9 08/46] UefiCpuPkg: Implement library support for
VMGEXIT

BZ:


https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbug



zilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2198&data=02%7C01%7Ct
ho



mas.lendacky%40amd.com%7Cd75554da4959407c967608d8135877be%7C3dd
8961fe



4884e608e11a82d994e183d%7C0%7C0%7C637280617975250842&sdata=
fBlK2B

FkRdAS5EWcM8YShf1ZswfRN%2F41L7XeUsb4ZCs%3D&reserved=0

To support handling #VC exceptions and issuing VMGEXIT instructions,
create a library with functions that can be used to perform these
#VC/VMGEXIT related operations. This includes functions for:
- Handling #VC exceptions
- Preparing for and issuing a VMGEXIT
- Performing MMIO-related write operations to support flash emulation
- Performing AP related boot opeations

The base functions in this driver will not do anything and will
return an error if a return value is required. It is expected that
other packages (like OvmfPkg) will create a version of the library to
fully support an SEV-ES guest.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Tom Lendacky 
---
   UefiCpuPkg/UefiCpuPkg.dec|   3 +
   UefiCpuPkg/UefiCpuPkg.dsc|   2 +
   UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf |  27 +
   UefiCpuPkg/Include/Library/VmgExitLib.h  | 103

+

   UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c   | 121

   UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni |  15 +++
   6 files changed, 271 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index df5d02bae6b4..cb92f34b6f55 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -53,6 +53,9 @@ [LibraryClasses.IA32, LibraryClasses.X64]
 ##

 MpInitLib|Include/Library/MpInitLib.h



+  ##  @libraryclass  Provides function to support VMGEXIT processing.

+  VmgExitLib|Include/Library/VmgExitLib.h

+

   [Guids]

 gUefiCpuPkgTokenSpaceGuid  = { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,
0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}

 gMsegSmramGuid = { 0x5802bce4, 0x, 0x4e33, { 0xa1, 
0x30,
0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}

diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index afa304128221..f0e58b90ff0a 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -56,6 +56,7 @@ [LibraryClasses]



PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base

PeCoffGetEntryPointLib.inf




PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/Base

PeCoffExtraActionLib|P
eCoffExtraActionLibNull.inf




TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/Tp

mMeasurementLibNull.inf

+  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf



   [LibraryClasses.common.SEC]




Platfo

[edk2-devel] [PATCH] MdeModulePkg: Upon BootOption failure, Destroy RamDisk memory before RSC.

2020-06-19 Thread KrishnadasX Veliyathuparambil Prakashan
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2818

For better memory management, re-ordered the DestroyRamDisk and
ReportStatusCode calls inside the EfiBootManagerBoot() function.

This will help to clean the unused memory before reporting the
failure status, so that OEMs can use RSC Listener to launch
custom boot option or application for recovering the failed
hard drive.

This change will help to ensure that the allocated pool of memory
for the failed boot option is freed before executing OEM's RSC
listener callback to handle every boot option failure.

Signed-off-by: KrishnadasX Veliyathuparambil Prakashan 

Cc: "Gao, Zhichao" 
Cc: "Ni, Ray" 
---
 .../Library/UefiBootManagerLib/BmBoot.c   | 28 ++-
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 540d169ec1..aff620ad52 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -2,7 +2,7 @@
   Library functions which relates with booting.
 
 Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
-Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -1903,17 +1903,17 @@ EfiBootManagerBoot (
 gBS->UnloadImage (ImageHandle);
   }
   //
-  // Report Status Code with the failure status to indicate that the 
failure to load boot option
-  //
-  BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
-  BootOption->Status = Status;
-  //
   // Destroy the RAM disk
   //
   if (RamDiskDevicePath != NULL) {
 BmDestroyRamDisk (RamDiskDevicePath);
 FreePool (RamDiskDevicePath);
   }
+  //
+  // Report Status Code with the failure status to indicate that the 
failure to load boot option
+  //
+  BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
+  BootOption->Status = Status;
   return;
 }
   }
@@ -1982,13 +1982,6 @@ EfiBootManagerBoot (
   Status = gBS->StartImage (ImageHandle, &BootOption->ExitDataSize, 
&BootOption->ExitData);
   DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Image Return Status = %r\n", Status));
   BootOption->Status = Status;
-  if (EFI_ERROR (Status)) {
-//
-// Report Status Code with the failure status to indicate that boot failure
-//
-BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED, Status);
-  }
-  PERF_END_EX (gImageHandle, "BdsAttempt", NULL, 0, (UINT32) OptionNumber);
 
   //
   // Destroy the RAM disk
@@ -1998,6 +1991,15 @@ EfiBootManagerBoot (
 FreePool (RamDiskDevicePath);
   }
 
+  if (EFI_ERROR (Status)) {
+//
+// Report Status Code with the failure status to indicate that boot failure
+//
+BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED, Status);
+  }
+  PERF_END_EX (gImageHandle, "BdsAttempt", NULL, 0, (UINT32) OptionNumber);
+
+
   //
   // Clear the Watchdog Timer after the image returns
   //
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61517): https://edk2.groups.io/g/devel/message/61517
Mute This Topic: https://groups.io/mt/74978785/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-rfc] MdeModulePkg/StatusCodeHandler: Separate NULL class libraries for Memory and serial handlers from MdeModulePkg/Universal/StatusCodeHandler modules

2020-06-19 Thread Laszlo Ersek
On 06/18/20 09:01, Dandan Bi wrote:
> Hi All,
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2816
> 
> We plan to separate two kinds of NULL class libraries for Memory and serial 
> handlers from MdeModulePkg/Universal/StatusCodeHandler/.../ 
> StatusCodeHandlerPei/RuntimeDxe/Smm modules.
> The benefit we want to gain from this separation is to 1) make the code clear 
> and easy to maintain, 2) make platform flexible to choose any handler library 
> they need, and it also can reduce image size since the unused handlers can be 
> excluded.
> If you have any concern or comments for this separation, please let me know.
> 
> We plan to add new separated NULL class library MemoryStausCodeHandlerLib and 
> SerialStatusCodeHandlerLib with different phase implementation into 
> MdeModulePkg\Library\ directory.
> The main tree structure may like below:
> MdeModulePkg\Library
> |--MemoryStausCodeHandlerLib
> |--|-- PeiMemoryStausCodeHandlerLib.inf
> |--|-- RuntimeDxeMemoryStatusCodeHandlerLib.inf
> |--|-- SmmMemoryStausCodeHandlerLib.inf
> |--SerialStatusCodeHandlerLib
> |--|-- PeiSerialStatusCodeHandlerLib.inf
> |--|-- RuntimeDxeSerialStatusCodeHandlerLib.inf
> |--|-- SmmSerialStatusCodeHandlerLib.inf
> 
> 
> We will update existing platform use cases in edk2 and edk2-platform repo to 
> cover the new NULL class library to make sure this change doesn't impact any 
> platform.
> After this separation, StatusCodeHandler module usage will like below, and 
> it's also very flexible for platform to cover more handler libraries to meet 
> their requirements.
> MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf {
>   
> NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/PeiMemoryStausCodeHandlerLib.inf
> NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/PeiSerialStatusCodeHandlerLib.inf
> ...
> }
> 
> MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
>   {
>   
> NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/RuntimeDxeMemoryStausCodeHandlerLib.inf
> NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/RuntimeDxeSerialStatusCodeHandlerLib.inf
> ...
> }
> 
> MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf {
>   
> 
> NULL|MdeModulePkg/Library/MemoryStausCodeHandlerLib/SmmMemoryStausCodeHandlerLib.inf
> NULL|MdeModulePkg/Library/SerialStatusCodeHandlerLib/SmmSerialStatusCodeHandlerLib.inf
> ...
> }

So I assume you're going to remove PcdStatusCodeUseSerial and
PcdStatusCodeUseMemory, and when converting the existent platforms, the
new NULL class resolutions in the DSC files will reflect the specific
PCD values used in those DSC files until then. Is that right?

I'm OK with it.

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61516): https://edk2.groups.io/g/devel/message/61516
Mute This Topic: https://groups.io/mt/74953841/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] Build error for UefiPayloadPkgIa32.dsc

2020-06-19 Thread PierreGondois
Hello Guo,
Thank you for your quick answer. I am asking on a testing perspective, I am not 
using a pure IA32 UEFI payload image.
However, would it be possible to increase the FV size for the NOOPT build type, 
or not to advertise it in the DSC file? I believe the build configuration 
should work if advertised.
Again, this is only for testing purpose. I can also remove this configuration 
from my test suite if this is too much trouble.

Regards,
Pierre

From: devel@edk2.groups.io  On Behalf Of Guo Dong via 
groups.io
Sent: 18 June 2020 23:17
To: devel@edk2.groups.io; Pierre Gondois ; Ma, Maurice 
; You, Benjamin ; nd 

Subject: Re: [edk2-devel] Build error for UefiPayloadPkgIa32.dsc


Thanks Pierre to report this build failure.
The failure is caused by FV size increase when using build parameter "-b NOOPT".
Given this build option would almost double the build size and it is  seldom 
used, I prefer you update the FDF file to increase the FV size to solve it 
locally.

BTW, from your build command, you are trying to build a pure IA32 UEFI payload 
image,  are you still using pure IA32 UEFI payload?
I ask this question because I plan to add pure X64 UEFI payload support and 
drop pure IA32 UEFI payload if possible.
Of course UEFI payload will continue support IA32 entrypoint and switch to X64 
before DXE core.

Thanks,
Guo

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of PierreGondois
Sent: Thursday, June 18, 2020 7:55 AM
To: Ma, Maurice mailto:maurice...@intel.com>>; Dong, Guo 
mailto:guo.d...@intel.com>>; You, Benjamin 
mailto:benjamin@intel.com>>; 
devel@edk2.groups.io; nd 
mailto:n...@arm.com>>
Subject: [edk2-devel] Build error for UefiPayloadPkgIa32.dsc

Hello,
I am not actively using this platform, but I wanted to report an error when 
building one of the DSC files in the UefiPayloadPkg with the following 
configuration:
build -b NOOPT -a IA32 -t VS2017 -p edk2 
edk2\UefiPayloadPkg\UefiPayloadPkgIa32.dsc

The following error occurs:
Generating PEIFV FV
 ['GenFv', '-a', 
'Build\\UefiPayloadPkgIA32\\NOOPT_VS2017\\FV\\Ffs\\PEIFV.inf', '-o', 
'Build\\UefiPayloadPkgIA32\\NOOPT_VS2017\\FV\\PEIFV.Fv', '-i', 
Build\\UefiPayloadPkgIA32\\NOOPT_VS2017\\FV\\PEIFV.inf']
Return Value = 2
GenFv: ERROR 3000: Invalid
the required fv image size 0x406c8 exceeds the set fv image size 0x3

Regards,
Pierre
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61515): https://edk2.groups.io/g/devel/message/61515
Mute This Topic: https://groups.io/mt/74960189/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file

2020-06-19 Thread Liming Gao
Reviewed-by: Liming Gao 

-Original Message-
From: Philippe Mathieu-Daudé  
Sent: 2020年6月1日 19:18
To: Wasim Khan ; devel@edk2.groups.io
Cc: Kinney, Michael D ; Gao, Liming 
; Varun Sethi 
Subject: Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file

On 6/1/20 1:16 PM, Wasim Khan wrote:
> 
> 
>> -Original Message-
>> From: Philippe Mathieu-Daudé 
>> Sent: Monday, June 1, 2020 2:17 PM
>> To: devel@edk2.groups.io; Wasim Khan 
>> Cc: michael.d.kin...@intel.com; liming@intel.com; Varun Sethi 
>> 
>> Subject: Re: [edk2-devel] [PATCH v2] MdePkg: Include Acpi header file
>>
>> On 4/20/20 9:48 AM, Wasim Khan wrote:
>>> ACPI memory mapped configuration space access (MCFG) table requires 
>>> defination of EFI_ACPI_DESCRIPTION_HEADER.
>>
>> What about:
>>
>> - DynamicTablesPkg/Include/Library/TableHelperLib.h
>> - DynamicTablesPkg/Include/StandardNameSpaceObjects.h
>> - EmbeddedPkg/Include/Library/AcpiLib.h
> 
> EmbeddedPkg/Include/Library/AcpiLib.h  => Acpi10.h is included in this file.
> For other two, Acpi.h /Acpi10.h has been included in the files where above 
> header file are used. 

OK, thanks Wasim.

Reviewed-by: Philippe Mathieu-Daude 

> 
>>
>>>
>>> Signed-off-by: Wasim Khan 
>>> ---
>>> Changes in v2: Corrected typo in subject
>>>
>>>  .../IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h|
>> 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git
>>>
>> a/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAcces
>> s
>>> Table.h
>>>
>> b/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAcces
>> s
>>> Table.h
>>> index 3356ec9..8a4933d 100644
>>> ---
>>>
>> a/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAcces
>> s
>>> Table.h
>>> +++
>> b/MdePkg/Include/IndustryStandard/MemoryMappedConfigurationSpaceAc
>>> +++ cessTable.h
>>> @@ -10,6 +10,8 @@
>>>  #ifndef _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_
>>>  #define _MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_H_
>>>
>>> +#include 
>>> +
>>>  //
>>>  // Ensure proper structure formats
>>>  //
>>>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61514): https://edk2.groups.io/g/devel/message/61514
Mute This Topic: https://groups.io/mt/73144786/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 0/3] add DwMmcHcDxe driver

2020-06-19 Thread Loh, Tien Hock
Hi Leif, Ard,

Can you help on the questions I have below?

Thanks! 

> -Original Message-
> From: Loh, Tien Hock
> Sent: Tuesday, June 16, 2020 4:39 PM
> To: 'Haojian Zhuang' ; 'leif.lindh...@linaro.org'
> ; 'ard.biesheu...@linaro.org'
> ; 'christopher...@microsoft.com'
> 
> Cc: 'devel@edk2.groups.io' ; 'thlo...@gmail.com'
> 
> Subject: RE: [PATCH v2 0/3] add DwMmcHcDxe driver
> 
> Hi Leif, Ard,
> 
> I talked to Haojian and got to know that you wanted the patch to go into the
> MdeModulePkg.
> I don't have a lot of context on it, do you have specific requirement?
> The driver at its current state already uses the MdeModulePkg's SdDxe's API, 
> so
> some more specific changes would help me understand and fix the concern you
> have.
> 
> Thanks
> 
> > -Original Message-
> > From: Loh, Tien Hock
> > Sent: Thursday, September 12, 2019 12:59 PM
> > To: Haojian Zhuang ;
> > leif.lindh...@linaro.org; ard.biesheu...@linaro.org;
> > christopher...@microsoft.com
> > Cc: devel@edk2.groups.io; thlo...@gmail.com
> > Subject: RE: [PATCH v2 0/3] add DwMmcHcDxe driver
> >
> > Hi Ard, Leif, Christopher,
> >
> > Any comments on the patches?
> >
> > Thanks!
> > Tien Hock
> > > -Original Message-
> > > From: Haojian Zhuang 
> > > Sent: Monday, September 2, 2019 5:31 PM
> > > To: Loh, Tien Hock 
> > > Cc: leif.lindh...@linaro.org; ard.biesheu...@linaro.org;
> > > christopher...@microsoft.com; devel@edk2.groups.io;
> > > thlo...@gmail.com
> > > Subject: Re: [PATCH v2 0/3] add DwMmcHcDxe driver
> > >
> > > Hi Leif, Ard, Christopher,
> > >
> > > Could you help to share the comments on this patch set? Thanks a lot.
> > >
> > > Best Regards
> > > Haojian
> > >
> > > On Thu, Aug 15, 2019 at 09:09:19AM +, Loh, Tien Hock wrote:
> > > > Hi Leif, Ard, Christopher,
> > > >
> > > > Haojian and I have tested the driver on 2 platforms, any further
> > > > comments
> > > on this?
> > > >
> > > > Thanks
> > > > Tien Hock
> > > >
> > > > > -Original Message-
> > > > > From: Haojian Zhuang 
> > > > > Sent: Tuesday, July 30, 2019 3:33 PM
> > > > > To: Loh, Tien Hock ;
> > > > > leif.lindh...@linaro.org; ard.biesheu...@linaro.org;
> > > > > christopher...@microsoft.com
> > > > > Cc: devel@edk2.groups.io; thlo...@gmail.com
> > > > > Subject: Re: [PATCH v2 0/3] add DwMmcHcDxe driver
> > > > >
> > > > > On Wed, Jul 24, 2019 at 05:26:03PM +0800,
> > > > > tien.hock@intel.com
> > > wrote:
> > > > > > From: "Tien Hock, Loh" 
> > > > > >
> > > > > > Changelog:
> > > > > > v3:
> > > > > >   * Fix an issue in NonDiscoverableDeviceDxe driver where it
> > > > > > did not
> > > > > invalidate
> > > > > > cache before copying the memory.
> > > > > > v2:
> > > > > >   *Split DwMmcHcDxe driver into two patches. One is for
> > > > > > PlatformDwMmc
> > > > > protocol,
> > > > > >and the other is for DwMmcHcDxe driver.
> > > > > > v1:
> > > > > >   *Add NonDiscoverableDeviceDxe for embedded platform. Make
> > > > > DwMmcHcDxe driver
> > > > > >to support both eMMC and SD controller.
> > > > > >
> > > > > > Haojian Zhuang (3):
> > > > > >   EmbeddedPkg: add NonDiscoverableDeviceDxe driver
> > > > > >   EmbeddedPkg: add PlatformDwMmc protocol
> > > > > >   EmbeddedPkg/Drivers: add DwMmcHcDxe driver
> > > > > >
> > > > > >  .../Drivers/DwMmcHcDxe/ComponentName.c|  214 ++
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c   | 1295
> > > > > +
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec |   40 +
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h   |  815
> > > ++
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf |   69 +
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c | 2366
> > > > > +
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h |  983
> +++
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c   | 1042
> > > 
> > > > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c | 1104 
> > > > > >  EmbeddedPkg/EmbeddedPkg.dec   |1 +
> > > > > >  EmbeddedPkg/Include/Protocol/PlatformDwMmc.h  |   79 +
> > > > > >  .../NonDiscoverableDeviceDxe/ComponentName.c  |  124 +
> > > > > >  .../NonDiscoverableDeviceDxe.c|  243 ++
> > > > > >  .../NonDiscoverableDeviceDxe.inf  |   52 +
> > > > > >  .../NonDiscoverableDeviceIo.c |  976 +++
> > > > > >  .../NonDiscoverableDeviceIo.h |   92 +
> > > > > >  16 files changed, 9495 insertions(+)  create mode 100644
> > > > > EmbeddedPkg/Drivers/DwMmcHcDxe/ComponentName.c
> > > > > >  create mode 100644
> > > > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c
> > > > > >  create mode 100644
> > > > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec
> > > > > >  create mode 100644
> > > > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h
> > > > > >  create mode 100644
> > > > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf
> > > > > >  create mode 100644
> > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c
> 

Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library support for VMGEXIT

2020-06-19 Thread Dong, Eric


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Lendacky, Thomas
> Sent: Thursday, June 18, 2020 10:09 PM
> To: Dong, Eric ; devel@edk2.groups.io
> Cc: Brijesh Singh ; Ard Biesheuvel
> ; Justen, Jordan L ;
> Laszlo Ersek ; Gao, Liming ;
> Kinney, Michael D ; Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH v9 08/46] UefiCpuPkg: Implement library
> support for VMGEXIT
> 
> On 6/18/20 2:23 AM, Dong, Eric wrote:
> > Hi Tom,
> >
> > When use VS2015 to build this code, it reports below error. Please help to
> fix it.
> >
> > k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: error C2220: warning
> > treated as error - no 'object' file generated
> > k:\edk2\UefiCpuPkg\Include\Library/VmgExitLib.h: warning C4335: Mac
> > file format detected: please convert the source file to either DOS or
> > UNIX format
> 
> That is strange...  I didn't see this when I ran through the CI. When I do a 
> file
> command against the file it reports:
> 
> UefiCpuPkg/Include/Library/VmgExitLib.h: C source, ASCII text, with CRLF
> line terminators
> 
> I'll investigate this and try and figure out what's going on, but if anyone 
> else
> has some ideas, please let me know.

Hi Tom,

I met this error again when I trig below patch from AMD again for CPU change.
"UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib"

I'm not sure whether this is patch issue, or our internal test sever issue. I 
have reported this error to our internal team to check also.
Please check it from your side and make sure no error from your side. I will 
update the status from my side when I get the update.

Thanks,
Eric

> 
> Thanks,
> Tom
> 
> >
> > Thanks,
> > Eric
> >
> >> -Original Message-
> >> From: Tom Lendacky 
> >> Sent: Friday, June 5, 2020 9:27 PM
> >> To: devel@edk2.groups.io
> >> Cc: Brijesh Singh ; Ard Biesheuvel
> >> ; Dong, Eric ; Justen,
> >> Jordan L ; Laszlo Ersek
> >> ; Gao, Liming ; Kinney,
> >> Michael D ; Ni, Ray 
> >> Subject: [PATCH v9 08/46] UefiCpuPkg: Implement library support for
> >> VMGEXIT
> >>
> >> BZ:
> >>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbug
> >>
> zilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2198&data=02%7C01%7Ct
> ho
> >>
> mas.lendacky%40amd.com%7Cd75554da4959407c967608d8135877be%7C3dd
> 8961fe
> >>
> 4884e608e11a82d994e183d%7C0%7C0%7C637280617975250842&sdata=
> fBlK2B
> >> FkRdAS5EWcM8YShf1ZswfRN%2F41L7XeUsb4ZCs%3D&reserved=0
> >>
> >> To support handling #VC exceptions and issuing VMGEXIT instructions,
> >> create a library with functions that can be used to perform these
> >> #VC/VMGEXIT related operations. This includes functions for:
> >>- Handling #VC exceptions
> >>- Preparing for and issuing a VMGEXIT
> >>- Performing MMIO-related write operations to support flash emulation
> >>- Performing AP related boot opeations
> >>
> >> The base functions in this driver will not do anything and will
> >> return an error if a return value is required. It is expected that
> >> other packages (like OvmfPkg) will create a version of the library to
> >> fully support an SEV-ES guest.
> >>
> >> Cc: Eric Dong 
> >> Cc: Ray Ni 
> >> Cc: Laszlo Ersek 
> >> Signed-off-by: Tom Lendacky 
> >> ---
> >>   UefiCpuPkg/UefiCpuPkg.dec|   3 +
> >>   UefiCpuPkg/UefiCpuPkg.dsc|   2 +
> >>   UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf |  27 +
> >>   UefiCpuPkg/Include/Library/VmgExitLib.h  | 103
> +
> >>   UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c   | 121
> >> 
> >>   UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.uni |  15 +++
> >>   6 files changed, 271 insertions(+)
> >>
> >> diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
> >> index df5d02bae6b4..cb92f34b6f55 100644
> >> --- a/UefiCpuPkg/UefiCpuPkg.dec
> >> +++ b/UefiCpuPkg/UefiCpuPkg.dec
> >> @@ -53,6 +53,9 @@ [LibraryClasses.IA32, LibraryClasses.X64]
> >> ##
> >>
> >> MpInitLib|Include/Library/MpInitLib.h
> >>
> >>
> >>
> >> +  ##  @libraryclass  Provides function to support VMGEXIT processing.
> >>
> >> +  VmgExitLib|Include/Library/VmgExitLib.h
> >>
> >> +
> >>
> >>   [Guids]
> >>
> >> gUefiCpuPkgTokenSpaceGuid  = { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,
> >> 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}
> >>
> >> gMsegSmramGuid = { 0x5802bce4, 0x, 0x4e33, { 0xa1, 
> >> 0x30,
> >> 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}
> >>
> >> diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
> >> index afa304128221..f0e58b90ff0a 100644
> >> --- a/UefiCpuPkg/UefiCpuPkg.dsc
> >> +++ b/UefiCpuPkg/UefiCpuPkg.dsc
> >> @@ -56,6 +56,7 @@ [LibraryClasses]
> >>
> >>
> PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base
> >> PeCoffGetEntryPointLib.inf
> >>
> >>
> >>
> PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/Base
> >> PeCoffExtraActionLib|P
> >> eCoffExtraActionLibNull.inf
> >>
> >>
> >>
>

Re: [edk2-devel] [PATCH v9 43/46] OvmfPkg: Use the SEV-ES work area for the SEV-ES AP reset vector

2020-06-19 Thread Dong, Eric
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> Lendacky, Thomas
> Sent: Thursday, June 18, 2020 10:51 PM
> To: Dong, Eric ; devel@edk2.groups.io
> Cc: Brijesh Singh ; Ard Biesheuvel
> ; Justen, Jordan L ;
> Laszlo Ersek ; Gao, Liming ;
> Kinney, Michael D ; Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH v9 43/46] OvmfPkg: Use the SEV-ES work
> area for the SEV-ES AP reset vector
> 
> On 6/18/20 2:43 AM, Dong, Eric wrote:
> > Hi Tom,
> 
> Hi Eric,
> 
> >
> > We use GCC5 to build the OVMF platform and report below errors, please
> help to check and fix it.
> 
> That's what I use when I build and have never encountered these errors. I
> also ran the patches through the EDK2 CI and didn't get any errors.
> 
> I've noticed that the dependencies aren't always handle properly for these
> files. Are you doing a clean build or an incremental build for this patch?
> Can you delete your Build directory and rebuild and see if you still get the
> errors?

I trig internal server build with your change and the build server found this 
issue. 
I think it should use clean build.

> 
> >
> >
> > I/opt/TCAgent/work/f9b29f3e80472c44/Edk2/MdeModulePkg/
> > -I/opt/TCAgent/work/f9b29f3e80472c44/Edk2/MdeModulePkg/Include/
> > -I/opt/TCAgent/work/f9b29f3e80472c44/Edk2/UefiCpuPkg/
> > -I/opt/TCAgent/work/f9b29f3e80472c44/Edk2/UefiCpuPkg/Include/
> > -
> I/opt/TCAgent/work/f9b29f3e80472c44/Edk2/UefiCpuPkg/ResetVector/Vtf0
> /
> > -o
> >
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5/
> X64/O
> > vmfPkg/ResetVector/ResetVector/OUTPUT/ResetVector.bin
> >
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5/
> X64/O
> > vmfPkg/ResetVector/ResetVector/OUTPUT/ResetVector.iii
> >
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5/
> X64/O
> > vmfPkg/ResetVector/ResetVector/OUTPUT/ResetVector.iii:72: error:
> > expression syntax error
> >
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5/
> X64/O
> > vmfPkg/ResetVector/ResetVector/OUTPUT/ResetVector.iii:74: error: label
> > or instruction expected at start of line > Ia32/PageTables64.asm:27:
> > error: label or instruction expected at start
> of line
> > Ia32/PageTables64.asm:29: error: label or instruction expected at
> > start of line
> > Ia32/PageTables64.asm:30: error: label or instruction expected at
> > start of line
> > Ia32/PageTables64.asm:369: error: expression syntax error
> 
> Can you paste the relevant portion of these files in an email or send copies 
> of
> those files to me?

Because the build is in internal sever and I can't copy the build file from it.

If you think you have pass all the test, I can rerun the test and check the 
result again.

Thanks,
Eric
> 
> Thanks,
> Tom
> 
> > GNUmakefile:319: recipe for target
> >
> '/opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5/
> X64/
> > OvmfPkg/ResetVector/ResetVector/OUTPUT/ResetVector.bin' failed
> > make: ***
> >
> [/opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5
> /X64/
> > OvmfPkg/ResetVector/ResetVector/OUTPUT/ResetVector.bin] Error 1
> >
> >
> > build.py...
> >   : error 7000: Failed to execute command
> >   make tbuild
> >
> [/opt/TCAgent/work/f9b29f3e80472c44/Edk2/Build/OvmfX64/DEBUG_GCC5
> /X64/
> > OvmfPkg/ResetVector/ResetVector]
> >
> >
> > build.py...
> >   : error F002: Failed to build module
> >
> >
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/OvmfPkg/ResetVector/ResetV
> ecto
> > r.inf [X64, GCC5, DEBUG]
> >
> > 
> > Related platform build configuration like below:
> >
> > WORKSPACE= /opt/TCAgent/work/f9b29f3e80472c44/Edk2
> > EDK_TOOLS_PATH   =
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/BaseTools
> > CONF_PATH= /opt/TCAgent/work/f9b29f3e80472c44/Edk2/Conf
> > PYTHON_COMMAND   = /usr/bin/python3.5
> >
> > Architecture(s)  = X64
> > Build target = DEBUG
> > Toolchain= GCC5
> >
> > Active Platform  =
> /opt/TCAgent/work/f9b29f3e80472c44/Edk2/OvmfPkg/OvmfPkgX64.dsc
> >
> >
> > Thanks,
> > Eric
> >> -Original Message-
> >> From: Tom Lendacky 
> >> Sent: Friday, June 5, 2020 9:28 PM
> >> To: devel@edk2.groups.io
> >> Cc: Brijesh Singh ; Ard Biesheuvel
> >> ; Dong, Eric ; Justen,
> >> Jordan L ; Laszlo Ersek
> >> ; Gao, Liming ; Kinney,
> >> Michael D ; Ni, Ray 
> >> Subject: [PATCH v9 43/46] OvmfPkg: Use the SEV-ES work area for the
> >> SEV- ES AP reset vector
> >>
> >> BZ:
> >>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbug
> >>
> zilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2198&data=02%7C01%7Ct
> ho
> >>
> mas.lendacky%40amd.com%7C68b736db1acf4493c24308d8135b4a75%7C3dd
> 8961fe
> >>
> 4884e608e11a82d994e183d%7C0%7C0%7C637280630097752935&sdata=
> R8sYtS
> >> a7bQXgeW4tiSAxDdwcoZaldq4%2BoN2Xn378JMc%3D&reserved=0
> >>
> >> A hypervisor is not allowed to update an SEV-ES guest's register
> >> state, so when booting an SEV-ES guest AP, the hypervisor is not
> >> allowed to set the