All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap
@ 2018-02-01  2:53 Frederick Lawler
  2018-02-01  2:53 ` [PATCH v2 1/1] " Frederick Lawler
  2018-02-22 23:45 ` [PATCH v2 0/1] " Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Frederick Lawler @ 2018-02-01  2:53 UTC (permalink / raw)
  To: linux-pci; +Cc: helgaas, Frederick Lawler

Hello,

I replaced certain pci_find_ext_capability(..., PCI_EXT_CAP_ID_ERR) calls
with pci_dev's aer_cap.

Since I do not have a computer with a PCIe device with the Advanced Error
Reporting capability, these changes have not been tested with
CONFIG_PCIEAER=y set on a machine that has a capable device.

V2:
* Reset program_hpp_type2() in probe.c back to its original state

Frederick Lawler (1):
  PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap

 drivers/pci/pcie/aer/aer_inject.c |  4 ++--
 drivers/pci/pcie/aer/ecrc.c       |  4 ++--
 drivers/pci/pcie/portdrv_core.c   | 15 +++++++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap
  2018-02-01  2:53 [PATCH v2 0/1] PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap Frederick Lawler
@ 2018-02-01  2:53 ` Frederick Lawler
  2018-02-22 23:45 ` [PATCH v2 0/1] " Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Frederick Lawler @ 2018-02-01  2:53 UTC (permalink / raw)
  To: linux-pci; +Cc: helgaas, Frederick Lawler

Replace pci_find_ext_capability(..., PCI_EXT_CAP_ID_ERR) calls with
pci_dev aer_cap.

Signed-off-by: Frederick Lawler <fred@fredlawl.com>
--
V2:
* Reset program_hpp_type2() in probe.c back to its original state
---
 drivers/pci/pcie/aer/aer_inject.c |  4 ++--
 drivers/pci/pcie/aer/ecrc.c       |  4 ++--
 drivers/pci/pcie/portdrv_core.c   | 15 +++++++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index 2b6a592..c8e6634 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -349,7 +349,7 @@ static int aer_inject(struct aer_error_inj *einj)
 		goto out_put;
 	}
 
-	pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
+	pos_cap_err = dev->aer_cap;
 	if (!pos_cap_err) {
 		dev_err(&dev->dev, "aer_inject: Device doesn't support AER\n");
 		ret = -EPROTONOSUPPORT;
@@ -360,7 +360,7 @@ static int aer_inject(struct aer_error_inj *einj)
 	pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK,
 			      &uncor_mask);
 
-	rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR);
+	rp_pos_cap_err = rpdev->aer_cap;
 	if (!rp_pos_cap_err) {
 		dev_err(&rpdev->dev,
 			"aer_inject: Root port doesn't support AER\n");
diff --git a/drivers/pci/pcie/aer/ecrc.c b/drivers/pci/pcie/aer/ecrc.c
index a2747a6..18289be 100644
--- a/drivers/pci/pcie/aer/ecrc.c
+++ b/drivers/pci/pcie/aer/ecrc.c
@@ -54,7 +54,7 @@ static int enable_ecrc_checking(struct pci_dev *dev)
 	if (!pci_is_pcie(dev))
 		return -ENODEV;
 
-	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
+	pos = dev->aer_cap;
 	if (!pos)
 		return -ENODEV;
 
@@ -82,7 +82,7 @@ static int disable_ecrc_checking(struct pci_dev *dev)
 	if (!pci_is_pcie(dev))
 		return -ENODEV;
 
-	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
+	pos = dev->aer_cap;
 	if (!pos)
 		return -ENODEV;
 
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index a592103..5a5d817 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -52,7 +52,7 @@ static void release_pcie_device(struct device *dev)
 static int pcie_message_numbers(struct pci_dev *dev, int mask,
 				u32 *pme, u32 *aer, u32 *dpc)
 {
-	u32 nvec = 0, pos, reg32;
+	u32 nvec = 0, pos;
 	u16 reg16;
 
 	/*
@@ -68,8 +68,11 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
 		nvec = *pme + 1;
 	}
 
+#ifdef CONFIG_PCIEAER
 	if (mask & PCIE_PORT_SERVICE_AER) {
-		pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
+		u32 reg32;
+
+		pos = dev->aer_cap;
 		if (pos) {
 			pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS,
 					      &reg32);
@@ -77,6 +80,7 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
 			nvec = max(nvec, *aer + 1);
 		}
 	}
+#endif
 
 	if (mask & PCIE_PORT_SERVICE_DPC) {
 		pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC);
@@ -233,9 +237,10 @@ static int get_port_device_capability(struct pci_dev *dev)
 		pcie_capability_clear_word(dev, PCI_EXP_SLTCTL,
 			  PCI_EXP_SLTCTL_CCIE | PCI_EXP_SLTCTL_HPIE);
 	}
+
+#ifdef CONFIG_PCIEAER
 	/* AER capable */
-	if ((cap_mask & PCIE_PORT_SERVICE_AER)
-	    && pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR)) {
+	if ((cap_mask & PCIE_PORT_SERVICE_AER) && dev->aer_cap) {
 		services |= PCIE_PORT_SERVICE_AER;
 		/*
 		 * Disable AER on this port in case it's been enabled by the
@@ -243,6 +248,8 @@ static int get_port_device_capability(struct pci_dev *dev)
 		 */
 		pci_disable_pcie_error_reporting(dev);
 	}
+#endif
+
 	/* VC support */
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_VC))
 		services |= PCIE_PORT_SERVICE_VC;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 0/1] PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap
  2018-02-01  2:53 [PATCH v2 0/1] PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap Frederick Lawler
  2018-02-01  2:53 ` [PATCH v2 1/1] " Frederick Lawler
@ 2018-02-22 23:45 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2018-02-22 23:45 UTC (permalink / raw)
  To: Frederick Lawler; +Cc: linux-pci

On Wed, Jan 31, 2018 at 08:53:44PM -0600, Frederick Lawler wrote:
> Hello,
> 
> I replaced certain pci_find_ext_capability(..., PCI_EXT_CAP_ID_ERR) calls
> with pci_dev's aer_cap.
> 
> Since I do not have a computer with a PCIe device with the Advanced Error
> Reporting capability, these changes have not been tested with
> CONFIG_PCIEAER=y set on a machine that has a capable device.
> 
> V2:
> * Reset program_hpp_type2() in probe.c back to its original state
> 
> Frederick Lawler (1):
>   PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap
> 
>  drivers/pci/pcie/aer/aer_inject.c |  4 ++--
>  drivers/pci/pcie/aer/ecrc.c       |  4 ++--
>  drivers/pci/pcie/portdrv_core.c   | 15 +++++++++++----
>  3 files changed, 15 insertions(+), 8 deletions(-)

Applied to pci/aer for v4.17, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-22 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01  2:53 [PATCH v2 0/1] PCI: Replace pci_find_ext_capability() calls with pci_dev aer_cap Frederick Lawler
2018-02-01  2:53 ` [PATCH v2 1/1] " Frederick Lawler
2018-02-22 23:45 ` [PATCH v2 0/1] " Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.