From nobody Sun May 12 11:55:30 2024 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+90138+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+90138+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654159348; cv=none; d=zohomail.com; s=zohoarc; b=hH7b7uxc9tvKWQKEm9INXBCfudgW2aRg9uTMk4JavyShMuRwpkaELQj38CqjjyN6nZjTmUvhXWgNKmn+FFNKEOwqHTPbsw/TuKbpFLnP5SCWgcAklGwWrPNQIEWc9k9F6Le/OC6u7afyPAraA9ZYhjhtuUeiQ0nhmRIGHbjxL5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654159348; 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=PTgWlm9Nvz8DmycWobCSl1nL66spQ6EQI6Q9w8ER7Ss=; b=QJ/ce+sOTJNNjsoyIVIFIw+MRDnN7B9BTzqYWceVOrKbCp1PPYq7S7rLts6Ie9nV8mIiqCoZWqnUoAh71/YUUwtDiNSZHmtTI5lT1gloosZjrdMHEf44RFYrFuYncLnRmxDFnbMA4pF15Kxt3YE8uDASJq6uUO8MLbG/pUrzlpc= 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+90138+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 1654159348840683.6522734134495; Thu, 2 Jun 2022 01:42:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gKO1YY1788612xBDfx4SLYD7; Thu, 02 Jun 2022 01:42:23 -0700 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.web12.4352.1654159342618250751 for ; Thu, 02 Jun 2022 01:42:22 -0700 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-bWidjuj_M_e7uk4O5R2sHQ-1; Thu, 02 Jun 2022 04:42:18 -0400 X-MC-Unique: bWidjuj_M_e7uk4O5R2sHQ-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CADF296A62F; Thu, 2 Jun 2022 08:42:18 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C96CE1121314; Thu, 2 Jun 2022 08:42:17 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 673801800397; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen , Ard Biesheuvel Subject: [edk2-devel] [PATCH v7 1/6] MdeModulePkg/PciHostBridge: io range is not mandatory Date: Thu, 2 Jun 2022 10:42:11 +0200 Message-Id: <20220602084216.159028-2-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 4uWc67LtcBtw5hSEny8lhOlrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654159343; bh=JJ0cmWSjOEF2TL6zbOjyCv6RbWmoEwDfZHEZZUl3mUg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=rmEk+kRanZMrDYJLADIks+CFmZyOR9V8MYOya/0dDEHn4HBfGMqFyWCpVR2Cav6+/mm V80uxskPtwhS/qKvif9Z1/XXcCvw7drGcs+18m23cdiZfCv0Xqf6LEASIbHQ02mO6DPYc qQYavlEQVaMTJnzYFGZQfgom57xdjHvRRJs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654159350705100002 Content-Type: text/plain; charset="utf-8"; x-default="true" io range is not mandatory according to pcie spec, so allow pcie host bridge configurations without io window in case there are no io reservations. Signed-off-by: Gerd Hoffmann Reviewed-by: Ard Biesheuvel --- MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c b/MdeMod= ulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c index b20bcd310ad5..354be6dbb313 100644 --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c @@ -1085,6 +1085,12 @@ NotifyPhase ( RootBridge->ResAllocNode[Index].Base =3D BaseAddress; RootBridge->ResAllocNode[Index].Status =3D ResAllocated; DEBUG ((DEBUG_INFO, "Success\n")); + } else if ((Index =3D=3D TypeIo) && + (RootBridge->Io.Base =3D=3D MAX_UINT64) && + (RootBridge->ResAllocNode[Index].Length =3D=3D 0)) + { + /* I/O is optional on PCIe */ + DEBUG ((DEBUG_INFO, "Success (PCIe NoIO)\n")); } else { ReturnStatus =3D EFI_OUT_OF_RESOURCES; DEBUG ((DEBUG_ERROR, "Out Of Resource!\n")); --=20 2.36.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 (#90138): https://edk2.groups.io/g/devel/message/90138 Mute This Topic: https://groups.io/mt/91495635/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- From nobody Sun May 12 11:55:30 2024 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+90139+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+90139+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654159348; cv=none; d=zohomail.com; s=zohoarc; b=EAQ5qg722dHeOFDO12761SNQMsyJ9ADcF9Rk99sXyAtDSA0NRPEp9XOuaPXgXWbICRPUT427XrQj5KZ+Obvrqpe1ZKt+h3aXbyNM9pS4CY1yUPV0Y8Vz5ouBld1/MFF+u3HJ7hmr+dErVCjW2NK6Ed96sUcp7e0w7hbDBy/XJrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654159348; 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=5v6wsacr87EFNfuo/Hd26SEFjsihEyHl56UC/y7kPTE=; b=jXtZWJ83kkJgJBjXUeZaTqyCyPed837wH9SjMml58790LpZWsHDsavCb1iU5erIDSRGk3UizifU/40xrwH88NuykXZQOzzpqctBvvpt0+/lHYHBCpCsOw0GHrO28fu4BRbXBXnxh9XDqelif6K0mI/Tf/E83IJt//Et9sBXTdZ0= 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+90139+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 1654159348756582.4747605935212; Thu, 2 Jun 2022 01:42:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id eRksYY1788612xNwGTBaMubE; Thu, 02 Jun 2022 01:42:23 -0700 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.web08.4397.1654159342484779390 for ; Thu, 02 Jun 2022 01:42:22 -0700 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-g4S2bb44PsqMx4JcDAjRLg-1; Thu, 02 Jun 2022 04:42:20 -0400 X-MC-Unique: g4S2bb44PsqMx4JcDAjRLg-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24720858F11; Thu, 2 Jun 2022 08:42:20 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6904140F06B; Thu, 2 Jun 2022 08:42:19 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6CC01180039D; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen Subject: [edk2-devel] [PATCH v7 2/6] OvmfPkg/FdtPciHostBridgeLib: io range is not mandatory Date: Thu, 2 Jun 2022 10:42:12 +0200 Message-Id: <20220602084216.159028-3-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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: zRiYCremJ6r0qFQA9aqQ9BW5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654159343; bh=TrI4UU+3OFWyAvSBvtdxfo8y+KczEgJ6zCNtWQuBZdU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=jVIQq6KMr/Q1Oylh7XESqR2vY82YMU4FQ/ZHJWHavq6OTTw+Qrrchv1ka5kRnAXFwb0 1Sm2yX3oP0AdXeGBS2UQ0oHUjPLROCbKoSC0mKaqWHdrjsGNNiP49f6sL6jpTFZaDeEQQ JTL0v4sW8N0xOe8+JEsuE81Q2bF9bgVhSMo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654159350714100004 Content-Type: text/plain; charset="utf-8"; x-default="true" io range is not mandatory according to pcie spec, so allow host bridges without io address space. Signed-off-by: Gerd Hoffmann --- .../FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c b/OvmfPk= g/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c index 98828e0b262b..14b41a533e96 100644 --- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c +++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c @@ -292,13 +292,8 @@ ProcessPciHost ( } } =20 - if ((*IoSize =3D=3D 0) || (*Mmio32Size =3D=3D 0)) { - DEBUG (( - DEBUG_ERROR, - "%a: %a space empty\n", - __FUNCTION__, - (*IoSize =3D=3D 0) ? "IO" : "MMIO32" - )); + if (*Mmio32Size =3D=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n", __FUNCTION__)); return EFI_PROTOCOL_ERROR; } =20 @@ -333,13 +328,15 @@ ProcessPciHost ( return Status; } =20 - // - // Map the MMIO window that provides I/O access - the PCI host bridge co= de - // is not aware of this translation and so it will only map the I/O view - // in the GCD I/O map. - // - Status =3D MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize); - ASSERT_EFI_ERROR (Status); + if (*IoSize !=3D 0) { + // + // Map the MMIO window that provides I/O access - the PCI host bridge = code + // is not aware of this translation and so it will only map the I/O vi= ew + // in the GCD I/O map. + // + Status =3D MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize); + ASSERT_EFI_ERROR (Status); + } =20 return Status; } @@ -413,17 +410,21 @@ PciHostBridgeGetRootBridges ( =20 AllocationAttributes =3D EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM; =20 - Io.Base =3D IoBase; - Io.Limit =3D IoBase + IoSize - 1; + if (IoSize !=3D 0) { + Io.Base =3D IoBase; + Io.Limit =3D IoBase + IoSize - 1; + } else { + Io.Base =3D MAX_UINT64; + Io.Limit =3D 0; + } + Mem.Base =3D Mmio32Base; Mem.Limit =3D Mmio32Base + Mmio32Size - 1; =20 - if (sizeof (UINTN) =3D=3D sizeof (UINT64)) { - MemAbove4G.Base =3D Mmio64Base; - MemAbove4G.Limit =3D Mmio64Base + Mmio64Size - 1; - if (Mmio64Size > 0) { - AllocationAttributes |=3D EFI_PCI_HOST_BRIDGE_MEM64_DECODE; - } + if ((sizeof (UINTN) =3D=3D sizeof (UINT64)) && (Mmio64Size !=3D 0)) { + MemAbove4G.Base =3D Mmio64Base; + MemAbove4G.Limit =3D Mmio64Base + Mmio64Size - 1; + AllocationAttributes |=3D EFI_PCI_HOST_BRIDGE_MEM64_DECODE; } else { // // UEFI mandates a 1:1 virtual-to-physical mapping, so on a 32-bit --=20 2.36.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 (#90139): https://edk2.groups.io/g/devel/message/90139 Mute This Topic: https://groups.io/mt/91495636/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- From nobody Sun May 12 11:55:30 2024 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+90144+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+90144+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654159353; cv=none; d=zohomail.com; s=zohoarc; b=ABbHrcMJQF/qXNrzgwk8LgILFIzQVUqhdeOXftUkP4bdXJJEK88eoB2DvkAF/WlN0PIvv5+NCMUpfT4J8QUdzA8YYUo+ZQGo4mlfN5CPktPtX+y8s9WBBDLp2o/AxHzTzKb05hRNUVG0eDZTVZ+M3IDAThK8xk0Fq+nPo3qMels= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654159353; 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=B8hz/cP9M4olxe82QbHcv/btitSldYe0n37v5HMWUzA=; b=fZRgt5HJPPsCtNyOjp9ZLtRD9cbbslILZP00TDYEE5doNNfKbG1WEvt30OSqNnZWTlF3Xa2uCY/TbytwpqoRhPMzGHy7FM8Fk4yYwJh9/sahLaMohqBJwCPgjfbvt6yfRhkjhZ50wwK1/SmAheb4EzKIF7+qzcsqf0yqKvDw418= 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+90144+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 1654159353057563.9661100438522; Thu, 2 Jun 2022 01:42:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id tH2MYY1788612xkIl7Pz2aM3; Thu, 02 Jun 2022 01:42:32 -0700 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.web08.4399.1654159352026084149 for ; Thu, 02 Jun 2022 01:42:32 -0700 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-618-NrKMScVKMvS-nCkt4kERJg-1; Thu, 02 Jun 2022 04:42:20 -0400 X-MC-Unique: NrKMScVKMvS-nCkt4kERJg-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0970100BAA0; Thu, 2 Jun 2022 08:42:19 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69BCD492C3B; Thu, 2 Jun 2022 08:42:19 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 70252180039F; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen Subject: [edk2-devel] [PATCH v7 3/6] OvmfPkg/Platform: unfix PcdPciExpressBaseAddress Date: Thu, 2 Jun 2022 10:42:13 +0200 Message-Id: <20220602084216.159028-4-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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: W1Ytqat1Mwt1TUouCjdG05ivx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654159352; bh=GL4NkntmFvzhznxlHfdBUPJAV/kw1IlvTrsZ1HgpT0k=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ZWRAqf7rdW7NhbdGHXMSHVVXg4oIzlp7+I8NWMMbY2l73NmV61yQzux5zWHqYEOMOY8 J2ZX0Sx4fZJZgaGMDeyVuunqJKvjwnlCQLfYKAUhoQazBRgRsjBZ+tW7BdxDzJshxvgQf SitC2co6ufrrGkYpSOsxJ6/bpCKuNwN32mM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654159354714100025 Content-Type: text/plain; charset="utf-8"; x-default="true" Will be set by FdtPciHostBridgeLib, so it can't be an fixed when we want use that library. Signed-off-by: Gerd Hoffmann --- OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf | 4 +++- OvmfPkg/PlatformPei/PlatformPei.inf | 2 +- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 4 ++-- OvmfPkg/Library/PlatformInitLib/Platform.c | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf b/OvmfPkg/= Library/PlatformInitLib/PlatformInitLib.inf index d0fab5cc1f4f..d2a0bec43452 100644 --- a/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf +++ b/OvmfPkg/Library/PlatformInitLib/PlatformInitLib.inf @@ -54,8 +54,10 @@ [LibraryClasses] [LibraryClasses.X64] TdxLib =20 -[FixedPcd] +[Pcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + +[FixedPcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index 00372fa0ebb5..3cd83e6ec3e5 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -95,6 +95,7 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved @@ -118,7 +119,6 @@ [Pcd] [FixedPcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfCpuidSize - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index 4c1dedf863c3..83a7b6726bb7 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -61,8 +61,8 @@ PlatformQemuUc32BaseInitialization ( // [PcdPciExpressBaseAddress, 4GB) range require a very small number of // variable MTRRs (preferably 1 or 2). // - ASSERT (FixedPcdGet64 (PcdPciExpressBaseAddress) <=3D MAX_UINT32); - PlatformInfoHob->Uc32Base =3D (UINT32)FixedPcdGet64 (PcdPciExpressBase= Address); + ASSERT (PcdGet64 (PcdPciExpressBaseAddress) <=3D MAX_UINT32); + PlatformInfoHob->Uc32Base =3D (UINT32)PcdGet64 (PcdPciExpressBaseAddre= ss); return; } =20 diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/P= latformInitLib/Platform.c index 101074f6100d..60a30a01f3b5 100644 --- a/OvmfPkg/Library/PlatformInitLib/Platform.c +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c @@ -154,7 +154,7 @@ PlatformMemMapInitialization ( // The MMCONFIG area is expected to fall between the top of low RAM and // the base of the 32-bit PCI host aperture. // - PciExBarBase =3D FixedPcdGet64 (PcdPciExpressBaseAddress); + PciExBarBase =3D PcdGet64 (PcdPciExpressBaseAddress); ASSERT (TopOfLowRam <=3D PciExBarBase); ASSERT (PciExBarBase <=3D MAX_UINT32 - SIZE_256MB); PciBase =3D (UINT32)(PciExBarBase + SIZE_256MB); @@ -278,7 +278,7 @@ PciExBarInitialization ( // determined in AddressWidthInitialization(), i.e., 36 bits, will suffi= ce // for DXE's page tables to cover the MMCONFIG area. // - PciExBarBase.Uint64 =3D FixedPcdGet64 (PcdPciExpressBaseAddress); + PciExBarBase.Uint64 =3D PcdGet64 (PcdPciExpressBaseAddress); ASSERT ((PciExBarBase.Uint32[1] & MCH_PCIEXBAR_HIGHMASK) =3D=3D 0); ASSERT ((PciExBarBase.Uint32[0] & MCH_PCIEXBAR_LOWMASK) =3D=3D 0); =20 --=20 2.36.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 (#90144): https://edk2.groups.io/g/devel/message/90144 Mute This Topic: https://groups.io/mt/91495644/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- From nobody Sun May 12 11:55:30 2024 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+90142+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+90142+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654159350; cv=none; d=zohomail.com; s=zohoarc; b=fSa6IL5uYFfXeNkzGrjDmveUIScM/Kgg/EIi8W7RUB22eOHGjzfSUiSlJCGK3ibIcLnMENTsr7eRM03aWgO8czEtEFaU8XCnEpmtTAJg6LERdSbVTtXxuRjhw3YzU5i0oGuH6C8hwoFSPacPC5s3cSMq/HoQdOVipejMxLjzXPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654159350; 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=jdhEdpjJUyCRulIL2V11cgev40t7zDmhf6kF7One1rk=; b=nRslRJhwdbrkks2EjYcTiqw9cE22Ai44SJR7W/8I+NZDNDL9lWNnJMyCCoBjqMhwOA/kYdPGJ7sgF0W5RZO2U3sBfRZGpUOrubv+YrTmKbdLe+8VfplCripLrNTwpFtj/hZE445waByv5nCYUNPkjLazszmQQu4helHUj1lI2K4= 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+90142+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 1654159350241598.9740568317322; Thu, 2 Jun 2022 01:42:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zWBPYY1788612xdACeTYQ5it; Thu, 02 Jun 2022 01:42:29 -0700 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.4381.1654159346366519182 for ; Thu, 02 Jun 2022 01:42:26 -0700 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-SspZscGPOkWyysEjPQitAA-1; Thu, 02 Jun 2022 04:42:21 -0400 X-MC-Unique: SspZscGPOkWyysEjPQitAA-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2BA333C01DA5; Thu, 2 Jun 2022 08:42:21 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E797DC27E97; Thu, 2 Jun 2022 08:42:20 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 738F918003A1; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen Subject: [edk2-devel] [PATCH v7 4/6] OvmfPkg/Microvm/pcie: no vbeshim please Date: Thu, 2 Jun 2022 10:42:14 +0200 Message-Id: <20220602084216.159028-5-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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: Dqmth84jcPrlmpC9iAv1TEkUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654159349; bh=Cxk/sxmYDoOMnfRKT7+NGvmYoHrIRLvNJyPk4clvBds=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=qYwn543Xvp+WeGpZWg+b4zZ/fMtHTBhGiq+jL+jSb1LAoEp+rlp5iM41QpvJ88bVkVM ZfZ5qDuPbLZ7zB+xwUC0o2yykOPbcJo/tSW4OAGXmbY1NzKC6chpnSmnxmSOa5BVDKrBz 8Q8t/925DYtCeeRS/mDdjvoS6PTYi3zT2UY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654159350694100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Those old windows versions which need the vbeshim hack will not run on microvm anyway. Signed-off-by: Gerd Hoffmann --- OvmfPkg/QemuVideoDxe/VbeShim.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.c b/OvmfPkg/QemuVideoDxe/VbeShim.c index 8faa146b6cce..2a048211a823 100644 --- a/OvmfPkg/QemuVideoDxe/VbeShim.c +++ b/OvmfPkg/QemuVideoDxe/VbeShim.c @@ -156,6 +156,8 @@ InstallVbeShim ( case INTEL_Q35_MCH_DEVICE_ID: Pam1Address =3D DRAMC_REGISTER_Q35 (MCH_PAM1); break; + case MICROVM_PSEUDO_DEVICE_ID: + return; default: DEBUG (( DEBUG_ERROR, --=20 2.36.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 (#90142): https://edk2.groups.io/g/devel/message/90142 Mute This Topic: https://groups.io/mt/91495641/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- From nobody Sun May 12 11:55:30 2024 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+90141+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+90141+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654159350; cv=none; d=zohomail.com; s=zohoarc; b=P3HaMT/Rnp1paHDINXu+taSF03RM3tgXvX/w0yFBXdcVp0fosGOiTdRls0WgluORMPWU1MUQaeo0WF9j4kpFItuqsBjm7qCgAhycXZVp6p89JXsi7RM6hkgL8+JJRmbtqhxeaqEvKxc84+KPUDVyFXWPy8V/rKwiYSow6d/Ll2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654159350; 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=E63ny4zvJr5l/jtNg5oNU7lpIsFsZ+2bHcNEu6K6glA=; b=E6KgSdCC5rKwMZwL4DZ66gdQFbwZPDu5ZeKjP0swT2oQ+Xd+vWLvGxeI8HACiZlMYLanyepBHZQhG6GQY/b2kGNzHRagqf1LcGjLvA9zl/D3x1WNP5YQ3IMJ9/ksDDOShlZKKuBqG/JI4V62twAMwoXDqEs/O3384sJRo9RGdZo= 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+90141+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 1654159350007665.4780009684816; Thu, 2 Jun 2022 01:42:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EPtxYY1788612xWXVRubqMSW; Thu, 02 Jun 2022 01:42:29 -0700 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.web12.4353.1654159346150200978 for ; Thu, 02 Jun 2022 01:42:26 -0700 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-191-oJVdEm4bPgilqj5VZSFOow-1; Thu, 02 Jun 2022 04:42:22 -0400 X-MC-Unique: oJVdEm4bPgilqj5VZSFOow-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E4E380088A; Thu, 2 Jun 2022 08:42:21 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A618C15E72; Thu, 2 Jun 2022 08:42:21 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 76F1218003A3; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen Subject: [edk2-devel] [PATCH v7 5/6] OvmfPkg/Microvm/pcie: mPhysMemAddressWidth tweak Date: Thu, 2 Jun 2022 10:42:15 +0200 Message-Id: <20220602084216.159028-6-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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: E5LIPGRvwbauPvPpia8RzBPxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654159349; bh=WPsXgjzMtgaSqtjgbPYDdPlfxiNgknNi2d4gULCsR4w=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=hF4CJ6nFGOrAB/jqQv56LmnxOafs5S4rWHMdrp9AhEKvsuUDq1lcAEGw2fVWN8aO/Xl 5Fj6RTiMKq6bGC8A3Xgh/XidyQ4sFlEmRwrd0QFDBLxSo8cDH7Y6ZhuujNYgF5t8/WRYi XMxkqE+XNWdEvAjFUhbaYmOeMzwmpX4+esk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654159350722100005 Content-Type: text/plain; charset="utf-8"; x-default="true" 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/Library/PlatformInitLib/MemDetect.c | 41 +++++++++++++++++++++ OvmfPkg/PlatformPei/Platform.c | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index 83a7b6726bb7..c28d7601f87e 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -491,6 +491,42 @@ PlatformGetFirstNonAddress ( return FirstNonAddress; } =20 +/* + * Use CPUID to figure physical address width. Does *not* work + * reliable on qemu. For historical reasons qemu returns phys-bits=3D40 + * even in case the host machine supports less than that. + * + * qemu has a cpu property (host-phys-bits=3D{on,off}) to change that + * and make sure guest phys-bits are not larger than host phys-bits., + * but it is off by default. Exception: microvm machine type + * hard-wires that property to on. + */ +VOID +EFIAPI +PlatformAddressWidthFromCpuid ( + IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob + ) +{ + UINT32 RegEax; + + AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); + if (RegEax >=3D 0x80000008) { + AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); + PlatformInfoHob->PhysMemAddressWidth =3D (UINT8)RegEax; + } else { + PlatformInfoHob->PhysMemAddressWidth =3D 36; + } + + PlatformInfoHob->FirstNonAddress =3D LShiftU64 (1, PlatformInfoHob->Phys= MemAddressWidth); + + DEBUG (( + DEBUG_INFO, + "%a: cpuid: phys-bits is %d\n", + __FUNCTION__, + PlatformInfoHob->PhysMemAddressWidth + )); +} + /** Initialize the PhysMemAddressWidth field in PlatformInfoHob based on gue= st RAM size. **/ @@ -503,6 +539,11 @@ PlatformAddressWidthInitialization ( UINT64 FirstNonAddress; UINT8 PhysMemAddressWidth; =20 + if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff /* microvm */) { + PlatformAddressWidthFromCpuid (PlatformInfoHob); + 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 f006755d5fdb..009db67ee60a 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -357,12 +357,12 @@ InitializePlatform ( =20 S3Verification (); BootModeInitialization (&mPlatformInfoHob); - AddressWidthInitialization (&mPlatformInfoHob); =20 // // Query Host Bridge DID // mPlatformInfoHob.HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); + AddressWidthInitialization (&mPlatformInfoHob); =20 MaxCpuCountInitialization (&mPlatformInfoHob); =20 --=20 2.36.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 (#90141): https://edk2.groups.io/g/devel/message/90141 Mute This Topic: https://groups.io/mt/91495640/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- From nobody Sun May 12 11:55:30 2024 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+90143+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+90143+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654159350; cv=none; d=zohomail.com; s=zohoarc; b=HNpN/eTxjadTCMt8O7usClCouX+fRK/EjK0N0fI67Pv7lpx09bmSErIQYlMGRby65NMq9sYkM2/vjwn+ou2NIeQl/VlXs89U1umxTl6FWG5JMImrmaW7FMPiOMlJ7YhHIUqziiABZyNuCXt3BdMvqj6qCBKcw/tcvdphLAfcV7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654159350; 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=1/EMHPbKCXpP3Ferw78bQx9qL0l0Z2//pJDtLBmpLSg=; b=m0DeJAzXeQgSijXT0M4QzzgEhGoElC2FKEsEBS8CWKaj3p+nWh3joB3tY6BEQ2jYCGl8nL25Eg4JUX5ZVqvGU52VuFf/gXFT884prn4PJ1eDoBT65WS30JumoDmmVpzid+sfYJoXRnVnn+nNYmth6F+ai18Vi9dqU/KZmjktxy8= 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+90143+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 1654159350737827.1888080831554; Thu, 2 Jun 2022 01:42:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mfWNYY1788612xTI89Rlb63Z; Thu, 02 Jun 2022 01:42:30 -0700 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.4382.1654159347410636164 for ; Thu, 02 Jun 2022 01:42:27 -0700 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-4e44hoE2MuOt_UNx_DE4fQ-1; Thu, 02 Jun 2022 04:42:23 -0400 X-MC-Unique: 4e44hoE2MuOt_UNx_DE4fQ-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 02C311C051AD; Thu, 2 Jun 2022 08:42:23 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9305C2166B2C; Thu, 2 Jun 2022 08:42:22 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7AD3118003AB; Thu, 2 Jun 2022 10:42:16 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Hao A Wu , Pawel Polawski , Ard Biesheuvel , mateusz.albecki@intel.com, Abner Chang , Ray Ni , Leif Lindholm , Jiewen Yao , Oliver Steffen , Liming Gao , Gerd Hoffmann , Jian J Wang , Jordan Justen Subject: [edk2-devel] [PATCH v7 6/6] OvmfPkg/Microvm/pcie: add pcie support Date: Thu, 2 Jun 2022 10:42:16 +0200 Message-Id: <20220602084216.159028-7-kraxel@redhat.com> In-Reply-To: <20220602084216.159028-1-kraxel@redhat.com> References: <20220602084216.159028-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: oDR3J08AK5junxE7HVxVpvCQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1654159350; bh=b/yAYGd+F3DiWPmW2EcPZR72tW+nWumVbOknLLJfDds=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=CdT24pClEliau+TcNS7tiRVjq0BKKi3L0SZs0ubm6n7hyZwLORtpHMjp7KUgaMEOfgn DFWqRUBCU7Xy5Ty4TwHkp1tBkAnIAxYu2I/9LKWSznd5bVPovMYZqdkrTzRL57uM5UVjD W7MRhVcx6MVI0Aiwr5sXlRxzCqK/dCdTCts= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1654159352680100021 Content-Type: text/plain; charset="utf-8"; x-default="true" Link in pcie and host bridge bits. Enables support for PCIe in microvm (qemu-system-x86_64 -M microvm,pcie=3Don). Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3777 Signed-off-by: Gerd Hoffmann --- OvmfPkg/Microvm/MicrovmX64.dsc | 40 +++++++++++++++++++++------------- OvmfPkg/Microvm/README | 2 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index f8fc977cb205..5b150a959c12 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -337,7 +337,9 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] !endif UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf - PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf +# PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf +# PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib= .inf +# PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciEx= pressLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ibRuntimeDxe.inf =20 @@ -354,7 +356,9 @@ [LibraryClasses.common.UEFI_DRIVER] DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf !endif UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf - PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.= inf + PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExp= ressLib.inf =20 [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf @@ -376,7 +380,9 @@ [LibraryClasses.common.DXE_DRIVER] !if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf !endif - PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.= inf + PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExp= ressLib.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib= .inf @@ -392,7 +398,9 @@ [LibraryClasses.common.UEFI_APPLICATION] !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf !endif - PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.= inf + PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExp= ressLib.inf =20 [LibraryClasses.common.DXE_SMM_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf @@ -413,7 +421,9 @@ [LibraryClasses.common.DXE_SMM_DRIVER] DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf !endif BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf - PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.= inf + PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExp= ressLib.inf =20 [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf @@ -429,7 +439,9 @@ [LibraryClasses.common.SMM_CORE] !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf !endif - PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.= inf + PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExp= ressLib.inf =20 ##########################################################################= ###### # @@ -504,14 +516,6 @@ [PcdsFixedAtBuild] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F !endif =20 - # This PCD is used to set the base address of the PCI express hierarchy.= It - # is only consulted when OVMF runs on Q35. In that case it is programmed= into - # the PCIEXBAR register. - # - # On Q35 machine types that QEMU intends to support in the long term, QE= MU - # never lets the RAM below 4 GB exceed 2816 MB. - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xB0000000 - !if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 !endif @@ -579,6 +583,12 @@ [PcdsDynamicDefault] gEfiMdePkgTokenSpaceGuid.PcdFSBClock|1000000000 gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0 =20 + # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that this + # PCD and PcdPciDisableBusEnumeration below have not been assigned yet + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF + gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x0 + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE + # Set video resolution for text setup. gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 @@ -679,7 +689,7 @@ [Components] OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf { - PciHostBridgeLib|MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBr= idgeLibNull.inf + PciHostBridgeLib|OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib= .inf PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciH= ostBridgeUtilityLib.inf NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf } diff --git a/OvmfPkg/Microvm/README b/OvmfPkg/Microvm/README index 540d39f2ec21..813920d92a60 100644 --- a/OvmfPkg/Microvm/README +++ b/OvmfPkg/Microvm/README @@ -29,7 +29,7 @@ features [working] serial console [working] direct kernel boot [working] virtio-mmio support - [in progress] pcie support + [working] pcie support =20 known limitations ----------------- --=20 2.36.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 (#90143): https://edk2.groups.io/g/devel/message/90143 Mute This Topic: https://groups.io/mt/91495642/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-