[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.1.3 53/58] pci: ensure valid link status bits for downstream p
From: |
Michael Tokarev |
Subject: |
[Stable-9.1.3 53/58] pci: ensure valid link status bits for downstream ports |
Date: |
Mon, 27 Jan 2025 23:25:39 +0300 |
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>
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 4b2f0805c6..9cb137c30f 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -1080,18 +1080,22 @@ void pcie_sync_bridge_lnk(PCIDevice *bridge_dev)
if ((lnksta & PCI_EXP_LNKSTA_NLW) > (lnkcap & PCI_EXP_LNKCAP_MLW)) {
lnksta &= ~PCI_EXP_LNKSTA_NLW;
lnksta |= lnkcap & PCI_EXP_LNKCAP_MLW;
- } else if (!(lnksta & PCI_EXP_LNKSTA_NLW)) {
- lnksta |= QEMU_PCI_EXP_LNKSTA_NLW(QEMU_PCI_EXP_LNK_X1);
}
if ((lnksta & PCI_EXP_LNKSTA_CLS) > (lnkcap & PCI_EXP_LNKCAP_SLS)) {
lnksta &= ~PCI_EXP_LNKSTA_CLS;
lnksta |= lnkcap & PCI_EXP_LNKCAP_SLS;
- } else if (!(lnksta & PCI_EXP_LNKSTA_CLS)) {
- lnksta |= QEMU_PCI_EXP_LNKSTA_CLS(QEMU_PCI_EXP_LNK_2_5GT);
}
}
+ if (!(lnksta & PCI_EXP_LNKSTA_NLW)) {
+ lnksta |= QEMU_PCI_EXP_LNKSTA_NLW(QEMU_PCI_EXP_LNK_X1);
+ }
+
+ if (!(lnksta & PCI_EXP_LNKSTA_CLS)) {
+ lnksta |= QEMU_PCI_EXP_LNKSTA_CLS(QEMU_PCI_EXP_LNK_2_5GT);
+ }
+
pci_word_test_and_clear_mask(exp_cap + PCI_EXP_LNKSTA,
PCI_EXP_LNKSTA_CLS | PCI_EXP_LNKSTA_NLW);
pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA, lnksta &
--
2.39.5
- [Stable-9.1.3 36/58] s390x/s390-virtio-ccw: don't crash on weird RAM sizes, (continued)
- [Stable-9.1.3 36/58] s390x/s390-virtio-ccw: don't crash on weird RAM sizes, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 42/58] migration: Remove unused argument in vmsd_desc_field_end, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 44/58] s390x: Fix CSS migration, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 45/58] migration: Rename vmstate_info_nullptr, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 46/58] migration: Dump correct JSON format for nullptr replacement, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 47/58] migration: Fix arrays of pointers in JSON writer, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 49/58] multifd: bugfix for incorrect migration data with QPL compression, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 50/58] tests/qtest/boot-serial-test: Correct HPPA machine name, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 38/58] target/loongarch: Use actual operand size with vbsrl check, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 48/58] multifd: bugfix for migration using compression methods, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 53/58] pci: ensure valid link status bits for downstream ports,
Michael Tokarev <=
- [Stable-9.1.3 51/58] backends/cryptodev-vhost-user: Fix local_error leaks, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 52/58] hw/usb/hcd-xhci-pci: Use modulo to select MSI vector as per spec, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 54/58] pci/msix: Fix msix pba read vector poll end calculation, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 55/58] tests: acpi: whitelist expected blobs, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 57/58] tests: acpi: update expected blobs, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 56/58] pci: acpi: Windows 'PCI Label Id' bug workaround, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 58/58] hw/cxl: Fix msix_notify: Assertion `vector < dev->msix_entries_nr`, Michael Tokarev, 2025/01/28