From: "Laszlo Ersek" <lersek@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Pawel Polawski <ppolawsk@redhat.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Oliver Steffen <osteffen@redhat.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>
Subject: Re: [PATCH v2 4/4] OvmfPkg/PciHotPlugInitDxe: reserve more mmio space
Date: Tue, 4 Oct 2022 17:57:46 +0200 [thread overview]
Message-ID: <6e33ffa4-4f06-c993-6ceb-474805e28cac@redhat.com> (raw)
In-Reply-To: <20221004134728.55499-5-kraxel@redhat.com>
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
next prev parent reply other threads:[~2022-10-04 15:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 13:47 [PATCH v2 0/4] OvmfPkg: make better use of physical address space Gerd Hoffmann
2022-10-04 13:47 ` [PATCH v2 1/4] OvmfPkg/PlatformInitLib: qemu cpuid physbits detection Gerd Hoffmann
2022-10-04 13:47 ` [PATCH v2 2/4] OvmfPkg/PlatformInitLib: detect physical address space Gerd Hoffmann
2023-03-16 13:58 ` f.ebner
2023-03-16 14:37 ` Gerd Hoffmann
2023-03-17 11:34 ` [edk2-devel] " Fiona Ebner
2023-03-17 14:01 ` Gerd Hoffmann
2023-03-20 14:20 ` Fiona Ebner
2023-03-20 15:58 ` Gerd Hoffmann
2022-10-04 13:47 ` [PATCH v2 3/4] OvmfPkg/PlatformInitLib: dynamic mmio window size Gerd Hoffmann
2023-03-15 8:54 ` [edk2-devel] " joeyli
2023-03-15 9:28 ` Gerd Hoffmann
2023-05-16 14:00 ` Fiona Ebner
2023-05-17 5:59 ` [edk2-devel] " Gerd Hoffmann
2023-05-17 13:38 ` Fiona Ebner
2023-05-22 11:12 ` Gerd Hoffmann
2023-05-22 13:36 ` Fiona Ebner
2022-10-04 13:47 ` [PATCH v2 4/4] OvmfPkg/PciHotPlugInitDxe: reserve more mmio space Gerd Hoffmann
2022-10-04 15:57 ` Laszlo Ersek [this message]
2022-10-05 5:01 ` Gerd Hoffmann
2022-10-06 8:50 ` Laszlo Ersek
2022-10-07 21:49 ` [edk2-devel] [PATCH v2 0/4] OvmfPkg: make better use of physical address space Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e33ffa4-4f06-c993-6ceb-474805e28cac@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox