public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Tiger Liu(BJ-RD)" <TigerLiu@zhaoxin.com>
Cc: "'edk2-devel@lists.01.org'" <edk2-devel@lists.01.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	Julien Grall <julien.grall@linaro.org>,
	Marcel Apfelbaum <marcel@redhat.com>
Subject: Re: OVMF package : Question about Qemu/Xen support
Date: Tue, 3 Apr 2018 12:36:09 +0200	[thread overview]
Message-ID: <f636c2c0-1521-6395-9228-1b91dc1bf402@redhat.com> (raw)
In-Reply-To: <d3c0c6f22dcf4293a42a0aeb6b154208@zhaoxin.com>

Hi,

(CC Marcel)

On 04/02/18 08:55, Tiger Liu(BJ-RD) wrote:
> Hi, Laszlo:
> I have a question you would like to ask you.
> Could I study pcie native hot plug feature with ovmf?
> 
> It seems qemu emulates Q35 chipset.
> And ovmf provides PciHotPlugInitDxe driver.

Sure. Here's some tips I can give you:

* The first PCI Express -- not traditional PCI -- hotplug feature
request for OVMF arrived in
<https://github.com/tianocore/edk2/issues/32>. That link is dead now,
because we abandoned the GitHub issue tracker. Instead, the report was
migrated to <https://bugzilla.tianocore.org/show_bug.cgi?id=75>.

This issue got solved by adding MMCONFIG (ECAM) config space access to
OVMF. Without MMCONFIG, PCIe hotplug in the guest OS would not work.
Please see Marcel's analysis in the TianoCore BZ linked above. The edk2
commit range is noted in comment 32.

* Once config space access works like that, you need the PCIe
enumeration / resource assignment (which occurs in the firmware) to
account for PCI resources *in advance* that hotplugged endpoints *might*
require. This means reserving various kinds of apertures. On the QEMU
side, this is documented in the following two text files (in the QEMU tree):

- docs/pcie.txt
- docs/pcie_pci_bridge.txt

In particular there is a "resource reservation hint" PCIe capability
(for PCIe root ports) that QEMU can populate and OVMF can parse. Then
OVMF informs PciBusDxe to reserve the appropriate resources.

* PCI_HOT_PLUG_INIT_PROTOCOL (implemented in OVMF by
OvmfPkg/PciHotPlugInitDxe) is defined by the PI spec. Roughly, it has
two purposes: it can (a) report+initialize non-enumerable [*] hotplug
controllers (of which QEMU has none) to PciBusDxe, (b) it can convey
reservation hints ("resource paddings") to PciBusDxe. OVMF stubs out the
two interfaces related to purpose (a), and implements the
GetResourcePadding() member function (purpose (b)) by translating QEMU's
PCIe capability to the format expected by the PI spec and PciBusDxe.

[*] The PI spec calls this kind of hotplug controller "root" HPC, but
that has nothing to do with "root" in the PCIe sense. In this
terminology, "root HPC" simply means "non-enumerable", and "non-root
HPC" means "enumerable" through the normal PCI(e) traversal.


Hope this helps,
Laszlo


  reply	other threads:[~2018-04-03 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02  6:55 OVMF package : Question about Qemu/Xen support Tiger Liu(BJ-RD)
2018-04-03 10:36 ` Laszlo Ersek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-04-04  0:38 Tiger Liu(BJ-RD)
2018-03-05  5:49 Tiger Liu(BJ-RD)
2018-03-05  9:15 ` 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=f636c2c0-1521-6395-9228-1b91dc1bf402@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