This series makes the following test case succeed:

- Set the CODE env variable to the OVMF_CODE.fd file in the build
  output.

- Set the TMPL env variable to the OVMF_VARS.fd file in the build
  output.

- Set the ISO env variable to the pathname of a Linux LiveCD.

- Create a copy of the varstore template:

  cp $TMPL vars.fd

- Create an empty disk image:

  qemu-img create -f qcow2 test.qcow2 1G

- Start QEMU as follows.

  qemu-system-x86_64 \
    -m 2048 \
    \
    -machine q35,accel=kvm \
    -device VGA \
    \
    -drive if=pflash,format=raw,file=$CODE,readonly \
    -drive if=pflash,format=raw,file=vars.fd \
    \
    -drive id=cdrom,if=none,readonly,format=raw,file=$ISO \
    -drive id=disk,if=none,format=qcow2,file=test.qcow2 \
    \
    -chardev file,id=debugfile,path=test.log \
    -device isa-debugcon,iobase=0x402,chardev=debugfile \
    \
    -chardev stdio,id=char0,signal=off,mux=on \
    -mon chardev=char0,mode=readline,default \
    -serial chardev:char0 \
    \
    -device ioh3420,id=root_port,bus=pcie.0 \
    \
    -device x3130-upstream,id=upstream_port,bus=root_port \
    \
    -device xio3130-downstream,id=downstream_port1,bus=upstream_port,chassis=1 \
    -device virtio-scsi-pci,id=scsi0,bus=downstream_port1 \
    -device scsi-cd,bus=scsi0.0,drive=cdrom,bootindex=0 \
    \
    -device xio3130-downstream,id=downstream_port2,bus=upstream_port,chassis=2

  This command line creates a PCIe root port, and cold-plugs a PCIe
  switch into it. The PCIe switch has one upstream port and two
  downstream ports. Into one of those downstream ports, a virtio-scsi
  controller is cold-plugged, and the LiveCD is made available to the
  guest as a SCSI CD-ROM on that virtio-scsi controller. The other
  downstream port of the PCIe switch is left empty.

- After booting the LiveCD, enter [Ctrl-A C] to switch the terminal I/O
  from the guest's serial port to the QEMU monitor, then hotplug a
  virtio-block device with the following command into the second
  downstream port:

  device_add virtio-blk-pci,drive=disk,bus=downstream_port2

- Without the patches, the guest kernel will spew PCI resource
  allocation errors to the syslog, and it might even hang eventually.
  With the patches, the hotplugged disk can be used (/dev/vda).

Public branch: <https://github.com/lersek/edk2/commits/bridge_rsrc_pad>.

Cc: "Johnson, Brian J." <bjohn...@sgi.com>
Cc: Alex Williamson <alex.william...@redhat.com>
Cc: Andrew Fish <af...@apple.com>
Cc: Feng Tian <feng.t...@intel.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Cc: Marcel Apfelbaum <mar...@redhat.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Star Zeng <star.z...@intel.com>

Thanks
Laszlo

Laszlo Ersek (4):
  MdePkg/IndustryStandard: introduce EFI_PCI_CAPABILITY_ID_SHPC
  MdeModulePkg/PciBusDxe: look for the right capability in IsSHPC()
  MdeModulePkg/PciBusDxe: recognize hotplug-capable PCIe ports
  OvmfPkg: add PciHotPlugInitDxe

 MdeModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c |  73 +++-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h |  19 ++
 MdePkg/Include/IndustryStandard/Pci22.h            |   1 +
 OvmfPkg/OvmfPkgIa32.dsc                            |   1 +
 OvmfPkg/OvmfPkgIa32.fdf                            |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                         |   1 +
 OvmfPkg/OvmfPkgIa32X64.fdf                         |   1 +
 OvmfPkg/OvmfPkgX64.dsc                             |   1 +
 OvmfPkg/OvmfPkgX64.fdf                             |   1 +
 OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c         | 352 ++++++++++++++++++++
 OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf       |  46 +++
 11 files changed, 496 insertions(+), 1 deletion(-)
 create mode 100644 OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
 create mode 100644 OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c

-- 
1.8.3.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to