From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.97131.1680601587817315062 for ; Tue, 04 Apr 2023 02:46:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HNpIpbjN; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C3D8630E2 for ; Tue, 4 Apr 2023 09:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DD1BC433A1 for ; Tue, 4 Apr 2023 09:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680601586; bh=2CLQKAv0E9dbbslv/pDGRO/LNueQyyGXj2qIGff0/c4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HNpIpbjNYZ7xQgSbwk+Q/jXXDXJSVvnuQKgRqHIJGs0ixD24/vbi+e5ZcFKY75Y5I Tgg43ZqMkv5+1WBYEA5t91biXRbms8HX+JVMUbI0/UDiJ77qxgtai9RbreaHdV+C52 1WW7YU4gJT+z4UfrCL365xCrN1qg0gSI/cjA+GzbEzGNpiK0Mb0r6ZgEpp7ILJzdZH 1HwCf3SKjGQnaQWEXLBz3cXJNL4lvvnHL8cpOm0vviKYHlvXbgbwehe2hHywbPLwdY YhiUavXv6VrQeU8iu45LmaGcjC7z82L4rgewuSGOggT3lHYahynprNgfd8UubSdwCE HpkbaBJjsm05A== Received: by mail-lf1-f44.google.com with SMTP id h11so34649831lfu.8 for ; Tue, 04 Apr 2023 02:46:26 -0700 (PDT) X-Gm-Message-State: AAQBX9dW8WFt17vxfrgpPgL0mMUHhBFN5R7qLs+O0m67eEIaQDpPxqDM y6vGRsLnf4NrU3bG4p7KDzcA5fAVmFTcgWysj4w= X-Google-Smtp-Source: AKy350aFOK48YCWsze9so/LYOQ8MYBkFhwn4kJyhLoSyqhs++0ZQhD/48j1S8avpKKIPF946MBeTowLGwDYcEBdZx8k= X-Received: by 2002:ac2:5614:0:b0:4eb:dcc:52ce with SMTP id v20-20020ac25614000000b004eb0dcc52cemr521210lfd.9.1680601584170; Tue, 04 Apr 2023 02:46:24 -0700 (PDT) MIME-Version: 1.0 References: <20230403142920.1921619-1-ardb@kernel.org> <9C006672-4DCD-4296-9C6F-F6B80E817666@posteo.de> In-Reply-To: <9C006672-4DCD-4296-9C6F-F6B80E817666@posteo.de> From: "Ard Biesheuvel" Date: Tue, 4 Apr 2023 11:46:13 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v4 0/6] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib To: devel@edk2.groups.io, mhaeuser@posteo.de, "Ni, Ray" Cc: Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , "Liming Gao (Byosoft address)" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks all Ray, any comments on this version? Thanks. Liming, Rebecca, any comments on the BaseTools changes? On Tue, 4 Apr 2023 at 09:57, Marvin H=C3=A4user wrote: > > FWIW, Reviewed-by: Marvin H=C3=A4user > > > On 3. Apr 2023, at 16:29, Ard Biesheuvel wrote: > > > > =EF=BB=BFWe have a special version of CpuExceptionHandlerLib for XCODE5= , whose > > linker (LLD) does not permit absolute symbol references in read-only > > sections. > > > > Instead of fixing this up at runtime for all toolchains (which is done > > by writing the fixed up values to the .text section, which we'd prefer > > to avoid), tweak the SEC/PEI version so it does not need this, and > > update the remaining versions to only incorporate this logic when using > > the XCODE toolchain. > > > > Changes since v3: > > - Add another patch to move PeiCpuExceptionHandlerLib to SEC/PEI versio= n > > of the NASM source file > > - Improve commit logs > > > > Changes since v2: > > - As Marvin points out, using '-read_only_relocs suppress' with the X6= 4 > > XCODE linker is a terrible idea, as it corrupts the resulting PE > > binaries, so instead, let's do the following: > > . tweak the SEC/PEI version of the library so the relocs are emitted > > into .data when using XCODE; > > . tweak the other versions so the runtime fixups are only done when > > using XCODE > > - add acks from Jiewen and Ray > > > > Changes since v1: > > - pass linker switches to permit absolute relocations in read-only > > regions, and keep all code in .text > > > > Cc: "Ni, Ray" > > Cc: Andrew Fish > > Cc: "Kinney, Michael D" > > Cc: "Liu, Zhiguang" > > Cc: Rebecca Cran > > Cc: Tom Lendacky > > Cc: Marvin H=C3=A4user > > > > Ard Biesheuvel (6): > > BaseTools/tools_def CLANGDWARF: Permit text relocations > > UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version > > UefiCpuPkg/PeiCpuExceptionHandlerLib: Use SEC/PEI specific asm > > component > > UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only > > OvmfPkg: Drop special Xcode5 version of exception handler library > > UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version > > > > BaseTools/Conf/tools_def.template = | 2 +- > > OvmfPkg/AmdSev/AmdSevX64.dsc = | 4 - > > OvmfPkg/CloudHv/CloudHvX64.dsc = | 4 - > > OvmfPkg/IntelTdx/IntelTdxX64.dsc = | 4 - > > OvmfPkg/Microvm/MicrovmX64.dsc = | 4 - > > OvmfPkg/OvmfPkgIa32.dsc = | 4 - > > OvmfPkg/OvmfPkgIa32X64.dsc = | 4 - > > OvmfPkg/OvmfPkgX64.dsc = | 4 - > > OvmfPkg/OvmfXen.dsc = | 4 - > > UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf= | 5 +- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf= | 4 +- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.= inf | 4 +- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf= | 4 +- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm = | 116 +++++++++++++++++--- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandlerAs= m.nasm =3D> SecPeiExceptionHandlerAsm.nasm} | 108 +++--------------- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandl= erLib.inf | 65 ----------- > > UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandl= erLib.uni | 18 --- > > UefiCpuPkg/UefiCpuPkg.dsc = | 7 -- > > 18 files changed, 133 insertions(+), 232 deletions(-) > > rename UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHa= ndlerAsm.nasm =3D> SecPeiExceptionHandlerAsm.nasm} (70%) > > delete mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecP= eiCpuExceptionHandlerLib.inf > > delete mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecP= eiCpuExceptionHandlerLib.uni > > > > -- > > 2.39.2 > > > > > >=20 > >