Patch "PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller" has been added to the 4.10-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller
to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch
and it can be found in the queue-4.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
9abb27c7594a62bbf6385e20b7f5a90b4eceae2fMon Sep 17 00:00:00 2001
From: Tomasz Nowicki <[email protected]>
Date: Thu, 23 Mar 2017 17:10:16 -0500
Subject: PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller
From: Tomasz Nowicki <[email protected]>
commit 9abb27c7594a62bbf6385e20b7f5a90b4eceae2f upstream.
During early days of PCI quirks support, ThunderX firmware did not provide PNP0c02 node with PCI configuration space and PEM-specific register ranges. This means that for legacy FW we are not reserving these resources and cannot gather PEM-specific resources for further PEM initialization.
To support already deployed legacy FW, calculate PEM-specific ranges and provide resources reservation as fallback scenario into PEM driver when we could not gather PEM reg base from ACPI tables.
--- drivers/pci/host/pci-thunder-pem.c | 56 +++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-)
drivers/pci/host/pci-thunder-pem.c +54 -2
@@ -14,6 +14,7 @@* Copyright (C) 2015 - 2016 Cavium, Inc. */ +#include <linux/bitfield.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/of_address.h>
@@ -319,6 +320,50 @@ static int thunder_pem_init(struct devic#if defined(CONFIG_ACPI ) && defined(CONFIG_PCI_QUIRKS ) +#define PEM_RES_BASE 0x87e0c0000000UL +#define PEM_NODE_MASK GENMASK(45, 44) +#define PEM_INDX_MASK GENMASK(26, 24) +#define PEM_MIN_DOM_IN_NODE 4 +#define PEM_MAX_DOM_IN_NODE 10 + +static void thunder_pem_reserve_range (struct device *dev,int seg, +struct resource *r) +{ +resource_size_t start = r->start, end = r->end; +struct resource *res; +const char *regionid; + + regionid =kasprintf (GFP_KERNEL ,"PEM RC:%d" , seg); +if (!regionid) +return ; + + res =request_mem_region (start, end - start +1 , regionid); +if (res) + res->flags &= ~IORESOURCE_BUSY ; +else +kfree (regionid); + +dev_info (dev,"%pR %s reserved\n" , r, + res ?"has been" :"could not be" ); +} + +static void thunder_pem_legacy_fw (struct acpi_pci_root *root, +struct resource *res_pem) +{ +int node =acpi_get_node (root->device->handle); +int index; + +if (node ==NUMA_NO_NODE ) + node =0 ; + + index = root->segment -PEM_MIN_DOM_IN_NODE ; + 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 ; +} +static int thunder_pem_acpi_init (struct pci_config_window *cfg) {struct device *dev = cfg->parent;
@@ -332,9 +377,16 @@ static int thunder_pem_acpi_init(structreturn -ENOMEM ; ret =acpi_get_rc_resources (dev,"CAVA02B" , root->segment, res_pem); + +/* +* If we fail to gather resources it means that we run with old +* FW where we need to calculate PEM-specific resources manually. +*/ if (ret) { -dev_err (dev,"can't get rc base address\n" ); -return ret; +thunder_pem_legacy_fw (root, res_pem); +/* Reserve PEM-specific resources and PCI configuration space */ +thunder_pem_reserve_range (dev, root->segment, res_pem); +thunder_pem_reserve_range (dev, root->segment, &cfg->res); }return thunder_pem_init (dev, cfg, res_pem);
Patches currently in stable-queue which might be from [email protected] are
queue-4.10/pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch queue-4.10/pci-thunder-pem-use-cavium-assigned-hardware-id-for-thunderx-host-controller.patch
Bjorn Helgaas
maintainerI think there's an issue with this one that will be resolved this week. It would be better to wait for that and add both patches to the stable tree at the same time.
Quoted 131 lines · On Mon, Apr 3, 2017 at 5:40 AM, <[email protected]> wrote:
This is a note to let you know that I've just added the patch titled
PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller
to the 4.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch
and it can be found in the queue-4.10 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From
9abb27c7594a62bbf6385e20b7f5a90b4eceae2fMon Sep 17 00:00:00 2001
From: Tomasz Nowicki <[email protected]>
Date: Thu, 23 Mar 2017 17:10:16 -0500
Subject: PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controllerFrom: Tomasz Nowicki <[email protected]>
commit
9abb27c7594a62bbf6385e20b7f5a90b4eceae2fupstream.During early days of PCI quirks support, ThunderX firmware did not provide PNP0c02 node with PCI configuration space and PEM-specific register ranges. This means that for legacy FW we are not reserving these resources and cannot gather PEM-specific resources for further PEM initialization.
To support already deployed legacy FW, calculate PEM-specific ranges and provide resources reservation as fallback scenario into PEM driver when we could not gather PEM reg base from ACPI tables.
Tested-by Robert Richter <[email protected]>Signed-off-by Tomasz Nowicki <[email protected]>Signed-off-by Vadim Lomovtsev <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Acked-by Robert Richter <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/host/pci-thunder-pem.c | 56 +++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-)drivers/pci/host/pci-thunder-pem.c +54
-2@@ -14,6 +14,7 @@* Copyright (C) 2015 - 2016 Cavium, Inc. */ +#include <linux/bitfield.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/of_address.h> @@ -319,6 +320,50 @@ static int thunder_pem_init(struct devic#if defined(CONFIG_ACPI ) && defined(CONFIG_PCI_QUIRKS ) +#define PEM_RES_BASE 0x87e0c0000000UL +#define PEM_NODE_MASK GENMASK(45, 44) +#define PEM_INDX_MASK GENMASK(26, 24) +#define PEM_MIN_DOM_IN_NODE 4 +#define PEM_MAX_DOM_IN_NODE 10 + +static void thunder_pem_reserve_range (struct device *dev,int seg, +struct resource *r) +{ +resource_size_t start = r->start, end = r->end; +struct resource *res; +const char *regionid; + + regionid =kasprintf (GFP_KERNEL ,"PEM RC:%d" , seg); +if (!regionid) +return ; + + res =request_mem_region (start, end - start +1 , regionid); +if (res) + res->flags &= ~IORESOURCE_BUSY ; +else +kfree (regionid); + +dev_info (dev,"%pR %s reserved\n" , r, + res ?"has been" :"could not be" ); +} + +static void thunder_pem_legacy_fw (struct acpi_pci_root *root, +struct resource *res_pem) +{ +int node =acpi_get_node (root->device->handle); +int index; + +if (node ==NUMA_NO_NODE ) + node =0 ; + + index = root->segment -PEM_MIN_DOM_IN_NODE ; + 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 ; +} +static int thunder_pem_acpi_init (struct pci_config_window *cfg) {struct device *dev = cfg->parent;@@ -332,9 +377,16 @@ static int thunder_pem_acpi_init(structreturn -ENOMEM ; ret =acpi_get_rc_resources (dev,"CAVA02B" , root->segment, res_pem); + +/* +* If we fail to gather resources it means that we run with old +* FW where we need to calculate PEM-specific resources manually. +*/ if (ret) { -dev_err (dev,"can't get rc base address\n" ); -return ret; +thunder_pem_legacy_fw (root, res_pem); +/* Reserve PEM-specific resources and PCI configuration space */ +thunder_pem_reserve_range (dev, root->segment, res_pem); +thunder_pem_reserve_range (dev, root->segment, &cfg->res); }return thunder_pem_init (dev, cfg, res_pem);Patches currently in stable-queue which might be from [email protected] are
queue-4.10/pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patchqueue-4.10/pci-thunder-pem-use-cavium-assigned-hardware-id-for-thunderx-host-controller.patch
Greg Kroah-Hartman
maintainerQuoted 3 lines · Bjorn Helgaas
I think there's an issue with this one that will be resolved this week. It would be better to wait for that and add both patches to the stable tree at the same time.
Ok, I'll drop this one now, can someone remind stable@ when the fix goes in to add this patch, and the new one?
thanks,
greg k-h
Bjorn Helgaas
maintainerQuoted 7 lines · Greg Kroah-Hartman
Quoted 3 lines · Bjorn Helgaas
I think there's an issue with this one that will be resolved this week. It would be better to wait for that and add both patches to the stable tree at the same time.
Ok, I'll drop this one now, can someone remind stable@ when the fix goes in to add this patch, and the new one?
This patch (9abb27c7594a ("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")) and feb199ebef48 ("PCI:
thunder-pem: Fix legacy firmware PEM-specific resources"), which appeared in Linus' tree yesterday, should be merged to stable together.
Greg Kroah-Hartman
maintainerQuoted 7 lines · Bjorn Helgaas
Quoted 5 lines · Greg Kroah-Hartman
Quoted 3 lines · Bjorn Helgaas
I think there's an issue with this one that will be resolved this week. It would be better to wait for that and add both patches to the stable tree at the same time.
Quoted 8 lines
Quoted 2 lines
Ok, I'll drop this one now, can someone remind stable@ when the fix goes in to add this patch, and the new one?
This patch (
9abb27c7594a("PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller")) andfeb199ebef48("PCI:
thunder-pem: Fix legacy firmware PEM-specific resources"), which appeared in Linus' tree yesterday, should be merged to stable together.
Thanks for letting me know, now all queued up.
greg k-h