From nobody Mon Feb 9 19:07:53 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+84980+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+84980+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639648256; cv=none; d=zohomail.com; s=zohoarc; b=XKLF+Stgk3PsWABkFqlBxo52plLR+zvHUW3wuiJiHOFWS1ufMTcfvsbJv7/VQzXLQicZsH6E45089Y+DG3Gz3t84dGjRCLfGcZgq8vh3dZmkOOGFUuk0O+vQ0hR9bhyct404RLehoXBJAY1usKC0bea/X1g6hSylGKNJ7ZCnz4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639648256; h=Content-Type: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=ONucoMjqlIcMHtMq1dKx84c2UoK3KjhsI0U2CEW+H2A=; b=hWae7/0Ls+BkGFIjT8AXSlRc6wgg31tu8yZeEKQbvJKtCuvF9wDEQhu5Y8bWWHjkBTstRc6L5CCLm9FMrWgVvswNgpnD00cGKymOXfivO5fa6NPilBtv0A+vqXBoCjzV6aL4eRGnZX0w0/pPM4vnOwqerPR7gM9gRk89hvfz1WQ= 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+84980+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 1639648256386632.0488176865879; Thu, 16 Dec 2021 01:50:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id f0EcYY1788612xnimfsSVtru; Thu, 16 Dec 2021 01:50:56 -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.web11.8683.1639648255239899263 for ; Thu, 16 Dec 2021 01:50:55 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-XjmxlACRNuSuArCVOjCfWA-1; Thu, 16 Dec 2021 04:50:51 -0500 X-MC-Unique: XjmxlACRNuSuArCVOjCfWA-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03D77801B0C; Thu, 16 Dec 2021 09:50:50 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF1CD2BCC1; Thu, 16 Dec 2021 09:50:49 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A218018003BC; Thu, 16 Dec 2021 10:50:37 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Liming Gao , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiewen Yao , Abner Chang , Ard Biesheuvel , Ray Ni , Gerd Hoffmann , Hao A Wu , Jian J Wang , Jordan Justen , Leif Lindholm Subject: [edk2-devel] [PATCH 5/6] OvmfPkg/Microvm/pcie: mPhysMemAddressWidth tweak Date: Thu, 16 Dec 2021 10:50:36 +0100 Message-Id: <20211216095037.1843149-6-kraxel@redhat.com> In-Reply-To: <20211216095037.1843149-1-kraxel@redhat.com> References: <20211216095037.1843149-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,kraxel@redhat.com X-Gm-Message-State: 91mMREJ54vOc3s2cgxUzuhIIx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639648256; bh=aRcH3E4ZT8462mVTG2FHWLuPLUjA0bWUTh5QX3qCazQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=O9WEOWd93GHX6FyjQhUC+bB5PKxFdaPgGIPnQRqnWCHRCdgRt+zUnvhKzNj3K7mTu/G 0/kKewjl0arbyAfUJfm+9yBxj+NYNGlfuX5DEMRBvnfU9WUm8WQe+YkV9+NuIWQA6n14q GY7ekPZpat4yKgHgGLbNCHHYNgiCwmtee5s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639648256681100016 Content-Type: text/plain; charset="utf-8" microvm places the 64bit mmio space at the end of the physical address space. So mPhysMemAddressWidth must be correct, otherwise the pci host bridge setup throws an error because it thinks the 64bit mmio window is not addressable. On microvm we can simply use standard cpuid to figure the address width because the host-phys-bits option (-cpu ${name},host-phys-bits=3Don) is forced to be enabled. Side note: For 'pc' and 'q35' this is not the case for backward compatibility reasons. Signed-off-by: Gerd Hoffmann --- OvmfPkg/PlatformPei/MemDetect.c | 21 +++++++++++++++++++++ OvmfPkg/PlatformPei/Platform.c | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index 81378eaf9b4c..ba8f2d4b3269 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -508,6 +508,27 @@ AddressWidthInitialization ( { UINT64 FirstNonAddress; =20 + if (mHostBridgeDevId =3D=3D 0xffff /* microvm */) { + UINT32 RegEax; + + /* NOTE: microvm phys-bits are reliable. */ + AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); + if (RegEax >=3D 0x80000008) { + AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); + mPhysMemAddressWidth =3D (UINT8)RegEax; + } else { + mPhysMemAddressWidth =3D 36; + } + + DEBUG (( + DEBUG_INFO, + "%a: microvm: phys-bits is %d\n", + __FUNCTION__, + mPhysMemAddressWidth + )); + return; + } + // // As guest-physical memory size grows, the permanent PEI RAM requiremen= ts // are dominated by the identity-mapping page tables built by the DXE IP= L. diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 27ada0c17577..b8cc0c31dd64 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -821,12 +821,12 @@ InitializePlatform ( =20 S3Verification (); BootModeInitialization (); - AddressWidthInitialization (); =20 // // Query Host Bridge DID // mHostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); + AddressWidthInitialization (); =20 MaxCpuCountInitialization (); =20 --=20 2.33.1 -=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 (#84980): https://edk2.groups.io/g/devel/message/84980 Mute This Topic: https://groups.io/mt/87764068/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-