From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.3936.1637745328623472397 for ; Wed, 24 Nov 2021 01:15:29 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: zhiguang.liu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10177"; a="222462725" X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="222462725" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 01:15:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,260,1631602800"; d="scan'208";a="674797799" Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.158]) by orsmga005.jf.intel.com with ESMTP; 24 Nov 2021 01:15:25 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You Subject: [PATCH 2/2] UefiPayloadPkg: Add performance measurement feature Date: Wed, 24 Nov 2021 17:15:09 +0800 Message-Id: <20211124091509.207-2-zhiguang.liu@intel.com> X-Mailer: git-send-email 2.32.0.windows.2 In-Reply-To: <20211124091509.207-1-zhiguang.liu@intel.com> References: <20211124091509.207-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add a Macro to enable performance measurement feature. For any platform that uses UniversalPayload, we assume it supports BaseCpuTimerLib and use it to align timerlib to get more accurate performance result. Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadPkg.dsc | 34 +++++++++++++++++++++++++++++++++- UefiPayloadPkg/UefiPayloadPkg.fdf | 6 ++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 0df5f827c9..a1ef711f24 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -109,6 +109,7 @@ DEFINE RTC_TARGET_REGISTER =3D 0x71=0D =0D DEFINE SERIAL_DRIVER_ENABLE =3D TRUE=0D + DEFINE PERFORMANCE_MEASUREMENT_ENABLE =3D FALSE=0D =0D [BuildOptions]=0D *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES= =0D @@ -216,7 +217,11 @@ #=0D # Platform=0D #=0D +!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE=0D + TimerLib|UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf=0D +!else=0D TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf=0D +!endif=0D ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf= =0D SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf=0D PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.i= nf=0D @@ -277,6 +282,9 @@ DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.in= f=0D !endif=0D CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform= anceLib.inf=0D +!endif=0D =0D [LibraryClasses.common.DXE_DRIVER]=0D PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D @@ -288,17 +296,26 @@ !endif=0D CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf=0D MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf=0D +!endif=0D =0D [LibraryClasses.common.DXE_RUNTIME_DRIVER]=0D PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf=0D VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ibRuntimeDxe.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf=0D +!endif=0D =0D [LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]= =0D PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf=0D +!endif=0D =0D [LibraryClasses.common.SMM_CORE]=0D !if $(SMM_SUPPORT) =3D=3D TRUE=0D @@ -309,6 +326,9 @@ SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/S= mmCorePlatformHookLibNull.inf=0D SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf=0D ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + PerformanceLib|MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerform= anceLib.inf=0D +!endif=0D !endif=0D =0D [LibraryClasses.common.DXE_SMM_DRIVER]=0D @@ -324,6 +344,9 @@ SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib= .inf=0D CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuE= xceptionHandlerLib.inf=0D ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.= inf=0D +!endif=0D !endif=0D !if $(VARIABLE_SUPPORT) =3D=3D "SPI"=0D SpiFlashLib|UefiPayloadPkg/Library/SpiFlashLib/SpiFlashLib.inf=0D @@ -366,6 +389,10 @@ gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2=0D !endif=0D gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdEdkiiFpdtStringRecordEnableOnly| TRUE= =0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask | 0x1=0D +!endif=0D =0D [PcdsPatchableInModule.X64]=0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)= =0D @@ -633,7 +660,9 @@ MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=0D !endif=0D UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutputDxe.inf=0D -=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerf= ormanceDxe.inf=0D +!endif=0D #=0D # SMM Support=0D #=0D @@ -646,6 +675,9 @@ UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.inf=0D UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf=0D UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerf= ormanceSmm.inf=0D +!endif=0D !endif=0D =0D !if $(VARIABLE_SUPPORT) =3D=3D "EMU"=0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayload= Pkg.fdf index 2f5cb17f62..8e7b34e783 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -115,6 +115,9 @@ INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/M= onotonicCounterRuntimeDxe INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf= =0D !endif=0D INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe= .inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Firmware= PerformanceDxe.inf=0D +!endif=0D =0D #=0D # SMM Support=0D @@ -128,6 +131,9 @@ INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatReal= TimeClockRuntimeDxe.inf INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf=0D INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf=0D INF UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.inf=0D +!if $(PERFORMANCE_MEASUREMENT_ENABLE)=0D + INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Firmwar= ePerformanceSmm.inf=0D +!endif=0D !endif=0D =0D !if $(VARIABLE_SUPPORT) =3D=3D "EMU"=0D --=20 2.32.0.windows.2