summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/PciHotPlugInitDxe
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2022-10-04 15:47:28 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-10-07 18:14:05 +0000
commit9e6b552b4c48bed39e9b8a2936d390fb5b95e07d (patch)
tree3b1288514c3d8f6637cdd19c5cadfe786d78ed7c /OvmfPkg/PciHotPlugInitDxe
parentecb778d0ac62560aa172786ba19521f27bc3f650 (diff)
downloadedk2-9e6b552b4c48bed39e9b8a2936d390fb5b95e07d.tar.gz
edk2-9e6b552b4c48bed39e9b8a2936d390fb5b95e07d.tar.bz2
edk2-9e6b552b4c48bed39e9b8a2936d390fb5b95e07d.zip
OvmfPkg/PciHotPlugInitDxe: reserve more mmio space
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. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/PciHotPlugInitDxe')
-rw-r--r--OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c21
-rw-r--r--OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf1
2 files changed, 20 insertions, 2 deletions
diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
index c122855b73..3f9c84cf2b 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
diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
index 78b95faa7a..f56b1de6fd 100644
--- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
+++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
@@ -40,6 +40,7 @@
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId ## CONSUMES
+ gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size ## CONSUMES
[Depex]
TRUE