From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web11.22365.1581343814389305986 for ; Mon, 10 Feb 2020 06:10:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dM1s8dVp; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581343813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N25+h1qP3BZFHNTXbX8QUFumNvnJ7huYnqfoCtV2maw=; b=dM1s8dVpvNpgLGmAJhblCTatGYEJKZLHgwGWv/UwKJAfrGvOQDfOZP6lE9DEVARCXTpsci MIsXkCbrh6o/27NXBTVScrM5Prsqxuk30ntQp90yn7I0yRJBiCn5ZhBfS2wcmhpFp5/Y6g rXnmDivXTt9CtxSd3MOLJjLJKcfQtIk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-ASuXiII0OdiHSLaXBijuQQ-1; Mon, 10 Feb 2020 09:09:54 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17B3CDB64; Mon, 10 Feb 2020 14:09:52 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.36.118.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DE54387; Mon, 10 Feb 2020 14:09:48 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v4 08/40] UefiCpuPkg/CpuExceptionHandler: Add base support for the #VC exception To: Tom Lendacky , devel@edk2.groups.io Cc: Jordan Justen , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh , Maurice Ma , Guo Dong , Benjamin You References: <18638c9ee90a20f9758bf6072115e8c491dfb098.1580857303.git.thomas.lendacky@amd.com> <1ba2f5d9-5c50-cc2f-938a-27c1035f74d9@redhat.com> From: "Laszlo Ersek" Message-ID: <803f0108-363c-5252-1626-ba14623bce3e@redhat.com> Date: Mon, 10 Feb 2020 15:09:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: ASuXiII0OdiHSLaXBijuQQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 02/07/20 16:07, Tom Lendacky wrote: > 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 >>> Cc: Ray Ni >>> Cc: Laszlo Ersek >>> Cc: Jordan Justen >>> Cc: Ard Biesheuvel >>> Cc: Maurice Ma >>> Cc: Guo Dong >>> Cc: Benjamin You >>> Signed-off-by: Tom Lendacky >>> --- >>> 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). Between the following two patches: [edk2-devel] [PATCH v4 07/40] UefiCpuPkg: Implement library support for VMGEXIT [edk2-devel] [PATCH v4 08/40] UefiCpuPkg/CpuExceptionHandler: Add base support for the #VC exception please locate all the platform DSC files that rely on any of the exception handler library instances that you extend with a VmgExitLib dependency in v4 08/40. And then please insert patches (one patch per Pkg) for resolving VmgExitLib in those DSC files. $ git grep -l -E \ 'UefiCpuPkg/Library/CpuExceptionHandlerLib/(SecPei|Pei|Dxe|Smm)CpuExceptionHandlerLib\.inf' \ -- '*dsc*' OvmfPkg/OvmfPkgIa32.dsc OvmfPkg/OvmfPkgIa32X64.dsc OvmfPkg/OvmfPkgX64.dsc OvmfPkg/OvmfXen.dsc UefiCpuPkg/UefiCpuPkg.dsc UefiPayloadPkg/UefiPayloadPkgIa32.dsc UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc Thanks! Laszlo > >> >> 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 >> >