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 849DF740034 for ; Tue, 30 Jan 2024 22:28:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=rOw/K1H6D8j613/XUxlrKAsBrQKaHjwE3TPrlUttvQ8=; 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=1706653694; v=1; b=nAR4mfD3kh6uWv3EQ6asiNhRQqgepGS8nj3QiZ7bvCiAPGMtk7pjjHWZWT5WqSALparU/1f0 tblbijjxvgo2ge7tgwGFITdsHwnLC1txasqDppC6nXf2Lx3f8AH8ufrsy6Kt8Sob6rnBcnAkIYM Rs11VaydtR6GvsX95efntT4w= X-Received: by 127.0.0.2 with SMTP id uowUYY7687511xUdFlCwtuIq; Tue, 30 Jan 2024 14:28:14 -0800 X-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.web10.548.1706653693243815066 for ; Tue, 30 Jan 2024 14:28:13 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-MrNLBpSXPiGgmZc_8Q02qA-1; Tue, 30 Jan 2024 17:28:09 -0500 X-MC-Unique: MrNLBpSXPiGgmZc_8Q02qA-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 693881C05153; Tue, 30 Jan 2024 22:28:08 +0000 (UTC) X-Received: from [10.39.192.67] (unknown [10.39.192.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 233731121306; Tue, 30 Jan 2024 22:28:06 +0000 (UTC) Message-ID: <69c99682-80b5-274d-4f8e-c8c8f4ed5e7a@redhat.com> Date: Tue, 30 Jan 2024 23:28:04 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2 3/5] OvmfPkg/ResetVector: improve page table flag names To: Pedro Falcato , devel@edk2.groups.io, kraxel@redhat.com Cc: Erdem Aktas , Oliver Steffen , Jiewen Yao , Ard Biesheuvel , Min Xu , Tom Lendacky , Michael Roth , Liming Gao References: <20240130123204.764453-1-kraxel@redhat.com> <20240130123204.764453-4-kraxel@redhat.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 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: 9JJAE4DAF4rsXFQ0rICiarUbx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=nAR4mfD3; 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 1/30/24 20:46, Pedro Falcato wrote: > On Tue, Jan 30, 2024 at 12:32 PM Gerd Hoffmann wrote: >> >> Add comments, rename some of the PAGE_* flags and combined attributes. >> Specifically use "LARGEPAGE" instead of "2M" because that bit is used >> for both 2M and 1G large pages. >> >> Signed-off-by: Gerd Hoffmann >> --- >> OvmfPkg/ResetVector/Ia32/PageTables64.asm | 39 +++++++++++++---------- >> 1 file changed, 22 insertions(+), 17 deletions(-) >> >> diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVector/Ia32/PageTables64.asm >> index 317cad430f29..6fec6f2beeea 100644 >> --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm >> +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm >> @@ -10,6 +10,7 @@ >> >> BITS 32 >> >> +; common for all levels >> %define PAGE_PRESENT 0x01 >> %define PAGE_READ_WRITE 0x02 >> %define PAGE_USER_SUPERVISOR 0x04 >> @@ -17,25 +18,29 @@ BITS 32 >> %define PAGE_CACHE_DISABLE 0x010 >> %define PAGE_ACCESSED 0x020 >> %define PAGE_DIRTY 0x040 >> -%define PAGE_PAT 0x080 >> %define PAGE_GLOBAL 0x0100 >> -%define PAGE_2M_MBO 0x080 >> -%define PAGE_2M_PAT 0x01000 >> + >> +; page table entries (level 1) >> +%define PAGE_PTE_PAT 0x080 >> + >> +; page directory entries (level 2+) >> +%define PAGE_PDE_LARGEPAGE 0x080 >> +%define PAGE_PDE_PAT 0x01000 >> >> %define PAGE_4K_PDE_ATTR (PAGE_ACCESSED + \ >> PAGE_DIRTY + \ >> PAGE_READ_WRITE + \ >> PAGE_PRESENT) >> >> -%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \ >> - PAGE_ACCESSED + \ >> - PAGE_DIRTY + \ >> - PAGE_READ_WRITE + \ >> - PAGE_PRESENT) >> +%define PAGE_PDE_LARGEPAGE_ATTR (PAGE_PDE_LARGEPAGE + \ >> + PAGE_ACCESSED + \ >> + PAGE_DIRTY + \ >> + PAGE_READ_WRITE + \ >> + PAGE_PRESENT) >> >> -%define PAGE_PDP_ATTR (PAGE_ACCESSED + \ >> - PAGE_READ_WRITE + \ >> - PAGE_PRESENT) >> +%define PAGE_PDE_DIRECTORY_ATTR (PAGE_ACCESSED + \ >> + PAGE_READ_WRITE + \ >> + PAGE_PRESENT) >> >> %define TDX_BSP 1 >> %define TDX_AP 2 >> @@ -84,19 +89,19 @@ clearPageTablesMemoryLoop: >> ; >> ; Top level Page Directory Pointers (1 * 512GB entry) >> ; >> - mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDP_ATTR >> + mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDE_DIRECTORY_ATTR >> mov dword[PT_ADDR (4)], edx >> >> ; >> ; Next level Page Directory Pointers (4 * 1GB entries => 4GB) >> ; >> - mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDP_ATTR >> + mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDE_DIRECTORY_ATTR > > Technically, if we want to be pedantic, these are PDPTEs (or PDPs I > guess), so PDE is misleading here. I remembered the fact that the SDM used different terms for different table levels, but honestly, I've never been able to keep all those in my mind for longer than 5 minutes. I recall them as fairly arbitrary. So I consciously ignored this; in my book, this doesn't count as misleading. But, I have nothing against more detailed macro names, if Gerd's willing to respin! Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114830): https://edk2.groups.io/g/devel/message/114830 Mute This Topic: https://groups.io/mt/104052210/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-