diff options
author | Amey Narkhede <ameynarkhede03@gmail.com> | 2021-08-17 23:34:52 +0530 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2021-08-17 15:21:35 -0500 |
commit | 69139244806537f9d51364f37fe146bb2ee88a05 (patch) | |
tree | 6f2589dfbded45253d70ceb92a45723a2b119982 /drivers/pci/probe.c | |
parent | e73f0f0ee7541171d89f2e2491130c7771ba58d3 (diff) | |
download | linux-69139244806537f9d51364f37fe146bb2ee88a05.tar.gz linux-69139244806537f9d51364f37fe146bb2ee88a05.tar.bz2 linux-69139244806537f9d51364f37fe146bb2ee88a05.zip |
PCI: Cache PCIe Device Capabilities register
Add a new member called devcap in struct pci_dev for caching the PCIe
Device Capabilities register to avoid reading PCI_EXP_DEVCAP multiple
times.
Refactor pcie_has_flr() to use cached device capabilities.
Link: https://lore.kernel.org/r/20210817180500.1253-2-ameynarkhede03@gmail.com
Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 79177ac37880..81eb88ae4301 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -19,6 +19,7 @@ #include <linux/hypervisor.h> #include <linux/irqdomain.h> #include <linux/pm_runtime.h> +#include <linux/bitfield.h> #include "pci.h" #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ @@ -1498,8 +1499,8 @@ void set_pcie_port_type(struct pci_dev *pdev) pdev->pcie_cap = pos; pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, ®16); pdev->pcie_flags_reg = reg16; - pci_read_config_word(pdev, pos + PCI_EXP_DEVCAP, ®16); - pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD; + pci_read_config_dword(pdev, pos + PCI_EXP_DEVCAP, &pdev->devcap); + pdev->pcie_mpss = FIELD_GET(PCI_EXP_DEVCAP_PAYLOAD, pdev->devcap); parent = pci_upstream_bridge(pdev); if (!parent) |