public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, lersek@redhat.com
Cc: Alex Williamson <alex.williamson@redhat.com>,
	Hao A Wu <hao.a.wu@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>, Ray Ni <ray.ni@intel.com>,
	Star Zeng <star.zeng@intel.com>
Subject: Re: [edk2-devel] [PATCH for-next] MdeModulePkg/PciBusDxe: catch unimplemented extended config space reads
Date: Wed, 5 Jun 2019 11:12:39 +0200	[thread overview]
Message-ID: <47a436df-6d81-8927-511f-11ddf95af91d@redhat.com> (raw)
In-Reply-To: <20190604214424.456-1-lersek@redhat.com>

On 6/4/19 11:44 PM, Laszlo Ersek wrote:
> When assigning a physical PCIe device to a QEMU/KVM guest, PciBusDxe may
> find that the extended config space is not (fully) implemented. In
> LocatePciExpressCapabilityRegBlock(), "CapabilityEntry" may be read as
> 0xFFFF_FFFF at a given config space offset, after which the loop gets
> stuck spinning on offset 0xFFC (the read at offset 0xFFC returns
> 0xFFFF_FFFF most likely as well).
> 
> Another scenario (not related to virtualization) for triggering the above
> is when a Conventional PCI bus -- exposed by a PCIe-to-PCI bridge in the
> topology -- intervenes between a PCI Express Root Port and a PCI Express
> Endpoint. The Conventional PCI bus limits the accessible config space of
> the PCI Express Endpoint, even though the endpoint advertizes the PCI
> Express capability. Here's a diagram, courtesy of Alex Williamson:
> 
>   [PCIe Root Port]--[PCIe-to-PCI]--[PCI-to-PCIe]--[PCIe EP]
>                               ->|  |<- Conventional PCI bus
> 
> Catch reads of 0xFFFF_FFFF in LocatePciExpressCapabilityRegBlock(), and
> break out of the scan with a warning message. The function will return
> EFI_NOT_FOUND.
> 
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     Repo:   https://github.com/lersek/edk2.git
>     Branch: pcibus_no_ext_conf
> 
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
> index 214aeecdd40a..6283d602207c 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c
> @@ -236,6 +236,19 @@ LocatePciExpressCapabilityRegBlock (
>        break;
>      }
>  
> +    if (CapabilityEntry == MAX_UINT32) {
> +      DEBUG ((
> +        DEBUG_WARN,
> +        "%a: [%02x|%02x|%02x] failed to access config space at offset 0x%x\n",
> +        __FUNCTION__,
> +        PciIoDevice->BusNumber,
> +        PciIoDevice->DeviceNumber,
> +        PciIoDevice->FunctionNumber,
> +        CapabilityPtr
> +        ));
> +      break;
> +    }
> +
>      CapabilityID = (UINT16) CapabilityEntry;
>  
>      if (CapabilityID == CapId) {
> 

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

  reply	other threads:[~2019-06-05  9:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 21:44 [PATCH for-next] MdeModulePkg/PciBusDxe: catch unimplemented extended config space reads Laszlo Ersek
2019-06-05  9:12 ` Philippe Mathieu-Daudé [this message]
2019-06-05  9:25 ` [edk2-devel] " Ard Biesheuvel
2019-06-05 10:15   ` Laszlo Ersek
2019-06-05 13:12     ` Ard Biesheuvel
2019-06-10  7:03     ` Wu, Hao A
2019-06-11  8:55       ` Ni, Ray
2019-06-11 16:56 ` Laszlo Ersek

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=47a436df-6d81-8927-511f-11ddf95af91d@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