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 AA905AC0B6F for ; Thu, 11 Jan 2024 06:54:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=HIrBJFNa/GVYnEZTtTKVqGgUDR4nGs7IR7HzgYCx100=; 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-Type; s=20140610; t=1704956048; v=1; b=BkAkPXmW7tG/apTMZmidGAUzeWltLHVIBhnkkjrdd2KOP5v+2PmwgPLN515Rndm1TnGu2Waj Cq/0HbZE4ATSBEE23uCk1tuIklf6qas0LwpjGWV+m214jMIv6/+wGr31fzU68wW6WwGRw9SQr9Q fvZiMXBghcAspgUsPyZlzfEs= X-Received: by 127.0.0.2 with SMTP id AWS2YY7687511xijWSsEBAb0; Wed, 10 Jan 2024 22:54:08 -0800 X-Received: from us-smtp-delivery-137.mimecast.com (us-smtp-delivery-137.mimecast.com [170.10.129.137]) by mx.groups.io with SMTP id smtpd.web11.7220.1704925370716119714 for ; Wed, 10 Jan 2024 14:22:50 -0800 X-Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-183-7bS8u9CxP3qZrZO1L837gA-1; Wed, 10 Jan 2024 17:22:34 -0500 X-MC-Unique: 7bS8u9CxP3qZrZO1L837gA-1 X-Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-28b77ca8807so2757980a91.3 for ; Wed, 10 Jan 2024 14:22:34 -0800 (PST) X-Gm-Message-State: oT44UiK738EdAcQ1fXYX9CCZx7686176AA= X-Received: by 2002:a17:90a:fe86:b0:28a:f0bc:2a9f with SMTP id co6-20020a17090afe8600b0028af0bc2a9fmr190837pjb.21.1704925352646; Wed, 10 Jan 2024 14:22:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWUg6o2JH//oUohnCO4HyEWvAYCreQlG0RAw4+UXFG1MJ3j09F33UPRk5IgqEHigBmGID+EA== X-Received: by 2002:a17:90a:fe86:b0:28a:f0bc:2a9f with SMTP id co6-20020a17090afe8600b0028af0bc2a9fmr190827pjb.21.1704925352261; Wed, 10 Jan 2024 14:22:32 -0800 (PST) X-Received: from dev-hypervisor-01.hsd1.ca.comcast.net ([2601:645:8001:5750::6d3b]) by smtp.googlemail.com with ESMTPSA id m1-20020a17090b068100b0028b6759d8c1sm2099092pjz.29.2024.01.10.14.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 14:22:31 -0800 (PST) From: "Thomas Barrett" To: devel@edk2.groups.io Cc: Thomas Barrett Subject: [edk2-devel] [PATCH 2/2] CloudHv: Update PlatformAddressWidthInitialization logic Date: Wed, 10 Jan 2024 22:21:37 +0000 Message-Id: <78159153d99401e1e5cd7b619cd1a64fbed82dc7.1704921917.git.tbarrett@crusoeenergy.com> In-Reply-To: <283db24a1d906fd115f85636bd1c2f9ddcde150c.1704921917.git.tbarrett@crusoeenergy.com> References: <283db24a1d906fd115f85636bd1c2f9ddcde150c.1704921917.git.tbarrett@crusoeenergy.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: crusoeenergy.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,tbarrett@crusoeenergy.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: multipart/alternative; boundary="MCBoundary=_12401101722410751" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=BkAkPXmW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=crusoeenergy.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 --MCBoundary=_12401101722410751 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 When booting CloudHv guests with greater than 1TiB of high memory, the PlatformAddressWidthInitialization function incorrect calculates the address width using the overflowed 24-bit CMOS register rather than the E820 entries. Signed-off-by: Thomas Barrett --- OvmfPkg/CloudHv/CloudHvX64.dsc | 2 ++ OvmfPkg/Library/PlatformInitLib/MemDetect.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.ds= c index af594959a9..b522fa1059 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc @@ -566,6 +566,8 @@ # Point to the MdeModulePkg/Application/UiApp/UiApp.inf gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } =20 + gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE + ##########################################################################= ###### # # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index 76a9dc9211..f042517bb6 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -873,6 +873,18 @@ PlatformAddressWidthInitialization ( =20 if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff /* microvm */) { PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE); + return; + } else if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { + PlatformInfoHob->FirstNonAddress =3D BASE_4GB; + Status =3D PlatformScanE820 (PlatformGetFirs= tNonAddressCB, PlatformInfoHob); + if (EFI_ERROR (Status)) { + PlatformInfoHob->FirstNonAddress =3D BASE_4GB + PlatformGetSystemMem= orySizeAbove4gb (); + } + + PlatformInfoHob->PcdPciMmio64Base =3D PlatformInfoHob->FirstNonAddress= ; + PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE); + PlatformInfoHob->PcdPciMmio64Size =3D PlatformInfoHob->FirstNonAddress= - PlatformInfoHob->PcdPciMmio64Base; + return; } =20 --=20 2.34.1 Disclaimer The information contained in this communication from the sender is confiden= tial. It is intended solely for use by the recipient and others authorized = to receive it. If you are not the recipient, you are hereby notified that a= ny disclosure, copying, distribution or taking action in relation of the co= ntents of this information is strictly prohibited and may be unlawful. This email has been scanned for viruses and malware, and may have been auto= matically archived by Mimecast, a leader in email security and cyber resili= ence. Mimecast integrates email defenses with brand protection, security aw= areness training, web security, compliance and other essential capabilities= . Mimecast helps protect large and small organizations from malicious activ= ity, human error and technology failure; and to lead the movement toward bu= ilding a more resilient world. To find out more, visit our website. -=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 (#113586): https://edk2.groups.io/g/devel/message/113586 Mute This Topic: https://groups.io/mt/103657893/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- --MCBoundary=_12401101722410751 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8 When booting CloudHv guests with greater than 1TiB = of high
memory, the PlatformAddressWidthInitialization function
incorrect calculates the address width using the overflowed
24-bit CMOS register rather than the E820 entries.

Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com>
---
OvmfPkg/CloudHv/CloudHvX64.dsc | 2 ++
OvmfPkg/Library/PlatformInitLib/MemDetect.c | 12 ++++++++++++
2 files changed, 14 insertions(+)

diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.ds= c
index af594959a9..b522fa1059 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -566,6 +566,8 @@
# Point to the MdeModulePkg/Application/UiApp/UiApp.inf

gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 }



+ gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE

+

##########################################################################= ######

#

# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c
index 76a9dc9211..f042517bb6 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -873,6 +873,18 @@ PlatformAddressWidthInitialization (


if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff /* microvm */) {
PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE);

+ return;

+ } else if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID)= {

+ PlatformInfoHob->FirstNonAddress =3D BASE_4GB;

+ Status =3D PlatformScanE820 (PlatformGetFirs= tNonAddressCB, PlatformInfoHob);

+ if (EFI_ERROR (Status)) {

+ PlatformInfoHob->FirstNonAddress =3D BASE_4GB + PlatformGetSystem= MemorySizeAbove4gb ();

+ }

+

+ PlatformInfoHob->PcdPciMmio64Base =3D PlatformInfoHob->FirstNonA= ddress;

+ PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE);

+ PlatformInfoHob->PcdPciMmio64Size =3D PlatformInfoHob->FirstNonA= ddress - PlatformInfoHob->PcdPciMmio64Base;

+

return;

}



--
2.34.1


<= b>Disclaimer

The information contained in this communication from the sender i= s confidential. It is intended solely for use by the recipient and others a= uthorized to receive it. If you are not the recipient, you are hereby notif= ied that any disclosure, copying, distribution or taking action in relation= of the contents of this information is strictly prohibited and may be unla= wful.

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#113586) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--MCBoundary=_12401101722410751--