public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: Nicolas Ojeda Leon <ncoleon@amazon.com>
Cc: devel@edk2.groups.io, atugup@amazon.com, Alexander Graf <graf@amazon.de>
Subject: Re: [PATCH v2 4/8] Ovmf/PlatformPei: Extend 64-bit MMIO range to fit resources
Date: Fri, 21 Jan 2022 10:57:24 +0100	[thread overview]
Message-ID: <20220121095724.z5byxffsqdiapz3l@sirius.home.kraxel.org> (raw)
In-Reply-To: <c178b26e0dcfefcdd811bf2bd027b36aa8d21505.1642697671.git.ncoleon@amazon.com>

  hi,

> As an example, if the PcdPciMmio64Size is initialized to 0x800000000
> and the runtime calculated base address produces the value 0x800000000,
> the last 64-bit MMIO address a PCI host bridge may use would be
> 0xFFFFFFFFF. If one of the host-specified bridges defines a high
> memory window 0x1000000000 - 0x17FFFFFFFF (inclusive) it would be
> outside of the valid range defined by the Base address + PcdPciMmio64Size.
> Therefore, parsing the HardwwareInfo resource allows to notice the higher
> requirement and increase the size to 0x1000000000 so that the MMIO
> address space solicited by the host can be met and the range effectively
> extended to 0x17FFFFFFFF.

I think you can completely ignore PcdPciMmio64Size + PcdPciMmio64Base,
you only must make sure mPhysMemAddressWidth is big enough ...

Background story:

On qemu there is no reliable way to figure what the size of the physical
address space is.  The reason for that a rather long story involving
historical reasons, backward compatibility, live migration compatibility
and probably more stuff which I forgot meanwhile.  Those details don't
matter here, the key takeaway is that ovmf tries to minimize it's
physical address space needs because it just doesn't know how much it
can actually use.

PcdPciMmio64Size default is 32G, so a typical virtual machine fits into
64G address space (aka mPhysMemAddressWidth == 36), which is guaranteed
to work on x64.  This is also part of the plan ;)

With the qemu q35 machine types the firmware initializes the host
bridge, i.e. ovmf programs the host bridge to place the windows and the
mmconfig xbar according to the PcdPciMmio64Base + PcdPciMmio64Size
values ovmf figured during memory detection.

The whole logic is pretty much moot though if the location and size of
the mmio windows is dictated by the host and the guest can't change them
anyway ...

take care,
  Gerd


  reply	other threads:[~2022-01-21  9:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 17:10 [PATCH v2 0/8] Handling of multiple PCI host bridges specified Ojeda Leon, Nicolas
2022-01-20 17:10 ` [PATCH v2 1/8] OvmfPkg/Library: Create base HardwareInfoLib for PCI Host Bridges Ojeda Leon, Nicolas
2022-01-21 10:09   ` Gerd Hoffmann
2022-01-20 17:10 ` [PATCH v2 2/8] Ovmf/HardwareInfoLib: Parse data directly from fw-cfg Ojeda Leon, Nicolas
2022-01-20 17:10 ` [PATCH v2 3/8] Ovmf/HardwareInfoLib: Add core to parse heterogenous data Ojeda Leon, Nicolas
2022-01-21 10:09   ` Gerd Hoffmann
2022-01-21 10:48     ` [edk2-devel] " Ojeda Leon, Nicolas
2022-01-21 11:03       ` Gerd Hoffmann
2022-01-21 11:10         ` Ojeda Leon, Nicolas
2022-01-20 17:10 ` [PATCH v2 4/8] Ovmf/PlatformPei: Extend 64-bit MMIO range to fit resources Ojeda Leon, Nicolas
2022-01-21  9:57   ` Gerd Hoffmann [this message]
2022-01-20 17:10 ` [PATCH v2 5/8] OvmfPkg/PciHostBridgeUtilityLib: Initialize RootBridges apertures with spec Ojeda Leon, Nicolas
2022-01-20 17:10 ` [PATCH v2 6/8] MdeModulePkg, OvmfPkg: Add Pcd token for PCI pre-populated BARs Ojeda Leon, Nicolas
2022-01-20 17:10 ` [PATCH v2 7/8] MdeModulePkg/Pci MdePkg: Create service to retrieve PCI base addresses Ojeda Leon, Nicolas
2022-01-20 17:10 ` [PATCH v2 8/8] MdeModulePkg/PciBusDxe: Handling of pre-populated PCI BARs Ojeda Leon, Nicolas

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=20220121095724.z5byxffsqdiapz3l@sirius.home.kraxel.org \
    --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