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 53DB1740041 for ; Fri, 1 Mar 2024 07:44:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=DTKMvPKcoVL7rHmaDqB9nDr8oqi9DihegnlqQvqeu1s=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1709279047; v=1; b=PxHEC098nj2u2eSdp0Tgj+vAftIEZCYJuLhUrXIjwdxwiD0eyEcUD9MWIZ7NKWETqpnn1Jvc 22Zv7sIKmNrsQxpCXMPHoDZnYmegr5hy7d3CXshitkqvRp0ahiTW7dQAgv6JJ9hA85j1f5CgG1f Xrti7jzl7oqOkqLr6BwpLtWs= X-Received: by 127.0.0.2 with SMTP id cizqYY7687511x44wjmCiyuk; Thu, 29 Feb 2024 23:44:07 -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.17780.1709279047205710456 for ; Thu, 29 Feb 2024 23:44:07 -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-333-njPzzDhAMw-77lwRWOuy7g-1; Fri, 01 Mar 2024 02:44:05 -0500 X-MC-Unique: njPzzDhAMw-77lwRWOuy7g-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 893DE106CFE2; Fri, 1 Mar 2024 07:44:04 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0481FC185C0; Fri, 1 Mar 2024 07:44:04 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AB123180148E; Fri, 1 Mar 2024 08:44:02 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , Laszlo Ersek , Michael Roth , Erdem Aktas , Gerd Hoffmann , Min Xu , Ard Biesheuvel , Tom Lendacky Subject: [edk2-devel] [PATCH v2 01/10] OvmfPkg/ResetVector: improve page table flag names Date: Fri, 1 Mar 2024 08:43:53 +0100 Message-ID: <20240301074402.98625-2-kraxel@redhat.com> In-Reply-To: <20240301074402.98625-1-kraxel@redhat.com> References: <20240301074402.98625-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 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,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: uv01z9NgiP6e2A1kMPuqvtbTx7686176AA= Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=PxHEC098; 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 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 Reviewed-by: Laszlo Ersek --- 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 mov dword[PT_ADDR (0x1004)], edx - mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x100C)], edx - mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x1014)], edx - mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDP_ATTR + mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDE_DIRECTORY_ATTR mov dword[PT_ADDR (0x101C)], edx ; @@ -107,7 +112,7 @@ pageTableEntriesLoop: mov eax, ecx dec eax shl eax, 21 - add eax, PAGE_2M_PDE_ATTR + add eax, PAGE_PDE_LARGEPAGE_ATTR mov [ecx * 8 + PT_ADDR (0x2000 - 8)], eax mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx loop pageTableEntriesLoop -- 2.44.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116213): https://edk2.groups.io/g/devel/message/116213 Mute This Topic: https://groups.io/mt/104660107/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-