Patch "IB/hfi: Only read capability registers if the capability exists" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
IB/hfi: Only read capability registers if the capability exists
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ib-hfi-only-read-capability-registers-if-the-capability-exists.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
4c009af473b2026caaa26107e34d7cc68dad7756Mon Sep 17 00:00:00 2001
From: "Michael J. Ruhl" <[email protected]>
Date: Fri, 22 Dec 2017 08:47:20 -0800
Subject: IB/hfi: Only read capability registers if the capability exists
From: Michael J. Ruhl <[email protected]>
commit 4c009af473b2026caaa26107e34d7cc68dad7756 upstream.
During driver init, various registers are saved to allow restoration after an FLR or gen3 bump. Some of these registers are not available in some circumstances (i.e. Virtual machines).
This bug makes the driver unusable when the PCI device is passed into a VM, it fails during probe.
Delete unnecessary register read/write, and only access register if the capability exists.
--- drivers/infiniband/hw/hfi1/hfi.h | 1 - drivers/infiniband/hw/hfi1/pcie.c | 30 ++++++++++++------------------ 2 files changed, 12 insertions(+), 19 deletions(-)
drivers/infiniband/hw/hfi1/hfi.h +0 -1
@@ -1129,7 +1129,6 @@ struct hfi1_devdata {u16 pcie_lnkctl;u16 pcie_devctl2;u32 pci_msix0; -u32 pci_lnkctl3;u32 pci_tph2;/*
drivers/infiniband/hw/hfi1/pcie.c +12 -18
@@ -411,15 +411,12 @@ int restore_pci_variables(struct hfi1_deif (ret) goto error; - ret =pci_write_config_dword (dd->pcidev,PCIE_CFG_SPCIE1 , - dd->pci_lnkctl3); -if (ret) - goto error; - - ret =pci_write_config_dword (dd->pcidev,PCIE_CFG_TPH2 , dd->pci_tph2); -if (ret) - goto error; - +if (pci_find_ext_capability (dd->pcidev,PCI_EXT_CAP_ID_TPH )) { + ret =pci_write_config_dword (dd->pcidev,PCIE_CFG_TPH2 , + dd->pci_tph2); +if (ret) + goto error; + }return 0 ; error:
@@ -469,15 +466,12 @@ int save_pci_variables(struct hfi1_devdaif (ret) goto error; - ret =pci_read_config_dword (dd->pcidev,PCIE_CFG_SPCIE1 , - &dd->pci_lnkctl3); -if (ret) - goto error; - - ret =pci_read_config_dword (dd->pcidev,PCIE_CFG_TPH2 , &dd->pci_tph2); -if (ret) - goto error; - +if (pci_find_ext_capability (dd->pcidev,PCI_EXT_CAP_ID_TPH )) { + ret =pci_read_config_dword (dd->pcidev,PCIE_CFG_TPH2 , + &dd->pci_tph2); +if (ret) + goto error; + }return 0 ; error:
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/ib-hfi-only-read-capability-registers-if-the-capability-exists.patch