From nobody Sat Nov 23 23:36:48 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+94701+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+94701+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1664891258; cv=none; d=zohomail.com; s=zohoarc; b=LkBBvQCUr9kL6wRjfOpl8HaNpj5lPQ9V1FWk4oOg2//24tyXIqTYwQ6oZP/fQvNLLznVwZ5Pt3BRAIvzm3f+PSHy5YuSBR1XZAdmYyeFvskTei02gvuCQqBw6bZ1r5SsnSYaV1uuM6jLilLkVPoTEFQvjNFE1BddEpGQW1gBh5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664891258; 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=z8Y2fM10bLp25kVTGAtiQ/1nDsx0/UGMOtzwBPN5ijE=; b=JIulTfk9vEvrQtgCKkGNb5f5ApeUWcqDMPEwkRA2iFgWKE1PutuL6OEut/q0C1bSFcVa3RiuSXKpNj+zHQbCaYyHgm6sRtryNplfw4fDMFdAH3PKNsMhqyaPw6k9XDEw41rcctPQr1GZz4g+vfxRbBbB7/B1jda0PY52JrLwWo4= 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+94701+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 1664891258916753.8411952559854; Tue, 4 Oct 2022 06:47:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id PD5aYY1788612xAtLzXpP4Wd; Tue, 04 Oct 2022 06:47:37 -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.web12.10831.1664891256726628098 for ; Tue, 04 Oct 2022 06:47:36 -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-606-flDFvIPJMw6AP8y2ihmamA-1; Tue, 04 Oct 2022 09:47:33 -0400 X-MC-Unique: flDFvIPJMw6AP8y2ihmamA-1 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A79E38027FE; Tue, 4 Oct 2022 13:47:32 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52ADD40EFB00; Tue, 4 Oct 2022 13:47:32 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 203C41801F26; Tue, 4 Oct 2022 15:47:28 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jordan Justen , Gerd Hoffmann , Pawel Polawski , Jiewen Yao , Oliver Steffen , Ard Biesheuvel , Laszlo Ersek Subject: [edk2-devel] [PATCH v2 4/4] OvmfPkg/PciHotPlugInitDxe: reserve more mmio space Date: Tue, 4 Oct 2022 15:47:28 +0200 Message-Id: <20221004134728.55499-5-kraxel@redhat.com> In-Reply-To: <20221004134728.55499-1-kraxel@redhat.com> References: <20221004134728.55499-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: OJlQ0d9oGQC1AvMokqbGnW3Mx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1664891257; bh=Ct9JPArTFYcjm7YetTweYXc6cezb3HjpSjtOEDF/hWU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=i4EQUwHanTFpdgC7llwhNAxD73EsHDaYzQQQDDvYnRITNnuOhtzMnvzsgTQ0XfCT8HT gZq4XQEzIQDEmyhIRopE3xAGIe8xV/oX2XRFQ1IZl94RPWnfFNRbTvIQofFkAiNiwUdpO n8w0p5+87Yd9zWoEvgQLOieEJgPGT6tRPZ4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1664891260901100004 Content-Type: text/plain; charset="utf-8"; x-default="true" In case the 64-bit pci mmio window is larger than the default size of 32G be generous and hand out larger chunks of address space for prefetchable mmio bridge windows. Cc: Laszlo Ersek Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf | 1 + OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c | 21 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf b/OvmfPkg/PciHotP= lugInitDxe/PciHotPlugInit.inf index 78b95faa7a7a..f56b1de6fd92 100644 --- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf +++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf @@ -40,6 +40,7 @@ [Protocols] =20 [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId ## CONSUMES + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size ## CONSUMES =20 [Depex] TRUE diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlu= gInitDxe/PciHotPlugInit.c index c122855b735d..3f9c84cf2b54 100644 --- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c +++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c @@ -556,6 +556,7 @@ GetResourcePadding ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *Address; BOOLEAN DefaultIo; BOOLEAN DefaultMmio; + BOOLEAN DefaultPrefMmio; RESOURCE_PADDING ReservationRequest; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *FirstResource; EFI_STATUS ReservationHintStatus; @@ -588,8 +589,9 @@ GetResourcePadding ( return EFI_INVALID_PARAMETER; } =20 - DefaultIo =3D TRUE; - DefaultMmio =3D TRUE; + DefaultIo =3D TRUE; + DefaultMmio =3D TRUE; + DefaultPrefMmio =3D TRUE; =20 // // Init ReservationRequest, and point FirstResource one past the last @@ -722,6 +724,7 @@ GetResourcePadding ( HighBit =3D HighBitSetRoundUp32 (ReservationHint.Prefetchable32BitMm= io); if (HighBit !=3D -1) { SetMmioPadding (--FirstResource, TRUE, TRUE, (UINTN)HighBit); + DefaultPrefMmio =3D FALSE; } } else if ((ReservationHint.Prefetchable64BitMmio > 0) && (ReservationHint.Prefetchable64BitMmio < MAX_UINT64)) @@ -729,6 +732,7 @@ GetResourcePadding ( HighBit =3D HighBitSetRoundUp64 (ReservationHint.Prefetchable64BitMm= io); if (HighBit !=3D -1) { SetMmioPadding (--FirstResource, TRUE, FALSE, (UINTN)HighBit); + DefaultPrefMmio =3D FALSE; } } } @@ -752,6 +756,19 @@ GetResourcePadding ( ); } =20 + if (DefaultPrefMmio) { + UINT64 Pci64Size =3D PcdGet64 (PcdPciMmio64Size); + + if (Pci64Size > SIZE_32GB) { + SetMmioPadding ( + --FirstResource, + TRUE, + FALSE, + (UINTN)HighBitSetRoundUp64 (RShiftU64 (Pci64Size, 8)) + ); + } + } + // // Output a copy of ReservationRequest from the lowest-address populated // entry until the end of the structure (including --=20 2.37.3 -=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 (#94701): https://edk2.groups.io/g/devel/message/94701 Mute This Topic: https://groups.io/mt/94113630/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-