linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc
@ 2020-10-01  6:00 Srinath Mannam
  2020-10-01  6:00 ` [PATCH v3 1/3] PCI: iproc: Fix out-of-bound array accesses Srinath Mannam
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Srinath Mannam @ 2020-10-01  6:00 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Ray Jui
  Cc: bcm-kernel-feedback-list, linux-pci, linux-arm-kernel,
	linux-kernel, Srinath Mannam

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

This patch series contains fixes and improvements to pcie iproc driver.

This patch set is based on Linux-5.9.0-rc2.

Changes from v2:
  - Addressed Bjorn's review comments
     - Corrected subject line and commit message of Patches 1 and 2.
     
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 accesses

Roman Bacik (1):
  PCI: iproc: Invalidate correct PAXB inbound windows

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


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4172 bytes --]

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

* [PATCH v3 1/3] PCI: iproc: Fix out-of-bound array accesses
  2020-10-01  6:00 [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Srinath Mannam
@ 2020-10-01  6:00 ` Srinath Mannam
  2020-10-01  6:00 ` [PATCH v3 2/3] PCI: iproc: Invalidate correct PAXB inbound windows Srinath Mannam
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Srinath Mannam @ 2020-10-01  6:00 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Ray Jui
  Cc: bcm-kernel-feedback-list, linux-pci, linux-arm-kernel,
	linux-kernel, Bharat Gooty

[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]

From: Bharat Gooty <bharat.gooty@broadcom.com>

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 iproc_pcie_rev_init().

Fixes: 06324ede76cdf ("PCI: iproc: Improve core register population")
Signed-off-by: Bharat Gooty <bharat.gooty@broadcom.com>
---
 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


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4172 bytes --]

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

* [PATCH v3 2/3] PCI: iproc: Invalidate correct PAXB inbound windows
  2020-10-01  6:00 [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Srinath Mannam
  2020-10-01  6:00 ` [PATCH v3 1/3] PCI: iproc: Fix out-of-bound array accesses Srinath Mannam
@ 2020-10-01  6:00 ` Srinath Mannam
  2020-10-01  6:00 ` [PATCH v3 3/3] PCI: iproc: Display PCIe Link information Srinath Mannam
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Srinath Mannam @ 2020-10-01  6:00 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Ray Jui
  Cc: bcm-kernel-feedback-list, linux-pci, linux-arm-kernel,
	linux-kernel, Roman Bacik, Srinath Mannam

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

From: Roman Bacik <roman.bacik@broadcom.com>

Second stage bootloader prior to Linux boot may use all inbound windows
including IARR1/IMAP1. We need to ensure all previous configuration of
inbound windows are invalidated during the initialization stage of the
Linux iProc PCIe driver. Add fix to define and invalidate IARR1/IMAP1
because it was missed in previous patch.

Fixes: 9415743e4c8a ("PCI: iproc: Invalidate PAXB address mapping")
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
---
 drivers/pci/controller/pcie-iproc.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
index d901b9d392b8..cc5b7823edeb 100644
--- a/drivers/pci/controller/pcie-iproc.c
+++ b/drivers/pci/controller/pcie-iproc.c
@@ -192,8 +192,15 @@ static const struct iproc_pcie_ib_map paxb_v2_ib_map[] = {
 		.imap_window_offset = 0x4,
 	},
 	{
-		/* IARR1/IMAP1 (currently unused) */
-		.type = IPROC_PCIE_IB_MAP_INVALID,
+		/* IARR1/IMAP1 */
+		.type = IPROC_PCIE_IB_MAP_MEM,
+		.size_unit = SZ_1M,
+		.region_sizes = { 8 },
+		.nr_sizes = 1,
+		.nr_windows = 8,
+		.imap_addr_offset = 0x4,
+		.imap_window_offset = 0x8,
+
 	},
 	{
 		/* IARR2/IMAP2 */
@@ -351,6 +358,8 @@ static const u16 iproc_pcie_reg_paxb_v2[IPROC_PCIE_MAX_NUM_REG] = {
 	[IPROC_PCIE_OMAP3]		= 0xdf8,
 	[IPROC_PCIE_IARR0]		= 0xd00,
 	[IPROC_PCIE_IMAP0]		= 0xc00,
+	[IPROC_PCIE_IARR1]		= 0xd08,
+	[IPROC_PCIE_IMAP1]		= 0xd70,
 	[IPROC_PCIE_IARR2]		= 0xd10,
 	[IPROC_PCIE_IMAP2]		= 0xcc0,
 	[IPROC_PCIE_IARR3]		= 0xe00,
-- 
2.17.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4172 bytes --]

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

* [PATCH v3 3/3] PCI: iproc: Display PCIe Link information
  2020-10-01  6:00 [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Srinath Mannam
  2020-10-01  6:00 ` [PATCH v3 1/3] PCI: iproc: Fix out-of-bound array accesses Srinath Mannam
  2020-10-01  6:00 ` [PATCH v3 2/3] PCI: iproc: Invalidate correct PAXB inbound windows Srinath Mannam
@ 2020-10-01  6:00 ` Srinath Mannam
  2020-11-30 12:19 ` [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Lorenzo Pieralisi
  2020-11-30 18:30 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Srinath Mannam @ 2020-10-01  6:00 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Ray Jui
  Cc: bcm-kernel-feedback-list, linux-pci, linux-arm-kernel,
	linux-kernel, Srinath Mannam

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

After successful linkup more comprehensive information about PCIe link
speed and link width will be displayed to the console.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
---
 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


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4172 bytes --]

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

* Re: [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc
  2020-10-01  6:00 [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Srinath Mannam
                   ` (2 preceding siblings ...)
  2020-10-01  6:00 ` [PATCH v3 3/3] PCI: iproc: Display PCIe Link information Srinath Mannam
@ 2020-11-30 12:19 ` Lorenzo Pieralisi
  2020-11-30 17:39   ` Scott Branden
  2020-11-30 18:30 ` Lorenzo Pieralisi
  4 siblings, 1 reply; 8+ messages in thread
From: Lorenzo Pieralisi @ 2020-11-30 12:19 UTC (permalink / raw)
  To: Srinath Mannam, Ray Jui, Scott Branden
  Cc: Bjorn Helgaas, bcm-kernel-feedback-list, linux-pci,
	linux-arm-kernel, linux-kernel

On Thu, Oct 01, 2020 at 11:30:51AM +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 v2:
>   - Addressed Bjorn's review comments
>      - Corrected subject line and commit message of Patches 1 and 2.
>      
> 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 accesses
> 
> Roman Bacik (1):
>   PCI: iproc: Invalidate correct PAXB inbound windows
> 
> Srinath Mannam (1):
>   PCI: iproc: Display PCIe Link information
> 
>  drivers/pci/controller/pcie-iproc.c | 29 ++++++++++++++++++++++-------
>  1 file changed, 22 insertions(+), 7 deletions(-)

I need Ray a/o Scott ACK to proceed.

Thanks,
Lorenzo

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

* Re: [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc
  2020-11-30 12:19 ` [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Lorenzo Pieralisi
@ 2020-11-30 17:39   ` Scott Branden
  2020-11-30 17:54     ` Ray Jui
  0 siblings, 1 reply; 8+ messages in thread
From: Scott Branden @ 2020-11-30 17:39 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Srinath Mannam, Ray Jui, Scott Branden
  Cc: Bjorn Helgaas, bcm-kernel-feedback-list, linux-pci,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]



On 2020-11-30 4:19 a.m., Lorenzo Pieralisi wrote:
> On Thu, Oct 01, 2020 at 11:30:51AM +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 v2:
>>   - Addressed Bjorn's review comments
>>      - Corrected subject line and commit message of Patches 1 and 2.
>>      
>> 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 accesses
>>
>> Roman Bacik (1):
>>   PCI: iproc: Invalidate correct PAXB inbound windows
>>
>> Srinath Mannam (1):
>>   PCI: iproc: Display PCIe Link information
>>
>>  drivers/pci/controller/pcie-iproc.c | 29 ++++++++++++++++++++++-------
>>  1 file changed, 22 insertions(+), 7 deletions(-)
> I need Ray a/o Scott ACK to proceed.
Let's see if Ray has anything to add.

Acked-by: Scott Branden <scott.branden@broadcom.com>
>
> Thanks,
> Lorenzo


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4169 bytes --]

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

* Re: [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc
  2020-11-30 17:39   ` Scott Branden
@ 2020-11-30 17:54     ` Ray Jui
  0 siblings, 0 replies; 8+ messages in thread
From: Ray Jui @ 2020-11-30 17:54 UTC (permalink / raw)
  To: Scott Branden, Lorenzo Pieralisi, Srinath Mannam, Ray Jui, Scott Branden
  Cc: Bjorn Helgaas, bcm-kernel-feedback-list, linux-pci,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]



On 11/30/2020 9:39 AM, Scott Branden wrote:
> 
> 
> On 2020-11-30 4:19 a.m., Lorenzo Pieralisi wrote:
>> On Thu, Oct 01, 2020 at 11:30:51AM +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 v2:
>>>   - Addressed Bjorn's review comments
>>>      - Corrected subject line and commit message of Patches 1 and 2.
>>>      
>>> 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 accesses
>>>
>>> Roman Bacik (1):
>>>   PCI: iproc: Invalidate correct PAXB inbound windows
>>>
>>> Srinath Mannam (1):
>>>   PCI: iproc: Display PCIe Link information
>>>
>>>  drivers/pci/controller/pcie-iproc.c | 29 ++++++++++++++++++++++-------
>>>  1 file changed, 22 insertions(+), 7 deletions(-)
>> I need Ray a/o Scott ACK to proceed.
> Let's see if Ray has anything to add.
> 
> Acked-by: Scott Branden <scott.branden@broadcom.com>

I reviewed them internally before they were sent out. I just reviewed
them again and yes they look fine to me.

1/3 and 2/3 are critical fixes for kernel crash and boot up issue in
corner cases (Fixes tag already applied and should be picked up by LTS
once merged).

Thanks.

Acked-by: Ray Jui <ray.jui@broadcom.com>

>>
>> Thanks,
>> Lorenzo
> 

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4151 bytes --]

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

* Re: [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc
  2020-10-01  6:00 [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Srinath Mannam
                   ` (3 preceding siblings ...)
  2020-11-30 12:19 ` [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Lorenzo Pieralisi
@ 2020-11-30 18:30 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Pieralisi @ 2020-11-30 18:30 UTC (permalink / raw)
  To: Ray Jui, Bjorn Helgaas, Srinath Mannam
  Cc: Lorenzo Pieralisi, bcm-kernel-feedback-list, linux-arm-kernel,
	linux-kernel, linux-pci

On Thu, 1 Oct 2020 11:30:51 +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 v2:
>   - Addressed Bjorn's review comments
>      - Corrected subject line and commit message of Patches 1 and 2.
> 
> [...]

Applied to pci/iproc, thanks!

[1/3] PCI: iproc: Fix out-of-bound array accesses
      https://git.kernel.org/lpieralisi/pci/c/a3ff529f5d
[2/3] PCI: iproc: Invalidate correct PAXB inbound windows
      https://git.kernel.org/lpieralisi/pci/c/89bbcaac3d
[3/3] PCI: iproc: Enhance PCIe Link information display
      https://git.kernel.org/lpieralisi/pci/c/7698c0f155

Thanks,
Lorenzo

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

end of thread, other threads:[~2020-11-30 18:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01  6:00 [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Srinath Mannam
2020-10-01  6:00 ` [PATCH v3 1/3] PCI: iproc: Fix out-of-bound array accesses Srinath Mannam
2020-10-01  6:00 ` [PATCH v3 2/3] PCI: iproc: Invalidate correct PAXB inbound windows Srinath Mannam
2020-10-01  6:00 ` [PATCH v3 3/3] PCI: iproc: Display PCIe Link information Srinath Mannam
2020-11-30 12:19 ` [PATCH v3 0/3] PCI: iproc: Add fixes to pcie iproc Lorenzo Pieralisi
2020-11-30 17:39   ` Scott Branden
2020-11-30 17:54     ` Ray Jui
2020-11-30 18:30 ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).