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 <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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
--
2.37.3
-=-=-=-=-=-=-=-=-=-=-=-
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]
-=-=-=-=-=-=-=-=-=-=-=-
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 <lersek@redhat.com> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > 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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94714): https://edk2.groups.io/g/devel/message/94714 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] -=-=-=-=-=-=-=-=-=-=-=-
On Tue, Oct 04, 2022 at 05:57:46PM +0200, Laszlo Ersek wrote: > 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. > > + SetMmioPadding ( > > + --FirstResource, > > + TRUE, > > + FALSE, > > + (UINTN)HighBitSetRoundUp64 (RShiftU64 (Pci64Size, 8)) > > + ); > Looks good to me, thanks; I'm just missing the rationale on the > RShiftU64() call. Please elaborate. Cover letter explains this a bit. The idea is to scale things up with the available address space. Patch #3 does that for the 64-bit pci mmio window. This patch does the same for the bridge windows, leveraging the patch #3 calculations by looking at PcdPciMmio64Size. The shift by 8 assigns 1/256 of the total mmio window size to each bridge. The '8' is just pulled out of thin air. Looks reasonable to me, in case it turns out it is not we can adjust that in the future. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94743): https://edk2.groups.io/g/devel/message/94743 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] -=-=-=-=-=-=-=-=-=-=-=-
On 10/05/22 07:01, Gerd Hoffmann wrote: > On Tue, Oct 04, 2022 at 05:57:46PM +0200, Laszlo Ersek wrote: >> 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. > >>> + SetMmioPadding ( >>> + --FirstResource, >>> + TRUE, >>> + FALSE, >>> + (UINTN)HighBitSetRoundUp64 (RShiftU64 (Pci64Size, 8)) >>> + ); > >> Looks good to me, thanks; I'm just missing the rationale on the >> RShiftU64() call. Please elaborate. > > Cover letter explains this a bit. The idea is to scale things up with > the available address space. Patch #3 does that for the 64-bit pci mmio > window. This patch does the same for the bridge windows, leveraging the > patch #3 calculations by looking at PcdPciMmio64Size. The shift by 8 > assigns 1/256 of the total mmio window size to each bridge. > > The '8' is just pulled out of thin air. Looks reasonable to me, in case > it turns out it is not we can adjust that in the future. OK, starting with a 64GB aperture size, 256MB will be reserved per port / bridge. For this patch: Reviewed-by: Laszlo Ersek <lersek@redhat.com> Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94784): https://edk2.groups.io/g/devel/message/94784 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] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.