Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/PartitionDxe: Add already start check for child hanldes

2020-07-15 Thread Ni, Ray
Zhichao,
What does the SUSE MBR table look like?

Thanks,
Ray

> -Original Message-
> From: Gao, Zhichao 
> Sent: Thursday, July 16, 2020 1:09 PM
> To: Gary Lin ; devel@edk2.groups.io
> Cc: Wu, Hao A ; Ni, Ray 
> Subject: RE: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/PartitionDxe: Add 
> already start check for child hanldes
> 
> Yes. I have checked the image with OVMF. The SUSE image has the MBR table but 
> not like others, such as Ubuntu, RedHat
> and Fedora which would contain a partition entry with the entire disk.
> 
> That means it would pass the MBR child handle check and would never go to the 
> UDF(or ElTorito) check.
> 
> I think we should update the invalid MBR check logic.
> 
> Thanks,
> Zhichao
> 
> > -Original Message-
> > From: Gary Lin 
> > Sent: Thursday, July 16, 2020 11:33 AM
> > To: devel@edk2.groups.io; Gao, Zhichao 
> > Cc: Wu, Hao A ; Ni, Ray 
> > Subject: Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/PartitionDxe: Add
> > already start check for child hanldes
> >
> > On Tue, Jul 14, 2020 at 09:22:59AM +0800, Gao, Zhichao via groups.io wrote:
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823
> > >
> > > Treat the EFI_ALREADY_STARTED as EFI_SUCCESS to avoid the partition
> > > driver continuely check next routine function.
> > Hi Zhichao,
> >
> > I just found that this patch breaks the loading of openSUSE iso images[*].
> > Would you mind to take a look at it?
> >
> > Thanks,
> >
> > Gary Lin
> >
> > [*] http://download.opensuse.org/distribution/leap/15.2/iso/openSUSE-Leap-
> > 15.2-NET-x86_64.iso
> >
> > >
> > > Cc: Hao A Wu 
> > > Cc: Ray Ni 
> > > Signed-off-by: Zhichao Gao 
> > > Reviewed-by: Hao A Wu 
> > > ---
> > >  MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 9 +
> > >  1 file changed, 9 insertions(+)
> > >
> > > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > index d1c878ad2e..6a43c3cafb 100644
> > > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > > @@ -1276,6 +1276,15 @@ PartitionInstallChildHandle (
> > >} else {
> > >  FreePool (Private->DevicePath);
> > >  FreePool (Private);
> > > +
> > > +//
> > > +// if the Status == EFI_ALREADY_STARTED, it means the child handles
> > > +// are already installed. So return EFI_SUCCESS to avoid do the next
> > > +// partition type check.
> > > +//
> > > +if (Status == EFI_ALREADY_STARTED) {
> > > +  Status = EFI_SUCCESS;
> > > +}
> > >}
> > >
> > >return Status;
> > > --
> > > 2.21.0.windows.1
> > >
> > >
> > > 
> > >
> 


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

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



Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device

2020-07-15 Thread Guomin Jiang
Hi Jeremy,

I know that you want to continue booting without ASSERT.

But what I care is that why the device error happened and if the change is the 
correct error handing.

The change can make the ASSERT disappear, but the device still not work after 
it, so there are some other potential issue or the device itself have some 
error rather than firmware.

So the change can't be checked in the master now.

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Jeremy
> Linton
> Sent: Wednesday, July 15, 2020 10:48 PM
> To: Jiang, Guomin ; devel@edk2.groups.io
> Cc: Wang, Jian J ; Wu, Hao A ;
> Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg/UsbBusDxe:
> Rebuild the description table after Reset Device
> 
> 
> Hi,
> 
> On 7/14/20 8:07 PM, Jiang, Guomin wrote:
> > Hi Jeremy,
> >
> > We test many different device and found some device haven't reproduced
> the issue.
> >
> > We need to figure out the root cause rather than work around.
> 
> Yes, there are two problems in my case. The first is specific to the device, 
> in
> that it can be put into a state (low power spun down IIRC) where the 
> individual
> disks are responding with a 5/2400 (invalid command). But, in theory there
> are a lot of cases like this where marginal cables/bad devices/etc, are going 
> to
> result in errors.
> 
> The second problem is this one, where any device that the subsystem thinks
> needs resetting (as part of the recovery process) crashes the firmware. This
> bug is pretty clear, the descriptor cache being maintained by XHCI is being
> cleared, and the xhci driver itself is depending on that cache to handle
> operations. Without fixing it, there are null pointer dereferences on just
> about any error condition that can happen on the USB bus. This is a far larger
> problem IMHO than whether or not a particular device is working. In my case,
> I don't need/want the JBOD to be used by the firmware, but I do want the
> machine to boot when that device is plugged in.
> 
> So, either the usb subsystem uses the same (re)initialization sequence
> following a reset as it does initially, or the XHCI driver needs to be 
> tweaked to
> either not drop the descriptor cache during reset, or rebuild it when it
> detects its missing.
> 
> 
> Thanks,
> 
> 
> 
> >
> > Best Regards
> > Guomin
> >> -Original Message-
> >> From: Jeremy Linton 
> >> Sent: Wednesday, July 15, 2020 8:19 AM
> >> To: Jiang, Guomin ; devel@edk2.groups.io
> >> Cc: Wang, Jian J ; Wu, Hao A
> >> ; Ni, Ray 
> >> Subject: Re: [PATCH v3 1/1] MdeModulePkg/UsbBusDxe: Rebuild the
> >> description table after Reset Device
> >>
> >> Hi,
> >>
> >> On 5/9/20 3:26 AM, Guomin Jiang wrote:
> >>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2694
> >>>
> >>> When the USB fail and then Reset Device, it should rebuild description.
> >>
> >>
> >> I pulled the latest edk2 a few hours ago and I'm still seeing the
> >> assert TrsRing != 0 messages on a real XHCI controller with the
> >> jmicron JBOD I mentioned earlier.
> >>
> >> Is there a newer version of this patch?
> >>
> >> Thanks,
> >>
> >>
> >>
> >>>
> >>> Signed-off-by: Guomin Jiang 
> >>> Cc: Jian J Wang 
> >>> Cc: Hao A Wu 
> >>> Cc: Ray Ni 
> >>> ---
> >>>MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c  |   7 ++
> >>>MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c | 152
> >> +++
> >>>MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h |  14 +++
> >>>3 files changed, 173 insertions(+)
> >>>
> >>> diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
> >>> b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
> >>> index 4b4915c019ad..7bb9373a6adf 100644
> >>> --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
> >>> +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
> >>> @@ -874,6 +874,13 @@ UsbIoPortReset (
> >>>  // is in CONFIGURED state.
> >>>  //
> >>>  if (Dev->ActiveConfig != NULL) {
> >>> +Status = UsbRebuildDescTable (Dev);
> >>> +
> >>> +if (EFI_ERROR (Status)) {
> >>> +  DEBUG (( DEBUG_ERROR, "UsbIoPortReset: failed to rebuild desc
> >>> + table
> >> - %r\n", Status));
> >>> +  goto ON_EXIT;
> >>> +}
> >>> +
> >>>Status = UsbSetConfig (Dev,
> >>> Dev->ActiveConfig->Desc.ConfigurationValue);
> >>>
> >>>if (EFI_ERROR (Status)) {
> >>> diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
> >>> b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
> >>> index b08188b1bc78..d8e5e50b7c5a 100644
> >>> --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
> >>> +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
> >>> @@ -900,6 +900,158 @@ UsbBuildDescTable (
> >>>  return EFI_SUCCESS;
> >>>}
> >>>
> >>> +/**
> >>> +  Copy the interface descriptor
> >>> +
> >>> +  @param[out]  DescBuf   The buffer of raw descriptor.
> >>> +  @param[in]   SrcBufThe buffer of raw descriptor
> >>> +**/
> >>> +VOID
> >>> +UsbCopyInterfaceDesc (
> >>> +  OUT USB_INTERFACE_DESC  *DescBuf,
> >>> +  IN  USB_INTERFACE_DESC  *SrcBuf
> >>> +  )
> >>> +{
> >>> +  

Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/PartitionDxe: Add already start check for child hanldes

2020-07-15 Thread Gao, Zhichao
Yes. I have checked the image with OVMF. The SUSE image has the MBR table but 
not like others, such as Ubuntu, RedHat and Fedora which would contain a 
partition entry with the entire disk.

That means it would pass the MBR child handle check and would never go to the 
UDF(or ElTorito) check.

I think we should update the invalid MBR check logic.

Thanks,
Zhichao

> -Original Message-
> From: Gary Lin 
> Sent: Thursday, July 16, 2020 11:33 AM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Wu, Hao A ; Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/PartitionDxe: Add
> already start check for child hanldes
> 
> On Tue, Jul 14, 2020 at 09:22:59AM +0800, Gao, Zhichao via groups.io wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823
> >
> > Treat the EFI_ALREADY_STARTED as EFI_SUCCESS to avoid the partition
> > driver continuely check next routine function.
> Hi Zhichao,
> 
> I just found that this patch breaks the loading of openSUSE iso images[*].
> Would you mind to take a look at it?
> 
> Thanks,
> 
> Gary Lin
> 
> [*] http://download.opensuse.org/distribution/leap/15.2/iso/openSUSE-Leap-
> 15.2-NET-x86_64.iso
> 
> >
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Signed-off-by: Zhichao Gao 
> > Reviewed-by: Hao A Wu 
> > ---
> >  MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 9 +
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > index d1c878ad2e..6a43c3cafb 100644
> > --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> > @@ -1276,6 +1276,15 @@ PartitionInstallChildHandle (
> >} else {
> >  FreePool (Private->DevicePath);
> >  FreePool (Private);
> > +
> > +//
> > +// if the Status == EFI_ALREADY_STARTED, it means the child handles
> > +// are already installed. So return EFI_SUCCESS to avoid do the next
> > +// partition type check.
> > +//
> > +if (Status == EFI_ALREADY_STARTED) {
> > +  Status = EFI_SUCCESS;
> > +}
> >}
> >
> >return Status;
> > --
> > 2.21.0.windows.1
> >
> >
> > 
> >


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

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



Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg.dsc: Add DxeAslUpdateLib to Components

2020-07-15 Thread Michael Kubacki
I haven't seen any further action on this patch. Ray/Sai, can you please 
help move it forward?


Thanks,
Michael

On 7/1/2020 11:44 AM, Chaganty, Rangasai V wrote:

Reviewed-by: Sai Chaganty 

-Original Message-
From: michael.kuba...@outlook.com 
Sent: Wednesday, July 01, 2020 10:50 AM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V ; Ni, Ray 

Subject: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg.dsc: Add 
DxeAslUpdateLib to Components

From: Michael Kubacki 

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

Adds DxeAslUpdateLib to the [Components] section so it is included in the 
package build.

Cc: Rangasai V Chaganty 
Cc: Ray Ni 
Signed-off-by: Michael Kubacki 
---
  Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc 
b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
index f9958836917a..029b9156f6dd 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -2,6 +2,7 @@
  # This package provides common open source Intel silicon modules.
  #
  # Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
  #
  #SPDX-License-Identifier: BSD-2-Clause-Patent
  #
@@ -87,6 +88,7 @@ [Components]
IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei.inf
IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf
IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf
+  IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf
  
  [BuildOptions]

*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.25.1.vfs.1.1



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

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



Re: [edk2-devel] [PATCH V3 3/3] MdeModulePkg/PartitionDxe: Add already start check for child hanldes

2020-07-15 Thread Gary Lin
On Tue, Jul 14, 2020 at 09:22:59AM +0800, Gao, Zhichao via groups.io wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823
> 
> Treat the EFI_ALREADY_STARTED as EFI_SUCCESS to avoid the partition driver
> continuely check next routine function.
Hi Zhichao,

I just found that this patch breaks the loading of openSUSE iso images[*].
Would you mind to take a look at it?

Thanks,

Gary Lin

[*] 
http://download.opensuse.org/distribution/leap/15.2/iso/openSUSE-Leap-15.2-NET-x86_64.iso

> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Zhichao Gao 
> Reviewed-by: Hao A Wu 
> ---
>  MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c 
> b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> index d1c878ad2e..6a43c3cafb 100644
> --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
> @@ -1276,6 +1276,15 @@ PartitionInstallChildHandle (
>} else {
>  FreePool (Private->DevicePath);
>  FreePool (Private);
> +
> +//
> +// if the Status == EFI_ALREADY_STARTED, it means the child handles
> +// are already installed. So return EFI_SUCCESS to avoid do the next
> +// partition type check.
> +//
> +if (Status == EFI_ALREADY_STARTED) {
> +  Status = EFI_SUCCESS;
> +}
>}
>  
>return Status;
> -- 
> 2.21.0.windows.1
> 
> 
> 
> 


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

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



[edk2-devel] [PATCH] BaseTools/PatchCheck.py: Skip length check for user name in xxx-by

2020-07-15 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2836
Current PatchCheck.py checks each line to ensure line's length is not
larger than 76. But there's a case that length of user's name is much
longer than that number. So enhance the script to handle this case.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 BaseTools/Scripts/PatchCheck.py | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 52244b0bc4d8..7db0775d14d1 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -268,7 +268,14 @@ class CommitMessageCheck:
 for i in range(2, count):
 if (len(lines[i]) >= 76 and
 len(lines[i].split()) > 1 and
-not lines[i].startswith('git-svn-id:')):
+not lines[i].startswith('git-svn-id:') and
+not lines[i].startswith('Reviewed-by') and
+not lines[i].startswith('Acked-by:') and
+not lines[i].startswith('Tested-by:') and
+not lines[i].startswith('Reported-by:') and
+not lines[i].startswith('Suggested-by:') and
+not lines[i].startswith('Signed-off-by:') and
+not lines[i].startswith('Cc:')):
 #
 # Print a warning if body line is longer than 75 characters
 #
-- 
2.18.0.windows.1


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

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



[edk2-devel] File in the build question. I'm working on a smart git grep

2020-07-15 Thread Andrew Fish via groups.io
I think I mentioned before on the list that I think a smart git grep that only 
scopes to a give target would be useful. For our internal repo we have lots of 
targets and lots of generations of platforms so lots of code that hits in a git 
grep that is not in the platform. 

In thinking about this it looks to me like the Build/**/AutoGenTimeStamp 
(module build files) files and the Build/**/AutoGen (global build files) 
contain a list of all the files for a project.

I wrote some python that takes the build target (OvmfX64 for example) parses 
all the  AutoGenTimeStamp and AutoGen files merges then together and removes 
the workspace path. All the other arguments are passed to `git grep` and only 
lines that match the file set are displayed. 

My questions are:
1) Did I extract all the files?
2) Are people interested in this feature?
3) Any ideas on how to hook it in? I just dropped in the root of the git tree 
for development. 
4) Any other cool ideas of what we could do with a file list of the project?

Example (to give people a feel for how it works):
$ time ./ggrep.py OvmfX64 CC_FLAGS | wc -l
  42

real0m0.318s
user0m0.243s
sys 0m0.576s
$ time git grep CC_FLAGS | wc -l
 479

real0m0.110s
user0m0.148s
sys 0m0.525s
$ ./ggrep.py OvmfX64 CC_FLAGS
OvmfX64 only: git grep CC_FLAGS
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf:96:  MSFT:*_*_*_CC_FLAGS = 
/wd4090
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf:100:  RVCT:*_*_ARM_CC_FLAGS = 
-JCryptoPkg/Include --diag_remark=1
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf:102:  GCC:*_CLANG35_*_CC_FLAGS 
= -std=c99
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf:103:  GCC:*_CLANG38_*_CC_FLAGS 
= -std=c99
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf:104:  GCC:*_CLANGPDB_*_CC_FLAGS 
= -std=c99 -Wno-error=incompatible-pointer-types
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf:106:  XCODE:*_*_*_CC_FLAGS = 
-std=c99
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:55:   
MSFT:DEBUG_VS2003_IA32_CC_FLAGS== /nologo /c /WX /W4 /Gs32768 /Gy /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- /Zi /Gm
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:56:   
MSFT:RELEASE_VS2003_IA32_CC_FLAGS  == /nologo /c /WX /W4 /Gs32768 /Gy /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX-
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:57:   
MSFT:DEBUG_VS2003xASL_IA32_CC_FLAGS== /nologo /c /WX /W4 /Gs32768 /Gy /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX- /Zi /Gm
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:58:   
MSFT:RELEASE_VS2003xASL_IA32_CC_FLAGS  == /nologo /c /WX /W4 /Gs32768 /Gy /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /GX-
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:59:   
MSFT:DEBUG_DDK3790_IA32_CC_FLAGS   == /nologo /c /WX /Gy /Gs32768 /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:60:   
MSFT:RELEASE_DDK3790_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:61:   
MSFT:DEBUG_DDK3790xASL_IA32_CC_FLAGS   == /nologo /c /WX /Gy /Gs32768 /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:62:   
MSFT:RELEASE_DDK3790xASL_IA32_CC_FLAGS == /nologo /c /WX /Gy /Gs32768 /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:63:   
MSFT:DEBUG_*_IA32_CC_FLAGS == /nologo /c /WX /GS- /W4 /Gs32768 /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:64:   
MSFT:RELEASE_*_IA32_CC_FLAGS   == /nologo /c /WX /GS- /W4 /Gs32768 /D 
UNICODE /O1b2 /FIAutoGen.h /EHs-c- /GR- /GF
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:65:   MSFT:DEBUG_*_X64_CC_FLAGS 
 == /nologo /c /WX /GS- /X /W4 /Gs32768 /D UNICODE /O1b2s /Gy 
/FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:66:   
MSFT:RELEASE_*_X64_CC_FLAGS== /nologo /c /WX /GS- /X /W4 /Gs32768 
/D UNICODE /O1b2s /Gy /FIAutoGen.h /EHs-c- /GR- /GF
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf:67:  INTEL:*_*_*_CC_FLAGS   
 =  /Oi-
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf:569:  MSFT:*_*_IA32_CC_FLAGS  
 = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) /wd4090 /wd4132 /wd4244 
/wd4245 /wd4267 /wd4310 /wd4389 /wd4700 /wd4702 /wd4706 /wd4819
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf:570:  MSFT:*_*_X64_CC_FLAGS   
 = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) /wd4090 /wd4132 /wd4244 
/wd4245 /wd4267 /wd4306 /wd4310 /wd4700 /wd4389 /wd4702 /wd4706 /wd4819
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf:572:  INTEL:*_*_IA32_CC_FLAGS 
 = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC $(OPENSSL_FLAGS) /w
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf:573:  INTEL:*_*_X64_CC_FLAGS  
 = -U_WIN32 -U_WIN64 -U_MSC_VER -U__ICC $(OPENSSL_FLAGS) /w
CryptoPkg/Library/OpensslLib/OpensslLib

Re: [edk2-devel] [PATCH v3 2/3] CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)

2020-07-15 Thread Matthew Carlson
You hit the nail on the head. I think it's a reasonable limitation to not
test the CrtWrapper functions. Our goal is to test the crypto functions and
I think the current tests do a decent job of that. The idea of adding some
of these limitations to the inf and header files could be useful, I'll do a
v5 and add it in.

-Matthew Carlson


On Wed, Jul 15, 2020 at 12:03 PM Kinney, Michael D <
michael.d.kin...@intel.com> wrote:

> Matt,
>
>
>
> For (4) and (5) I think I see the issue.  Host based unit tests always
> link against the standard C lib for the host OS env and
>
> those are in conflict with some if the wrappers that are provided to make
> OpenSSL work in an EDK II FW build env.
>
>
>
> So the approach to unit testing BaseCryptLib is not to test the actually
> lib instances used in FW, but to instead test the
>
> source code of the BaseCryptLib that is used by the FW specific instances.
> There is a small chance of some differences
>
> that may not be caught, but we can get really good unit test coverage for
> the source code that is identical in both host
>
> and FW instances.  If this is a correct assessment, you may want to add
> some of this information to the INF file header of
>
> and source file headers for the unit tests.
>
>
>
> Thanks,
>
>
>
> Mike
>
>
>
> *From:* Matthew Carlson 
> *Sent:* Wednesday, July 15, 2020 11:16 AM
> *To:* Kinney, Michael D 
> *Cc:* devel@edk2.groups.io; Wang, Jian J ; Lu,
> XiaoyuX 
> *Subject:* Re: [edk2-devel] [PATCH v3 2/3] CryptoPkg: BaseCryptLib: Add
> unit tests (Host and Shell based)
>
>
>
> Hey Mike,
>
>
>
> 1. I'll move it for v4.
>
> 2. I'll remove that, thanks!
>
> 3. I'll fix that as well, good spot.
>
> 4. It's mostly the same except for the different CrtWrappers
>
> 5. We need a host-specific CrtWrapper since the regular one has a bunch of
> conflicts with regular C98, but there are a few functions that since we're
> building no std mode of OpenSSL we still need to provide.
>
> 6. That would be my guess- this is largely based on the edk2-staging HBFA
> branch and I've had to reverse engineer some of the steps for
> generating the test data. I fixed the instructions.
>
>
> -Matthew Carlson
>
>
>
>
>
> On Tue, Jul 14, 2020 at 7:53 PM Kinney, Michael D <
> michael.d.kin...@intel.com> wrote:
>
> Hi Matt,
>
> I think the BaseCryptLib unit tests may need some more work.
>
> 1) The DSC file for host based tests is in the wrong directory.
>It should be in CryptoPkg/Test to match the MdePkg, MdeModulePkg
>and UnitTestFrameworkPkg location.
>
> 2) CryptoPkg/CryptoPkg.dsc includes a reference to the host based
>library UnitTestHostBaseCryptLib.inf.  This should only be
>listed in the host based DSC file.
>
> 3) CryptoPkg\Library\BaseCryptLib\UnitTestHostBaseCryptLib.inf
>This file appears to only be for host based tests, but it
>lists compatibility with DXE_DRIVER DXE_CORE UEFI_APPLICATION
> UEFI_DRIVER
>and does not list HOST_APPLICATION as expected.
>
> 4) Why do we need a new lib instance of the BaseCryptLib for
>host based unit testing.  I would think we would want to perform
>unit tests on the BaseCryptLib instances that would actually be
>used in FW components.  Can we update the unit tests to test
>the services provided in the Base, Pei, Runtime, and Smm
>instances of the BaseCryptLib?
>
> 5) Why do we need a host based specific version of the CrtWrapper,
>UnitTestHostCrtWrapper.c?
>
> 6) The file CryptoPkg/Test/UnitTest/Librray/BaseCryptLib/TestEKUCerts/
>ChainCreationInstructions.txt makes reference to a bintohex tool
>and putting the results in a file called AllTestSignatures.h.
>But I do not see this file in the patch.  Are these instructions
>out of date?
>
> Thanks,
>
> Mike
>
>

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

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



Re: [edk2-devel] [edk2-platforms: PATCH V1] MinPlatformPkg/PlatformInitPei:

2020-07-15 Thread Chaganty, Rangasai V
I see the changes in MinPlatformPkg.dec file are already checked in a commit 
back on April 22 so you might want to disregard that in this change.
With that:
Reviewed-by: Sai Chaganty 


-Original Message-
From: Kumar, Chandana C  
Sent: Wednesday, July 15, 2020 3:49 AM
To: devel@edk2.groups.io
Cc: Chaganty, Rangasai V ; Chiu, Chasel 
; Desimone, Nathaniel L 
Subject: [edk2-platforms: PATCH V1] MinPlatformPkg/PlatformInitPei:

Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

Update ReportCpuHobLib to PlatformInitPreMem driver and dec file.

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

Change-Id: Iad1be2612e0748d5c9a2a766cd2256dd9845ec13
Signed-off-by: Chandana Kumar 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
---
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
   | 5 +++--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 7f74ac93..da312c86 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -6,7 +6,7 @@
 # INF files to generate AutoGen.c and AutoGen.h files  # for the build 
infrastructure.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights 
+reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -68,7 +68,8 @@
   TestPointLib|Include/Library/TestPointLib.h
   TestPointCheckLib|Include/Library/TestPointCheckLib.h
 
-SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+  SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/Platfor
+++ mInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights 
+reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
--
2.16.2.windows.1


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

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



[edk2-devel] [PATCH v4 0/3] Add Unit Tests for BaseCryptLib to CryptoPkg

2020-07-15 Thread Matthew Carlson
From: Matthew Carlson 

This turns on Host Based Unit Tests for CryptoPkg, adds the unit test itself, 
and 
adds a POSIX BaseTimerLib for unit tests.

Matthew Carlson (3):
  UnitTestFrameworkPkg : BaseTimerLibPosix: Adds a host-based timer Lib
  CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)
  AzurePipelines : Pr Gate: Turn on HBUT for CryptoPkg

 CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
|   93 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c   
| 1002 
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BaseCryptLibUnitTests.c   
|   66 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BlockCipherTests.c
|  293 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/DhTests.c 
|  106 +++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HashTests.c   
|  197 
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/HmacTests.c   
|  184 
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/OaepEncryptTests.c
|  308 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs5Pbkdf2Tests.c
|   71 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTests.c   
|  524 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RandTests.c   
|   51 +
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaPkcs7Tests.c   
|  415 
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/RsaTests.c
|  310 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TSTests.c 
|  335 +++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
|   81 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMainBCOP.c
|   58 ++
 UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/TimerLibPosix.c   
|  132 +++
 .azurepipelines/templates/pr-gate-build-job.yml
|2 +-
 CryptoPkg/CryptoPkg.ci.yaml
|4 +
 CryptoPkg/CryptoPkg.dsc
|   25 +
 CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
|   90 ++
 CryptoPkg/Test/CryptoPkgHostUnitTest.dsc   
|   35 +
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Pkcs7EkuTestSignatures.h  
|  789 +++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLib.h
|  121 +++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibHost.inf  
|   46 +
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibUefiShell.inf 
|   49 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/ChainCreationInstructions.txt
|   92 ++
 CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/CreateTestCerts.cmd  
|   11 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/SignFirmwareWithEKUs.cmd
 |   76 ++
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingIssuingCA.ini
  |   45 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSigner.ini
 |   25 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSignerPid1.ini
 |   24 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingLeafSignerPid12345.ini
 |   27 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingNoEKUsInSigner.ini
 |   16 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingPolicyCA.ini
   |   28 +
 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestEKUCerts/TestEKUParsingRoot.ini
   |   28 +
 UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.inf 
|   33 +
 UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.uni 
|   14 +
 UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc 
|1 +
 UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc  
|1 +
 40 files changed, 5807 insertions(+), 1 deletion(-)
 create mode 100644 
CryptoPkg/Library/BaseCryptLib/SysCall/UnitTestHostCrtWrapper.c
 create mode 100644 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/AuthenticodeTests.c
 create mode 100644 
CryptoPkg/Test/UnitTest/Library/BaseCryptLib/Base

[edk2-devel] [PATCH v4 3/3] AzurePipelines : Pr Gate: Turn on HBUT for CryptoPkg

2020-07-15 Thread Matthew Carlson
From: Matthew Carlson 

Turns on Host Based Unit Tests for CryptoPkg by enabling the target
NOOPT in the CI pipeline.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 

Reviewed-by: Michael D Kinney 
Signed-off-by: Matthew Carlson 
---
 .azurepipelines/templates/pr-gate-build-job.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.azurepipelines/templates/pr-gate-build-job.yml 
b/.azurepipelines/templates/pr-gate-build-job.yml
index a9f89aa68451..e84ba80030b1 100644
--- a/.azurepipelines/templates/pr-gate-build-job.yml
+++ b/.azurepipelines/templates/pr-gate-build-job.yml
@@ -40,7 +40,7 @@ jobs:
 Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
   TARGET_CRYPTO:
 Build.Pkgs: 'CryptoPkg'
-Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
+Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
   TARGET_SECURITY:
 Build.Pkgs: 'SecurityPkg'
 Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
-- 
2.27.0.windows.1


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

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



[edk2-devel] [PATCH v4 1/3] UnitTestFrameworkPkg : BaseTimerLibPosix: Adds a host-based timer Lib

2020-07-15 Thread Matthew Carlson
From: Matthew Carlson 

This adds a host based BaseTimerLib that won't assert.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Reviewed-by: Michael D Kinney 
Signed-off-by: Matthew Carlson 
---
 UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/TimerLibPosix.c   | 
132 
 UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.inf |  
33 +
 UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.uni |  
14 +++
 UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc |   
1 +
 UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc  |   
1 +
 5 files changed, 181 insertions(+)

diff --git 
a/UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/TimerLibPosix.c 
b/UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/TimerLibPosix.c
new file mode 100644
index ..3c1394e3b21b
--- /dev/null
+++ b/UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/TimerLibPosix.c
@@ -0,0 +1,132 @@
+/** @file
+  A semi-functional instance of the Timer Library.
+
+  Copyright (c) Microsoft Corporation.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Stalls the CPU for at least the given number of microseconds.
+
+  @param  MicroSeconds  The minimum number of microseconds to delay.
+  @return The value of MicroSeconds inputted.
+
+**/
+UINTN
+EFIAPI
+MicroSecondDelay (
+  IN  UINTN MicroSeconds
+  )
+{
+  // Since this is a host based test, we don't actually want to stall
+  return MicroSeconds;
+}
+
+/**
+  Stalls the CPU for at least the given number of nanoseconds.
+
+  @param  NanoSeconds The minimum number of nanoseconds to delay.
+  @return The value of NanoSeconds inputted.
+
+**/
+UINTN
+EFIAPI
+NanoSecondDelay (
+  IN  UINTN NanoSeconds
+  )
+{
+  // Since this is a host based test, we don't actually want to stall
+  return NanoSeconds;
+}
+
+/**
+  Retrieves the current value of a 64-bit free running performance counter.
+
+  The counter can either count up by 1 or count down by 1. If the physical
+  performance counter counts by a larger increment, then the counter values
+  must be translated. The properties of the counter can be retrieved from
+  GetPerformanceCounterProperties().
+
+  @return The current value of the free running performance counter.
+
+**/
+UINT64
+EFIAPI
+GetPerformanceCounter (
+  VOID
+  )
+{
+  struct timespec ts;
+  timespec_get(&ts, TIME_UTC);
+  // Return the current number of nanoseconds on the clock
+  return ts.tv_nsec;
+}
+
+/**
+  Retrieves the 64-bit frequency in Hz and the range of performance counter
+  values.
+
+  If StartValue is not NULL, then the value that the performance counter starts
+  with immediately after is it rolls over is returned in StartValue. If
+  EndValue is not NULL, then the value that the performance counter end with
+  immediately before it rolls over is returned in EndValue. The 64-bit
+  frequency of the performance counter in Hz is always returned. If StartValue
+  is less than EndValue, then the performance counter counts up. If StartValue
+  is greater than EndValue, then the performance counter counts down. For
+  example, a 64-bit free running counter that counts up would have a StartValue
+  of 0 and an EndValue of 0x. A 24-bit free running counter
+  that counts down would have a StartValue of 0xFF and an EndValue of 0.
+
+  @param  StartValue  The value the performance counter starts with when it
+  rolls over.
+  @param  EndValueThe value that the performance counter ends with before
+  it rolls over.
+
+  @return The frequency in Hz.
+
+**/
+UINT64
+EFIAPI
+GetPerformanceCounterProperties (
+  OUT  UINT64*StartValue,  OPTIONAL
+  OUT  UINT64*EndValue OPTIONAL
+  )
+{
+  if ( EndValue != NULL ) {
+*EndValue = MAX_UINT64;
+  }
+  if ( StartValue != NULL ) {
+*StartValue = 0;
+  }
+  // Return the number of nanoseconds in a second
+  return 10;
+}
+
+/**
+  Converts elapsed ticks of performance counter to time in nanoseconds.
+
+  This function converts the elapsed ticks of running performance counter to
+  time value in unit of nanoseconds.
+
+  @param  Ticks The number of elapsed ticks of running performance counter.
+
+  @return The elapsed time in nanoseconds.
+
+**/
+UINT64
+EFIAPI
+GetTimeInNanoSecond (
+  IN  UINT64 Ticks
+  )
+{
+  return Ticks;
+}
diff --git 
a/UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.inf 
b/UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.inf
new file mode 100644
index ..797f04bb125b
--- /dev/null
+++ b/UnitTestFrameworkPkg/Library/Posix/BaseTimerLibPosix/BaseTimerLibPosix.inf
@@ -0,0 +1,33 @@
+## @file
+#  An instance of Timer Library for posix compliant 

[edk2-devel] Extremely long delays with UDF support?

2020-07-15 Thread Tim Lewis
Has anyone else seen extremely long delays with UDF support on USB
CD-ROMs/DVDs? We found that PartitionDxe can add seconds because of the
number blocks being read. 

 

Thanks,

 

Tim


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

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



Re: [edk2-devel] [PATCH v3 2/3] CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)

2020-07-15 Thread Michael D Kinney
Matt,

For (4) and (5) I think I see the issue.  Host based unit tests always link 
against the standard C lib for the host OS env and
those are in conflict with some if the wrappers that are provided to make 
OpenSSL work in an EDK II FW build env.

So the approach to unit testing BaseCryptLib is not to test the actually lib 
instances used in FW, but to instead test the
source code of the BaseCryptLib that is used by the FW specific instances.  
There is a small chance of some differences
that may not be caught, but we can get really good unit test coverage for the 
source code that is identical in both host
and FW instances.  If this is a correct assessment, you may want to add some of 
this information to the INF file header of
and source file headers for the unit tests.

Thanks,

Mike

From: Matthew Carlson 
Sent: Wednesday, July 15, 2020 11:16 AM
To: Kinney, Michael D 
Cc: devel@edk2.groups.io; Wang, Jian J ; Lu, XiaoyuX 

Subject: Re: [edk2-devel] [PATCH v3 2/3] CryptoPkg: BaseCryptLib: Add unit 
tests (Host and Shell based)

Hey Mike,

1. I'll move it for v4.
2. I'll remove that, thanks!
3. I'll fix that as well, good spot.
4. It's mostly the same except for the different CrtWrappers
5. We need a host-specific CrtWrapper since the regular one has a bunch of 
conflicts with regular C98, but there are a few functions that since we're 
building no std mode of OpenSSL we still need to provide.
6. That would be my guess- this is largely based on the edk2-staging HBFA 
branch and I've had to reverse engineer some of the steps for generating the 
test data. I fixed the instructions.

-Matthew Carlson


On Tue, Jul 14, 2020 at 7:53 PM Kinney, Michael D 
mailto:michael.d.kin...@intel.com>> wrote:
Hi Matt,

I think the BaseCryptLib unit tests may need some more work.

1) The DSC file for host based tests is in the wrong directory.
   It should be in CryptoPkg/Test to match the MdePkg, MdeModulePkg
   and UnitTestFrameworkPkg location.

2) CryptoPkg/CryptoPkg.dsc includes a reference to the host based
   library UnitTestHostBaseCryptLib.inf.  This should only be
   listed in the host based DSC file.

3) CryptoPkg\Library\BaseCryptLib\UnitTestHostBaseCryptLib.inf
   This file appears to only be for host based tests, but it
   lists compatibility with DXE_DRIVER DXE_CORE UEFI_APPLICATION UEFI_DRIVER
   and does not list HOST_APPLICATION as expected.

4) Why do we need a new lib instance of the BaseCryptLib for
   host based unit testing.  I would think we would want to perform
   unit tests on the BaseCryptLib instances that would actually be
   used in FW components.  Can we update the unit tests to test
   the services provided in the Base, Pei, Runtime, and Smm
   instances of the BaseCryptLib?

5) Why do we need a host based specific version of the CrtWrapper,
   UnitTestHostCrtWrapper.c?

6) The file CryptoPkg/Test/UnitTest/Librray/BaseCryptLib/TestEKUCerts/
   ChainCreationInstructions.txt makes reference to a bintohex tool
   and putting the results in a file called AllTestSignatures.h.
   But I do not see this file in the patch.  Are these instructions
   out of date?

Thanks,

Mike

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

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



Re: [edk2-devel] [PATCH v3 2/3] CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)

2020-07-15 Thread Matthew Carlson
Hey Mike,

1. I'll move it for v4.
2. I'll remove that, thanks!
3. I'll fix that as well, good spot.
4. It's mostly the same except for the different CrtWrappers
5. We need a host-specific CrtWrapper since the regular one has a bunch of
conflicts with regular C98, but there are a few functions that since we're
building no std mode of OpenSSL we still need to provide.
6. That would be my guess- this is largely based on the edk2-staging HBFA
branch and I've had to reverse engineer some of the steps for
generating the test data. I fixed the instructions.

-Matthew Carlson


On Tue, Jul 14, 2020 at 7:53 PM Kinney, Michael D <
michael.d.kin...@intel.com> wrote:

> Hi Matt,
>
> I think the BaseCryptLib unit tests may need some more work.
>
> 1) The DSC file for host based tests is in the wrong directory.
>It should be in CryptoPkg/Test to match the MdePkg, MdeModulePkg
>and UnitTestFrameworkPkg location.
>
> 2) CryptoPkg/CryptoPkg.dsc includes a reference to the host based
>library UnitTestHostBaseCryptLib.inf.  This should only be
>listed in the host based DSC file.
>
> 3) CryptoPkg\Library\BaseCryptLib\UnitTestHostBaseCryptLib.inf
>This file appears to only be for host based tests, but it
>lists compatibility with DXE_DRIVER DXE_CORE UEFI_APPLICATION
> UEFI_DRIVER
>and does not list HOST_APPLICATION as expected.
>
> 4) Why do we need a new lib instance of the BaseCryptLib for
>host based unit testing.  I would think we would want to perform
>unit tests on the BaseCryptLib instances that would actually be
>used in FW components.  Can we update the unit tests to test
>the services provided in the Base, Pei, Runtime, and Smm
>instances of the BaseCryptLib?
>
> 5) Why do we need a host based specific version of the CrtWrapper,
>UnitTestHostCrtWrapper.c?
>
> 6) The file CryptoPkg/Test/UnitTest/Librray/BaseCryptLib/TestEKUCerts/
>ChainCreationInstructions.txt makes reference to a bintohex tool
>and putting the results in a file called AllTestSignatures.h.
>But I do not see this file in the patch.  Are these instructions
>out of date?
>
> Thanks,
>
> Mike

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

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



Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand

2020-07-15 Thread Vladimir Olovyannikov via groups.io
Hi Laszlo,

Thank you for supporting this.
I can add required support.
But shouldn't we wait until the patch is reviewed and approved first?
I don't know the proper procedure. Please advise.

Thank you,
Vladimir

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Laszlo
> Ersek
> Sent: Wednesday, July 15, 2020 5:59 AM
> To: devel@edk2.groups.io; vladimir.olovyanni...@broadcom.com
> Cc: Samer El-Haj-Mahmoud ; Zhichao
> Gao ; Maciej Rabeda
> ; Jiaxin Wu ; Siyuan
> Fu ; Ray Ni ; Liming Gao
> ; Nd 
> Subject: Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add
> HttpDynamicCommand
>
> On 07/15/20 14:55, Laszlo Ersek wrote:
> > On 07/13/20 20:31, Vladimir Olovyannikov via groups.io wrote:
> >> Introduce an http client utilizing EDK2 HTTP protocol, to allow fast
> >> image downloading from http/https servers.
> >> HTTP download speed is usually faster than tftp.
> >> The client is based on the same approach as tftp dynamic command, and
> >> uses the same UEFI Shell command line parameters. This makes it easy
> >> integrating http into existing UEFI Shell scripts.
> >> Note that to enable HTTP download, feature Pcd
> >> gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections must be set
> to
> >> TRUE.
> >>
> >> Signed-off-by: Vladimir Olovyannikov
> >> 
> >> Tested-By: Samer El-Haj-Mahmoud 
> >> Cc: Zhichao Gao 
> >> Cc: Maciej Rabeda 
> >> Cc: Jiaxin Wu 
> >> Cc: Siyuan Fu 
> >> Cc: Ray Ni 
> >> Cc: Liming Gao 
> >> Cc: Nd 
> >> ---
> >>  .../DynamicCommand/HttpDynamicCommand/Http.c  | 1700
> +
> >>  .../DynamicCommand/HttpDynamicCommand/Http.h  |   84 +
> >>  .../HttpDynamicCommand/Http.uni   |  113 ++
> >>  .../HttpDynamicCommand/HttpApp.c  |   53 +
> >>  .../HttpDynamicCommand/HttpApp.inf|   58 +
> >>  .../HttpDynamicCommand/HttpDynamicCommand.c   |  134 ++
> >>  .../HttpDynamicCommand/HttpDynamicCommand.inf |   63 +
> >>  ShellPkg/Include/Guid/ShellLibHiiGuid.h   |5 +
> >>  ShellPkg/ShellPkg.dec |1 +
> >>  ShellPkg/ShellPkg.dsc |5 +
> >>  10 files changed, 2216 insertions(+)  create mode 100644
> >> ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c
> >>  create mode 100644
> ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h
> >>  create mode 100644
> >> ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni
> >>  create mode 100644
> >> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c
> >>  create mode 100644
> >> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.inf
> >>  create mode 100644
> >>
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> .c
> >>  create mode 100644
> >>
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> .inf
> >
> > This feature sounds very attractive for virtualization too.
> >
> > I suggest filing a BZ for collecting the various versions of the patch
> > (or patch series) in a common spot. (Based on the size of the patch, I
> > assume there could be multiple versions.)
>
> Sorry, I didn't look carefully enough at the subject -- I see we're
> already at v3.
> In that case, the BZ should please reference all three versions of the
> patch
> (thus far):
>
> * version 1:
>   [edk2-devel] [PATCH 1/1] ShellPkg/DynamicCommand: add
> HttpDynamicCommand
>   https://edk2.groups.io/g/devel/message/53483
>   http://mid.mail-archive.com/20200125005718.8931-1-
> vladimir.olovyanni...@broadcom.com
>
> * version 2:
>   [edk2-devel] [PATCH v2 1/1] ShellPkg/DynamicCommand: add
> HttpDynamicCommand
>   https://edk2.groups.io/g/devel/message/59160
>   http://mid.mail-archive.com/20200511180310.30964-1-
> vladimir.olovyanni...@broadcom.com
>
> * version 3 (this version):
>   [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add
> HttpDynamicCommand
>   https://edk2.groups.io/g/devel/message/62452
>   http://mid.mail-archive.com/20200713183137.9825-1-
> vladimir.olovyanni...@broadcom.com
>
> Thanks!
> Laszlo
>
>
> 

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

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



Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfPkg.dec: Adjust PcdMptScsiStallPerPollUsec

2020-07-15 Thread Laszlo Ersek
On 07/15/20 17:45, Laszlo Ersek wrote:
> On 07/15/20 10:20, Gary Lin wrote:
>> The toke value of PcdMptScsiStallPerPollUsec should be 0x3a since the
>> previous toke value is 0x39.
>>
>> Cc: Jordan Justen 
>> Cc: Laszlo Ersek 
>> Cc: Ard Biesheuvel 
>> Cc: Liran Alon 
>> Cc: Nikita Leshenko 
>> Signed-off-by: Gary Lin 
>> ---
>>  OvmfPkg/OvmfPkg.dec | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
>> index 65bb2bb0eb4c..2b0f137cbcce 100644
>> --- a/OvmfPkg/OvmfPkg.dec
>> +++ b/OvmfPkg/OvmfPkg.dec
>> @@ -172,7 +172,7 @@ [PcdsFixedAtBuild]
>>gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiMaxTargetLimit|7|UINT8|0x39
>>  
>>## Microseconds to stall between polling for MptScsi request result
>> -  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x40
>> +  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x3a
>>  
>>
>> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8
>>
>> gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9
>>
> 
> Thank you for the patch!
> 
> I've updated the subject:
> 
>   OvmfPkg/OvmfPkg.dec: Adjust PcdMptScsiStallPerPollUsec token value
> 
> I've also fixed two typos in the commit message (s/toke value/token
> value/, twice).
> 
> Reviewed-by: Laszlo Ersek 
> 
> I'm trying to merge this via .

Commit d9269d691388.

Thanks!
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 46/46] Maintainers.txt: Add reviewers for the OvmfPkg SEV-related files

2020-07-15 Thread Laszlo Ersek
On 07/14/20 21:50, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> Register reviewers for the SEV-related files in OvmfPkg.
> 
> Cc: Andrew Fish 
> Cc: Laszlo Ersek 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Brijesh Singh 
> Acked-by: Brijesh Singh 
> Reviewed-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  Maintainers.txt | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 32c9003a6209..cd10dc5e95fd 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -406,6 +406,16 @@ F: OvmfPkg/PvScsiDxe/
>  R: Liran Alon 
>  R: Nikita Leshenko 
>  
> +OvmfPkg: SEV-related modules
> +F: OvmfPkg/AmdSevDxe/
> +F: OvmfPkg/Include/Library/MemEncryptSevLib.h
> +F: OvmfPkg/IoMmuDxe/AmdSevIoMmu.*
> +F: OvmfPkg/Library/BaseMemEncryptSevLib/
> +F: OvmfPkg/Library/VmgExitLib/
> +F: OvmfPkg/PlatformPei/AmdSev.c
> +R: Tom Lendacky 
> +R: Brijesh Singh 
> +
>  OvmfPkg: TCG- and TPM2-related modules
>  F: OvmfPkg/Include/IndustryStandard/QemuTpm.h
>  F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
> 

rebase looks fine, thanks!
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 26/46] OvmfPkg/VmgExitLib: Add support for DR7 Read/Write NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:37, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a DR7 read or write intercept generates a #VC exception.
> The #VC handler must provide special support to the guest for this. On
> a DR7 write, the #VC handler must cache the value and issue a VMGEXIT
> to notify the hypervisor of the write. However, the #VC handler must
> not actually set the value of the DR7 register. On a DR7 read, the #VC
> handler must return the cached value of the DR7 register to the guest.
> VMGEXIT is not invoked for a DR7 register read.
> 
> The caching of the DR7 values will make use of the per-CPU data pages
> that are allocated along with the GHCB pages. The per-CPU page for a
> vCPU is the page that immediately follows the vCPU's GHCB page. Since
> each GHCB page is unique for a vCPU, the page that follows becomes
> unique for that vCPU. The SEC phase will reserves an area of memory for
> a single GHCB and per-CPU page for use by the BSP. After transitioning
> to the PEI phase, new GHCB and per-CPU pages are allocated for the BSP
> and all APs.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 114 ++
>  1 file changed, 114 insertions(+)

Thanks for the comment style fixes, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 25/46] OvmfPkg/VmgExitLib: Add support for MWAIT/MWAITX NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:37, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a MWAIT/MWAITX intercept generates a #VC exception.
> VMGEXIT must be used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 36 +++
>  1 file changed, 36 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 21/46] OvmfPkg/VmgExitLib: Add support for INVD NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a INVD intercept generates a #VC exception. VMGEXIT must be
> used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 29 +++
>  1 file changed, 29 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 22/46] OvmfPkg/VmgExitLib: Add support for VMMCALL NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a VMMCALL intercept generates a #VC exception. VMGEXIT must
> be used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 48 +++
>  1 file changed, 48 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 20/46] OvmfPkg/VmgExitLib: Add support for RDPMC NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a RDPMC intercept generates a #VC exception. VMGEXIT must be
> used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 46 +++
>  1 file changed, 46 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 24/46] OvmfPkg/VmgExitLib: Add support for MONITOR/MONITORX NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a MONITOR/MONITORX intercept generates a #VC exception.
> VMGEXIT must be used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 38 +++
>  1 file changed, 38 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 23/46] OvmfPkg/VmgExitLib: Add support for RDTSCP NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a RDTSCP intercept generates a #VC exception. VMGEXIT must be
> used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 47 +++
>  1 file changed, 47 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 19/46] OvmfPkg/VmgExitLib: Add support for RDTSC NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a RDTSC intercept generates a #VC exception. VMGEXIT must be
> used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 43 +++
>  1 file changed, 43 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 18/46] OvmfPkg/VmgExitLib: Add support for WBINVD NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a WBINVD intercept generates a #VC exception. VMGEXIT must be
> used to allow the hypervisor to handle this intercept.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 29 +++
>  1 file changed, 29 insertions(+)

Thanks for the comment style fix, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 17/46] OvmfPkg/VmgExitLib: Add support for NPF NAE events (MMIO)

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a NPF intercept for an NPT entry with a reserved bit set
> generates a #VC exception. This condition is assumed to be an MMIO access.
> VMGEXIT must be used to allow the hypervisor to handle this intercept.
> 
> Add support to construct the required GHCB values to support a NPF NAE
> event for MMIO.  Parse the instruction that generated the #VC exception,
> setting the required register values in the GHCB and creating the proper
> SW_EXIT_INFO1, SW_EXITINFO2 and SW_SCRATCH values in the GHCB.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 486 ++
>  1 file changed, 486 insertions(+)

Thanks for the updates:
- CopyMem() indentation
- Displacement multiplier cast to INT64 (VS warning suppression)
- comment style fixes
- other indentation fixes

My ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 06/46] MdePkg/BaseLib: Add support for the XGETBV instruction

2020-07-15 Thread Lendacky, Thomas
On 7/15/20 10:55 AM, Laszlo Ersek wrote:
> Hi Tom,
> 
> On 07/14/20 16:27, Lendacky, Thomas wrote:
>> From: Tom Lendacky 
>>
>> BZ: 
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2198&data=02%7C01%7Cthomas.lendacky%40amd.com%7C00c7f97271bf4efd050608d828d79a13%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637304253757199823&sdata=hQ%2BP%2F5DintrtGi66sfqRI%2B9h4V1rTB1YlYdY1VX6sLM%3D&reserved=0
>>
>> Under SEV-ES, a CPUID instruction requires the current value of the XCR0
>> register. In order to retrieve that value, the XGETBV instruction needs
>> to be executed.
>>
>> Provide the necessary support to execute the XGETBV instruction.
>>
>> Cc: Michael D Kinney 
>> Cc: Liming Gao 
>> Signed-off-by: Tom Lendacky 
>> ---
>>  MdePkg/Library/BaseLib/BaseLib.inf  |  2 ++
>>  MdePkg/Include/Library/BaseLib.h| 17 +
>>  MdePkg/Library/BaseLib/Ia32/GccInline.c | 28 
>>  MdePkg/Library/BaseLib/X64/GccInline.c  | 30 ++
>>  MdePkg/Library/BaseLib/Ia32/XGetBv.nasm | 31 ++
>>  MdePkg/Library/BaseLib/X64/XGetBv.nasm  | 34 +
>>  6 files changed, 142 insertions(+)
>>  create mode 100644 MdePkg/Library/BaseLib/Ia32/XGetBv.nasm
>>  create mode 100644 MdePkg/Library/BaseLib/X64/XGetBv.nasm
> 
> This patch no longer applies, it conflicts with commit d3c9e40abcc8
> ("MdePkg/BaseLib: Break out IA32/X64 GCC inline privileged functions",
> 2020-07-15).

Ok, that looks like it landed just after I sent my patches.

> 
> The conflict persists if I successfully apply the series on c7195b9ec3c5
> -- just preceding Mike's series "[Patch v3 00/16] UnitTestFrameworkPkg:
> Enhancements and bug fixes" --, and then try to rebase to current master
> (e77966b341b9) from there.
> 
> Can you please investigate?

Yup, I'll take a look.

Thanks,
Tom

> 
> Thanks,
> Laszlo
> 
>>
>> diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
>> b/MdePkg/Library/BaseLib/BaseLib.inf
>> index a57ae2da31f3..da6bc22a3e2b 100644
>> --- a/MdePkg/Library/BaseLib/BaseLib.inf
>> +++ b/MdePkg/Library/BaseLib/BaseLib.inf
>> @@ -153,6 +153,7 @@ [Sources.Ia32]
>>Ia32/ARShiftU64.c | MSFT
>>Ia32/EnableCache.c | MSFT
>>Ia32/DisableCache.c | MSFT
>> +  Ia32/XGetBv.nasm | MSFT
>>  
>>  
>>Ia32/GccInline.c | GCC
>> @@ -287,6 +288,7 @@ [Sources.X64]
>>X64/ReadCr2.nasm| MSFT
>>X64/ReadCr0.nasm| MSFT
>>X64/ReadEflags.nasm| MSFT
>> +  X64/XGetBv.nasm | MSFT
>>  
>>  
>>X64/Non-existing.c
>> diff --git a/MdePkg/Include/Library/BaseLib.h 
>> b/MdePkg/Include/Library/BaseLib.h
>> index 8e7b87cbda4e..7edf0051a0a0 100644
>> --- a/MdePkg/Include/Library/BaseLib.h
>> +++ b/MdePkg/Include/Library/BaseLib.h
>> @@ -7831,6 +7831,23 @@ AsmLfence (
>>VOID
>>);
>>  
>> +/**
>> +  Executes a XGETBV instruction
>> +
>> +  Executes a XGETBV instruction. This function is only available on IA-32 
>> and
>> +  x64.
>> +
>> +  @param[in] IndexExtended control register index
>> +
>> +  @return The current value of the extended control register
>> +**/
>> +UINT64
>> +EFIAPI
>> +AsmXGetBv (
>> +  IN UINT32  Index
>> +  );
>> +
>> +
>>  /**
>>Patch the immediate operand of an IA32 or X64 instruction such that the 
>> byte,
>>word, dword or qword operand is encoded at the end of the instruction's
>> diff --git a/MdePkg/Library/BaseLib/Ia32/GccInline.c 
>> b/MdePkg/Library/BaseLib/Ia32/GccInline.c
>> index 5287200f8754..c962bcfa4617 100644
>> --- a/MdePkg/Library/BaseLib/Ia32/GccInline.c
>> +++ b/MdePkg/Library/BaseLib/Ia32/GccInline.c
>> @@ -1763,3 +1763,31 @@ AsmFlushCacheLine (
>>  }
>>  
>>  
>> +/**
>> +  Executes a XGETBV instruction
>> +
>> +  Executes a XGETBV instruction. This function is only available on IA-32 
>> and
>> +  x64.
>> +
>> +  @param[in] IndexExtended control register index
>> +
>> +  @return The current value of the extended control register
>> +**/
>> +UINT64
>> +EFIAPI
>> +AsmXGetBv (
>> +  IN UINT32 Index
>> +  )
>> +{
>> +  UINT64 Data;
>> +
>> +  __asm__ __volatile__ (
>> +"xgetbv"
>> +: "=A" (Data)
>> +: "c"  (Index)
>> +);
>> +
>> +  return Data;
>> +}
>> +
>> +
>> diff --git a/MdePkg/Library/BaseLib/X64/GccInline.c 
>> b/MdePkg/Library/BaseLib/X64/GccInline.c
>> index 154ce1f57e92..91198f9f 100644
>> --- a/MdePkg/Library/BaseLib/X64/GccInline.c
>> +++ b/MdePkg/Library/BaseLib/X64/GccInline.c
>> @@ -1798,3 +1798,33 @@ AsmFlushCacheLine (
>>  }
>>  
>>  
>> +/**
>> +  Executes a XGETBV instruction
>> +
>> +  Executes a XGETBV instruction. This function is only available on IA-32 
>> and
>> +  x64.
>> +
>> +  @param[in] IndexExtended control register index
>> +
>> +  @return The current value of the extended control register
>> +**/
>> +UINT64
>> +EFIAPI
>> +AsmXGetBv (
>> +  IN UINT32 Index
>> +  )
>> +{
>> +  UINT32 LowData;
>> +  UINT32 HighData;
>> +
>> +  __asm__ __volat

Re: [edk2-devel] [PATCH v10 16/46] OvmfPkg/VmgExitLib: Add support for MSR_PROT NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a MSR_PROT intercept generates a #VC exception. VMGEXIT must
> be used to allow the hypervisor to handle this intercept.
> 
> Add support to construct the required GHCB values to support an MSR_PROT
> NAE event. Parse the instruction that generated the #VC exception to
> determine whether it is RDMSR or WRMSR, setting the required register
> register values in the GHCB and creating the proper SW_EXIT_INFO1 value in
> the GHCB.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 65 +++
>  1 file changed, 65 insertions(+)

Thanks for the comment updates, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 14/46] OvmfPkg/VmgExitLib: Support string IO for IOIO_PROT NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Add support to the #VC exception handler to handle string IO. This
> requires expanding the IO instruction parsing to recognize string based
> IO instructions as well as preparing an un-encrypted buffer to be used
> to transfer (either to or from the guest) the string contents for the IO
> operation. The SW_EXITINFO2 and SW_SCRATCH fields of the GHCB are set
> appropriately for the operation. Multiple VMGEXIT invocations may be
> needed to complete the string IO operation.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 90 ---
>  1 file changed, 76 insertions(+), 14 deletions(-)
> 
> diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c 
> b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
> index 04e8b8aebf7d..b6ac3552894f 100644
> --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
> +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c
> @@ -397,6 +397,26 @@ IoioExitInfo (
>ExitInfo = 0;
>  
>switch (*(InstructionData->OpCodes)) {
> +  //
> +  // INS opcodes
> +  //
> +  case 0x6C:
> +  case 0x6D:
> +ExitInfo |= IOIO_TYPE_INS;
> +ExitInfo |= IOIO_SEG_ES;
> +ExitInfo |= ((Regs->Rdx & 0x) << 16);
> +break;
> +
> +  //
> +  // OUTS opcodes
> +  //
> +  case 0x6E:
> +  case 0x6F:
> +ExitInfo |= IOIO_TYPE_OUTS;
> +ExitInfo |= IOIO_SEG_DS;
> +ExitInfo |= ((Regs->Rdx & 0x) << 16);
> +break;
> +
>//
>// IN immediate opcodes
>//
> @@ -445,6 +465,8 @@ IoioExitInfo (
>//
>// Single-byte opcodes
>//
> +  case 0x6C:
> +  case 0x6E:
>case 0xE4:
>case 0xE6:
>case 0xEC:
> @@ -506,30 +528,70 @@ IoioExit (
>IN SEV_ES_INSTRUCTION_DATA  *InstructionData
>)
>  {
> -  UINT64  ExitInfo1, Status;
> +  UINT64   ExitInfo1, ExitInfo2, Status;
> +  BOOLEAN  IsString;
>  
>ExitInfo1 = IoioExitInfo (Regs, InstructionData);
>if (ExitInfo1 == 0) {
>  return UnsupportedExit (Ghcb, Regs, InstructionData);
>}
>  
> -  if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {
> -Ghcb->SaveArea.Rax = 0;
> +  IsString = ((ExitInfo1 & IOIO_TYPE_STR) != 0) ? TRUE : FALSE;
> +  if (IsString) {
> +UINTN  IoBytes, VmgExitBytes;
> +UINTN  GhcbCount, OpCount;
> +
> +Status = 0;
> +
> +IoBytes = IOIO_DATA_BYTES (ExitInfo1);

Thanks for fixing the whitespace!
Laszlo

> +GhcbCount = sizeof (Ghcb->SharedBuffer) / IoBytes;
> +
> +OpCount = ((ExitInfo1 & IOIO_REP) != 0) ? Regs->Rcx : 1;
> +while (OpCount) {
> +  ExitInfo2 = MIN (OpCount, GhcbCount);
> +  VmgExitBytes = ExitInfo2 * IoBytes;
> +
> +  if ((ExitInfo1 & IOIO_TYPE_IN) == 0) {
> +CopyMem (Ghcb->SharedBuffer, (VOID *) Regs->Rsi, VmgExitBytes);
> +Regs->Rsi += VmgExitBytes;
> +  }
> +
> +  Ghcb->SaveArea.SwScratch = (UINT64) Ghcb->SharedBuffer;
> +  Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, ExitInfo2);
> +  if (Status != 0) {
> +return Status;
> +  }
> +
> +  if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {
> +CopyMem ((VOID *) Regs->Rdi, Ghcb->SharedBuffer, VmgExitBytes);
> +Regs->Rdi += VmgExitBytes;
> +  }
> +
> +  if ((ExitInfo1 & IOIO_REP) != 0) {
> +Regs->Rcx -= ExitInfo2;
> +  }
> +
> +  OpCount -= ExitInfo2;
> +}
>} else {
> -CopyMem (&Ghcb->SaveArea.Rax, &Regs->Rax, IOIO_DATA_BYTES (ExitInfo1));
> -  }
> -  GhcbSetRegValid (Ghcb, GhcbRax);
> +if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {
> +  Ghcb->SaveArea.Rax = 0;
> +} else {
> +  CopyMem (&Ghcb->SaveArea.Rax, &Regs->Rax, IOIO_DATA_BYTES (ExitInfo1));
> +}
> +GhcbSetRegValid (Ghcb, GhcbRax);
>  
> -  Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0);
> -  if (Status != 0) {
> -return Status;
> -  }
> +Status = VmgExit (Ghcb, SVM_EXIT_IOIO_PROT, ExitInfo1, 0);
> +if (Status != 0) {
> +  return Status;
> +}
>  
> -  if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {
> -if (!GhcbIsRegValid (Ghcb, GhcbRax)) {
> -  return UnsupportedExit (Ghcb, Regs, InstructionData);
> +if ((ExitInfo1 & IOIO_TYPE_IN) != 0) {
> +  if (!GhcbIsRegValid (Ghcb, GhcbRax)) {
> +return UnsupportedExit (Ghcb, Regs, InstructionData);
> +  }
> +  CopyMem (&Regs->Rax, &Ghcb->SaveArea.Rax, IOIO_DATA_BYTES (ExitInfo1));
>  }
> -CopyMem (&Regs->Rax, &Ghcb->SaveArea.Rax, IOIO_DATA_BYTES (ExitInfo1));
>}
>  
>return 0;
> 


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

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



Re: [edk2-devel] [PATCH v10 15/46] OvmfPkg/VmgExitLib: Add support for CPUID NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a CPUID intercept generates a #VC exception. VMGEXIT must be
> used to allow the hypervisor to handle this intercept.
> 
> Add support to construct the required GHCB values to support a CPUID NAE
> event. Additionally, CPUID 0x_000d (CPUID_EXTENDED_STATE) requires
> XCR0 to be supplied in the GHCB, so add support to issue the XGETBV
> instruction.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 60 +++
>  1 file changed, 60 insertions(+)

Thanks for the comment updates, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 13/46] OvmfPkg/VmgExitLib: Add support for IOIO_PROT NAE events

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a IOIO_PROT intercept generates a #VC exception. VMGEXIT
> must be used to allow the hypervisor to handle this intercept.
> 
> Add support to construct the required GHCB values to support a IOIO_PROT
> NAE event.  Parse the instruction that generated the #VC exception,
> setting the required register values in the GHCB and creating the proper
> SW_EXITINFO1 value in the GHCB.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  .../IndustryStandard/InstructionParsing.h |  83 +++
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 560 +-
>  2 files changed, 629 insertions(+), 14 deletions(-)
>  create mode 100644 OvmfPkg/Include/IndustryStandard/InstructionParsing.h

Thanks for the comment updates, my ACK stands.
Laszlo


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

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



Re: [edk2-devel] [PATCH v10 12/46] OvmfPkg/VmgExitLib: Implement library support for VmgExitLib in OVMF

2020-07-15 Thread Laszlo Ersek
On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> The base VmgExitLib library provides a default limited interface. As it
> does not provide full support, create an OVMF version of this library to
> begin the process of providing full support of SEV-ES within OVMF.
> 
> SEV-ES support is only provided for X64 builds, so only OvmfPkgX64.dsc is
> updated to make use of the OvmfPkg version of the library.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Acked-by: Laszlo Ersek 
> Signed-off-by: Tom Lendacky 
> ---
>  OvmfPkg/OvmfPkgX64.dsc|   2 +-
>  OvmfPkg/Library/VmgExitLib/VmgExitLib.inf |  36 
>  OvmfPkg/Library/VmgExitLib/VmgExitLib.c   | 159 ++
>  OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c |  81 +
>  4 files changed, 277 insertions(+), 1 deletion(-)
>  create mode 100644 OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
>  create mode 100644 OvmfPkg/Library/VmgExitLib/VmgExitLib.c
>  create mode 100644 OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c

Thanks for the updates! My ACK stands.

Laszlo


> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 269b6d973188..6db1f0b51c7c 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -232,7 +232,7 @@ [LibraryClasses]
>  
>  [LibraryClasses.common]
>BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> -  VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf
> +  VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
>  
>  [LibraryClasses.common.SEC]
>TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf
> diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitLib.inf 
> b/OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
> new file mode 100644
> index ..d003ac63173e
> --- /dev/null
> +++ b/OvmfPkg/Library/VmgExitLib/VmgExitLib.inf
> @@ -0,0 +1,36 @@
> +## @file
> +#  VMGEXIT Support Library.
> +#
> +#  Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = VmgExitLib
> +  FILE_GUID  = 0e923c25-13cd-430b-8714-ffe85652a97b
> +  MODULE_TYPE= BASE
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = VmgExitLib
> +
> +#
> +# The following information is for reference only and not required by the 
> build tools.
> +#
> +#  VALID_ARCHITECTURES   = X64
> +#
> +
> +[Sources.common]
> +  VmgExitLib.c
> +  VmgExitVcHandler.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  OvmfPkg/OvmfPkg.dec
> +  UefiCpuPkg/UefiCpuPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  BaseMemoryLib
> +  DebugLib
> +
> diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitLib.c 
> b/OvmfPkg/Library/VmgExitLib/VmgExitLib.c
> new file mode 100644
> index ..53040cc6f649
> --- /dev/null
> +++ b/OvmfPkg/Library/VmgExitLib/VmgExitLib.c
> @@ -0,0 +1,159 @@
> +/** @file
> +  VMGEXIT Support Library.
> +
> +  Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/**
> +  Check for VMGEXIT error
> +
> +  Check if the hypervisor has returned an error after completion of the 
> VMGEXIT
> +  by examining the SwExitInfo1 field of the GHCB.
> +
> +  @param[in]  Ghcb   A pointer to the GHCB
> +
> +  @retval  0 VMGEXIT succeeded.
> +  @returnException number to be propagated, VMGEXIT 
> processing
> + did not succeed.
> +
> +**/
> +STATIC
> +UINT64
> +VmgExitErrorCheck (
> +  IN GHCB*Ghcb
> +  )
> +{
> +  GHCB_EVENT_INJECTION  Event;
> +  GHCB_EXIT_INFOExitInfo;
> +  UINT64Status;
> +
> +  ExitInfo.Uint64 = Ghcb->SaveArea.SwExitInfo1;
> +  ASSERT ((ExitInfo.Elements.Lower32Bits == 0) ||
> +  (ExitInfo.Elements.Lower32Bits == 1));
> +
> +  Status = 0;
> +  if (ExitInfo.Elements.Lower32Bits == 0) {
> +return Status;
> +  }
> +
> +  if (ExitInfo.Elements.Lower32Bits == 1) {
> +ASSERT (Ghcb->SaveArea.SwExitInfo2 != 0);
> +
> +//
> +// Check that the return event is valid
> +//
> +Event.Uint64 = Ghcb->SaveArea.SwExitInfo2;
> +if (Event.Elements.Valid &&
> +Event.Elements.Type == GHCB_EVENT_INJECTION_TYPE_EXCEPTION) {
> +  switch (Event.Elements.Vector) {
> +  case GP_EXCEPTION:
> +  case UD_EXCEPTION:
> +//
> +// Use returned event as return code
> +//
> +Status = Event.Uint64;
> +  }
> +}
> +  }
> +
> +  if (Status == 0) {
> +GHCB_EVENT_INJECTION  GpEvent;
> +
> +GpEvent.Uint64 = 0;
> +GpEvent.Elements.Vector = GP_EXCEPTION;
> +GpEvent.Elements.Type   = GHCB_EVENT_INJECTION_TYPE_EXCEPTION;
> +GpEvent.Elements.Valid  = 1;
> +
> +Status = G

Re: [edk2-devel] [PATCH v10 06/46] MdePkg/BaseLib: Add support for the XGETBV instruction

2020-07-15 Thread Laszlo Ersek
Hi Tom,

On 07/14/20 16:27, Lendacky, Thomas wrote:
> From: Tom Lendacky 
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
> 
> Under SEV-ES, a CPUID instruction requires the current value of the XCR0
> register. In order to retrieve that value, the XGETBV instruction needs
> to be executed.
> 
> Provide the necessary support to execute the XGETBV instruction.
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Signed-off-by: Tom Lendacky 
> ---
>  MdePkg/Library/BaseLib/BaseLib.inf  |  2 ++
>  MdePkg/Include/Library/BaseLib.h| 17 +
>  MdePkg/Library/BaseLib/Ia32/GccInline.c | 28 
>  MdePkg/Library/BaseLib/X64/GccInline.c  | 30 ++
>  MdePkg/Library/BaseLib/Ia32/XGetBv.nasm | 31 ++
>  MdePkg/Library/BaseLib/X64/XGetBv.nasm  | 34 +
>  6 files changed, 142 insertions(+)
>  create mode 100644 MdePkg/Library/BaseLib/Ia32/XGetBv.nasm
>  create mode 100644 MdePkg/Library/BaseLib/X64/XGetBv.nasm

This patch no longer applies, it conflicts with commit d3c9e40abcc8
("MdePkg/BaseLib: Break out IA32/X64 GCC inline privileged functions",
2020-07-15).

The conflict persists if I successfully apply the series on c7195b9ec3c5
-- just preceding Mike's series "[Patch v3 00/16] UnitTestFrameworkPkg:
Enhancements and bug fixes" --, and then try to rebase to current master
(e77966b341b9) from there.

Can you please investigate?

Thanks,
Laszlo

> 
> diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
> b/MdePkg/Library/BaseLib/BaseLib.inf
> index a57ae2da31f3..da6bc22a3e2b 100644
> --- a/MdePkg/Library/BaseLib/BaseLib.inf
> +++ b/MdePkg/Library/BaseLib/BaseLib.inf
> @@ -153,6 +153,7 @@ [Sources.Ia32]
>Ia32/ARShiftU64.c | MSFT
>Ia32/EnableCache.c | MSFT
>Ia32/DisableCache.c | MSFT
> +  Ia32/XGetBv.nasm | MSFT
>  
>  
>Ia32/GccInline.c | GCC
> @@ -287,6 +288,7 @@ [Sources.X64]
>X64/ReadCr2.nasm| MSFT
>X64/ReadCr0.nasm| MSFT
>X64/ReadEflags.nasm| MSFT
> +  X64/XGetBv.nasm | MSFT
>  
>  
>X64/Non-existing.c
> diff --git a/MdePkg/Include/Library/BaseLib.h 
> b/MdePkg/Include/Library/BaseLib.h
> index 8e7b87cbda4e..7edf0051a0a0 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -7831,6 +7831,23 @@ AsmLfence (
>VOID
>);
>  
> +/**
> +  Executes a XGETBV instruction
> +
> +  Executes a XGETBV instruction. This function is only available on IA-32 and
> +  x64.
> +
> +  @param[in] IndexExtended control register index
> +
> +  @return The current value of the extended control register
> +**/
> +UINT64
> +EFIAPI
> +AsmXGetBv (
> +  IN UINT32  Index
> +  );
> +
> +
>  /**
>Patch the immediate operand of an IA32 or X64 instruction such that the 
> byte,
>word, dword or qword operand is encoded at the end of the instruction's
> diff --git a/MdePkg/Library/BaseLib/Ia32/GccInline.c 
> b/MdePkg/Library/BaseLib/Ia32/GccInline.c
> index 5287200f8754..c962bcfa4617 100644
> --- a/MdePkg/Library/BaseLib/Ia32/GccInline.c
> +++ b/MdePkg/Library/BaseLib/Ia32/GccInline.c
> @@ -1763,3 +1763,31 @@ AsmFlushCacheLine (
>  }
>  
>  
> +/**
> +  Executes a XGETBV instruction
> +
> +  Executes a XGETBV instruction. This function is only available on IA-32 and
> +  x64.
> +
> +  @param[in] IndexExtended control register index
> +
> +  @return The current value of the extended control register
> +**/
> +UINT64
> +EFIAPI
> +AsmXGetBv (
> +  IN UINT32 Index
> +  )
> +{
> +  UINT64 Data;
> +
> +  __asm__ __volatile__ (
> +"xgetbv"
> +: "=A" (Data)
> +: "c"  (Index)
> +);
> +
> +  return Data;
> +}
> +
> +
> diff --git a/MdePkg/Library/BaseLib/X64/GccInline.c 
> b/MdePkg/Library/BaseLib/X64/GccInline.c
> index 154ce1f57e92..91198f9f 100644
> --- a/MdePkg/Library/BaseLib/X64/GccInline.c
> +++ b/MdePkg/Library/BaseLib/X64/GccInline.c
> @@ -1798,3 +1798,33 @@ AsmFlushCacheLine (
>  }
>  
>  
> +/**
> +  Executes a XGETBV instruction
> +
> +  Executes a XGETBV instruction. This function is only available on IA-32 and
> +  x64.
> +
> +  @param[in] IndexExtended control register index
> +
> +  @return The current value of the extended control register
> +**/
> +UINT64
> +EFIAPI
> +AsmXGetBv (
> +  IN UINT32 Index
> +  )
> +{
> +  UINT32 LowData;
> +  UINT32 HighData;
> +
> +  __asm__ __volatile__ (
> +"xgetbv"
> +: "=a" (LowData),
> +  "=d" (HighData)
> +: "c"  (Index)
> +);
> +
> +  return (((UINT64)HighData) << 32) | LowData;
> +}
> +
> +
> diff --git a/MdePkg/Library/BaseLib/Ia32/XGetBv.nasm 
> b/MdePkg/Library/BaseLib/Ia32/XGetBv.nasm
> new file mode 100644
> index ..9f7b03bbff35
> --- /dev/null
> +++ b/MdePkg/Library/BaseLib/Ia32/XGetBv.nasm
> @@ -0,0 +1,31 @@
> +;--
> +;
> +; Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
> +; SPDX-License-Identifi

Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfPkg.dec: Adjust PcdMptScsiStallPerPollUsec

2020-07-15 Thread Laszlo Ersek
On 07/15/20 10:20, Gary Lin wrote:
> The toke value of PcdMptScsiStallPerPollUsec should be 0x3a since the
> previous toke value is 0x39.
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Liran Alon 
> Cc: Nikita Leshenko 
> Signed-off-by: Gary Lin 
> ---
>  OvmfPkg/OvmfPkg.dec | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
> index 65bb2bb0eb4c..2b0f137cbcce 100644
> --- a/OvmfPkg/OvmfPkg.dec
> +++ b/OvmfPkg/OvmfPkg.dec
> @@ -172,7 +172,7 @@ [PcdsFixedAtBuild]
>gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiMaxTargetLimit|7|UINT8|0x39
>  
>## Microseconds to stall between polling for MptScsi request result
> -  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x40
> +  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x3a
>  
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8
>gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9
> 

Thank you for the patch!

I've updated the subject:

  OvmfPkg/OvmfPkg.dec: Adjust PcdMptScsiStallPerPollUsec token value

I've also fixed two typos in the commit message (s/toke value/token
value/, twice).

Reviewed-by: Laszlo Ersek 

I'm trying to merge this via .

But, the PR seems stalled -- github appears unable to find the very
commit that I just pushed with the branch.

And this time even  seems to confirm the
issue -- it says "Some services are degraded". ... Oh wait, it's
progressed to an "incident" even:

https://www.githubstatus.com/incidents/phnch1rww464

Really frustrating. I've got stuff to do, and now I get to cirle back to
this merge request... when exactly? Sigh.

Laszlo


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

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



Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.

2020-07-15 Thread Bret Barkelew via groups.io
Yeah, that’s kinda what I was thinking. It seemed like there was a little of 
overlap that might eliminate the need for the extra libs (in our current 
solution).

I’ll try to get a more detailed problem statement today, but I think you’ve got 
the right idea there.

- Bret

From: Yao, Jiewen
Sent: Wednesday, July 15, 2020 8:20 AM
To: devel@edk2.groups.io; Yao, 
Jiewen; Bret 
Barkelew; Zhang, 
Qi1
Cc: Wang, Jian J
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi 
header file.

Maybe we can let TCG PEIM install the TCG_PPI *before* any measurement record, 
then the other PEIM can register a callback to record the HW ROT measurement ?

Thank you
Yao Jiewen

From: devel@edk2.groups.io  On Behalf Of Yao, Jiewen
Sent: Wednesday, July 15, 2020 10:45 PM
To: Bret Barkelew ; devel@edk2.groups.io; Zhang, 
Qi1 
Cc: Wang, Jian J 
Subject: Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header 
file.

Hi Bret
Do you have a full problem statement or Bugzilla?

If we are resolving same problem, we can resolve altogether.
If we are talking different problem, we can resolve one by one.

Thank you
Yao Jiewen

From: Bret Barkelew 
mailto:bret.barke...@microsoft.com>>
Sent: Wednesday, July 15, 2020 1:53 PM
To: devel@edk2.groups.io; Yao, Jiewen 
mailto:jiewen@intel.com>>; Zhang, Qi1 
mailto:qi1.zh...@intel.com>>
Cc: Wang, Jian J mailto:jian.j.w...@intel.com>>
Subject: Re: [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.

Since we’re working on early boot TCG interfaces, is this a good time to 
discuss a standard way to init the log with measurements made by the HW root of 
trust prior to Tcg2Pei? We were using a NULL lib and a registration pattern on 
the PEIM, but I’m open to other ideas, too. Thoughts?

- Bret

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Yao, Jiewen 
via groups.io 
mailto:jiewen.yao=intel@groups.io>>
Sent: Tuesday, July 14, 2020 10:08:30 PM
To: Zhang, Qi1 mailto:qi1.zh...@intel.com>>; 
devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>
Cc: Wang, Jian J mailto:jian.j.w...@intel.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi 
header file.

Thanks Qi.

I just thought one use case that a PEIM may already have a calculated hash  
(https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2Fmaster%2FSecurityPkg%2FTcg%2FTcg2Pei%2FTcg2Pei.c%23L652&data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cbe2bb9ca3e0c4dd95a0a08d8287d21ec%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637303865193113145&sdata=V3ofX%2Fvs6Pp%2Bc79cQx4iSB6K324Lyptqrj7FtvmDwsc%3D&reserved=0)
We may need add a flag to support this pre-hash use case. Such as:

> +(EFIAPI *EDKII_TCG_HASH_LOG_EXTEND_EVENT)(
>
> +  IN  EDKII_TCG_PPI *This,
>
> +  IN  UINT64   Flags,  // new field. BIT0 = 0 means 
> HashData is the data to be hashed; BIT0 = 1 means HashData is the pre-hash 
> digest.
>
> +  IN  UINT8 *HashData,
>
> +  IN  UINTN HashDataLen,
>
> +  IN  TCG_PCR_EVENT_HDR *NewEventHdr,
>
> +  IN  UINT8 *NewEventData
>
> +  );

> -Original Message-
> From: Zhang, Qi1 mailto:qi1.zh...@intel.com>>
> Sent: Tuesday, July 14, 2020 2:49 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen mailto:jiewen@intel.com>>; Wang, 
> Jian J mailto:jian.j.w...@intel.com>>;
> Zhang, Chao B mailto:chao.b.zh...@intel.com>>
> Subject: [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.
>
> From: Jiewen Yao mailto:jiewen@intel.com>>
>
> REF: 
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2841&data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cbe2bb9ca3e0c4dd95a0a08d8287d21ec%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637303865193113145&sdata=VgWc2LNPqJRlBisa%2Bvuqq2THVK62f66uzzqh4cle4Rs%3D&reserved=0
>
> Cc: Jiewen Yao mailto:jiewen@inte

Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.

2020-07-15 Thread Yao, Jiewen
Maybe we can let TCG PEIM install the TCG_PPI *before* any measurement record, 
then the other PEIM can register a callback to record the HW ROT measurement ?

Thank you
Yao Jiewen

From: devel@edk2.groups.io  On Behalf Of Yao, Jiewen
Sent: Wednesday, July 15, 2020 10:45 PM
To: Bret Barkelew ; devel@edk2.groups.io; Zhang, 
Qi1 
Cc: Wang, Jian J 
Subject: Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header 
file.

Hi Bret
Do you have a full problem statement or Bugzilla?

If we are resolving same problem, we can resolve altogether.
If we are talking different problem, we can resolve one by one.

Thank you
Yao Jiewen

From: Bret Barkelew 
mailto:bret.barke...@microsoft.com>>
Sent: Wednesday, July 15, 2020 1:53 PM
To: devel@edk2.groups.io; Yao, Jiewen 
mailto:jiewen@intel.com>>; Zhang, Qi1 
mailto:qi1.zh...@intel.com>>
Cc: Wang, Jian J mailto:jian.j.w...@intel.com>>
Subject: Re: [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.

Since we're working on early boot TCG interfaces, is this a good time to 
discuss a standard way to init the log with measurements made by the HW root of 
trust prior to Tcg2Pei? We were using a NULL lib and a registration pattern on 
the PEIM, but I'm open to other ideas, too. Thoughts?

- Bret

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Yao, Jiewen 
via groups.io 
mailto:jiewen.yao=intel@groups.io>>
Sent: Tuesday, July 14, 2020 10:08:30 PM
To: Zhang, Qi1 mailto:qi1.zh...@intel.com>>; 
devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>
Cc: Wang, Jian J mailto:jian.j.w...@intel.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi 
header file.

Thanks Qi.

I just thought one use case that a PEIM may already have a calculated hash  
(https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2Fmaster%2FSecurityPkg%2FTcg%2FTcg2Pei%2FTcg2Pei.c%23L652&data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cbe2bb9ca3e0c4dd95a0a08d8287d21ec%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637303865193113145&sdata=V3ofX%2Fvs6Pp%2Bc79cQx4iSB6K324Lyptqrj7FtvmDwsc%3D&reserved=0)
We may need add a flag to support this pre-hash use case. Such as:

> +(EFIAPI *EDKII_TCG_HASH_LOG_EXTEND_EVENT)(
>
> +  IN  EDKII_TCG_PPI *This,
>
> +  IN  UINT64   Flags,  // new field. BIT0 = 0 means 
> HashData is the data to be hashed; BIT0 = 1 means HashData is the pre-hash 
> digest.
>
> +  IN  UINT8 *HashData,
>
> +  IN  UINTN HashDataLen,
>
> +  IN  TCG_PCR_EVENT_HDR *NewEventHdr,
>
> +  IN  UINT8 *NewEventData
>
> +  );

> -Original Message-
> From: Zhang, Qi1 mailto:qi1.zh...@intel.com>>
> Sent: Tuesday, July 14, 2020 2:49 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen mailto:jiewen@intel.com>>; Wang, 
> Jian J mailto:jian.j.w...@intel.com>>;
> Zhang, Chao B mailto:chao.b.zh...@intel.com>>
> Subject: [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.
>
> From: Jiewen Yao mailto:jiewen@intel.com>>
>
> REF: 
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2841&data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cbe2bb9ca3e0c4dd95a0a08d8287d21ec%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637303865193113145&sdata=VgWc2LNPqJRlBisa%2Bvuqq2THVK62f66uzzqh4cle4Rs%3D&reserved=0
>
> Cc: Jiewen Yao mailto:jiewen@intel.com>>
> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>
> Cc: Chao Zhang mailto:chao.b.zh...@intel.com>>
> Signed-off-by: Jiewen Yao mailto:jiewen@intel.com>>
> ---
>  SecurityPkg/Include/Ppi/Tcg.h | 50 +++
>  1 file changed, 50 insertions(+)
>  create mode 100644 SecurityPkg/Include/Ppi/Tcg.h
>
> diff --git a/SecurityPkg/Include/Ppi/Tcg.h b/SecurityPkg/Include/Ppi/Tcg.h
> new file mode 100644
> index 00..4eacd57166
> --- /dev/null
> +++ b/SecurityPkg/Include/Ppi/Tcg.h
> @@ -0,0 +1,50 @@
> +/** @file
>
> +  TCG PPI services.
>
> +
>
> +Copyright (c) 2020, Intel Corporation. All rights reserved.
>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +
>
> +**/
>
> +
>
> +#ifndef _TCG_PPI_H_
>
> +#define _TCG_PPI_H_
>
> +
>
> +#include 
>
> +
>
> +typedef struct _EDKII_TCG_PPI EDKII_TCG_PPI;
>
> +
>
> +/**
>
> +  Tpm measure and log data, and extend the measurement result into a specific
> PCR.
>
> +
>
> +  @param[in]  This  Indicates the calling context
>
> +  @param[in]  HashData  Physical address of the start of the data 
> buffer
>
> +to be hashed, extended, and logged.
>
> +  @param[in]  HashDataLen   The length, in bytes, of the buffer 
> referenced by
> HashData.
>
> +  @param[in]  NewEventHdr   Pointer to a TCG_PCR_EVENT_HDR data
> s

Re: [edk2-devel] [PATCH V3 0/4] Add New Memory Attributes

2020-07-15 Thread Laszlo Ersek
On 07/02/20 22:50, Oleksiy Yakovlev wrote:
> This series of patches add usage of new memory
> attributes EFI_MEMORY_SP and EFI_MEMORY_CPU_CRYPTO,
> introduced in UEFI2.8 (mantis 1919 and 1872).
> First patch fix typos in description and introduce two 
> bitmasks for all memory type attributes.
> Second and fourth patches get rid of multiple memory attributes
> bitmasks definitions trough multiple files and headers,
> and replace them with new common definitions from MdePkg.
> Third patch includes WP attribute into cache type mask in
> CpuDexe.h to make next change in this file more clear.
> 
> Oleksiy Yakovlev (4):
>   MdePkg: Add New Memory Attributes
>   MdeModulePkg: Add New Memory Attributes
>   UefiCpuPkg: Update EFI_MEMORY_CACHETYPE_MASK definition
>   UefiCpuPkg: Add New Memory Attributes
> 
>  MdeModulePkg/Core/Dxe/Gcd/Gcd.c| 11 ++-
>  MdeModulePkg/Core/Dxe/Mem/Page.c   |  9 +++--
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c  |  7 ++-
>  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 10 ++
>  MdePkg/Include/Uefi/UefiSpec.h | 10 --
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 11 ---
>  UefiCpuPkg/CpuDxe/CpuDxe.h | 12 
>  UefiCpuPkg/CpuDxe/CpuPageTable.c   |  6 +++---
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c |  2 +-
>  9 files changed, 25 insertions(+), 53 deletions(-)
> 

Merged as commit range 5d29e2d020e8..e77966b341b9, via
.

Thanks
Laszlo


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

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



Re: [edk2-devel] [PATCH v3 1/1] MdeModulePkg/UsbBusDxe: Rebuild the description table after Reset Device

2020-07-15 Thread Jeremy Linton



Hi,

On 7/14/20 8:07 PM, Jiang, Guomin wrote:

Hi Jeremy,

We test many different device and found some device haven't reproduced the 
issue.

We need to figure out the root cause rather than work around.


Yes, there are two problems in my case. The first is specific to the 
device, in that it can be put into a state (low power spun down IIRC) 
where the individual disks are responding with a 5/2400 (invalid 
command). But, in theory there are a lot of cases like this where 
marginal cables/bad devices/etc, are going to result in errors.


The second problem is this one, where any device that the subsystem 
thinks needs resetting (as part of the recovery process) crashes the 
firmware. This bug is pretty clear, the descriptor cache being 
maintained by XHCI is being cleared, and the xhci driver itself is 
depending on that cache to handle operations. Without fixing it, there 
are null pointer dereferences on just about any error condition that can 
happen on the USB bus. This is a far larger problem IMHO than whether or 
not a particular device is working. In my case, I don't need/want the 
JBOD to be used by the firmware, but I do want the machine to boot when 
that device is plugged in.


So, either the usb subsystem uses the same (re)initialization sequence 
following a reset as it does initially, or the XHCI driver needs to be 
tweaked to either not drop the descriptor cache during reset, or rebuild 
it when it detects its missing.



Thanks,





Best Regards
Guomin

-Original Message-
From: Jeremy Linton 
Sent: Wednesday, July 15, 2020 8:19 AM
To: Jiang, Guomin ; devel@edk2.groups.io
Cc: Wang, Jian J ; Wu, Hao A
; Ni, Ray 
Subject: Re: [PATCH v3 1/1] MdeModulePkg/UsbBusDxe: Rebuild the
description table after Reset Device

Hi,

On 5/9/20 3:26 AM, Guomin Jiang wrote:

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

When the USB fail and then Reset Device, it should rebuild description.



I pulled the latest edk2 a few hours ago and I'm still seeing the assert TrsRing
!= 0 messages on a real XHCI controller with the jmicron JBOD I mentioned
earlier.

Is there a newer version of this patch?

Thanks,





Signed-off-by: Guomin Jiang 
Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
---
   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c  |   7 ++
   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c | 152

+++

   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h |  14 +++
   3 files changed, 173 insertions(+)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 4b4915c019ad..7bb9373a6adf 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -874,6 +874,13 @@ UsbIoPortReset (
 // is in CONFIGURED state.
 //
 if (Dev->ActiveConfig != NULL) {
+Status = UsbRebuildDescTable (Dev);
+
+if (EFI_ERROR (Status)) {
+  DEBUG (( DEBUG_ERROR, "UsbIoPortReset: failed to rebuild desc table

- %r\n", Status));

+  goto ON_EXIT;
+}
+
   Status = UsbSetConfig (Dev,
Dev->ActiveConfig->Desc.ConfigurationValue);

   if (EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
index b08188b1bc78..d8e5e50b7c5a 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
@@ -900,6 +900,158 @@ UsbBuildDescTable (
 return EFI_SUCCESS;
   }

+/**
+  Copy the interface descriptor
+
+  @param[out]  DescBuf   The buffer of raw descriptor.
+  @param[in]   SrcBufThe buffer of raw descriptor
+**/
+VOID
+UsbCopyInterfaceDesc (
+  OUT USB_INTERFACE_DESC  *DescBuf,
+  IN  USB_INTERFACE_DESC  *SrcBuf
+  )
+{
+  UINTN   Index, IndexI;
+
+  ASSERT ((DescBuf != NULL) && (SrcBuf != NULL));
+
+  if (DescBuf->NumOfSetting == SrcBuf->NumOfSetting) {
+DescBuf->ActiveIndex = SrcBuf->ActiveIndex;
+
+for (Index = 0; Index < DescBuf->NumOfSetting; Index++) {
+  CopyMem (&DescBuf->Settings[Index]->Desc,
+&SrcBuf->Settings[Index]->Desc,
+sizeof(EFI_USB_INTERFACE_DESCRIPTOR));
+
+  if (DescBuf->Settings[Index]->Desc.NumEndpoints ==
+   SrcBuf->Settings[Index]->Desc.NumEndpoints) {
+
+for (IndexI = 0; IndexI < DescBuf->Settings[Index]-
Desc.NumEndpoints;
+  IndexI++) {
+  CopyMem (DescBuf->Settings[Index]->Endpoints[IndexI],
+SrcBuf->Settings[Index]->Endpoints[IndexI],
+sizeof(USB_ENDPOINT_DESC));
+}
+  }
+}
+  }
+}
+
+/**
+  Copy the configuration descriptor and its interfaces.
+
+  @param[out]  DescBuf   The buffer of raw descriptor.
+  @param[in]   SrcBufThe buffer of raw descriptor
+**/
+VOID
+UsbCopyConfigDesc (
+  OUT USB_CONFIG_DESC   *DescBuf,
+  IN  USB_CONFIG_DESC   *SrcBuf
+  )
+{
+  UINTN   Index;
+
+  ASSERT ((DescBuf != NULL) && (SrcBuf != NULL));
+
+  if (DescBuf->Desc.NumIn

Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.

2020-07-15 Thread Yao, Jiewen
Hi Bret
Do you have a full problem statement or Bugzilla?

If we are resolving same problem, we can resolve altogether.
If we are talking different problem, we can resolve one by one.

Thank you
Yao Jiewen

From: Bret Barkelew 
Sent: Wednesday, July 15, 2020 1:53 PM
To: devel@edk2.groups.io; Yao, Jiewen ; Zhang, Qi1 

Cc: Wang, Jian J 
Subject: Re: [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.

Since we're working on early boot TCG interfaces, is this a good time to 
discuss a standard way to init the log with measurements made by the HW root of 
trust prior to Tcg2Pei? We were using a NULL lib and a registration pattern on 
the PEIM, but I'm open to other ideas, too. Thoughts?

- Bret

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Yao, Jiewen 
via groups.io 
mailto:jiewen.yao=intel@groups.io>>
Sent: Tuesday, July 14, 2020 10:08:30 PM
To: Zhang, Qi1 mailto:qi1.zh...@intel.com>>; 
devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>
Cc: Wang, Jian J mailto:jian.j.w...@intel.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi 
header file.

Thanks Qi.

I just thought one use case that a PEIM may already have a calculated hash  
(https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftianocore%2Fedk2%2Fblob%2Fmaster%2FSecurityPkg%2FTcg%2FTcg2Pei%2FTcg2Pei.c%23L652&data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cbe2bb9ca3e0c4dd95a0a08d8287d21ec%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637303865193113145&sdata=V3ofX%2Fvs6Pp%2Bc79cQx4iSB6K324Lyptqrj7FtvmDwsc%3D&reserved=0)
We may need add a flag to support this pre-hash use case. Such as:

> +(EFIAPI *EDKII_TCG_HASH_LOG_EXTEND_EVENT)(
>
> +  IN  EDKII_TCG_PPI *This,
>
> +  IN  UINT64   Flags,  // new field. BIT0 = 0 means 
> HashData is the data to be hashed; BIT0 = 1 means HashData is the pre-hash 
> digest.
>
> +  IN  UINT8 *HashData,
>
> +  IN  UINTN HashDataLen,
>
> +  IN  TCG_PCR_EVENT_HDR *NewEventHdr,
>
> +  IN  UINT8 *NewEventData
>
> +  );

> -Original Message-
> From: Zhang, Qi1 mailto:qi1.zh...@intel.com>>
> Sent: Tuesday, July 14, 2020 2:49 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen mailto:jiewen@intel.com>>; Wang, 
> Jian J mailto:jian.j.w...@intel.com>>;
> Zhang, Chao B mailto:chao.b.zh...@intel.com>>
> Subject: [PATCH 1/6] SecurityPkg/TcgPpi: Add TcgPpi header file.
>
> From: Jiewen Yao mailto:jiewen@intel.com>>
>
> REF: 
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2841&data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cbe2bb9ca3e0c4dd95a0a08d8287d21ec%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637303865193113145&sdata=VgWc2LNPqJRlBisa%2Bvuqq2THVK62f66uzzqh4cle4Rs%3D&reserved=0
>
> Cc: Jiewen Yao mailto:jiewen@intel.com>>
> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>
> Cc: Chao Zhang mailto:chao.b.zh...@intel.com>>
> Signed-off-by: Jiewen Yao mailto:jiewen@intel.com>>
> ---
>  SecurityPkg/Include/Ppi/Tcg.h | 50 +++
>  1 file changed, 50 insertions(+)
>  create mode 100644 SecurityPkg/Include/Ppi/Tcg.h
>
> diff --git a/SecurityPkg/Include/Ppi/Tcg.h b/SecurityPkg/Include/Ppi/Tcg.h
> new file mode 100644
> index 00..4eacd57166
> --- /dev/null
> +++ b/SecurityPkg/Include/Ppi/Tcg.h
> @@ -0,0 +1,50 @@
> +/** @file
>
> +  TCG PPI services.
>
> +
>
> +Copyright (c) 2020, Intel Corporation. All rights reserved.
>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +
>
> +**/
>
> +
>
> +#ifndef _TCG_PPI_H_
>
> +#define _TCG_PPI_H_
>
> +
>
> +#include 
>
> +
>
> +typedef struct _EDKII_TCG_PPI EDKII_TCG_PPI;
>
> +
>
> +/**
>
> +  Tpm measure and log data, and extend the measurement result into a specific
> PCR.
>
> +
>
> +  @param[in]  This  Indicates the calling context
>
> +  @param[in]  HashData  Physical address of the start of the data 
> buffer
>
> +to be hashed, extended, and logged.
>
> +  @param[in]  HashDataLen   The length, in bytes, of the buffer 
> referenced by
> HashData.
>
> +  @param[in]  NewEventHdr   Pointer to a TCG_PCR_EVENT_HDR data
> structure.
>
> +  @param[in]  NewEventData  Pointer to the new event data.
>
> +
>
> +  @retval EFI_SUCCESS   Operation completed successfully.
>
> +  @retval EFI_UNSUPPORTED   TPM device not available.
>
> +  @retval EFI_OUT_OF_RESOURCES  Out of memory.
>
> +  @retval EFI_DEVICE_ERROR  The operation was unsuccessful.
>
> +**/
>
> +typedef
>
> +EFI_STATUS
>
> +(EFIAPI *EDKII_TCG_HASH_LOG_EXTEND_EVENT)(
>
> +  IN  EDKII_TCG_PPI *This,
>
> +  IN  UINT8 *HashData,
>
> +  IN  UINTN HashDataLen,
>
> +  

Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand

2020-07-15 Thread Laszlo Ersek
On 07/15/20 14:55, Laszlo Ersek wrote:
> On 07/13/20 20:31, Vladimir Olovyannikov via groups.io wrote:
>> Introduce an http client utilizing EDK2 HTTP protocol, to
>> allow fast image downloading from http/https servers.
>> HTTP download speed is usually faster than tftp.
>> The client is based on the same approach as tftp dynamic command, and
>> uses the same UEFI Shell command line parameters. This makes it easy
>> integrating http into existing UEFI Shell scripts.
>> Note that to enable HTTP download, feature Pcd
>> gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections must
>> be set to TRUE.
>>
>> Signed-off-by: Vladimir Olovyannikov 
>> Tested-By: Samer El-Haj-Mahmoud 
>> Cc: Zhichao Gao 
>> Cc: Maciej Rabeda 
>> Cc: Jiaxin Wu 
>> Cc: Siyuan Fu 
>> Cc: Ray Ni 
>> Cc: Liming Gao 
>> Cc: Nd 
>> ---
>>  .../DynamicCommand/HttpDynamicCommand/Http.c  | 1700 +
>>  .../DynamicCommand/HttpDynamicCommand/Http.h  |   84 +
>>  .../HttpDynamicCommand/Http.uni   |  113 ++
>>  .../HttpDynamicCommand/HttpApp.c  |   53 +
>>  .../HttpDynamicCommand/HttpApp.inf|   58 +
>>  .../HttpDynamicCommand/HttpDynamicCommand.c   |  134 ++
>>  .../HttpDynamicCommand/HttpDynamicCommand.inf |   63 +
>>  ShellPkg/Include/Guid/ShellLibHiiGuid.h   |5 +
>>  ShellPkg/ShellPkg.dec |1 +
>>  ShellPkg/ShellPkg.dsc |5 +
>>  10 files changed, 2216 insertions(+)
>>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c
>>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h
>>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni
>>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c
>>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.inf
>>  create mode 100644 
>> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c
>>  create mode 100644 
>> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
> 
> This feature sounds very attractive for virtualization too.
> 
> I suggest filing a BZ for collecting the various versions of the patch
> (or patch series) in a common spot. (Based on the size of the patch, I
> assume there could be multiple versions.)

Sorry, I didn't look carefully enough at the subject -- I see we're already at 
v3. In that case, the BZ should please reference all three versions of the 
patch (thus far):

* version 1:
  [edk2-devel] [PATCH 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand
  https://edk2.groups.io/g/devel/message/53483
  
http://mid.mail-archive.com/20200125005718.8931-1-vladimir.olovyannikov@broadcom.com

* version 2:
  [edk2-devel] [PATCH v2 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand
  https://edk2.groups.io/g/devel/message/59160
  
http://mid.mail-archive.com/20200511180310.30964-1-vladimir.olovyannikov@broadcom.com

* version 3 (this version):
  [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand
  https://edk2.groups.io/g/devel/message/62452
  
20200713183137.9825-1-vladimir.olovyannikov@broadcom.com">http://mid.mail-archive.com/20200713183137.9825-1-vladimir.olovyannikov@broadcom.com

Thanks!
Laszlo


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

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



Re: [edk2-devel] [PATCH v3 1/1] ShellPkg/DynamicCommand: add HttpDynamicCommand

2020-07-15 Thread Laszlo Ersek
On 07/13/20 20:31, Vladimir Olovyannikov via groups.io wrote:
> Introduce an http client utilizing EDK2 HTTP protocol, to
> allow fast image downloading from http/https servers.
> HTTP download speed is usually faster than tftp.
> The client is based on the same approach as tftp dynamic command, and
> uses the same UEFI Shell command line parameters. This makes it easy
> integrating http into existing UEFI Shell scripts.
> Note that to enable HTTP download, feature Pcd
> gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections must
> be set to TRUE.
> 
> Signed-off-by: Vladimir Olovyannikov 
> Tested-By: Samer El-Haj-Mahmoud 
> Cc: Zhichao Gao 
> Cc: Maciej Rabeda 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Cc: Ray Ni 
> Cc: Liming Gao 
> Cc: Nd 
> ---
>  .../DynamicCommand/HttpDynamicCommand/Http.c  | 1700 +
>  .../DynamicCommand/HttpDynamicCommand/Http.h  |   84 +
>  .../HttpDynamicCommand/Http.uni   |  113 ++
>  .../HttpDynamicCommand/HttpApp.c  |   53 +
>  .../HttpDynamicCommand/HttpApp.inf|   58 +
>  .../HttpDynamicCommand/HttpDynamicCommand.c   |  134 ++
>  .../HttpDynamicCommand/HttpDynamicCommand.inf |   63 +
>  ShellPkg/Include/Guid/ShellLibHiiGuid.h   |5 +
>  ShellPkg/ShellPkg.dec |1 +
>  ShellPkg/ShellPkg.dsc |5 +
>  10 files changed, 2216 insertions(+)
>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/Http.c
>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/Http.h
>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/Http.uni
>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.c
>  create mode 100644 ShellPkg/DynamicCommand/HttpDynamicCommand/HttpApp.inf
>  create mode 100644 
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.c
>  create mode 100644 
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf

This feature sounds very attractive for virtualization too.

I suggest filing a BZ for collecting the various versions of the patch
(or patch series) in a common spot. (Based on the size of the patch, I
assume there could be multiple versions.)

Once we have a BZ, it should certainly be listed under the proposed
features section for the next stable release.

https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Planning#proposed-features

I would also like to request that you please append patches for OvmfPkg
and ArmVirtPkg, for including the new command in those platforms.
Similarly to how they already include:
- TftpDynamicCommand.inf
- LinuxInitrdDynamicShellCommand.inf

Thank you!
Laszlo


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

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



Re: [edk2-devel] openssl.exe disappeared

2020-07-15 Thread Kilian Kegel
Hi Mike,

you are right, it is available again.

Maybe it was just gone for the weekend to prevent us from working 😉

Thank you,
Kilian

From: Kinney, Michael D
Sent: Monday, July 13, 2020 05:08 PM
To: devel@edk2.groups.io; 
kilian_ke...@outlook.com; Kinney, Michael 
D
Cc: Richardson, Brian
Subject: RE: [edk2-devel] openssl.exe disappeared

Hi Kilian,

It must have been a temporary issue.  The link is working for me this morning.

Mike

From: devel@edk2.groups.io  On Behalf Of Kilian Kegel
Sent: Sunday, July 12, 2020 5:35 AM
To: devel@edk2.groups.io; Kinney, Michael D 
Cc: Richardson, Brian 
Subject: [edk2-devel] openssl.exe disappeared

Hi Mike,

the link https://indy.fulgan.com/SSL/openssl-1.0.2r-x64_86-win64.zip from your 
script
https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel/Vlv2TbltDevicePkg/Readme.md#download-and-build-minnowmax-using-windowsvisual-studio
is not available anymore.

Do you know if anyone can restore the content or provide the content on an 
Intel/tianocore web space?

Cheers,
   Kilian



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

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



[edk2-devel] [PATCH edk2-platforms 2/4] Readme.md: update build parallellism information

2020-07-15 Thread Leif Lindholm
BaseTools can now be built in parallel, so drop the statement that says
it cannot, and add -j flag to example command line.

Also, the `build` command now utilizes parallellism by default, so update
text and examples to reflect this (and drop the examples for manually
figuring out available core count).

Signed-off-by: Leif Lindholm 
---
 Readme.md | 24 +---
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/Readme.md b/Readme.md
index c5df5a15f53d..e1350b456619 100644
--- a/Readme.md
+++ b/Readme.md
@@ -105,11 +105,7 @@ target-specific binutils. These are included with any 
prepackaged GCC toolchain
(This step _depends_ on **WORKSPACE** being set as per above.)
 1. Build BaseTools
 
-   `make -C edk2/BaseTools`
-
-   (BaseTools can currently not be built in parallel, so do not specify any 
`-j`
-   option, either on the command line or in a **MAKEFLAGS** environment
-   variable.)
+   `make -C edk2/BaseTools -j`
 
 ### Build options
 There are a number of options that can (or must) be specified at the point of
@@ -123,8 +119,9 @@ TARGET| `-b` | One of DEBUG, RELEASE or 
NOOPT.
 TARGET_ARCH   | `-a` | Architecture to build for.
 TOOL_CHAIN_TAG| `-t` | Toolchain profile to use for building.
 
-There is also MAX_CONCURRENT_THREAD_NUMBER (`-n`), roughly equivalent to
-`make -j`.
+The `build` command will automatically determine the number of available cpus
+and enable parallell builds. If you wish to restrict the parallellism, the `-n`
+option specifies how many threads to use.
 
 When specified on command line, `-b` can be repeated multiple times in order to
 build multiple targets sequentially.
@@ -133,21 +130,10 @@ After a successful build, the resulting images can be 
found in
 `Build/{Platform Name}/{TARGET}_{TOOL_CHAIN_TAG}/FV`.
 
 ### Build a platform
-The main build process _can_ run in parallel - so figure out how many threads 
we
-have available.
-
-```
-$ getconf _NPROCESSORS_ONLN
-8
-```
-OK, so we have 8 CPUs - let's tell the build to use a little more than that:
-```
-$ NUM_CPUS=$((`getconf _NPROCESSORS_ONLN` + 2))
-```
 For the toolchain tag, use GCC5 for gcc version 5 or later, GCC4x for
 earlier versions, or CLANG35/CLANG38 as appropriate when building with clang.
 ```
-$ build -n $NUM_CPUS -a AARCH64 -t GCC5 -p Platform/ARM/JunoPkg/ArmJuno.dsc
+$ build -a AARCH64 -t GCC5 -p Platform/ARM/JunoPkg/ArmJuno.dsc
 ```
 (Note that the description file gets resolved by the build command through
 searching in all locations specified in **PACKAGES_PATH**.)
-- 
2.20.1


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

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



[edk2-devel] [PATCH edk2-platforms 3/4] Readme.md: update ARM/AARCH64 cross-toolchain info

2020-07-15 Thread Leif Lindholm
In the past, Linaro released binary builds of GCC cross-toolchains for
ARM and AARCH64, but this has since stopped, and up-to-date toolchains
are now being released directly by ARM. Update cross compilation section
of documentation to reflect this.

Reported-by: Vin Xue 
Signed-off-by: Leif Lindholm 
---
 Readme.md | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Readme.md b/Readme.md
index e1350b456619..a800f86b84a9 100644
--- a/Readme.md
+++ b/Readme.md
@@ -56,11 +56,11 @@ X64 | x86_64-linux-gnu-
 \* i386, i486, i586 or i686
 
 ### GCC
-Linaro provides GCC toolchains for
-[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/)
-and 
[arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/)
-compiled to run on x86_64/i686 Linux and i686 Windows. Some Linux distributions
-provide their own packaged cross-toolchains.
+ARM provides binary downloads of prebuilt GCC cross-toolchains for
+[aarch64-linux-gnu and 
arm-linux-gnueabihf](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads)
+compiled to run on i686 Windows as well as x86_64 and aarch64
+(for arm-linux-gnueabihf) x86_64 Linux.
+Some Linux distributions provide their own packaged cross-toolchains.
 
 ### clang
 Clang does not require separate cross compilers, but it does need a
-- 
2.20.1


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

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



[edk2-devel] [PATCH edk2-platforms 1/4] Readme.md: wrap long line

2020-07-15 Thread Leif Lindholm
The line describing how to set cross compiler prefix was way too long,
wrap it to match the rest of the file.

Signed-off-by: Leif Lindholm 
---
 Readme.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Readme.md b/Readme.md
index ea9492240adb..c5df5a15f53d 100644
--- a/Readme.md
+++ b/Readme.md
@@ -159,7 +159,8 @@ build command which toolchain to use. We do this by setting 
the environment
 variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in the case above,
 **GCC5_AARCH64_PREFIX**.
 
-So, referring to the cross compiler toolchain table above, we should prepend 
the `build` command line with `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.
+So, referring to the cross compiler toolchain table above, we should prepend 
the
+`build` command line with `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.
 
 ## Using uefi-tools helper scripts
 uefi-tools is a completely unofficial set of helper-scripts developed by 
Linaro.
-- 
2.20.1


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

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



[edk2-devel] [PATCH edk2-platforms 0/4] Readme.md: various build example updates

2020-07-15 Thread Leif Lindholm
As reported by Vin Xue, the URL for downloading GCC cross-toolchains
from Linaro went away - but they are now also released directly by ARM.
Update link to download page, and also update description to point out
that there are now aarch64->aarch32 cross compilers published.

Also, a patch from Vin Xue adding a full usage example for a
cross-compiling build command line.

Before that, a preparatory patch breaking a way too long line, and
another one aligning the documenting of build parallellism with current
reality.

Leif Lindholm (3):
  Readme.md: wrap long line
  Readme.md: update build parallellism information
  Readme.md: update ARM/AARCH64 cross-toolchain info

Vin Xue (1):
  Readme.md: add example command line to cross compiling section

 Readme.md | 40 +++-
 1 file changed, 15 insertions(+), 25 deletions(-)

Cc: Vin Xue 
-- 
2.20.1


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

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



[edk2-devel] [PATCH edk2-platforms 4/4] Readme.md: add example command line to cross compiling section

2020-07-15 Thread Leif Lindholm
From: Vin Xue 

Add build command example for cross compiling.

Cc: Leif Lindholm 
Cc: Michael D Kinney 
Signed-off-by: Vin Xue 
Reviewed-by: Leif Lindholm 
---
 Readme.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Readme.md b/Readme.md
index a800f86b84a9..3de88c330f5c 100644
--- a/Readme.md
+++ b/Readme.md
@@ -147,6 +147,9 @@ variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in the 
case above,
 
 So, referring to the cross compiler toolchain table above, we should prepend 
the
 `build` command line with `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.
+```
+$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a AARCH64 -t GCC5 -p 
Platform/ARM/JunoPkg/ArmJuno.dsc
+```
 
 ## Using uefi-tools helper scripts
 uefi-tools is a completely unofficial set of helper-scripts developed by 
Linaro.
-- 
2.20.1


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

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



Re: [edk2-devel] [edk2-platforms][PATCH] Readme.md: Update cross compiling section

2020-07-15 Thread Vin Xue
Hi Lindholm,

Thanks for your comments.
Usually, I am working on Windows PC for BIOS development.
Today I tried to build edk2-platform AAarch64 code, and found it's not
easy to follow readme document. So, I submitted the patch.

Please drop the patch if there is a better update in the near future.


From: Leif Lindholm 
Sent: Wednesday, July 15, 2020 5:26 PM
To: Vin Xue 
Cc: devel@edk2.groups.io ; Michael D Kinney 

Subject: Re: [edk2-platforms][PATCH] Readme.md: Update cross compiling section

On Wed, Jul 15, 2020 at 14:05:03 +0800, Vin Xue wrote:
> 1. Update invalid URL link of Linaro GCC toolchains.
> 2. Add build command example for cross compiling.
>
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Signed-off-by: Vin Xue 
> ---
>  Readme.md | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/Readme.md b/Readme.md
> index ea9492240a..2e30f672cc 100644
> --- a/Readme.md
> +++ b/Readme.md
> @@ -57,10 +57,13 @@ X64 | x86_64-linux-gnu-
>
>  ### GCC
>  Linaro provides GCC toolchains for
> -[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/)
> -and 
> [arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/)
> -compiled to run on x86_64/i686 Linux and i686 Windows. Some Linux 
> distributions
> -provide their own packaged cross-toolchains.
> +[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/)
> +and 
> [arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/)
> +compiled to run on x86_64/i686 Linux and i686 Windows.

Yes, we should update the information about the Windows toolchains.
But gcc 7 is ancient. If we go to
https://releases.linaro.org/components/toolchain/binaries/, we see
they have added a gcc-8 "directory". I say "directory" with quotes
because clicking on that redirects you to
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
This is the location we should now be pointing to - and these
toolchains are now gcc 9.2.

> +
> +Some Linux distributions provide their own packaged cross-toolchains. e.g. 
> Install AArch64 GCC toolchain on Ubuntu (x86_64) with:
> +
> +`sudo apt install gcc-aarch64-linux-gnu`

We can't maintain a list of every possible package name with every
possible package install command (apt, yum, dnf, pacman, ?) for every
distribution (debian, ubuntu, redhat, fedora, centos, suse, arch,
gentoo, ?) out there. We'll also be adding RISC-V support in the near
future.

The abovementioned arm.com link includes prebuilt compilers for
Windows-x86_64, Linux-x86_64, and Linux-AArch64 (for AArch32).
Anyone unable to figure out how to find and install packages provided
with their distro can always grab a toolchain from that download page.

>
>  ### clang
>  Clang does not require separate cross compilers, but it does need a
> @@ -160,6 +163,9 @@ variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in the 
> case above,
>  **GCC5_AARCH64_PREFIX**.
>
>  So, referring to the cross compiler toolchain table above, we should prepend 
> the `build` command line with `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.
> +```
> +$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 -t 
> GCC5 -p Platform/ARM/JunoPkg/ArmJuno.dsc
> +```

How to build a platform is already described in the section
immediately preceding this one. This paragraph tells you how to inform
the build system to apply a prefix for the compiler if cross compiling.

Seprate note (to self, really): we don't need the -n thing anymore,
the 'build' command has been updated to figure this out for itself.

/
Leif

>
>  ## Using uefi-tools helper scripts
>  uefi-tools is a completely unofficial set of helper-scripts developed by 
> Linaro.
> --
> 2.27.0.windows.1
>

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

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



Re: [edk2-devel] [edk2-platforms][PATCH] Readme.md: Update cross compiling section

2020-07-15 Thread Leif Lindholm
Hi Vin Xue,

If the documentation can be improved, it should.

I will propose an update to the cross-compilation section, thank you
for reporting that the link had stopped working.

On Wed, Jul 15, 2020 at 10:31:23 +, Vin Xue wrote:
> Hi Lindholm,
> 
> Thanks for your comments.
> Usually, I am working on Windows PC for BIOS development.
> Today I tried to build edk2-platform AAarch64 code, and found it's not
> easy to follow readme document. So, I submitted the patch.
> 
> Please drop the patch if there is a better update in the near future.
> 
> >  ### clang
> >  Clang does not require separate cross compilers, but it does need a
> > @@ -160,6 +163,9 @@ variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in 
> > the case above,
> >  **GCC5_AARCH64_PREFIX**.
> >
> >  So, referring to the cross compiler toolchain table above, we should 
> > prepend the `build` command line with 
> > `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.
> > +```
> > +$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 -t 
> > GCC5 -p Platform/ARM/JunoPkg/ArmJuno.dsc
> > +```

Actually, I misread this hunk since the context line before the
addition is too long, wrapping unfortuinately in my email client; I
read it as *replacing* the variable setting with the full usage
example. Apologies for this.
I have no objection to the addition of the full usage example. I will
drop the other bits of this patch and send out a minor set of readme
updates including the remainder of this patch.

/
Leif

> 
> How to build a platform is already described in the section
> immediately preceding this one. This paragraph tells you how to inform
> the build system to apply a prefix for the compiler if cross compiling.
> 
> Seprate note (to self, really): we don't need the -n thing anymore,
> the 'build' command has been updated to figure this out for itself.
> 
> /
> Leif
> 
> >
> >  ## Using uefi-tools helper scripts
> >  uefi-tools is a completely unofficial set of helper-scripts developed by 
> > Linaro.
> > --
> > 2.27.0.windows.1
> >

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

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



[edk2-devel] [edk2-platforms: PATCH V1] MinPlatformPkg/PlatformInitPei:

2020-07-15 Thread Kumar, Chandana C
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

Update ReportCpuHobLib to PlatformInitPreMem driver and dec file.

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

Change-Id: Iad1be2612e0748d5c9a2a766cd2256dd9845ec13
Signed-off-by: Chandana Kumar 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
---
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
   | 5 +++--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index 7f74ac93..da312c86 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -6,7 +6,7 @@
 # INF files to generate AutoGen.c and AutoGen.h files
 # for the build infrastructure.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -68,7 +68,8 @@
   TestPointLib|Include/Library/TestPointLib.h
   TestPointCheckLib|Include/Library/TestPointCheckLib.h
 
-SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+  SetCacheMtrrLib|Include/Library/SetCacheMtrrLib.h
+  ReportCpuHobLib|Include/Library/ReportCpuHobLib.h
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.16.2.windows.1


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

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



Re: [edk2-devel] [PATCH 1/1] OvmfPkg/OvmfPkg.dec: Adjust PcdMptScsiStallPerPollUsec

2020-07-15 Thread Liran Alon



On 15/07/2020 11:20, Gary Lin wrote:

The toke value of PcdMptScsiStallPerPollUsec should be 0x3a since the
previous toke value is 0x39.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Liran Alon 
Cc: Nikita Leshenko 
Signed-off-by: Gary Lin 
---

Reviewed-by: Liran Alon 

  OvmfPkg/OvmfPkg.dec | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 65bb2bb0eb4c..2b0f137cbcce 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -172,7 +172,7 @@ [PcdsFixedAtBuild]
gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiMaxTargetLimit|7|UINT8|0x39
  
## Microseconds to stall between polling for MptScsi request result

-  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x40
+  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x3a
  
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8

gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9


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

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



Re: [edk2-devel] [edk2-platforms][PATCH] Readme.md: Update cross compiling section

2020-07-15 Thread Leif Lindholm
On Wed, Jul 15, 2020 at 14:05:03 +0800, Vin Xue wrote:
> 1. Update invalid URL link of Linaro GCC toolchains.
> 2. Add build command example for cross compiling.
> 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Signed-off-by: Vin Xue 
> ---
>  Readme.md | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/Readme.md b/Readme.md
> index ea9492240a..2e30f672cc 100644
> --- a/Readme.md
> +++ b/Readme.md
> @@ -57,10 +57,13 @@ X64 | x86_64-linux-gnu-
>  
>  ### GCC
>  Linaro provides GCC toolchains for
> -[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/)
> -and 
> [arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/)
> -compiled to run on x86_64/i686 Linux and i686 Windows. Some Linux 
> distributions
> -provide their own packaged cross-toolchains.
> +[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/)
> +and 
> [arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/)
> +compiled to run on x86_64/i686 Linux and i686 Windows.

Yes, we should update the information about the Windows toolchains.
But gcc 7 is ancient. If we go to
https://releases.linaro.org/components/toolchain/binaries/, we see
they have added a gcc-8 "directory". I say "directory" with quotes
because clicking on that redirects you to
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
This is the location we should now be pointing to - and these
toolchains are now gcc 9.2.

> +
> +Some Linux distributions provide their own packaged cross-toolchains. e.g. 
> Install AArch64 GCC toolchain on Ubuntu (x86_64) with:
> +
> +`sudo apt install gcc-aarch64-linux-gnu`

We can't maintain a list of every possible package name with every
possible package install command (apt, yum, dnf, pacman, ?) for every
distribution (debian, ubuntu, redhat, fedora, centos, suse, arch,
gentoo, ?) out there. We'll also be adding RISC-V support in the near
future.

The abovementioned arm.com link includes prebuilt compilers for
Windows-x86_64, Linux-x86_64, and Linux-AArch64 (for AArch32).
Anyone unable to figure out how to find and install packages provided
with their distro can always grab a toolchain from that download page.

>  
>  ### clang
>  Clang does not require separate cross compilers, but it does need a
> @@ -160,6 +163,9 @@ variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in the 
> case above,
>  **GCC5_AARCH64_PREFIX**.
>  
>  So, referring to the cross compiler toolchain table above, we should prepend 
> the `build` command line with `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.
> +```
> +$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 -t 
> GCC5 -p Platform/ARM/JunoPkg/ArmJuno.dsc
> +```

How to build a platform is already described in the section
immediately preceding this one. This paragraph tells you how to inform
the build system to apply a prefix for the compiler if cross compiling.

Seprate note (to self, really): we don't need the -n thing anymore,
the 'build' command has been updated to figure this out for itself.

/
Leif

>  
>  ## Using uefi-tools helper scripts
>  uefi-tools is a completely unofficial set of helper-scripts developed by 
> Linaro.
> -- 
> 2.27.0.windows.1
> 

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

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



[edk2-devel] [edk2-platforms][PATCH] Readme.md: Update cross compiling section

2020-07-15 Thread Vin Xue
1. Update invalid URL link of Linaro GCC toolchains.
2. Add build command example for cross compiling.

Cc: Leif Lindholm 
Cc: Michael D Kinney 
Signed-off-by: Vin Xue 
---
 Readme.md | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Readme.md b/Readme.md
index ea9492240a..2e30f672cc 100644
--- a/Readme.md
+++ b/Readme.md
@@ -57,10 +57,13 @@ X64 | x86_64-linux-gnu-
 

 ### GCC

 Linaro provides GCC toolchains for

-[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/)

-and 
[arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/)

-compiled to run on x86_64/i686 Linux and i686 Windows. Some Linux distributions

-provide their own packaged cross-toolchains.

+[aarch64-linux-gnu](https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/)

+and 
[arm-linux-gnueabihf](https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/)

+compiled to run on x86_64/i686 Linux and i686 Windows.

+

+Some Linux distributions provide their own packaged cross-toolchains. e.g. 
Install AArch64 GCC toolchain on Ubuntu (x86_64) with:

+

+`sudo apt install gcc-aarch64-linux-gnu`

 

 ### clang

 Clang does not require separate cross compilers, but it does need a

@@ -160,6 +163,9 @@ variable `{TOOL_CHAIN_TAG}_{TARGET_ARCH}_PREFIX` - in the 
case above,
 **GCC5_AARCH64_PREFIX**.

 

 So, referring to the cross compiler toolchain table above, we should prepend 
the `build` command line with `GCC5_AARCH64_PREFIX=aarch64-linux-gnu-`.

+```

+$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -n $NUM_CPUS -a AARCH64 -t GCC5 
-p Platform/ARM/JunoPkg/ArmJuno.dsc

+```

 

 ## Using uefi-tools helper scripts

 uefi-tools is a completely unofficial set of helper-scripts developed by 
Linaro.

-- 
2.27.0.windows.1


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

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



[edk2-devel] [PATCH 1/1] OvmfPkg/OvmfPkg.dec: Adjust PcdMptScsiStallPerPollUsec

2020-07-15 Thread Gary Lin
The toke value of PcdMptScsiStallPerPollUsec should be 0x3a since the
previous toke value is 0x39.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Liran Alon 
Cc: Nikita Leshenko 
Signed-off-by: Gary Lin 
---
 OvmfPkg/OvmfPkg.dec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 65bb2bb0eb4c..2b0f137cbcce 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -172,7 +172,7 @@ [PcdsFixedAtBuild]
   gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiMaxTargetLimit|7|UINT8|0x39

 

   ## Microseconds to stall between polling for MptScsi request result

-  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x40

+  gUefiOvmfPkgTokenSpaceGuid.PcdMptScsiStallPerPollUsec|5|UINT32|0x3a

 

   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|0x8

   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|0x9

-- 
2.25.1


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

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