On 2/6/20 2:03 AM, Laszlo Ersek wrote: > Hi Tom, > > On 02/05/20 00:01, Lendacky, Thomas wrote: >> 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%7C92474104c034464629d108d7aadb1215%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637165730207240579&sdata=UFoI4ubid3023HHuo2uoYiP1Dfoa%2BC7uKVMakr72LM4%3D&reserved=0 >> >> Add base support to handle #VC exceptions. This includes a stub routine >> to invoke when a #VC exception occurs and special checks in the common >> exception handlers to invoke the #VC exception handler routine. >> >> Cc: Eric Dong <eric.d...@intel.com> >> Cc: Ray Ni <ray...@intel.com> >> Cc: Laszlo Ersek <ler...@redhat.com> >> Cc: Jordan Justen <jordan.l.jus...@intel.com> >> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> >> Cc: Maurice Ma <maurice...@intel.com> >> Cc: Guo Dong <guo.d...@intel.com> >> Cc: Benjamin You <benjamin....@intel.com> >> Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com> >> --- >> OvmfPkg/OvmfPkgIa32.dsc | 5 ++ >> OvmfPkg/OvmfPkgIa32X64.dsc | 5 ++ >> OvmfPkg/OvmfPkgX64.dsc | 5 ++ > >> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc >> index 4568b78cadf1..41ec761e3f17 100644 >> --- a/OvmfPkg/OvmfPkgIa32.dsc >> +++ b/OvmfPkg/OvmfPkgIa32.dsc >> @@ -236,6 +236,7 @@ [LibraryClasses.common.SEC] >> >> PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf >> >> MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> >> [LibraryClasses.common.PEI_CORE] >> HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >> @@ -274,6 +275,7 @@ [LibraryClasses.common.PEIM] >> >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf >> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/PeiQemuFwCfgS3LibFwCfg.inf >> PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf >> @@ -299,6 +301,7 @@ [LibraryClasses.common.DXE_CORE] >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >> >> [LibraryClasses.common.DXE_RUNTIME_DRIVER] >> @@ -349,6 +352,7 @@ [LibraryClasses.common.DXE_DRIVER] >> >> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf >> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> !if $(SMM_REQUIRE) == TRUE >> LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf >> !else >> @@ -392,6 +396,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] >> DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> !if $(SOURCE_DEBUG_ENABLE) == TRUE >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf >> !endif >> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc >> index 152b5d067116..41cc3eec3757 100644 >> --- a/OvmfPkg/OvmfPkgIa32X64.dsc >> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc >> @@ -241,6 +241,7 @@ [LibraryClasses.common.SEC] >> >> PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf >> >> MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> >> [LibraryClasses.common.PEI_CORE] >> HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >> @@ -279,6 +280,7 @@ [LibraryClasses.common.PEIM] >> >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf >> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/PeiQemuFwCfgS3LibFwCfg.inf >> PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf >> @@ -304,6 +306,7 @@ [LibraryClasses.common.DXE_CORE] >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >> >> [LibraryClasses.common.DXE_RUNTIME_DRIVER] >> @@ -354,6 +357,7 @@ [LibraryClasses.common.DXE_DRIVER] >> >> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf >> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> !if $(SMM_REQUIRE) == TRUE >> LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf >> !else >> @@ -397,6 +401,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] >> DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> !if $(SOURCE_DEBUG_ENABLE) == TRUE >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf >> !endif >> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc >> index 4bfad441bd9f..46a679a0073e 100644 >> --- a/OvmfPkg/OvmfPkgX64.dsc >> +++ b/OvmfPkg/OvmfPkgX64.dsc >> @@ -241,6 +241,7 @@ [LibraryClasses.common.SEC] >> >> PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf >> >> MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> >> [LibraryClasses.common.PEI_CORE] >> HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >> @@ -279,6 +280,7 @@ [LibraryClasses.common.PEIM] >> >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf >> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/PeiQemuFwCfgS3LibFwCfg.inf >> PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf >> @@ -304,6 +306,7 @@ [LibraryClasses.common.DXE_CORE] >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >> >> [LibraryClasses.common.DXE_RUNTIME_DRIVER] >> @@ -354,6 +357,7 @@ [LibraryClasses.common.DXE_DRIVER] >> >> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf >> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> !if $(SMM_REQUIRE) == TRUE >> LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf >> !else >> @@ -397,6 +401,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] >> DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf >> !endif >> >> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf >> + VmgExitLib|UefiCpuPkg/Library/VmgExitLib/VmgExitLib.inf >> !if $(SOURCE_DEBUG_ENABLE) == TRUE >> DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf >> !endif > > The three OvmfPkg DSC files should be updated in a different patch; most > likely in the first OvmfPkg patch that relies on #VC exception handling.
I did that because the build will fail at this stage without the Ovmf changes: build.py... /root/kernels/ovmf-build-X64/OvmfPkg/OvmfPkgX64.dsc(...): error 4000: Instance of library class [VmgExitLib] is not found in [/root/kernels/ovmf-build-X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf] [X64] consumed by module [/root/kernels/ovmf-build-X64/UefiCpuPkg/CpuMpPei/CpuMpPei.inf] - Failed - Is there a way that we can avoid updating the Ovmf DSC files entirely when a DSC file specifies one of the exception libraries? Otherwise, I guess I would have to update the Ovmf DSC files before this patch? Or I could make the changes to use the VmgExitLib all at once, which would be a single patch that adds the VmgExitLib and corresponding AMD exception handling source files at once across UefiCpuPkg and Ovmf? (Which triggers that I need to check other DSC files that include these exception libraries to be sure I don't break anything). > > Furthermore, seeing how the same lib instance is used for resolving the > VmgExitLib class for all (necessary) module types, I think you could add > a single common resolution per DSC file, in the [LibraryClasses] section. Yup, makes sense, will do. Thanks, Tom > > Thanks > Laszlo > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54046): https://edk2.groups.io/g/devel/message/54046 Mute This Topic: https://groups.io/mt/70984928/21656 Mute #vc: https://groups.io/mk?hashtag=vc&subid=3846945 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-