From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web08.12892.1634040817967604391 for ; Tue, 12 Oct 2021 05:13:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fGI1zUmP; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634040817; 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=mV3NCNlxy+ULOB5eM6pRvn1iqu7GyyXUzkRwh4P04Lw=; b=fGI1zUmPp4zdh9t0hlJJHzWNTJVRL4oATJqqDVqdOEgx0OPKF38AZRa6PBEQG3TT8t8HWN +3+HJCZjH3FK2jUMMefTe7e1g+oUC02qWNiwBTz274hKXLFiisyfXx7AbSfCDMNs+GtRRu +EXnM/sNgJkTxcR16bw+HUcGaf5sq0E= 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-525-Ojky6194Pq-UtHB52HBOeA-1; Tue, 12 Oct 2021 08:13:31 -0400 X-MC-Unique: Ojky6194Pq-UtHB52HBOeA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 342B810B3941; Tue, 12 Oct 2021 12:13:30 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1B175BAE6; Tue, 12 Oct 2021 12:13:29 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 279E6180060E; Tue, 12 Oct 2021 14:13:28 +0200 (CEST) Date: Tue, 12 Oct 2021 14:13:28 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io, min.m.xu@intel.com Cc: Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V2 25/28] OvmfPkg/BaseMemEncryptTdxLib: Add TDX helper library Message-ID: <20211012121328.z2f5iiedzqblxwpx@sirius.home.kraxel.org> References: <96d207f5d59e60183c51321b3f3b53e5b1f8348f.1633401643.git.min.m.xu@intel.com> MIME-Version: 1.0 In-Reply-To: <96d207f5d59e60183c51321b3f3b53e5b1f8348f.1633401643.git.min.m.xu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 > +/** > + Initialize a buffer pool for page table use only. > + > + To reduce the potential split operation on page table, the pages reserved for > + page table should be allocated in the times of PAGE_TABLE_POOL_UNIT_PAGES and > + at the boundary of PAGE_TABLE_POOL_ALIGNMENT. So the page pool is always > + initialized with number of pages greater than or equal to the given > + PoolPages. Hmm, doesn't have tianocore a lib for such allocation pools? > + // > + // Link all pools into a list for easier track later. > + // Seems to be never used. > +/** > + Disable Write Protect on pages marked as read-only. > +**/ > +STATIC > +VOID > +DisableReadOnlyPageWriteProtect ( Why this is needed? > +typedef union { > + struct { > + UINT64 Present:1; // 0 = Not present in memory, > + // 1 = Present in memory > + UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write > + UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User > + UINT64 WriteThrough:1; // 0 = Write-Back caching, > + // 1 = Write-Through caching > + UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached > + UINT64 Accessed:1; // 0 = Not accessed, > + // 1 = Accessed (set by CPU) > + UINT64 Reserved:1; // Reserved > + UINT64 MustBeZero:2; // Must Be Zero > + UINT64 Available:3; // Available for use by system software > + UINT64 PageTableBaseAddress:40; // Page Table Base Address > + UINT64 AvabilableHigh:11; // Available for use by system software > + UINT64 Nx:1; // No Execute bit > + } Bits; > + UINT64 Uint64; > +} PAGE_MAP_AND_DIRECTORY_POINTER; No need to add that, there is OvmfPkg/Include/IndustryStandard/PageTable.h take care, Gerd