All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
@ 2017-03-31 15:06 ` Tomasz Nowicki
  0 siblings, 0 replies; 7+ messages in thread
From: Tomasz Nowicki @ 2017-03-31 15:06 UTC (permalink / raw)
  To: helgaas, Lorenzo.Pieralisi, robert.richter, ddaney,
	Vadim.Lomovtsev, rafael
  Cc: Sunil.Goutham, geethasowjanya.akula, linu.cherian, linux-pci,
	linux-arm-kernel, linux-acpi, Tomasz Nowicki

SZ_16M PEM resource size includes PEM-specific register and its children
resources. Reservation of the whole SZ_16M range leads to child device
driver failure when pcieport driver is requesting resources:
pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
So we cannot reserve full 16M here and instead we want to reserve
PEM-specific register only which is SZ_64K.

At the end increase PEM resource to SZ_16M since this is what
thunder_pem_init() call expects for proper initialization.

Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
CC: stable@vger.kernel.org	# v4.10+
---
 drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
index b89c373..6e031b5 100644
--- a/drivers/pci/host/pci-thunder-pem.c
+++ b/drivers/pci/host/pci-thunder-pem.c
@@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
 	index -= node * PEM_MAX_DOM_IN_NODE;
 	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
 					FIELD_PREP(PEM_INDX_MASK, index);
-	res_pem->end = res_pem->start + SZ_16M - 1;
 	res_pem->flags = IORESOURCE_MEM;
 }
 
@@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
 	 */
 	if (ret) {
 		thunder_pem_legacy_fw(root, res_pem);
-		/* Reserve PEM-specific resources and PCI configuration space */
+		/*
+		 * Reserve 64K size PEM specific resources. The full 16M range
+		 * size is required for thunder_pem_init() call.
+		 */
+		res_pem->end = res_pem->start + SZ_64K - 1;
 		thunder_pem_reserve_range(dev, root->segment, res_pem);
+		res_pem->end = res_pem->start + SZ_16M - 1;
+
+		/* Reserve PCI configuration space as well. */
 		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
 	}
 
-- 
2.7.4

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

* [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
@ 2017-03-31 15:06 ` Tomasz Nowicki
  0 siblings, 0 replies; 7+ messages in thread
From: Tomasz Nowicki @ 2017-03-31 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

SZ_16M PEM resource size includes PEM-specific register and its children
resources. Reservation of the whole SZ_16M range leads to child device
driver failure when pcieport driver is requesting resources:
pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
So we cannot reserve full 16M here and instead we want to reserve
PEM-specific register only which is SZ_64K.

At the end increase PEM resource to SZ_16M since this is what
thunder_pem_init() call expects for proper initialization.

Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
CC: stable at vger.kernel.org	# v4.10+
---
 drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
index b89c373..6e031b5 100644
--- a/drivers/pci/host/pci-thunder-pem.c
+++ b/drivers/pci/host/pci-thunder-pem.c
@@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
 	index -= node * PEM_MAX_DOM_IN_NODE;
 	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
 					FIELD_PREP(PEM_INDX_MASK, index);
-	res_pem->end = res_pem->start + SZ_16M - 1;
 	res_pem->flags = IORESOURCE_MEM;
 }
 
@@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
 	 */
 	if (ret) {
 		thunder_pem_legacy_fw(root, res_pem);
-		/* Reserve PEM-specific resources and PCI configuration space */
+		/*
+		 * Reserve 64K size PEM specific resources. The full 16M range
+		 * size is required for thunder_pem_init() call.
+		 */
+		res_pem->end = res_pem->start + SZ_64K - 1;
 		thunder_pem_reserve_range(dev, root->segment, res_pem);
+		res_pem->end = res_pem->start + SZ_16M - 1;
+
+		/* Reserve PCI configuration space as well. */
 		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
 	}
 
-- 
2.7.4

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

* Re: [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
  2017-03-31 15:06 ` Tomasz Nowicki
  (?)
@ 2017-04-03 20:18   ` Bjorn Helgaas
  -1 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2017-04-03 20:18 UTC (permalink / raw)
  To: Tomasz Nowicki
  Cc: Lorenzo.Pieralisi, robert.richter, ddaney, Vadim.Lomovtsev,
	rafael, Sunil.Goutham, geethasowjanya.akula, linu.cherian,
	linux-pci, linux-arm-kernel, linux-acpi

On Fri, Mar 31, 2017 at 05:06:44PM +0200, Tomasz Nowicki wrote:
> SZ_16M PEM resource size includes PEM-specific register and its children
> resources. Reservation of the whole SZ_16M range leads to child device
> driver failure when pcieport driver is requesting resources:
> pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
> So we cannot reserve full 16M here and instead we want to reserve
> PEM-specific register only which is SZ_64K.
> 
> At the end increase PEM resource to SZ_16M since this is what
> thunder_pem_init() call expects for proper initialization.
> 
> Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> CC: stable@vger.kernel.org	# v4.10+

Applied to for-linus for v4.11, thanks!

> ---
>  drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
> index b89c373..6e031b5 100644
> --- a/drivers/pci/host/pci-thunder-pem.c
> +++ b/drivers/pci/host/pci-thunder-pem.c
> @@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
>  	index -= node * PEM_MAX_DOM_IN_NODE;
>  	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
>  					FIELD_PREP(PEM_INDX_MASK, index);
> -	res_pem->end = res_pem->start + SZ_16M - 1;
>  	res_pem->flags = IORESOURCE_MEM;
>  }
>  
> @@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
>  	 */
>  	if (ret) {
>  		thunder_pem_legacy_fw(root, res_pem);
> -		/* Reserve PEM-specific resources and PCI configuration space */
> +		/*
> +		 * Reserve 64K size PEM specific resources. The full 16M range
> +		 * size is required for thunder_pem_init() call.
> +		 */
> +		res_pem->end = res_pem->start + SZ_64K - 1;
>  		thunder_pem_reserve_range(dev, root->segment, res_pem);
> +		res_pem->end = res_pem->start + SZ_16M - 1;
> +
> +		/* Reserve PCI configuration space as well. */
>  		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
>  	}
>  
> -- 
> 2.7.4
> 

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

* Re: [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
@ 2017-04-03 20:18   ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2017-04-03 20:18 UTC (permalink / raw)
  To: Tomasz Nowicki
  Cc: Lorenzo.Pieralisi, Sunil.Goutham, rafael, linux-pci,
	linu.cherian, ddaney, geethasowjanya.akula, linux-acpi,
	robert.richter, Vadim.Lomovtsev, linux-arm-kernel

On Fri, Mar 31, 2017 at 05:06:44PM +0200, Tomasz Nowicki wrote:
> SZ_16M PEM resource size includes PEM-specific register and its children
> resources. Reservation of the whole SZ_16M range leads to child device
> driver failure when pcieport driver is requesting resources:
> pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
> So we cannot reserve full 16M here and instead we want to reserve
> PEM-specific register only which is SZ_64K.
> 
> At the end increase PEM resource to SZ_16M since this is what
> thunder_pem_init() call expects for proper initialization.
> 
> Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> CC: stable@vger.kernel.org	# v4.10+

Applied to for-linus for v4.11, thanks!

> ---
>  drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
> index b89c373..6e031b5 100644
> --- a/drivers/pci/host/pci-thunder-pem.c
> +++ b/drivers/pci/host/pci-thunder-pem.c
> @@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
>  	index -= node * PEM_MAX_DOM_IN_NODE;
>  	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
>  					FIELD_PREP(PEM_INDX_MASK, index);
> -	res_pem->end = res_pem->start + SZ_16M - 1;
>  	res_pem->flags = IORESOURCE_MEM;
>  }
>  
> @@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
>  	 */
>  	if (ret) {
>  		thunder_pem_legacy_fw(root, res_pem);
> -		/* Reserve PEM-specific resources and PCI configuration space */
> +		/*
> +		 * Reserve 64K size PEM specific resources. The full 16M range
> +		 * size is required for thunder_pem_init() call.
> +		 */
> +		res_pem->end = res_pem->start + SZ_64K - 1;
>  		thunder_pem_reserve_range(dev, root->segment, res_pem);
> +		res_pem->end = res_pem->start + SZ_16M - 1;
> +
> +		/* Reserve PCI configuration space as well. */
>  		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
>  	}
>  
> -- 
> 2.7.4
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
@ 2017-04-03 20:18   ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2017-04-03 20:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 31, 2017 at 05:06:44PM +0200, Tomasz Nowicki wrote:
> SZ_16M PEM resource size includes PEM-specific register and its children
> resources. Reservation of the whole SZ_16M range leads to child device
> driver failure when pcieport driver is requesting resources:
> pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
> So we cannot reserve full 16M here and instead we want to reserve
> PEM-specific register only which is SZ_64K.
> 
> At the end increase PEM resource to SZ_16M since this is what
> thunder_pem_init() call expects for proper initialization.
> 
> Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> CC: stable at vger.kernel.org	# v4.10+

Applied to for-linus for v4.11, thanks!

> ---
>  drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
> index b89c373..6e031b5 100644
> --- a/drivers/pci/host/pci-thunder-pem.c
> +++ b/drivers/pci/host/pci-thunder-pem.c
> @@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
>  	index -= node * PEM_MAX_DOM_IN_NODE;
>  	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
>  					FIELD_PREP(PEM_INDX_MASK, index);
> -	res_pem->end = res_pem->start + SZ_16M - 1;
>  	res_pem->flags = IORESOURCE_MEM;
>  }
>  
> @@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
>  	 */
>  	if (ret) {
>  		thunder_pem_legacy_fw(root, res_pem);
> -		/* Reserve PEM-specific resources and PCI configuration space */
> +		/*
> +		 * Reserve 64K size PEM specific resources. The full 16M range
> +		 * size is required for thunder_pem_init() call.
> +		 */
> +		res_pem->end = res_pem->start + SZ_64K - 1;
>  		thunder_pem_reserve_range(dev, root->segment, res_pem);
> +		res_pem->end = res_pem->start + SZ_16M - 1;
> +
> +		/* Reserve PCI configuration space as well. */
>  		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
>  	}
>  
> -- 
> 2.7.4
> 

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

* Re: [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
  2017-04-03 20:18   ` Bjorn Helgaas
@ 2017-04-04  5:12     ` Tomasz Nowicki
  -1 siblings, 0 replies; 7+ messages in thread
From: Tomasz Nowicki @ 2017-04-04  5:12 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Lorenzo.Pieralisi, robert.richter, ddaney, Vadim.Lomovtsev,
	rafael, Sunil.Goutham, geethasowjanya.akula, linu.cherian,
	linux-pci, linux-arm-kernel, linux-acpi

On 03.04.2017 22:18, Bjorn Helgaas wrote:
> On Fri, Mar 31, 2017 at 05:06:44PM +0200, Tomasz Nowicki wrote:
>> SZ_16M PEM resource size includes PEM-specific register and its children
>> resources. Reservation of the whole SZ_16M range leads to child device
>> driver failure when pcieport driver is requesting resources:
>> pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
>> So we cannot reserve full 16M here and instead we want to reserve
>> PEM-specific register only which is SZ_64K.
>>
>> At the end increase PEM resource to SZ_16M since this is what
>> thunder_pem_init() call expects for proper initialization.
>>
>> Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
>> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
>> CC: stable@vger.kernel.org	# v4.10+
>
> Applied to for-linus for v4.11, thanks!

Thanks Bjorn.

Tomasz

>
>> ---
>>  drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
>> index b89c373..6e031b5 100644
>> --- a/drivers/pci/host/pci-thunder-pem.c
>> +++ b/drivers/pci/host/pci-thunder-pem.c
>> @@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
>>  	index -= node * PEM_MAX_DOM_IN_NODE;
>>  	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
>>  					FIELD_PREP(PEM_INDX_MASK, index);
>> -	res_pem->end = res_pem->start + SZ_16M - 1;
>>  	res_pem->flags = IORESOURCE_MEM;
>>  }
>>
>> @@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
>>  	 */
>>  	if (ret) {
>>  		thunder_pem_legacy_fw(root, res_pem);
>> -		/* Reserve PEM-specific resources and PCI configuration space */
>> +		/*
>> +		 * Reserve 64K size PEM specific resources. The full 16M range
>> +		 * size is required for thunder_pem_init() call.
>> +		 */
>> +		res_pem->end = res_pem->start + SZ_64K - 1;
>>  		thunder_pem_reserve_range(dev, root->segment, res_pem);
>> +		res_pem->end = res_pem->start + SZ_16M - 1;
>> +
>> +		/* Reserve PCI configuration space as well. */
>>  		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
>>  	}
>>
>> --
>> 2.7.4
>>

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

* [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case
@ 2017-04-04  5:12     ` Tomasz Nowicki
  0 siblings, 0 replies; 7+ messages in thread
From: Tomasz Nowicki @ 2017-04-04  5:12 UTC (permalink / raw)
  To: linux-arm-kernel

On 03.04.2017 22:18, Bjorn Helgaas wrote:
> On Fri, Mar 31, 2017 at 05:06:44PM +0200, Tomasz Nowicki wrote:
>> SZ_16M PEM resource size includes PEM-specific register and its children
>> resources. Reservation of the whole SZ_16M range leads to child device
>> driver failure when pcieport driver is requesting resources:
>> pcieport 0004:1f:00.0: can't enable device: BAR 0 [mem 0x87e0c0f00000-0x87e0c0ffffff 64bit] not claimed
>> So we cannot reserve full 16M here and instead we want to reserve
>> PEM-specific register only which is SZ_64K.
>>
>> At the end increase PEM resource to SZ_16M since this is what
>> thunder_pem_init() call expects for proper initialization.
>>
>> Fixes: 9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")
>> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
>> CC: stable at vger.kernel.org	# v4.10+
>
> Applied to for-linus for v4.11, thanks!

Thanks Bjorn.

Tomasz

>
>> ---
>>  drivers/pci/host/pci-thunder-pem.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
>> index b89c373..6e031b5 100644
>> --- a/drivers/pci/host/pci-thunder-pem.c
>> +++ b/drivers/pci/host/pci-thunder-pem.c
>> @@ -375,7 +375,6 @@ static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
>>  	index -= node * PEM_MAX_DOM_IN_NODE;
>>  	res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
>>  					FIELD_PREP(PEM_INDX_MASK, index);
>> -	res_pem->end = res_pem->start + SZ_16M - 1;
>>  	res_pem->flags = IORESOURCE_MEM;
>>  }
>>
>> @@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
>>  	 */
>>  	if (ret) {
>>  		thunder_pem_legacy_fw(root, res_pem);
>> -		/* Reserve PEM-specific resources and PCI configuration space */
>> +		/*
>> +		 * Reserve 64K size PEM specific resources. The full 16M range
>> +		 * size is required for thunder_pem_init() call.
>> +		 */
>> +		res_pem->end = res_pem->start + SZ_64K - 1;
>>  		thunder_pem_reserve_range(dev, root->segment, res_pem);
>> +		res_pem->end = res_pem->start + SZ_16M - 1;
>> +
>> +		/* Reserve PCI configuration space as well. */
>>  		thunder_pem_reserve_range(dev, root->segment, &cfg->res);
>>  	}
>>
>> --
>> 2.7.4
>>

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

end of thread, other threads:[~2017-04-04  5:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31 15:06 [PATCH 1/1] PCI: Fix for PEM-specific resource reservation for legacy firmware case Tomasz Nowicki
2017-03-31 15:06 ` Tomasz Nowicki
2017-04-03 20:18 ` Bjorn Helgaas
2017-04-03 20:18   ` Bjorn Helgaas
2017-04-03 20:18   ` Bjorn Helgaas
2017-04-04  5:12   ` Tomasz Nowicki
2017-04-04  5:12     ` Tomasz Nowicki

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.