From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.78]) by mx.groups.io with SMTP id smtpd.web10.86208.1680560306464626635 for ; Mon, 03 Apr 2023 15:18:27 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=eOzdTrBg; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.93.78, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z3uCizvBRQRdIwgDmcxEEk/ljyEupIC8UN1HEL4nrmZxhbPvAZ5NroJMunPPHAL2vh2nGCE5GES+nTSUfz6UtDecluQiIaQ4gkF0razMN1RqmNySMpbUWR73pFCDQO8ISS+2bWUTK+H9YLA10hnJFOf+WNEIBnK3yzwhQ/T/HWPxLdY85La7H3AHrhqtvFWNeXpvUhDcfQoevgL6hl9tNZZP/+cFom+fJwNdkKDABpz28N1eCDxhD9eFKbJGvVvoR9dU8OXFb7DrGV2LGyooKklyaGW729P67atEKR36rBM4AJyGtBPfEjQb6AC+C7DypOPs9ImyQes8f7kS5nmCKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OWtg7mpI0Qg+uT5ms9fKA8rnDqL8KiwAIjirDpqBQEk=; b=BC6gXuv2dRpwe6CjerlPsgZwjR3tK8CRgeaBjwIjInIeuVu4O1WW2Znu21Q3eh5jMOBTuzh4oycF8ftkHjhlE6qvp44IHLW+B4B+Vj2fmQN3e9hJ6BsT31Z864E00/O7qp32BDxjhQtRM2yvDGfkGonSjnFies0wpcYJFxhCXq50zOBGwd7arX0qcohawCyt5cZPLg4yY1d8hO0SJVgGpoqw8DyUxHuafD0uQYkNA4IElID32d28YCOKbfUysV5Z4N4RPluNVZLxXiqctepTH9ykzPrUGfp1QeslSz4qbgkvYOM3uUV9XaperF5oDT+mXe1t4YrakYqgDTmvQaqUeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OWtg7mpI0Qg+uT5ms9fKA8rnDqL8KiwAIjirDpqBQEk=; b=eOzdTrBgcmvlMGz/V7QH3jlWnRjjILPAwCD4pG6AmkEzgQ4+/7U0hdzmHxaoDPOYCyw5Qjut01IGLBqi+x722KGC0NJ/IyqM8sRtNV2FMTgFQWQum0WfT+B0O/siAvIbEuqwhyZFmOjTfVsoabjL+bT8QiiHwThL45gzu7d2Lfc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by SJ0PR12MB6854.namprd12.prod.outlook.com (2603:10b6:a03:47c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.26; Mon, 3 Apr 2023 22:18:24 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::5b56:bf13:70be:ea60]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::5b56:bf13:70be:ea60%5]) with mapi id 15.20.6254.033; Mon, 3 Apr 2023 22:18:24 +0000 Message-ID: <2f4c1b8b-0eec-2a78-b6ac-d64341e19427@amd.com> Date: Mon, 3 Apr 2023 17:18:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [edk2-devel] [PATCH v4 0/6] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib To: devel@edk2.groups.io, ardb@kernel.org CC: "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , =?UTF-8?Q?Marvin_H=c3=a4user?= References: <20230403142920.1921619-1-ardb@kernel.org> From: "Lendacky, Thomas" In-Reply-To: <20230403142920.1921619-1-ardb@kernel.org> X-ClientProxiedBy: MN2PR05CA0038.namprd05.prod.outlook.com (2603:10b6:208:236::7) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) Return-Path: Thomas.Lendacky@amd.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|SJ0PR12MB6854:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b36229d-7130-4195-1d14-08db34915700 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sAmPOzXXAFfKqzRjX/wpBK9sYEokZMgxk11Z6snijpYorI+d6n/8MvllYOonB5xUBj/B0Xl3yo7Nb5Bnxon165eMDgxuYTwsXExOm0T364UcwYogZ2Md93PvKfgXWBiqjFI5KjdrtzKYPY813KipdBwpVnHDrzi3CnRtneJomuvClVi9Wc0YBYjCJbcYzVMORHxZ5ZYQLYLhhXqIW9ZdAWjuJNWtyaajH8qVnNG610ovL8v348xrede9lwyjV5dvHmbAZPlPQTyWvN/lpTlZ9LMQk0zdmq23ws7LMtGVfR3t6O08f+WeYGvQgeGmdUdsTYJnAbjK53ytMtXC0RdzqbeBHdHujcZtmTgbzXzfVrEEkUB2WK99LitIqbpHSF0SOKQC97VkqS+qeEiqWqEFHOfHu/Lp2ucEg2D933yOtrlwlW9PAsVxmC0X6T6YJVvXnwCP4GD+Aql6SonMpybFnwAB1Xmlm+7vYm8bCtqrMYIyuEh+JoeJHq/eQyzOmMM4eLeVTuvTbH2QCPFLhA2V539JWjOrQ45yt/tt0GZIbTwvBB2YZkp6uGPBq7E3KeKw01ILWZpMvRcDmfPri7wWQNjR4oojAW8SFcOc6ieD3w4Jjm1zl2dwZb++cEFCkDtRB7UhWPF4ehy7qIkzHzHNpg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(366004)(346002)(376002)(136003)(396003)(451199021)(31686004)(2906002)(5660300002)(4326008)(66476007)(8936002)(66946007)(19627235002)(66556008)(8676002)(316002)(41300700001)(478600001)(36756003)(54906003)(6506007)(31696002)(83380400001)(186003)(6512007)(86362001)(2616005)(66574015)(26005)(6666004)(6486002)(38100700002)(53546011)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vB6ndBZyxOSFQufkRuV0ASgctTntkhYWUcp9EDdNJP/hSAvZgR5FhhK3grwT?= =?us-ascii?Q?xe7SxflrlW8TNlODrtZZ9DyoyrDajPLvVjqlGEzyMoZ5qRETLFAU+l1gpSoU?= =?us-ascii?Q?HN83bSQulCU7m5q+ZaoziU6WnU8u2RIqMZ+TNJYSuLXAYg5ZU4EukeymtOCf?= =?us-ascii?Q?ud28/At9MUolPZt2JyjpupLhc+ayE7UUjx2tTKOVJ748zF8FsNubGJsfxwwu?= =?us-ascii?Q?ORM8Goe5aickBScHb4R94UMZwYqdQZfXCRk5i7koyCrloRnes4tQVgBe8gnO?= =?us-ascii?Q?aAEfmrhBx4tkjbBdRKtPZvX0oqZerdNUBo5XVXajLOPJcIQxwV7tMDYNLKM1?= =?us-ascii?Q?IY80RH//Dp893sFwXCObEtgHf6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?Q?aMGZskoUtVziyOj7WlUgWGjdGwZ88q+DvfN8uJPi4Td9gO89joUwhf2NXcAf?= =?us-ascii?Q?PZNuNrMWro7+nhU5HkVLMktKhot0kZs6TM3p/2Tly3bdjtEFLLKssVfaoRzR?= =?us-ascii?Q?fgB85OAsaIVhiPFSZ/MqE5s3oALCXdzHgrFl+yM4RfnW9pGqpIgLb7+YoVBo?= =?us-ascii?Q?t+94lX0FYSQPU2TqE9NLpZgJUnkPR6qIAe6RIlicrMAtQB5Alf7P66KZoyK3?= =?us-ascii?Q?boljX4XgUWuywsgz5UYGKqsDV9XhtqVXmCQ8Yz/a2S88TOSddjITJpbjuSbE?= =?us-ascii?Q?u69o9eeJhL7lfdVEKKNmJG38B4T6bl2Smr29nYNP?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b36229d-7130-4195-1d14-08db34915700 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 22:18:23.9484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UPFDiqWsE/caSNAbS1eSXvKiQ9Y0nWxUCUWpBvUKlUTuKzNaOqorGY7M+oBv7x0E9rY39RpaSOoE6elEZ1kG1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6854 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 4/3/23 09:29, Ard Biesheuvel via groups.io wrote: > We have a special version of CpuExceptionHandlerLib for XCODE5, whose > linker (LLD) does not permit absolute symbol references in read-only > sections. >=20 > 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. >=20 > Changes since v3: > - Add another patch to move PeiCpuExceptionHandlerLib to SEC/PEI version > of the NASM source file > - Improve commit logs >=20 > Changes since v2: > - As Marvin points out, using '-read_only_relocs suppress' with the X64 > 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 >=20 > Changes since v1: > - pass linker switches to permit absolute relocations in read-only > regions, and keep all code in .text >=20 > Cc: "Ni, Ray" > Cc: Andrew Fish > Cc: "Kinney, Michael D" > Cc: "Liu, Zhiguang" > Cc: Rebecca Cran > Cc: Tom Lendacky > Cc: Marvin H=C3=A4user Validated against SEV-ES (which was part of the original reason for the=20 split out) and SEV-SNP guests. Both guest types boot successfully. Tested-by: Tom Lendacky >=20 > 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 >=20 > 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 >=20