diff mbox

[v2,4/4] core/pci: Check PCIe cap version in pci_disable_completion_timeout()

Message ID 1497854809-26032-5-git-send-email-gwshan@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Gavin Shan June 19, 2017, 6:46 a.m. UTC
When the PCIe capability version is less than 2, the completion
timeout isn't supported and no need to disable it at all.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 core/pci.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Oliver O'Halloran Nov. 20, 2019, 12:29 a.m. UTC | #1
On Mon, Jun 19, 2017 at 4:47 PM Gavin Shan <gwshan@linux.vnet.ibm.com> wrote:
>
> When the PCIe capability version is less than 2, the completion
> timeout isn't supported and no need to disable it at all.

Merged as c9c681521fb05dbcd592c532e957c4164c1b3585

>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  core/pci.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/core/pci.c b/core/pci.c
> index 684c054..cdb5de0 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -942,15 +942,21 @@ static int pci_configure_mps(struct phb *phb,
>
>  static void pci_disable_completion_timeout(struct phb *phb, struct pci_device *pd)
>  {
> -       uint32_t ecap;
> -       uint32_t val;
> +       uint32_t ecap, val;
> +       uint16_t pcie_cap;
>
>         /* PCIE capability required */
>         if (!pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false))
>                 return;
>
> -       /* Check if it has capability to disable completion timeout */
> +       /* Check PCIe capability version */
>         ecap = pci_cap(pd, PCI_CFG_CAP_ID_EXP, false);
> +       pci_cfg_read16(phb, pd->bdfn,
> +                      ecap + PCICAP_EXP_CAPABILITY_REG, &pcie_cap);
> +       if ((pcie_cap & PCICAP_EXP_CAP_VERSION) <= 1)
> +               return;
> +
> +       /* Check if it has capability to disable completion timeout */
>         pci_cfg_read32(phb, pd->bdfn, ecap + PCIECAP_EXP_DCAP2, &val);
>         if (!(val & PCICAP_EXP_DCAP2_CMPTOUT_DIS))
>                 return;
> --
> 2.7.4
>
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
diff mbox

Patch

diff --git a/core/pci.c b/core/pci.c
index 684c054..cdb5de0 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -942,15 +942,21 @@  static int pci_configure_mps(struct phb *phb,
 
 static void pci_disable_completion_timeout(struct phb *phb, struct pci_device *pd)
 {
-	uint32_t ecap;
-	uint32_t val;
+	uint32_t ecap, val;
+	uint16_t pcie_cap;
 
 	/* PCIE capability required */
 	if (!pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false))
 		return;
 
-	/* Check if it has capability to disable completion timeout */
+	/* Check PCIe capability version */
 	ecap = pci_cap(pd, PCI_CFG_CAP_ID_EXP, false);
+	pci_cfg_read16(phb, pd->bdfn,
+		       ecap + PCICAP_EXP_CAPABILITY_REG, &pcie_cap);
+	if ((pcie_cap & PCICAP_EXP_CAP_VERSION) <= 1)
+		return;
+
+	/* Check if it has capability to disable completion timeout */
 	pci_cfg_read32(phb, pd->bdfn, ecap + PCIECAP_EXP_DCAP2, &val);
 	if (!(val & PCICAP_EXP_DCAP2_CMPTOUT_DIS))
 		return;