From mboxrd@z Thu Jan 1 00:00:00 1970 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.web08.12439.1664899076787770776 for ; Tue, 04 Oct 2022 08:57:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=csqXB/TP; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664899075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VrLyPjJ0r0w4+J2x5sG+hBItpXAtCpexorz414eeNNE=; b=csqXB/TPhC7WhXJwfMiueVPUWg4h2chH82u4IJS6wVxyhYDmAZSMshUKK/TU+ddUw9UoNr mVxsnR352+KYnglZMB6E7gshJ9LNutluWZP6Ykw2QxCAGnkz231qVo+F7cmHfQJMG3UN5T oREyAII+ynloloxkITR/Ishgt8sX0JM= 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-231-ggIA19XHM86C7dFjRvWVWQ-1; Tue, 04 Oct 2022 11:57:52 -0400 X-MC-Unique: ggIA19XHM86C7dFjRvWVWQ-1 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 1CE3A3C01E07; Tue, 4 Oct 2022 15:57:52 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.39.193.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFC63492B04; Tue, 4 Oct 2022 15:57:47 +0000 (UTC) Subject: Re: [PATCH v2 4/4] OvmfPkg/PciHotPlugInitDxe: reserve more mmio space To: Gerd Hoffmann , devel@edk2.groups.io Cc: Jordan Justen , Pawel Polawski , Jiewen Yao , Oliver Steffen , Ard Biesheuvel References: <20221004134728.55499-1-kraxel@redhat.com> <20221004134728.55499-5-kraxel@redhat.com> From: "Laszlo Ersek" Message-ID: <6e33ffa4-4f06-c993-6ceb-474805e28cac@redhat.com> Date: Tue, 4 Oct 2022 17:57:46 +0200 MIME-Version: 1.0 In-Reply-To: <20221004134728.55499-5-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/04/22 15:47, Gerd Hoffmann wrote: > 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 > --- > 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/PciHotPlugInitDxe/PciHotPlugInit.inf > index 78b95faa7a7a..f56b1de6fd92 100644 > --- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf > +++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf > @@ -40,6 +40,7 @@ [Protocols] > > [Pcd] > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId ## CONSUMES > + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size ## CONSUMES > > [Depex] > TRUE > diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/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; > } > > - DefaultIo = TRUE; > - DefaultMmio = TRUE; > + DefaultIo = TRUE; > + DefaultMmio = TRUE; > + DefaultPrefMmio = TRUE; > > // > // Init ReservationRequest, and point FirstResource one past the last > @@ -722,6 +724,7 @@ GetResourcePadding ( > HighBit = HighBitSetRoundUp32 (ReservationHint.Prefetchable32BitMmio); > if (HighBit != -1) { > SetMmioPadding (--FirstResource, TRUE, TRUE, (UINTN)HighBit); > + DefaultPrefMmio = FALSE; > } > } else if ((ReservationHint.Prefetchable64BitMmio > 0) && > (ReservationHint.Prefetchable64BitMmio < MAX_UINT64)) > @@ -729,6 +732,7 @@ GetResourcePadding ( > HighBit = HighBitSetRoundUp64 (ReservationHint.Prefetchable64BitMmio); > if (HighBit != -1) { > SetMmioPadding (--FirstResource, TRUE, FALSE, (UINTN)HighBit); > + DefaultPrefMmio = FALSE; > } > } > } > @@ -752,6 +756,19 @@ GetResourcePadding ( > ); > } > > + if (DefaultPrefMmio) { > + UINT64 Pci64Size = 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 > Looks good to me, thanks; I'm just missing the rationale on the RShiftU64() call. Please elaborate. Laszlo