render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 7cdf18b541dfdbbbe4ed1e35179dd41c0d473648 Mon Sep 17 00:00:00 2001
Message-Id: <7cdf18b541dfdbbbe4ed1e35179dd41c0d473648@dist-git>
From: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Date: Mon, 17 Apr 2017 17:16:44 -0400
Subject: [PATCH] pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link speed

Without this added enum value, nodedev-dumpxml of a GEN4 (PCIe 4.0)
card will fail (due to the unrecognized link speed), and since
nodedev-detach and nodedev-reattach internally do a dumpxml+parse,
they will also fail. With this patch, all those operations succeed.

Resolves: https://bugzilla.redhat.com/1442831

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
(cherry picked from commit 8e09663f7ff70b10a560746f17897d2c67c8460d)
---
 src/util/virpci.c | 4 ++--
 src/util/virpci.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index 65c108f2e..c89b94b5f 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -53,7 +53,7 @@ VIR_LOG_INIT("util.pci");
 #define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */
 
 VIR_ENUM_IMPL(virPCIELinkSpeed, VIR_PCIE_LINK_SPEED_LAST,
-              "", "2.5", "5", "8")
+              "", "2.5", "5", "8", "16")
 
 VIR_ENUM_IMPL(virPCIStubDriver, VIR_PCI_STUB_DRIVER_LAST,
               "none",
@@ -147,7 +147,7 @@ struct _virPCIDeviceList {
 #define PCI_EXP_DEVCAP          0x4     /* Device capabilities */
 #define PCI_EXP_DEVCAP_FLR     (1<<28)  /* Function Level Reset */
 #define PCI_EXP_LNKCAP          0xc     /* Link Capabilities */
-#define PCI_EXP_LNKCAP_SPEED    0x0000f /* Maximum Link Speed */
+#define PCI_EXP_LNKCAP_SPEED    0x0001f /* Maximum Link Speed */
 #define PCI_EXP_LNKCAP_WIDTH    0x003f0 /* Maximum Link Width */
 #define PCI_EXP_LNKSTA          0x12    /* Link Status */
 #define PCI_EXP_LNKSTA_SPEED    0x000f  /* Negotiated Link Speed */
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 8637c2c68..570684e75 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -58,6 +58,7 @@ typedef enum {
     VIR_PCIE_LINK_SPEED_25,
     VIR_PCIE_LINK_SPEED_5,
     VIR_PCIE_LINK_SPEED_8,
+    VIR_PCIE_LINK_SPEED_16,
     VIR_PCIE_LINK_SPEED_LAST
 } virPCIELinkSpeed;
 
-- 
2.12.2