* Tue Jan 21 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-11

- kvm-pci-ensure-valid-link-status-bits-for-downstream-por.patch [RHEL-65616]
- Resolves: RHEL-65616
  (Failed to hot add PCIe device behind xio3130 downstream port)
This commit is contained in:
Jon Maloy 2025-01-21 21:27:48 -05:00
parent e81c6c5fa7
commit 7a1f7d789e
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,76 @@
From 8a9811c6442d2d836d7483e3b4af969df43b1781 Mon Sep 17 00:00:00 2001
From: Sebastian Ott <sebott@redhat.com>
Date: Tue, 3 Dec 2024 13:19:28 +0100
Subject: [PATCH] pci: ensure valid link status bits for downstream ports
RH-Author: Sebastian Ott <sebott@redhat.com>
RH-MergeRequest: 329: pci: ensure valid link status bits for downstream ports
RH-Jira: RHEL-65616
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
RH-Acked-by: Gavin Shan <gshan@redhat.com>
RH-Acked-by: Shaoqin Huang <shahuang@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
RH-Commit: [1/1] 93a557766cbc12314e83cdf2c89b6ca9275f0c45 (seott1/cos-qemu-kvm)
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)
JIRA: https://issues.redhat.com/browse/RHEL-65616
Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
hw/pci/pcie.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
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.48.0

View File

@ -149,7 +149,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \
Summary: QEMU is a machine emulator and virtualizer
Name: qemu-kvm
Version: 9.1.0
Release: 10%{?rcrel}%{?dist}%{?cc_suffix}
Release: 11%{?rcrel}%{?dist}%{?cc_suffix}
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
# Epoch 15 used for RHEL 8
# Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5)
@ -350,6 +350,8 @@ Patch104: kvm-hw-virtio-fix-crash-in-processing-balloon-stats.patch
Patch105: kvm-qemu-ga-Optimize-freeze-hook-script-logic-of-logging.patch
# For RHEL-56340 - qemu-ga logs only "guest-fsfreeze called" (but not "guest-fsthaw called")
Patch106: kvm-qga-Add-log-to-guest-fsfreeze-thaw-command.patch
# For RHEL-65616 - Failed to hot add PCIe device behind xio3130 downstream port
Patch107: kvm-pci-ensure-valid-link-status-bits-for-downstream-por.patch
%if %{have_clang}
BuildRequires: clang
@ -1416,6 +1418,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%endif
%changelog
* Tue Jan 21 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-11
- kvm-pci-ensure-valid-link-status-bits-for-downstream-por.patch [RHEL-65616]
- Resolves: RHEL-65616
(Failed to hot add PCIe device behind xio3130 downstream port)
* Mon Jan 20 2025 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-10
- kvm-target-i386-Make-sure-SynIC-state-is-really-updated-.patch [RHEL-53073]
- kvm-hw-virtio-fix-crash-in-processing-balloon-stats.patch [RHEL-73688]