]> git.ipfire.org Git - thirdparty/qemu.git/commit
pci: ensure valid link status bits for downstream ports
authorSebastian Ott <sebott@redhat.com>
Tue, 3 Dec 2024 12:19:28 +0000 (13:19 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 17 Jan 2025 06:22:13 +0000 (09:22 +0300)
commit3a336fce8caded2e9f00162e8d66b8a22e4c73c8
treefc8777b3974dd1fbb1ec060cf49e2d61f2d6caf5
parent50afc8d32d5503655dc3a9e7b26642f7f97043e5
pci: ensure valid link status bits for downstream ports

PCI hotplug for downstream endpoints on arm fails because Linux'
PCIe hotplug driver doesn't like the QEMU provided LNKSTA:

  pcieport 0000:08:01.0: pciehp: Slot(2): Card present
  pcieport 0000:08:01.0: pciehp: Slot(2): Link Up
  pcieport 0000:08:01.0: pciehp: Slot(2): Cannot train link: status 0x2000

There's 2 cases where LNKSTA isn't setup properly:
* the downstream device has no express capability
* max link width of the bridge is 0

Move the sanity checks added via 88c869198aa63
("pci: Sanity test minimum downstream LNKSTA") outside of the
branch to make sure downstream ports always have a valid LNKSTA.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
Message-Id: <20241203121928.14861-1-sebott@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 694632fd44987cc4618612a38ad151047524a590)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/pci/pcie.c