Skip to content

RFC: standard pci bridge device

Michael S. Tsirkin kvm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2shpc: standard hot plug controllerMakefile.objs hw/pci.h hw/shpc.c +2 more+694 -05 replies
2/2pci: add standard bridge deviceMakefile.objs hw/pci_bridge_dev.c+137 -16 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCHv2-RFC 0/2] RFC: standard pci bridge device

Here's a new version of the patch. It works for me. Deep nesting of bridges is supported.
You need a small BIOS patch to support the OSHP method if you want hotplug to work. I will post this separately. We'd need a full ACPI driver to make hotplug work for guests without an SHPC driver (e.g. windows XP). Management support will also be needed.

One small wrinkle is that the pci_addr property wants data in a format bus:device.function which is broken as guests can change bus numbers.
For testing I used the 'addr' property which encodes slot*8+function#. We probably want to extend pci_addr in some way (e.g. :device.function ? Thoughts?).

The SHPC controller supports up to 31 devices (out of 32 slots) so slot 0 doesn't support hotplug. Non hot-pluggable devices behind the bridge don't work currectly (we'll try to unplug them) so don't do this.
For now I just blocked adding devices in slot 0, in the future it might be possible to add
a non-hotpluggable device there.

Example:

qemu-system-x86_64 -enable-kvm -m 1G
-drive file=/home/mst/rhel6.qcow2
-netdev tap,id=foo,ifname=msttap0,script=/home/mst/ifup,downscript=no,vhost=on -device pci-bridge,id=bog
-device virtio-net-pci,netdev=foo,bus=bog,addr=8

Hot-unplug currently causes qemu to crash, this happens without this patch too, so I'm not worried :)

New since v1:
hotplug support

Signature · 20 lines
MST


Michael S. Tsirkin (2):
  shpc: standard hot plug controller
  pci: add standard bridge device

 Makefile.objs       |    3 +-
 hw/pci.h            |    6 +
 hw/pci_bridge_dev.c |  136 +++++++++++
 hw/shpc.c           |  646 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/shpc.h           |   40 ++++
 qemu-common.h       |    1 +
 6 files changed, 831 insertions(+), 1 deletions(-)
 create mode 100644 hw/pci_bridge_dev.c
 create mode 100644 hw/shpc.c
 create mode 100644 hw/shpc.h

-- 
1.7.9.111.gf3fb0