From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.86]) by mx.groups.io with SMTP id smtpd.web11.13292.1636039284758166335 for ; Thu, 04 Nov 2021 08:21:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=07ErXXic; 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.94.86, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F7YI2n6NS1cCPfTnj7cHb7dpAV733P9u3wfurLWyWMn43uyTNeyTtI5qTJT8fvFjiDwBNlN9eFsHZLsrmgE0h0ACH7GXmebDmBAsxyt0/6KF+2Q4PugwMGrUY1IWhj4DMUecEV2w1Ipr4bfddrxzcFtK6BJ3cTaN7CDisiNmZBUfQjY0yIOqtg9Jur2Gi969O4QGgMgDQ3N4/p1fI3VdZ+5IPOqEfR286D9Sc5XGIAo9qoeNMogxjVmP3zA9s1f0K1bNGfMqJn0O4cL9Xo/jURkCt17odrRSV3KUZrrPK/I2NYVjgCtAnO2JQp25lsnIkBp2VJwELGwLZHyV4eCXdg== 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=bFz4azVY60FT0Ft5a06CKtngBhY6nEKANu0Sm3TrvM0=; b=eKLzVBvVDJJcp4z0XYaY8rUtxGJUu+1m9igcSDx/Z8dJbCJ2BtMEi3rwlMBYZl4IQ7AkaU93FjCMETo3dlx6KddL+NxT0cwiNVwLqrtMvkWkbWH9caRbJzky2VwddummjaoV6XBP950+v4aUukh24Qe34bWKjcmF57gS5JkD9vADUsfOP4GhCR9POEPylLkjqIBXu8jV7o5LYQrn19JbxsEj2oK9zts/i3KoU0FRRaHuo5PB5O1heYRFtsqbfT84HxYYS+vLlmkFsNLIa6jn7GZ7aioZXtZFR6383zVOzY+oQHesMxiu0+Kj8MUC00tORvD+33Axa8bM8pD6zOVnQw== 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=bFz4azVY60FT0Ft5a06CKtngBhY6nEKANu0Sm3TrvM0=; b=07ErXXic42cY9sV9NF+6bvF6EFFs4T0qgyLwQtB17KSL7ZEL/rUV3PBrxUg2uWMzXcudwDl4KtNiLDEQnrLO2nQU9cIPRFp/0bpK3GtaTD+CUGfpulNZihNoZWFqJHpgJ1WRz/e9//WYgXtHNuZCcJbDdgjLoAUU8CX+FtUXGI0= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM8PR12MB5478.namprd12.prod.outlook.com (2603:10b6:8:29::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.13; Thu, 4 Nov 2021 15:21:22 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::a87d:568d:994f:c5f9]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::a87d:568d:994f:c5f9%8]) with mapi id 15.20.4649.019; Thu, 4 Nov 2021 15:21:22 +0000 Subject: Re: [PATCH V3 14/29] UefiCpuPkg: Enable Tdx support in MpInitLib To: Gerd Hoffmann , "Xu, Min M" Cc: "devel@edk2.groups.io" , Brijesh Singh , Erdem Aktas , James Bottomley , "Yao, Jiewen" , "Dong, Eric" , "Ni, Ray" , "Kumar, Rahul1" References: <9d8a7f7da913a1062d3f01e24615bb8bdc958458.1635769996.git.min.m.xu@intel.com> <20211103060914.scktdnjbfzrtu4xk@sirius.home.kraxel.org> <20211104081004.4mhzk7hqozg3prrp@sirius.home.kraxel.org> From: "Lendacky, Thomas" Message-ID: Date: Thu, 4 Nov 2021 10:21:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <20211104081004.4mhzk7hqozg3prrp@sirius.home.kraxel.org> X-ClientProxiedBy: SN4PR0201CA0035.namprd02.prod.outlook.com (2603:10b6:803:2e::21) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) Return-Path: Thomas.Lendacky@amd.com MIME-Version: 1.0 Received: from office-ryzen.texastahm.com (67.79.209.213) by SN4PR0201CA0035.namprd02.prod.outlook.com (2603:10b6:803:2e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Thu, 4 Nov 2021 15:21:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 934f674c-65f0-43a1-0862-08d99fa6c27c X-MS-TrafficTypeDiagnostic: DM8PR12MB5478: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TiQlKBmulYHuRBeFmPG0B4FDyhLR40HnAYx6JgpNrvpddSNwog195K530j5OFmEL2GBiMG0btsgxH6thPbBiBEqnzUz0YBHDTN2RJ1mv+EFG5prW4TwGMQnS1y3Urnm16xuMlibU9WRcQxZqAW+RGJ97bkJmKLyc2BQ9MaTlg7QJAyPyJiAUnyhrL8OuhGSXWYBvXrGkh+TAPZ1TaJ+lrIpuEcqdrG1Mx0AKNt7bs68mVg9M0FPqwIeVRuObmSspiuSJdzwFVzG+EZYhlbj7nmwCI54hB4UJ5HzV13o7t8iuzS4duPTbkrqRWa+flKip/SXStpTav2khAfgwllb5OnYOEInya/Y6RiTncQ327w5bJpFuCr05F03OKkiKC6B7wr5Lvv9WjcVJzn6ZAjfxejRm89zqsEHNdgSEyQNN/QqbXYbIo+EUUcFdTE/WGKs3r8L4iuY0FhXrEE3/IWvzrlMZCRYxK0/8g4xa+0Ce8ZnPKn0SxFxZ8sZDWZDpPZTCTcqx/MTXyigfdGICNHqzshGi+dopOSW6x9Ld25xlsobIYaCqtN83h1LxiXWVcDV0i/FTyWwxmWZFkRoEcj6YDw2D21/fW9MA/g5C94KJaidsH+SbQVtXGKAxMQPbOBTzUadhvtIMXGt+4m8sg/LWEu8Js16nMppNZDSu6imGx+SoRoo+/mrh9oUkKf9ohA9+YXOowBbyJHWHXxeR4x4FKphsLL/HoZmAhrdss/1o+dQPjVdPC0ou8SkxWUSoOZNL 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:(6029001)(4636009)(366004)(31696002)(53546011)(6506007)(5660300002)(6486002)(86362001)(4326008)(2616005)(956004)(66946007)(19627235002)(66556008)(66476007)(31686004)(8676002)(54906003)(2906002)(36756003)(508600001)(316002)(26005)(186003)(8936002)(110136005)(83380400001)(6512007)(38100700002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aFFGM1RRSmhmZEVqcjcrdko1cFBJVWFYS2pnVHNNdjVvblZRNldNbitxRzdO?= =?utf-8?B?di95Mm0xQ2dPUUtzekJia1B1MG9uZjZHQjRMNlZlbmJEc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G1vRlJPY1BDTytiZUVENzdCSVUrcGZF?= =?utf-8?B?ZlJKOXhhSEtOK01scFlpcWNUKytYa05nc2ZJTnZKMnpuZ0ZKeEZkMGxyRTBL?= =?utf-8?B?L3dSK25jZCtxVDExS3ZFMFJrRHc5cWpQN0VDWEZqU3FFSUlXU1JrdVVjR2dz?= =?utf-8?B?U0xwajl6N1BWSkNEaGpPalp3bnNjdURhcEVJY0RmZTE1cWJkM1B4amkrcGpW?= =?utf-8?B?T3pxN3hhSGxwVkNFZjlWM0Zhclc3WTRKbG5HUTZ3Uk5aNDlSbmNQNitBYVdh?= =?utf-8?Q?74SdYYN69CjBngf5lvle39k=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 934f674c-65f0-43a1-0862-08d99fa6c27c X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2021 15:21:22.7594 (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: fFH22a3K0rody1RBMnN6NX/sXy6av+H+HuGtH+IkXZtUjqLXLA9gDRWdKaa2Av6esNBKDs5IUGfA26NUdXXoRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5478 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/4/21 3:10 AM, Gerd Hoffmann wrote: > On Wed, Nov 03, 2021 at 12:57:37PM +0000, Xu, Min M wrote: >> On November 3, 2021 2:09 PM, Gerd Hoffmann wrote: >>>> +++ b/UefiCpuPkg/Library/MpInitLib/X64/IntelTdcall.nasm >>>> @@ -0,0 +1,120 @@ >>>> +;-------------------------------------------------------------------- >>>> +---------- >>>> +;* >>>> +;* Copyright (c) 2020 - 2021, Intel Corporation. All rights >>>> +reserved.
>>>> +;* SPDX-License-Identifier: BSD-2-Clause-Patent >>>> +;* >>>> +;* >>>> +;-------------------------------------------------------------------- >>>> +---------- >>>> + >>>> +DEFAULT REL >>>> +SECTION .text >>>> + >>>> +%macro tdcall 0 >>>> + db 0x66,0x0f,0x01,0xcc >>>> +%endmacro >>> >>> Hmm, could you just use TdxLib instead of bringing your own copy of the >>> assembler code? > >> My initial thought was to include TdxLib in the .dsc as little as >> possible. For example, DxeMpInitLib is included in >> OvmfPkg/Microvm/MicrovmX64.dsc. If TdxLib is used by DxeMpInitLib, >> then it has to be included in MicrovmX64.dsc as well. > > Hmm, yes. Adding a TdxLib dependency has its downsides indeed. > >> So I copy the assemble code in MpInitLib. > > The problem with copying code is that long-term maintenance becomes > harder. When a bug is found you have to find and fix all the copies of > that code. That's why I strongly prefer to avoid code copy&paste. > Sometimes there is no easy way around creating a copy though. Can't you create something in MdePkg/Library/Baselib and then use it everywhere it's needed? Thanks, Tom > > take care, > Gerd >