public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, benjamin.you@intel.com, "Dong,
	Guo" <guo.dong@intel.com>,
	"mjg59@srcf.ucam.org" <mjg59@srcf.ucam.org>
Cc: "patrick.rudolph@9elements.com" <patrick.rudolph@9elements.com>
Subject: Re: [edk2-devel] UefiPayloadPkg and over-eager PCI resource allocation?
Date: Thu, 7 Jan 2021 14:14:06 +0100	[thread overview]
Message-ID: <26ee2dc5-e3fa-8726-eb62-2eb966cc996f@redhat.com> (raw)
In-Reply-To: <BN8PR11MB3748CC9138FB10BDB260D9E38AAF0@BN8PR11MB3748.namprd11.prod.outlook.com>

On 01/07/21 05:09, Benjamin You wrote:
> Hi,
> 
> The PCI_ROOT_BRIDGE data structure defined in MdeModulePkg\Include\Library\
> PciHostBridgeLib.h does not support reporting non-continuous resources managed
> by a root bridge. This is probably proper since it reflects the range of 
> addresses the root bridge forwards downstream.
> 
> Could the PCI Host Bridge driver be configured to relax the checking against
> conflicting resources and exclude those overlapping ranges from the root
> bridge resources reported to GCD? If this relaxation is turned on, other BIOS
> components should ensure address map consistency.

I don't think this will work well. Each (contiguous) aperture type,
captured in the PCI_ROOT_BRIDGE structure, is not only used for
sanitizing the GCD IO space map or memory space map (as appropriate).

Namely, at least the MMIO apertures are also used in
RootBridgeIoCheckParameter(), for verifying the

  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.Mem.{Read,Write}

member function calls that arrive from (minimally) the PciBusDxe driver.

If the MMCONFIG area overlaps such an aperture of the PCI_ROOT_BRIDGE
structure, then RootBridgeIoCheckParameter() will not catch
EFI_PCI_IO_PROTOCOL.Mem{Read,Write} calls that ultimately translate to
that PCI_ROOT_BRIDGE structure *but* mistakenly land in MMCONFIG.

I tend to agree with Guo's idea -- more or less, make coreboot export a
list of

  [bus range] -> [contiguous mmio range]

entries. Then "UefiPayloadPkg/Library/PciHostBridgeLib" can turn each
such entry into a PCI_ROOT_BRIDGE structure. It's not a problem if a
single physical root bridge is described by multiple PCI_ROOT_BRIDGE
objects, as long as for any two PCI_ROOT_BRIDGE objects, their Bus
apertures are distinct. (Other aperture types need not be distinct
between PCI_ROOT_BRIDGE objects.)

Now, if coreboot assigns resources such that even a *single bus number*
may have resources straddling the MMCONFIG area, then that's a
fundamental incompatibility between coreboot and edk2. I hope this is
not the case; Matt's log contains "Bus: 0 - 3", so I hope that, given
any single bus (= one-element bus range), the set of related MMIO
resources does not bracket the MMCONFIG area.

Thanks
Laszlo


  reply	other threads:[~2021-01-07 13:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27 20:40 UefiPayloadPkg and over-eager PCI resource allocation? mjg59
2021-01-04  3:17 ` [edk2-devel] " Guo Dong
2021-01-04  6:34   ` Benjamin You
2021-01-06 13:56     ` Patrick Rudolph
2021-01-06 22:20       ` Guo Dong
2021-01-06 22:34         ` Matthew Garrett
2021-01-06 23:04           ` Guo Dong
2021-01-07  4:09             ` Benjamin You
2021-01-07 13:14               ` Laszlo Ersek [this message]
2021-01-07 22:04                 ` Matthew Garrett
2021-01-07 22:28                   ` Laszlo Ersek
2021-01-07 22:39                     ` Matthew Garrett
2021-01-08  2:18                       ` Guo Dong

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=26ee2dc5-e3fa-8726-eb62-2eb966cc996f@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