Re: [edk2-devel] Help of acpi event

2020-07-26 Thread Kumar G
Please help experts
On Tue, 21 Jul 2020 at 11:23, Kumar G  wrote:

> Hi Experts,
>
> I am moving from device tree world to acpi. I found the event notification
> feature of acpi table interesting.
>
> I have some questions over notification
> -  Is some hardware can generate events and notify OS by its own ?(if yes
> , please help me how) , I mean without calling any method from OS
>
> - I may be wrong, but it looks OS needs to call a method in order to
> execution of Notify function of acpi table
>
> - Is this correct acpi tables are static piece of code, having no
> thread/execution context, All execution in done from OS
>
>
> Thanks
> Kumar G
>

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

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



Re: [edk2-devel] [PATCH v8 0/9] Add new feature that evacuate temporary to permanent memory (CVE-2019-11098)

2020-07-26 Thread Liming Gao
Reviewed-by: Liming Gao  for this patch set. 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Guomin Jiang
Sent: 2020年7月24日 17:55
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH v8 0/9] Add new feature that evacuate temporary to 
permanent memory (CVE-2019-11098)

The TOCTOU vulnerability allow that the physical present person to replace the 
code with the normal BootGuard check and PCR0 value.
The issue occur when BootGuard measure IBB and access flash code after NEM 
disable.
The reason why we access the flash code is that we have some pointer to flash.
To avoid this vulnerability, we need to convert those pointers, the patch 
series do this work and make sure that no code will access flash address.

v2:
Create gEdkiiMigratedFvInfoGuid HOB and add 
PcdMigrateTemporaryRamFirmwareVolumes to control whole feature.

v3:
Remove changes which is not related with the feature and disable the feature in 
virtual platform.

v4:
Disable the feature as default, Copy the Tcg2Pei behavior to TcgPei

v5:
Initialize local variable Shadow and return EFI_ABORTED when RepublishSecPpi 
not installed.

v6:
Avoid redundant shadow PEIM when enable Migrated PCD.

v7:
Change patch 10/10 to enhance the logic.

v8:
Drop the patch#10 added in v6 and v7, the optimization will be considered 
future.

Guomin Jiang (6):
  MdeModulePkg: Add new PCD to control the evacuate temporary memory
feature (CVE-2019-11098)
  MdeModulePkg/Core: Create Migrated FV Info Hob for calculating hash
(CVE-2019-11098)
  SecurityPkg/Tcg2Pei: Use Migrated FV Info Hob for calculating hash
(CVE-2019-11098)
  UefiCpuPkg/CpuMpPei: Enable paging and set NP flag to avoid TOCTOU
(CVE-2019-11098)
  UefiCpuPkg: Correct some typos.
  SecurityPkg/TcgPei: Use Migrated FV Info Hob for calculating hash
(CVE-2019-11098)

Michael Kubacki (3):
  MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore
(CVE-2019-11098)
  UefiCpuPkg/CpuMpPei: Add GDT migration support (CVE-2019-11098)
  UefiCpuPkg/SecMigrationPei: Add initial PEIM (CVE-2019-11098)

 MdeModulePkg/MdeModulePkg.dec |  12 +
 UefiCpuPkg/UefiCpuPkg.dec |   3 +
 UefiCpuPkg/UefiCpuPkg.dsc |   1 +
 MdeModulePkg/Core/Pei/PeiMain.inf |   3 +
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf   |   1 +
 SecurityPkg/Tcg/TcgPei/TcgPei.inf |   1 +
 UefiCpuPkg/CpuMpPei/CpuMpPei.inf  |   4 +
 UefiCpuPkg/SecCore/SecCore.inf|   2 +
 .../SecMigrationPei/SecMigrationPei.inf   |  68 +++
 MdeModulePkg/Core/Pei/PeiMain.h   | 170 +++
 MdeModulePkg/Include/Guid/MigratedFvInfo.h|  22 +
 UefiCpuPkg/CpuMpPei/CpuMpPei.h|  14 +-
 UefiCpuPkg/Include/Ppi/RepublishSecPpi.h  |  54 +++
 .../CpuExceptionCommon.h  |   4 +-
 UefiCpuPkg/SecCore/SecMain.h  |   1 +
 UefiCpuPkg/SecMigrationPei/SecMigrationPei.h  | 158 +++  
MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 445 +-
 MdeModulePkg/Core/Pei/Image/Image.c   | 130 -
 MdeModulePkg/Core/Pei/Memory/MemoryServices.c |  82 
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c   |  22 +-
 MdeModulePkg/Core/Pei/Ppi/Ppi.c   | 286 +++
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c |  31 +-
 SecurityPkg/Tcg/TcgPei/TcgPei.c   |  29 +-
 UefiCpuPkg/CpuMpPei/CpuMpPei.c|  37 ++
 UefiCpuPkg/CpuMpPei/CpuPaging.c   |  42 +-
 .../Ia32/ArchExceptionHandler.c   |   4 +-
 .../SecPeiCpuException.c  |   2 +-
 .../X64/ArchExceptionHandler.c|   4 +-
 UefiCpuPkg/SecCore/SecMain.c  |  26 +-
 UefiCpuPkg/SecMigrationPei/SecMigrationPei.c  | 385 +++
 MdeModulePkg/MdeModulePkg.uni |   6 +
 .../SecMigrationPei/SecMigrationPei.uni   |  13 +
 32 files changed, 2032 insertions(+), 30 deletions(-)  create mode 100644 
UefiCpuPkg/SecMigrationPei/SecMigrationPei.inf
 create mode 100644 MdeModulePkg/Include/Guid/MigratedFvInfo.h
 create mode 100644 UefiCpuPkg/Include/Ppi/RepublishSecPpi.h
 create mode 100644 UefiCpuPkg/SecMigrationPei/SecMigrationPei.h
 create mode 100644 UefiCpuPkg/SecMigrationPei/SecMigrationPei.c
 create mode 100644 UefiCpuPkg/SecMigrationPei/SecMigrationPei.uni

--
2.25.1.windows.1





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

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



Re: [edk2-devel] [PATCH V4 0/2] CXL Specification Registers

2020-07-26 Thread Liming Gao
https://github.com/tianocore/edk2/pull/828 for this change, be merged. 

-Original Message-
From: Gao, Liming 
Sent: 2020年7月27日 10:36
To: Javeed, Ashraf ; devel@edk2.groups.io
Cc: Kinney, Michael D 
Subject: RE: [PATCH V4 0/2] CXL Specification Registers

This version is good to me. Reviewed-by: Liming Gao 

-Original Message-
From: Javeed, Ashraf  
Sent: 2020年7月25日 2:26
To: devel@edk2.groups.io
Cc: Kinney, Michael D ; Gao, Liming 

Subject: [PATCH V4 0/2] CXL Specification Registers

These 2 patches introduces the Compute Express Link (CXL) Specificition defined 
registers.
The Cxl11.h has the actual register definitions of the CXL Specification 
Revision 1.1; and the Cxl.h is the main header file to include all versions of 
the CXL register definitions.

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

Signed-off-by: Ashraf Javeed 
Cc: Michael D Kinney 
Cc: Liming Gao 
--

Ashraf Javeed (2):
  MdePkg/Include/IndustryStandard: CXL 1.1 Registers
  MdePkg/Include/IndustryStandard: Main CXL header

 MdePkg/Include/IndustryStandard/Cxl.h   |  22 ++
 MdePkg/Include/IndustryStandard/Cxl11.h | 569 
+
 MdePkg/Include/IndustryStandard/Pci.h   |   6 ++
 3 files changed, 593 insertions(+), 4 deletions(-)  create mode 100644 
MdePkg/Include/IndustryStandard/Cxl.h
 create mode 100644 MdePkg/Include/IndustryStandard/Cxl11.h

--
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH 00/15] Add a plugin LicenseCheck in open ci

2020-07-26 Thread Liming Gao
Shenglei:
  I have one comment. Seemly, LicenseCheck_plug_in.yaml copyright may be Intel 
one. 

  Reviewed-by: Liming Gao  for this patch set. 

Thanks
Liming
-Original Message-
From: Zhang, Shenglei  
Sent: 2020年7月20日 16:37
To: devel@edk2.groups.io
Cc: Kinney, Michael D ; Sean Brogan 
; Bret Barkelew ; Dong, 
Eric ; Laszlo Ersek ; Gao, Zhichao 
; Yao, Jiewen ; Chao Zhang 
; Justen, Jordan L ; Maciej 
Rabeda ; Wu, Jiaxin ; Fu, 
Siyuan ; Gao, Liming ; Wang, Jian J 
; Wu, Hao A ; Andrew Fish 
; Ni, Ray ; Lu, XiaoyuX 
; Ard Biesheuvel ; Leif Lindholm 

Subject: [PATCH 00/15] Add a plugin LicenseCheck in open ci

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
LicenseCheck is now enabled in PatchCheck.py. But there's a patch "Revert 
'BaseTools/PatchCheck.py: Add LicenseCheck'"
to suggest revert the change.These patch series introduce a plugin LicenseCheck 
into open ci so that license issues can still be checked after the checker is 
disabled in PatchCheck.py.
1/15 is the plugin implementation.
2/15 ~ 15/15 introduce sections "IgnoreFiles" to allow developers to skip 
license check for some files like generated files.

Only BSD-2-Clause-Patent and BSD-3-Clause-Patent can pass this checker.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Zhichao Gao 
Cc: Jiewen Yao 
Cc: Chao Zhang 
Cc: Jordan Justen 
Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Cc: Liming Gao 
Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Shenglei Zhang (15):
  .pytool/Plugin: Add a plugin LicenseCheck
  FatPkg/FatPkg.ci.yaml: Add configuration for LicenseCheck
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for LicenseCheck
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for LicenseCheck
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for LicenseCheck
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for LicenseCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for LicenseCheck
  MdePkg/MdePkg.ci.yaml: Add configuration for LicenseCheck
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for LicenseCheck
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for LicenseCheck
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for
LicenseCheck
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for LicenseCheck
  ShellPkg/ShellPkg.ci.yaml: Add configuration for LicenseCheck
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for LicenseCheck
  UnitTestFrameworkPkg: Add configuration for LicenseCheck in yaml file

 .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 118 ++
 .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
 .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
 ArmVirtPkg/ArmVirtPkg.ci.yaml |   4 +
 CryptoPkg/CryptoPkg.ci.yaml   |   3 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |   4 +
 FatPkg/FatPkg.ci.yaml |   3 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |   3 +
 MdeModulePkg/MdeModulePkg.ci.yaml |   4 +
 MdePkg/MdePkg.ci.yaml |   4 +
 NetworkPkg/NetworkPkg.ci.yaml |   3 +
 OvmfPkg/OvmfPkg.ci.yaml   |   4 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |   3 +
 SecurityPkg/SecurityPkg.ci.yaml   |   3 +
 ShellPkg/ShellPkg.ci.yaml |   3 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |   3 +
 .../UnitTestFrameworkPkg.ci.yaml  |   4 +
 17 files changed, 194 insertions(+)
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck.py
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/LicenseCheck/Readme.md

--
2.18.0.windows.1


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

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



Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test

2020-07-26 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Ni, Ray 
> Sent: Friday, July 24, 2020 2:42 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Shao, Ming
> ; Dong, Eric ; Laszlo Ersek
> ; Sean Brogan ; Bret
> Barkelew ; Yao, Jiewen
> 
> Subject: [PATCH v2] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test
> 
> Add host based unit tests for the MtrrLib services.
> The BaseLib services AsmCpuid(), AsmReadMsr64(), and
> AsmWriteMsr64() are hooked and provide simple emulation
> of the CPUID leafs and MSRs required by the MtrrLib to
> run as a host based unit test.
> 
> Test cases are developed for each of the API.
> 
> For the most important APIs MtrrSetMemoryAttributesInMtrrSettings()
> and MtrrSetMemoryAttributeInMtrrSettings(), random inputs are
> generated and fed to the APIs to make sure the implementation is
> good. The test application accepts an optional parameter which
> specifies how many iterations of feeding random inputs to the two
> APIs. The overall number of test cases increases when the iteration
> increases. Default iteration is 10 when no parameter is specified.
> 
> Signed-off-by: Ray Ni 
> Signed-off-by: Michael D Kinney 
> Signed-off-by: Ming Shao 
> Cc: Michael D Kinney 
> Cc: Ming Shao 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Sean Brogan 
> Cc: Bret Barkelew 
> Cc: Jiewen Yao 
> ---
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.c| 1140 +
>  .../MtrrLib/UnitTest/MtrrLibUnitTest.h|  171 +++
>  .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf  |   39 +
>  UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c |  913 +
>  UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc|   31 +
>  5 files changed, 2294 insertions(+)
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h
>  create mode 100644
> UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTestHost.inf
>  create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
>  create mode 100644 UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc
> 
> diff --git a/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> new file mode 100644
> index 00..2eac41fc74
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c
> @@ -0,0 +1,1140 @@
> +/** @file
> 
> +  Unit tests of the MtrrLib instance of the MtrrLib class
> 
> +
> 
> +  Copyright (c) 2020, Intel Corporation. All rights reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include "MtrrLibUnitTest.h"
> 
> +
> 
> +STATIC CONST MTRR_LIB_SYSTEM_PARAMETER mDefaultSystemParameter
> = {
> 
> +  42, TRUE, TRUE, CacheUncacheable, 12
> 
> +};
> 
> +
> 
> +STATIC MTRR_LIB_SYSTEM_PARAMETER mSystemParameters[] = {
> 
> +  { 38, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 38, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 42, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 42, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +
> 
> +  { 48, TRUE, TRUE, CacheUncacheable,12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteBack,  12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteThrough,   12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteProtected, 12 },
> 
> +  { 48, TRUE, TRUE, CacheWriteCombining, 12 },
> 
> +};
> 
> +
> 
> +UINT32mFixedMtrrsIndex[] = {
> 
> +  MSR_IA32_MTRR_FIX64K_0,
> 
> +  MSR_IA32_MTRR_FIX16K_8,
> 
> +  MSR_IA32_MTRR_FIX16K_A,
> 
> +  MSR_IA32_MTRR_FIX4K_C,
> 
> +  MSR_IA32_MTRR_FIX4K_C8000,
> 
> +  MSR_IA32_MTRR_FIX4K_D,
> 
> +  MSR_IA32_MTRR_FIX4K_D8000,
> 
> +  MSR_IA32_MTRR_FIX4K_E,
> 
> +  MSR_IA32_MTRR_FIX4K_E8000,
> 
> +  MSR_IA32_MTRR_FIX4K_F,
> 
> +  MSR_IA32_MTRR_FIX4K_F8000
> 
> +};
> 
> +STATIC_ASSERT (
> 
> +  (ARRAY_SIZE (mFixedMtrrsIndex) == MTRR_NUMBER_OF_FIXED_MTRR),
> 
> +  "gFixedMtrrIndex does NOT contain all the fixed MTRRs!"
> 
> +  );
> 
> +
> 
> +//
> 
> +// Context structure to be used for most of the test cases.
> 
> +//
> 
> +typedef struct {
> 
> +  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
> 
> +} MTRR_LIB_TEST_CONTEXT;
> 
> +
> 
> +//
> 
> +// Context structure to be used for GetFirmwareVariableMtrrCount() test.
> 
> +//
> 
> +typedef struct {
> 
> +  UINT32  NumberOfReservedVariableMtrrs;
> 
> +  CONST MTRR_LIB_SYSTEM_PARAMETER *SystemParameter;
> 
> +} MTRR_LIB_GET_FIRMWARE_VARIABLE_MTRR_COUNT_CONTEXT;
> 
> +
> 
> +STATIC CHAR8 *mCacheDescription[] = { "UC", "WC", "N/A", "N/A", "WT",
> "WP", "WB" };
> 
> +
> 
> +/**
> 
> +  Compare the actual memory ranges against expected memory ranges and
> 

Re: [edk2-devel] [PATCH V4 0/2] CXL Specification Registers

2020-07-26 Thread Liming Gao
This version is good to me. Reviewed-by: Liming Gao 

-Original Message-
From: Javeed, Ashraf  
Sent: 2020年7月25日 2:26
To: devel@edk2.groups.io
Cc: Kinney, Michael D ; Gao, Liming 

Subject: [PATCH V4 0/2] CXL Specification Registers

These 2 patches introduces the Compute Express Link (CXL) Specificition defined 
registers.
The Cxl11.h has the actual register definitions of the CXL Specification 
Revision 1.1; and the Cxl.h is the main header file to include all versions of 
the CXL register definitions.

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

Signed-off-by: Ashraf Javeed 
Cc: Michael D Kinney 
Cc: Liming Gao 
--

Ashraf Javeed (2):
  MdePkg/Include/IndustryStandard: CXL 1.1 Registers
  MdePkg/Include/IndustryStandard: Main CXL header

 MdePkg/Include/IndustryStandard/Cxl.h   |  22 ++
 MdePkg/Include/IndustryStandard/Cxl11.h | 569 
+
 MdePkg/Include/IndustryStandard/Pci.h   |   6 ++
 3 files changed, 593 insertions(+), 4 deletions(-)  create mode 100644 
MdePkg/Include/IndustryStandard/Cxl.h
 create mode 100644 MdePkg/Include/IndustryStandard/Cxl11.h

--
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH 00/15] Add a plugin LicenseCheck in open ci

2020-07-26 Thread Liming Gao
Rebecca:
  I see Shenglei patch. I plan to finish review early of this week, then merge 
this patch set, and revert the original change in PatchCheck.py. 

Thanks
Liming
-Original Message-
From: Rebecca Cran  
Sent: 2020年7月25日 9:38
To: devel@edk2.groups.io; Zhang, Shenglei 
Cc: Kinney, Michael D ; Sean Brogan 
; Bret Barkelew ; Dong, 
Eric ; Laszlo Ersek ; Gao, Zhichao 
; Yao, Jiewen ; Chao Zhang 
; Justen, Jordan L ; Maciej 
Rabeda ; Wu, Jiaxin ; Fu, 
Siyuan ; Gao, Liming ; Wang, Jian J 
; Wu, Hao A ; Andrew Fish 
; Ni, Ray ; Lu, XiaoyuX 
; Ard Biesheuvel ; Leif Lindholm 

Subject: Re: [edk2-devel] [PATCH 00/15] Add a plugin LicenseCheck in open ci

On 7/20/20 2:36 AM, Zhang, Shenglei wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
> LicenseCheck is now enabled in PatchCheck.py. But there's a patch 
> "Revert 'BaseTools/PatchCheck.py: Add LicenseCheck'"
> to suggest revert the change.These patch series introduce a plugin 
> LicenseCheck into open ci so that license issues can still be checked 
> after the checker is disabled in PatchCheck.py.
> 1/15 is the plugin implementation.
> 2/15 ~ 15/15 introduce sections "IgnoreFiles" to allow developers to 
> skip license check for some files like generated files.

Has there been any progress on this? I'm waiting for it because it's required 
for my bhyve changes.


-- 

Rebecca Cran



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

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



Re: [edk2-devel] [PATCH edk2-platforms 0/2] Add ACPI support of MMIO TPM on SynQuacer

2020-07-26 Thread Masahisa Kojima
Hi Leif,

> Since this patch modifies line endings, and all of the CRs get lost in
> transit, can you please provide a pointer to a branch where I can pull
> these patches from?

My working branch is here:
https://git.linaro.org/people/masahisa.kojima/edk2-platforms.git/log/?h=synquacer/add_tpm_mmio_acpi

Thanks,
Masahisa

On Sat, 25 Jul 2020 at 02:03, Leif Lindholm  wrote:
>
> Masahisa,
>
> Since this patch modifies line endings, and all of the CRs get lost in
> transit, can you please provide a pointer to a branch where I can pull
> these patches from?
>
> Best Regards,
>
> Leif
>
> On Fri, Jul 17, 2020 at 19:09:10 +0900, Masahisa Kojima wrote:
> > This patches add the ACPI description of MMIO TPM on SynQuacer.
> > This also fixes the non CRLF line endings of Acpi.dsc.inc.
> >
> > Masahisa Kojima (2):
> >   Silicon/SynQuacer: add ACPI descriptor of MMIO TPM
> >   Silicon/SynQuacer: CRLF fixup for Acpi.dsc.inc
> >
> >  Silicon/Socionext/SynQuacer/Acpi.dsc.inc  | 89 ++-
> >  .../Socionext/SynQuacer/AcpiTables/Dsdt.asl   | 14 +++
> >  2 files changed, 61 insertions(+), 42 deletions(-)
> >
> > --
> > 2.17.1
> >

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

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



Re: [edk2-devel] [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address

2020-07-26 Thread Liming Gao
Reviewed-by: Liming Gao 

-Original Message-
From: Jessica Clarke  
Sent: 2020年7月27日 9:59
To: devel@edk2.groups.io
Cc: Jessica Clarke ; Gao, Liming ; 
l...@nuviainc.com; Kinney, Michael D 
Subject: [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address

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

Being a compiler builtin, the type of __builtin_return_address is already known 
to the compiler so no prototype is needed. Clang also errors out when 
redeclaring certain builtins like this[1], though currently only for ones with 
custom type checking. At the moment, __builtin_return_address does not use 
custom type checking and so does not trigger this error, however, the CHERI 
fork of LLVM, which will form the basis of the toolchain for Arm's experimental 
Morello platform, does use custom type checking for it, and so gives an error. 
Thus, simply delete the unnecessary line.

[1] llvm/llvm-project@41af97137572ad6d4dafc872e7ecf6bbb08d4984

Cc: Leif Lindholm 
Signed-off-by: Jessica Clarke 
---
Changes in v2:
 * Shortened [1] reference to fit column limit. The bug report has the
   full URL already, and this will still link correctly on GitHub.

 MdePkg/Include/Base.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 
85a091b9d5..8e4271f6ea 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -1273,7 +1273,6 @@ typedef UINTN RETURN_STATUS;
   **/
   #define RETURN_ADDRESS(L) ((L == 0) ? _ReturnAddress() : (VOID *) 0)
 #elif defined (__GNUC__) || defined (__clang__)
-  void * __builtin_return_address (unsigned int level);
   /**
 Get the return address of the calling function.
 
--
2.20.1


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

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



Re: [edk2-devel] [PATCH v2 1/1] CryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1g

2020-07-26 Thread Guomin Jiang
Checked in 8c30327debb28c0b6cfa2106b736774e0b20daac.

> -Original Message-
> From: Laszlo Ersek 
> Sent: Saturday, July 18, 2020 12:18 AM
> To: Jiang, Guomin ; devel@edk2.groups.io
> Cc: Wang, Jian J ; Lu, XiaoyuX
> 
> Subject: Re: [PATCH v2 1/1] CryptoPkg/OpensslLib: Upgrade OpenSSL to
> 1.1.1g
> 
> On 07/17/20 03:36, Guomin Jiang wrote:
> > Upgrade openssl to 1.1.1g. the directory have been reorganized,
> > openssl moved crypto/include/internal to include/crypto folder.
> > So we change directory to match the re-organization.
> >
> > The dso_conf.h and opensslconf.h will generated in UNIX format, change
> > process_files.pl to covent the EOL automatically.
> >
> > Cc: Jian J Wang 
> > Cc: Xiaoyu Lu 
> > Signed-off-by: Guomin Jiang 
> > Reviewed-by: Laszlo Ersek 
> > Tested-by: Laszlo Ersek 
> > ---
> >  CryptoPkg/CryptoPkg.dec   |  1 -
> >  CryptoPkg/Library/OpensslLib/OpensslLib.inf   | 58 +--
> >  .../Library/OpensslLib/OpensslLibCrypto.inf   | 50 
> >  .../Include/{internal => crypto}/dso_conf.h   | 32 +-
> >  .../Library/Include/openssl/opensslconf.h |  3 -
> >  .../Library/BaseCryptLib/Hash/CryptSm3.c  |  2 +-
> >  .../BaseCryptLib/Pk/CryptPkcs7VerifyEku.c |  4 +-
> >  CryptoPkg/Library/OpensslLib/rand_pool.c  |  2 +-
> >  CryptoPkg/Library/OpensslLib/openssl  |  2 +-
> >  CryptoPkg/Library/OpensslLib/process_files.pl | 25 +---
> >  10 files changed, 91 insertions(+), 88 deletions(-)  rename
> > CryptoPkg/Library/Include/{internal => crypto}/dso_conf.h (76%)
> 
> The patch changed non-trivially, so *in general* my R-b and especially T-b
> tags should have been dropped, in v2.
> 
> However, the v1->v2 changes are the following:
> 
> - the commit message has been extended, the way I asked,
> 
> - the code changes are restricted to "process_files.pl", and:
> 
>   - I never tested that script in the first place (my T-b didn't
> cover the script anyway), so my T-b is unaffected by the v1->v2
> update
> 
>   - the new stuff in the script looks acceptable (although certainly not
> optimal; see below), so I'm fine with keeping my R-b as well.
> 
> >
> > diff --git a/CryptoPkg/CryptoPkg.dec b/CryptoPkg/CryptoPkg.dec index
> > 4d1a1368a8d4..5888941bab4c 100644
> > --- a/CryptoPkg/CryptoPkg.dec
> > +++ b/CryptoPkg/CryptoPkg.dec
> > @@ -23,7 +23,6 @@ [Includes.Common.Private]
> >Private
> >Library/Include
> >Library/OpensslLib/openssl/include
> > -  Library/OpensslLib/openssl/crypto/include
> >
> >  [LibraryClasses]
> >##  @libraryclass  Provides basic library functions for cryptographic
> primitives.
> > diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > index c8ec9454bd90..dbbe5386a10c 100644
> > --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > @@ -477,45 +477,45 @@ [Sources]
> >$(OPENSSL_PATH)/crypto/s390x_arch.h
> >$(OPENSSL_PATH)/crypto/sparc_arch.h
> >$(OPENSSL_PATH)/crypto/vms_rms.h
> > -  $(OPENSSL_PATH)/crypto/aes/aes_locl.h
> > +  $(OPENSSL_PATH)/crypto/aes/aes_local.h
> >$(OPENSSL_PATH)/crypto/asn1/asn1_item_list.h
> > -  $(OPENSSL_PATH)/crypto/asn1/asn1_locl.h
> > +  $(OPENSSL_PATH)/crypto/asn1/asn1_local.h
> >$(OPENSSL_PATH)/crypto/asn1/charmap.h
> >$(OPENSSL_PATH)/crypto/asn1/standard_methods.h
> >$(OPENSSL_PATH)/crypto/asn1/tbl_standard.h
> > -  $(OPENSSL_PATH)/crypto/async/async_locl.h
> > +  $(OPENSSL_PATH)/crypto/async/async_local.h
> >$(OPENSSL_PATH)/crypto/async/arch/async_null.h
> >$(OPENSSL_PATH)/crypto/async/arch/async_posix.h
> >$(OPENSSL_PATH)/crypto/async/arch/async_win.h
> > -  $(OPENSSL_PATH)/crypto/bio/bio_lcl.h
> > -  $(OPENSSL_PATH)/crypto/bn/bn_lcl.h
> > +  $(OPENSSL_PATH)/crypto/bio/bio_local.h
> > +  $(OPENSSL_PATH)/crypto/bn/bn_local.h
> >$(OPENSSL_PATH)/crypto/bn/bn_prime.h
> >$(OPENSSL_PATH)/crypto/bn/rsaz_exp.h
> > -  $(OPENSSL_PATH)/crypto/comp/comp_lcl.h
> > +  $(OPENSSL_PATH)/crypto/comp/comp_local.h
> >$(OPENSSL_PATH)/crypto/conf/conf_def.h
> > -  $(OPENSSL_PATH)/crypto/conf/conf_lcl.h
> > -  $(OPENSSL_PATH)/crypto/dh/dh_locl.h
> > -  $(OPENSSL_PATH)/crypto/dso/dso_locl.h
> > -  $(OPENSSL_PATH)/crypto/evp/evp_locl.h
> > -  $(OPENSSL_PATH)/crypto/hmac/hmac_lcl.h
> > -  $(OPENSSL_PATH)/crypto/lhash/lhash_lcl.h
> > -  $(OPENSSL_PATH)/crypto/md5/md5_locl.h
> > -  $(OPENSSL_PATH)/crypto/modes/modes_lcl.h
> > +  $(OPENSSL_PATH)/crypto/conf/conf_local.h
> > +  $(OPENSSL_PATH)/crypto/dh/dh_local.h
> > +  $(OPENSSL_PATH)/crypto/dso/dso_local.h
> > +  $(OPENSSL_PATH)/crypto/evp/evp_local.h
> > +  $(OPENSSL_PATH)/crypto/hmac/hmac_local.h
> > +  $(OPENSSL_PATH)/crypto/lhash/lhash_local.h
> > +  $(OPENSSL_PATH)/crypto/md5/md5_local.h
> > +  $(OPENSSL_PATH)/crypto/modes/modes_local.h
> >$(OPENSSL_PATH)/crypto/objects/obj_dat.h
> > -  $(OPENSSL_PATH)/crypto/objects/obj_lcl.h
> > +  

Re: [edk2-devel] [PATCH v3 1/1] BaseTools/Scripts: Ignore the CRLF check when upgrade submodule.

2020-07-26 Thread Guomin Jiang
Checked in ff2655d1a4ce8f2c85b1a5f09b85fb4f51fe13f1.

> -Original Message-
> From: Feng, Bob C 
> Sent: Thursday, July 23, 2020 3:33 PM
> To: Jiang, Guomin ; devel@edk2.groups.io
> Cc: Gao, Liming 
> Subject: RE: [PATCH v3 1/1] BaseTools/Scripts: Ignore the CRLF check when
> upgrade submodule.
> 
> Reviewed-by: Bob Feng 
> 
> -Original Message-
> From: Jiang, Guomin 
> Sent: Wednesday, July 22, 2020 6:33 PM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming
> 
> Subject: [PATCH v3 1/1] BaseTools/Scripts: Ignore the CRLF check when
> upgrade submodule.
> 
> If the submodule is upgraded, skip the CRLF check as it isn't change for file.
> 
> Signed-off-by: Guomin Jiang 
> Cc: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Scripts/PatchCheck.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Scripts/PatchCheck.py
> b/BaseTools/Scripts/PatchCheck.py index 7db0775d14d1..ca0849b77bbe
> 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -502,7 +502,7 @@ class GitDiffCheck:
> 
>  stripped = line.rstrip()
> 
> -if self.force_crlf and eol != '\r\n':
> +if self.force_crlf and eol != '\r\n' and (line.find('Subproject 
> commit') == -
> 1):
>  self.added_line_error('Line ending (%s) is not CRLF' % repr(eol),
>line)
>  if self.force_notabs and '\t' in line:
> --
> 2.25.1.windows.1


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

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



Re: [edk2-devel] [PATCH] uefi-sct/SctPkg: Remove gEfiFormBrowserExProtocolGuid

2020-07-26 Thread G Edhaya Chandran
The code is upstreamed to EDK2Test Repository

Commit link: 
https://github.com/tianocore/edk2-test/commit/4a0caaaf7f452723a0cda028c3d702568a62b378

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

View/Reply Online (#63273): https://edk2.groups.io/g/devel/message/63273
Mute This Topic: https://groups.io/mt/74529350/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 v5 1/5] Silicon/ARM/N1SoC: Add platform library implementation

2020-07-26 Thread Pranav Madhu
Hi Leif,

> -Original Message-
> From: Leif Lindholm 
> Sent: Friday, July 24, 2020 10:59 PM
> To: Pranav Madhu 
> Cc: devel@edk2.groups.io; Ard Biesheuvel 
> Subject: Re: [edk2-platforms][PATCH v5 1/5] Silicon/ARM/N1SoC: Add
> platform library implementation
>
> On Wed, Jul 22, 2020 at 20:55:20 +0530, Pranav Madhu wrote:
> > From: Deepak Pandey 
> >
> > Add the initial Arm's Neoverse N1 System-on-Chip platform library
> > support. This includes the virtual memory map and helper functions for
> > platform initialization.
> >
> > Cc: Ard Biesheuvel 
> > Cc: Leif Lindholm 
> > Signed-off-by: Pranav Madhu 
> > ---
> >  Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec|  27 +
> >  Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.inf  |  43
> +++
> >  Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h  |  66
> +++
> >  Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.c|  67
> +++
> >  Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c | 125
> > 
> > Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/AArch64/Helper.S |  84
> > +
> >  6 files changed, 412 insertions(+)


<...>

> > +// Base address to a structure of type NEOVERSEN1SOC_PLAT_INFO
> which
> > +is // pre-populated by a earlier boot stage
> > +#define NEOVERSEN1SOC_PLAT_INFO_STRUCT_BASE
> (NEOVERSEN1SOC_NON_SECURE_SRAM_BASE + \
> > +  0x8000)
> > +
> > +/*
> > + * Platform information structure stored in non-secure SRAM. Platform
>
> The architectural terms as Secure an Non-secure. I asked for the latter. I 
> will
> fix this up before pushing, but please pay attention to case for architectural
> terminology.
>
> Other than this, the patch is fine, so:
> Reviewed-by: Leif Lindholm 

Thanks for fixing this up and your review of the patches. I'll take care of the 
case for architectural terminology henceforth.

Regards,
Pranav

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

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

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



[edk2-devel] [PATCH v8 02/16] .pytool/Plugin: Add a plugin EccCheck

2020-07-26 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
EccCheck is a plugin to report Ecc issues for code in pull request
, which will be run on open ci.
But note not each kind of issue could be reported out.
It can only handle the issues, whose line number in CSV report
accurately map with their code in source code files. And Ecc issues
about comments can also be handled.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py   | 291 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 3 files changed, 317 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
new file mode 100644
index ..f23b85bc5a2a
--- /dev/null
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -0,0 +1,291 @@
+# @file EccCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import re
+import csv
+import xml.dom.minidom
+from typing import List, Dict, Tuple
+import logging
+from io import StringIO
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class EccCheck(ICiBuildPlugin):
+"""
+A CiBuildPlugin that finds the Ecc issues of newly added code in pull 
request.
+
+Configuration options:
+"EccCheck": {
+"ExceptionList": [],
+"IgnoreFiles": []
+},
+"""
+
+ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
+FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
+LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
+LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for efi coding style for " + packagename, packagename + 
".EccCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+edk2_path = Edk2pathObj.WorkspacePath
+python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
+env = shell_environment.GetEnvironment()
+env.set_shell_var('PYTHONPATH', python_path)
+env.set_shell_var('WORKSPACE', edk2_path)
+self.ECC_PASS = True
+self.ApplyConfig(pkgconfig, edk2_path, packagename)
+modify_dir_list = self.GetModifyDir(packagename)
+patch = self.GetDiff(packagename)
+ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
+self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
+ecc_log = os.path.join(edk2_path, "Ecc.log")
+if self.ECC_PASS:
+tc.SetSuccess()
+self.RemoveFile(ecc_log)
+return 0
+else:
+with open(ecc_log, encoding='utf8') as output:
+ecc_output = output.readlines()
+for line in ecc_output:
+logging.error(line)
+self.RemoveFile(ecc_log)
+tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc 
detected issues")
+return 1
+
+def GetDiff(self, pkg: str) -> List[str]:
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+return patch
+
+def RemoveFile(self, file: str) -> 

[edk2-devel] [PATCH v8 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-26 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
As planed we will enable Ecc check for edk2 on open ci. And they are
ready now. I appreciate receiving feedback and comments if someone
find errors or false positive issues.

I created a pipline of EccCheck for my forked edk2. Welcome everyone to
create pull request to test the quality of this plugin.
My forked tree: https://github.com/shenglei10/edk2

And I also created some test cases for ECC plugin. Below are test cases.
https://github.com/shenglei10/edk2/tree/ECC
Results can be view in below azure server.
https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12&_a=summary

Patches
1/16: It's a lib necessary for py3 to run Ecc on azure servers.

2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
 on azure servers for open ci, or a local virtual environment.

3/16~16/16: We consider some cases that will report out Ecc issues but they 
won't
 be fixed, like submodule and industry standard related things. So we
 add two configuration fields "Exception" and "IgnoreFiles" for people
 to use. These patches add configuration in yaml files for Ecc check.

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

v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.

v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
Update 2/17, designate the version of antlr4 is 4.7.1.
Add 4/17~17/17.

v4. Update 1/17, remove the function EdksetupRebuild(), instead add
function SetupEnvironment(). Update variables' format and type hints
to pass flake8 and mypy.

v5. Conver the former method to plugin solution, to align with
other check points on open ci.

v6. The 1/16 patch is missed in v5 series. Now add it in v6.

v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.

v8. Enable error code config section to ignore certain kinds of issues,
which are always false positive in partial Ecc scaning.
All patches except 2/16 have been R-B and are not updated in v8 series.
To avoid making noise in community, I only send cover letter and 2/16 patch.

Shenglei Zhang (16):
  pip-requirements.txt: Add Ecc required lib
  .pytool/Plugin: Add a plugin EccCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
  FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
  MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
  ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
  UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

 .pytool/Plugin/EccCheck/EccCheck.py   | 291 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 ArmVirtPkg/ArmVirtPkg.ci.yaml |  11 +
 CryptoPkg/CryptoPkg.ci.yaml   |  11 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |  11 +
 FatPkg/FatPkg.ci.yaml |  11 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |  11 +
 MdeModulePkg/MdeModulePkg.ci.yaml |  11 +
 MdePkg/MdePkg.ci.yaml |  11 +
 NetworkPkg/NetworkPkg.ci.yaml |  11 +
 OvmfPkg/OvmfPkg.ci.yaml   |  11 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |  11 +
 SecurityPkg/SecurityPkg.ci.yaml   |  11 +
 ShellPkg/ShellPkg.ci.yaml |  11 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |  11 +
 .../UnitTestFrameworkPkg.ci.yaml  |  10 +
 pip-requirements.txt  |   1 +
 18 files changed, 471 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

-- 
2.18.0.windows.1


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

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