From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web12.8921.1636013422413171840 for ; Thu, 04 Nov 2021 01:10:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XtcaL9wt; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636013420; 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: in-reply-to:in-reply-to:references:references; bh=TLDn2JcHaeyNyiEE0BrJR8z5fdr8ZHNU6XRlHVOHzx4=; b=XtcaL9wt4Hp8L2kWts3cVPpXMr8Ss2ZpAc9S01DzjzzB18O0rK3pLkedp3BB4sAifyUAIM CjFrVWb1FRADkhZNvP7Q0sfytN7B/VklM/Nn1NlYUh5jc17TR9JemLZu0hSVkcEHnf63di I5ETGn5sEo5rh7enwexuYkzDt0Fhpts= 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-212-rHDsTniSPAitn0AJtFNJlQ-1; Thu, 04 Nov 2021 04:10:17 -0400 X-MC-Unique: rHDsTniSPAitn0AJtFNJlQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 244DE10A8E05; Thu, 4 Nov 2021 08:10:16 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C25E610246F8; Thu, 4 Nov 2021 08:10:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EFB521800923; Thu, 4 Nov 2021 09:10:04 +0100 (CET) Date: Thu, 4 Nov 2021 09:10:04 +0100 From: "Gerd Hoffmann" To: "Xu, Min M" Cc: "devel@edk2.groups.io" , Brijesh Singh , Erdem Aktas , James Bottomley , "Yao, Jiewen" , Tom Lendacky , "Dong, Eric" , "Ni, Ray" , "Kumar, Rahul1" Subject: Re: [PATCH V3 14/29] UefiCpuPkg: Enable Tdx support in MpInitLib Message-ID: <20211104081004.4mhzk7hqozg3prrp@sirius.home.kraxel.org> References: <9d8a7f7da913a1062d3f01e24615bb8bdc958458.1635769996.git.min.m.xu@intel.com> <20211103060914.scktdnjbfzrtu4xk@sirius.home.kraxel.org> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. take care, Gerd