From nobody Mon Feb 9 15:08:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91453+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91453+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1658150329; cv=none; d=zohomail.com; s=zohoarc; b=LyOVzSGJ9mBvFSxNmjEHOYH8RyMsaMecXXQ0zjHktiYO20prYNo4U7y14/hGvOWGBHit0VzpWN4o/av7iqWCgrOUH676/QtAWT6Qbg/j5PJ0Ci9B2e94q/L+72E6bqRnBSnx1laGDV+au8kAX8tTx4L15VA/73wS7U5OxsX5Qa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658150329; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=LgEBONytyF/mWFkAGPRQenSdoASId3Frd2jwkWinHeY=; b=UtmqS8S7fInHCFUV3HnyxAvAfg+aYejfzQ7cDCSaySYYEhKB7x8DHYMnPjKphl1B1XYo3IoiwZbkCss0YKyQ2FhUF9d9AZZG8/sp6HoKx32v0zpfobxbLshO9+Yhr8vD1UGoEjtm0+/1MVUfgroA+/8INQ04Mwwdajjib5uLnmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91453+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 165815032914467.93179150551555; Mon, 18 Jul 2022 06:18:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OIlIYY1788612xnbN4703xLa; Mon, 18 Jul 2022 06:18:48 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.27079.1658150325580236005 for ; Mon, 18 Jul 2022 06:18:46 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10411"; a="287363901" X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="287363901" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 06:18:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="624724978" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.183.102]) by orsmga008.jf.intel.com with ESMTP; 18 Jul 2022 06:18:44 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Zhiguang Liu , Eric Dong Subject: [edk2-devel] [PATCH 05/10] CpuPageTableLib: Split the page entry when LA is aligned but PA is not Date: Mon, 18 Jul 2022 21:18:26 +0800 Message-Id: <20220718131831.660-6-ray.ni@intel.com> In-Reply-To: <20220718131831.660-1-ray.ni@intel.com> References: <20220718131831.660-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: lvFcOECB71I5a3O50scDgMXmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1658150328; bh=Y/9P4k0h15Xov/gJg8sEqyFC9bmDXhya4O4oafJNGrk=; h=Cc:Date:From:Reply-To:Subject:To; b=IQoFUyh9f2SmVhFwK8OcxVQDonKSSw7IKpeD3HCPKCb9SRUn995edvtPKb5FDJyOVE9 J/Oh8C6QC/LdfCDtXG6Psu6ewfKGc9o8MTbBVsOnTRd4nZ9A+xxrXGCUquLU3PplZUhb/ pDBjHsYmhOpvYbuxbf/BDW1Vjt/FH2BTW6I= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1658150331549100028 Content-Type: text/plain; charset="utf-8" When PageTableMap() is called to create non 1:1 mapping such as [0, 1G) to [8K, 1G+8K), it should split the page entry to the 4K page level, but old logic has a bug that it just uses 1G page entry. The patch fixes the bug. Signed-off-by: Zhiguang Liu Cc: Ray Ni Cc: Eric Dong --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpu= Pkg/Library/CpuPageTableLib/CpuPageTableMap.c index 509fa5f7bd..dc37ca3647 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c @@ -360,7 +360,12 @@ PageTableLibMapInLevel ( PagingEntry =3D (IA32_PAGING_ENTRY *)(UINTN)IA32_PNLE_PAGE_TABLE_BASE_AD= DRESS (&ParentPagingEntry->Pnle); while (Offset < Length && Index < 512) { SubLength =3D MIN (Length - Offset, RegionStart + RegionLength - (Line= arAddress + Offset)); - if ((Level <=3D MaxLeafLevel) && (((LinearAddress + Offset) & RegionMa= sk) =3D=3D 0) && (SubLength =3D=3D RegionLength)) { + if ((Level <=3D MaxLeafLevel) && + (((LinearAddress + Offset) & RegionMask) =3D=3D 0) && + (((IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS (Attribute) + Offset= ) & RegionMask) =3D=3D 0) && + (SubLength =3D=3D RegionLength) + ) + { // // Create one entry mapping the entire region (1G, 2M or 4K). // --=20 2.35.1.windows.2 -=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 (#91453): https://edk2.groups.io/g/devel/message/91453 Mute This Topic: https://groups.io/mt/92458158/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-