Skip to content

hw/pcie: better hotplug/hotunplug support

Marcel Apfelbaum qemu-devel 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 0 repliesNew
  2. v23 patches 2 repliesSuperseded
  3. v13 patches 12 repliesSuperseded

Changes in v3 from the cover letter

- Rebased the series on PCI branch

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3hw/pcie: corrected a debug messagehw/pci/pcie.c+1 -10 replies
2/3hw/pcie: implement power controller functionalityhw/pci-bridge/ioh3420.c hw/pci-bridge/xio3130_downstream.c hw/pci/pcie.c +4 more+62 -20 replies
3/3hw/pcie: better hotplug/hotunplug supporthw/pci/pcie.c+24 -50 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/3] hw/pcie: better hotplug/hotunplug support

v2 -> v3:
- Rebased the series on PCI branch

v1 -> v2:
- Addressed Michael S. Tsirkin's comments:
- patch 2/3:
- Added "power controller present" to compat_props.
- patch 3/3:
- Unplug all bus functions on hot-unplug, not only function 0.
- Minor code refactoring

The current code is broken: it does surprise removal which crashes guests.

Reimplemented the steps:
- Hotplug triggers both 'present detect change' and 'attention button pressed'.

- Hotunplug starts by triggering 'attention button pressed', then waits for the OS to power off the device and only then detaches it.

Fixes CVE-2014-3471.

patch 1/3: trivial debug message fix
patch 2/3: enable 'power controller' to receive power events from guests patch 3/3: the actual hotplug/hotunplug implementation.

Tested with Linux and Windows guests and with an e1000 with "PCIe" capability. Notes:
Windows requires devices to be pci express in order to enable hotplug functionality, so we need to think about converting virtio devices to pci express.
Linux outputs a "Surprise Removal/Addition" info message because we trigger 2 events in the same time, however this warning can be disregarded or a kernel patch submitted for our scenario.

Marcel Apfelbaum (3):
hw/pcie: corrected a debug message hw/pcie: implement power controller functionality hw/pcie: better hotplug/hotunplug support

 hw/pci-bridge/ioh3420.c            |  7 +++++
 hw/pci-bridge/xio3130_downstream.c |  7 +++++
 hw/pci/pcie.c                      | 64 +++++++++++++++++++++++++++++++++-----
 include/hw/i386/pc.h               | 10 +++++-
 include/hw/pci/pci.h               |  3 ++
 include/hw/pci/pcie.h              |  2 ++
 include/hw/pci/pcie_regs.h         |  2 ++
 7 files changed, 87 insertions(+), 8 deletions(-)
Signature · 1 line
1.8.3.1