From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id F34537803CF for ; Wed, 28 Feb 2024 05:44:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=j5lki7cuIUu6Ub1nYfHQqZzk7v5BtTYtKjufFoYgTVc=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1709099067; v=1; b=PS9VZB2gZk6A2k2XEx8irykMTWPnWNGSL8zRWpEuBUkqWPS0hraKF1rqdsYRTTkKj4hMQi7f QW16GE9pbj6we1qy9f692RysPm3WxT1UKXBAKLhP3EJDE4xK06/SBcE5nXrdjhsHD4DTYenTNsa lu0Zu+Mwgg8Jg4C8B64sc9BA= X-Received: by 127.0.0.2 with SMTP id hPx6YY7687511x5OAoqKfnfE; Tue, 27 Feb 2024 21:44:27 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.7063.1709099067007956043 for ; Tue, 27 Feb 2024 21:44:27 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-487-pGCF9EPSORWMYnEwlqL9vg-1; Wed, 28 Feb 2024 00:44:24 -0500 X-MC-Unique: pGCF9EPSORWMYnEwlqL9vg-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05E44848525; Wed, 28 Feb 2024 05:44:24 +0000 (UTC) X-Received: from [10.39.192.46] (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E6F3400D295; Wed, 28 Feb 2024 05:44:22 +0000 (UTC) Message-ID: <25ae7ced-581e-31b8-a2e9-0b289c4f5c40@redhat.com> Date: Wed, 28 Feb 2024 06:44:21 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH 08/10] OvmfPkg/ResetVector: wire up 5-level paging for TDX To: devel@edk2.groups.io, kraxel@redhat.com Cc: Tom Lendacky , Jiewen Yao , Oliver Steffen , Erdem Aktas , Michael Roth , Ard Biesheuvel , Min Xu References: <20240222115435.85794-1-kraxel@redhat.com> <20240222115435.85794-9-kraxel@redhat.com> From: "Laszlo Ersek" In-Reply-To: <20240222115435.85794-9-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 2Q4UbgIavyXLgMzEV38aQiDDx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=PS9VZB2g; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/22/24 12:54, Gerd Hoffmann wrote: > BSP workflow is quite simliar to the non-coco case. >=20 > TDX_WORK_AREA_PGTBL_READY is used to record the paging mode: > 1 =3D=3D 4-level paging > 2 =3D=3D 5-level paging >=20 > APs will look at TDX_WORK_AREA_PGTBL_READY to figure whenever > they should enable 5-level paging or not. >=20 > Signed-off-by: Gerd Hoffmann > --- > OvmfPkg/ResetVector/Ia32/IntelTdx.asm | 13 ++++++++++++- > OvmfPkg/ResetVector/Ia32/PageTables64.asm | 12 ++++++++++++ > 2 files changed, 24 insertions(+), 1 deletion(-) >=20 > diff --git a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm b/OvmfPkg/ResetVector/= Ia32/IntelTdx.asm > index c6b86019dfb9..7d775591a05b 100644 > --- a/OvmfPkg/ResetVector/Ia32/IntelTdx.asm > +++ b/OvmfPkg/ResetVector/Ia32/IntelTdx.asm > @@ -179,7 +179,7 @@ InitTdx: > ; > ; Modified: EAX, EDX > ; > -; 0-NonTdx, 1-TdxBsp, 2-TdxAps > +; 0-NonTdx, 1-TdxBsp, 2-TdxAps, 3-TdxAps5Level > ; > CheckTdxFeaturesBeforeBuildPagetables: > xor eax, eax > @@ -200,6 +200,17 @@ TdxPostBuildPageTables: > mov byte[TDX_WORK_AREA_PGTBL_READY], 1 > OneTimeCallRet TdxPostBuildPageTables > =20 > +%if PG_5_LEVEL > + > +; > +; Set byte[TDX_WORK_AREA_PGTBL_READY] to 2 > +; > +TdxPostBuildPageTables5Level: > + mov byte[TDX_WORK_AREA_PGTBL_READY], 2 > + OneTimeCallRet TdxPostBuildPageTables5Level > + > +%endif > + > ; > ; Check if TDX is enabled > ; > diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVec= tor/Ia32/PageTables64.asm > index d736db028277..ada3dc0ffbe0 100644 > --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm > +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm > @@ -44,6 +44,7 @@ BITS 32 > =20 > %define TDX_BSP 1 > %define TDX_AP 2 > +%define TDX_AP_5_LEVEL 3 > =20 > ; > ; For OVMF, build some initial page tables at > @@ -214,6 +215,10 @@ SetCr3ForPageTables64: > je TdxBspInit > cmp eax, TDX_AP > je SetCr3 > +%if PG_5_LEVEL > + cmp eax, TDX_AP_5_LEVEL > + je SetCr3La57 > +%endif > =20 > ; Check whether the SEV is active and populate the SevEsWorkArea > OneTimeCall CheckSevFeatures > @@ -252,6 +257,13 @@ TdxBspInit: > ; TDX BSP workflow > ; > ClearOvmfPageTables > +%if PG_5_LEVEL > + Check5LevelPaging Tdx4Level > + CreatePageTables5Level 0 > + OneTimeCall TdxPostBuildPageTables5Level > + jmp SetCr3La57 > +Tdx4Level: > +%endif > CreatePageTables4Level 0 > OneTimeCall TdxPostBuildPageTables > jmp SetCr3 With SetCr3La57 eliminated as I request under patch #6, this patch looks fine to me. Thanks Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116087): https://edk2.groups.io/g/devel/message/116087 Mute This Topic: https://groups.io/mt/104506795/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-