This patch series contains fixes and improvements to pcie iproc driver.
This patch set is based on Linux-5.9.0-rc2.
Changes from v1:
- Addressed Bjorn's review comments
- pcie_print_link_status is used to print Link information.
- Added IARR1/IMAP1 window map definition.
Bharat Gooty (1):
PCI: iproc: fix out of bound array access
Roman Bacik (1):
PCI: iproc: fix invalidating PAXB address mapping
Srinath Mannam (1):
PCI: iproc: Display PCIe Link information
drivers/pci/controller/pcie-iproc.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
--
2.17.1
From: Bharat Gooty <[email protected]>
Declare the full size array for all revisions of PAX register sets
to avoid potentially out of bound access of the register array
when they are being initialized in the 'iproc_pcie_rev_init'
function.
Fixes: 06324ede76cdf ("PCI: iproc: Improve core register population")
Signed-off-by: Bharat Gooty <[email protected]>
---
drivers/pci/controller/pcie-iproc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
index 905e93808243..d901b9d392b8 100644
--- a/drivers/pci/controller/pcie-iproc.c
+++ b/drivers/pci/controller/pcie-iproc.c
@@ -307,7 +307,7 @@ enum iproc_pcie_reg {
};
/* iProc PCIe PAXB BCMA registers */
-static const u16 iproc_pcie_reg_paxb_bcma[] = {
+static const u16 iproc_pcie_reg_paxb_bcma[IPROC_PCIE_MAX_NUM_REG] = {
[IPROC_PCIE_CLK_CTRL] = 0x000,
[IPROC_PCIE_CFG_IND_ADDR] = 0x120,
[IPROC_PCIE_CFG_IND_DATA] = 0x124,
@@ -318,7 +318,7 @@ static const u16 iproc_pcie_reg_paxb_bcma[] = {
};
/* iProc PCIe PAXB registers */
-static const u16 iproc_pcie_reg_paxb[] = {
+static const u16 iproc_pcie_reg_paxb[IPROC_PCIE_MAX_NUM_REG] = {
[IPROC_PCIE_CLK_CTRL] = 0x000,
[IPROC_PCIE_CFG_IND_ADDR] = 0x120,
[IPROC_PCIE_CFG_IND_DATA] = 0x124,
@@ -334,7 +334,7 @@ static const u16 iproc_pcie_reg_paxb[] = {
};
/* iProc PCIe PAXB v2 registers */
-static const u16 iproc_pcie_reg_paxb_v2[] = {
+static const u16 iproc_pcie_reg_paxb_v2[IPROC_PCIE_MAX_NUM_REG] = {
[IPROC_PCIE_CLK_CTRL] = 0x000,
[IPROC_PCIE_CFG_IND_ADDR] = 0x120,
[IPROC_PCIE_CFG_IND_DATA] = 0x124,
@@ -363,7 +363,7 @@ static const u16 iproc_pcie_reg_paxb_v2[] = {
};
/* iProc PCIe PAXC v1 registers */
-static const u16 iproc_pcie_reg_paxc[] = {
+static const u16 iproc_pcie_reg_paxc[IPROC_PCIE_MAX_NUM_REG] = {
[IPROC_PCIE_CLK_CTRL] = 0x000,
[IPROC_PCIE_CFG_IND_ADDR] = 0x1f0,
[IPROC_PCIE_CFG_IND_DATA] = 0x1f4,
@@ -372,7 +372,7 @@ static const u16 iproc_pcie_reg_paxc[] = {
};
/* iProc PCIe PAXC v2 registers */
-static const u16 iproc_pcie_reg_paxc_v2[] = {
+static const u16 iproc_pcie_reg_paxc_v2[IPROC_PCIE_MAX_NUM_REG] = {
[IPROC_PCIE_MSI_GIC_MODE] = 0x050,
[IPROC_PCIE_MSI_BASE_ADDR] = 0x074,
[IPROC_PCIE_MSI_WINDOW_SIZE] = 0x078,
--
2.17.1
After successful linkup more comprehensive information about PCIe link
speed and link width will be displayed to the console.
Signed-off-by: Srinath Mannam <[email protected]>
---
drivers/pci/controller/pcie-iproc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
index cc5b7823edeb..8ef2d1fe392c 100644
--- a/drivers/pci/controller/pcie-iproc.c
+++ b/drivers/pci/controller/pcie-iproc.c
@@ -1479,6 +1479,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
{
struct device *dev;
int ret;
+ struct pci_dev *pdev;
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
dev = pcie->dev;
@@ -1542,6 +1543,11 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
goto err_power_off_phy;
}
+ for_each_pci_bridge(pdev, host->bus) {
+ if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT)
+ pcie_print_link_status(pdev);
+ }
+
return 0;
err_power_off_phy:
--
2.17.1
On Tue, Sep 15, 2020 at 07:15:38PM +0530, Srinath Mannam wrote:
> This patch series contains fixes and improvements to pcie iproc driver.
>
> This patch set is based on Linux-5.9.0-rc2.
>
> Changes from v1:
> - Addressed Bjorn's review comments
> - pcie_print_link_status is used to print Link information.
> - Added IARR1/IMAP1 window map definition.
>
> Bharat Gooty (1):
> PCI: iproc: fix out of bound array access
>
> Roman Bacik (1):
> PCI: iproc: fix invalidating PAXB address mapping
You didn't update thest subject lines so they match.
https://lore.kernel.org/r/[email protected]
> Srinath Mannam (1):
> PCI: iproc: Display PCIe Link information
>
> drivers/pci/controller/pcie-iproc.c | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> --
> 2.17.1
>
On Tue, Sep 15, 2020 at 07:15:41PM +0530, Srinath Mannam wrote:
> After successful linkup more comprehensive information about PCIe link
> speed and link width will be displayed to the console.
>
> Signed-off-by: Srinath Mannam <[email protected]>
> ---
> drivers/pci/controller/pcie-iproc.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index cc5b7823edeb..8ef2d1fe392c 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1479,6 +1479,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> {
> struct device *dev;
> int ret;
> + struct pci_dev *pdev;
> struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
>
> dev = pcie->dev;
> @@ -1542,6 +1543,11 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> goto err_power_off_phy;
> }
>
> + for_each_pci_bridge(pdev, host->bus) {
> + if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT)
> + pcie_print_link_status(pdev);
> + }
If this information is useful for 1 host implementation, why not all of
them and put this in a common spot.
Rob
On Thu, Sep 17, 2020 at 3:38 AM Bjorn Helgaas <[email protected]> wrote:
>
Hi Bjorn,
Thanks for review.
> On Tue, Sep 15, 2020 at 07:15:38PM +0530, Srinath Mannam wrote:
> > This patch series contains fixes and improvements to pcie iproc driver.
> >
> > This patch set is based on Linux-5.9.0-rc2.
> >
> > Changes from v1:
> > - Addressed Bjorn's review comments
> > - pcie_print_link_status is used to print Link information.
> > - Added IARR1/IMAP1 window map definition.
> >
> > Bharat Gooty (1):
> > PCI: iproc: fix out of bound array access
> >
> > Roman Bacik (1):
> > PCI: iproc: fix invalidating PAXB address mapping
>
> You didn't update thest subject lines so they match.
> https://lore.kernel.org/r/[email protected]
Yes this patchset is the latest version to the patches in the link.
My apologies that I missed to address your review comment about
the commit message of "PCI: iproc: fix out of bound array access"
in this patchset.
Thanks & Regards,
Srinath.
>
> > Srinath Mannam (1):
> > PCI: iproc: Display PCIe Link information
> >
> > drivers/pci/controller/pcie-iproc.c | 29 ++++++++++++++++++++++-------
> > 1 file changed, 22 insertions(+), 7 deletions(-)
> >
> > --
> > 2.17.1
> >
On Thu, Sep 17, 2020 at 7:22 AM Rob Herring <[email protected]> wrote:
>
Hi Rob,
Thanks for review.
> On Tue, Sep 15, 2020 at 07:15:41PM +0530, Srinath Mannam wrote:
> > After successful linkup more comprehensive information about PCIe link
> > speed and link width will be displayed to the console.
> >
> > Signed-off-by: Srinath Mannam <[email protected]>
> > ---
> > drivers/pci/controller/pcie-iproc.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> > index cc5b7823edeb..8ef2d1fe392c 100644
> > --- a/drivers/pci/controller/pcie-iproc.c
> > +++ b/drivers/pci/controller/pcie-iproc.c
> > @@ -1479,6 +1479,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> > {
> > struct device *dev;
> > int ret;
> > + struct pci_dev *pdev;
> > struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
> >
> > dev = pcie->dev;
> > @@ -1542,6 +1543,11 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> > goto err_power_off_phy;
> > }
> >
> > + for_each_pci_bridge(pdev, host->bus) {
> > + if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT)
> > + pcie_print_link_status(pdev);
> > + }
>
> If this information is useful for 1 host implementation, why not all of
> them and put this in a common spot.
In common, pcie_print_link_status() is called during pci device caps
initialization, if the available link bandwidth is less than capabilities
of devices. Few EP drivers also used this function to print link
bandwidth info. This host can be configured for different link
speeds and link widths on different platforms so we thought
displaying link bandwidth after successful linkup is helpful to
know link details.
Thanks & Regards,
Srinath.
>
> Rob