diff options
author | Tomasz Nowicki <tn@semihalf.com> | 2017-03-31 11:06:44 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-04-03 16:10:21 -0400 |
commit | feb199ebef488a9f2c3550fb10524f3dac9d8abe (patch) | |
tree | 550c2cf1c487f1ddfacdb634e1c1f04489ae21b2 | |
parent | 9abb27c7594a62bbf6385e20b7f5a90b4eceae2f (diff) |
PCI: thunder-pem: Fix legacy firmware PEM-specific resources
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>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org # v4.10+
-rw-r--r-- | drivers/pci/host/pci-thunder-pem.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c index b89c373555c5..6e031b522529 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, | |||
375 | index -= node * PEM_MAX_DOM_IN_NODE; | 375 | index -= node * PEM_MAX_DOM_IN_NODE; |
376 | res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) | | 376 | res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) | |
377 | FIELD_PREP(PEM_INDX_MASK, index); | 377 | FIELD_PREP(PEM_INDX_MASK, index); |
378 | res_pem->end = res_pem->start + SZ_16M - 1; | ||
379 | res_pem->flags = IORESOURCE_MEM; | 378 | res_pem->flags = IORESOURCE_MEM; |
380 | } | 379 | } |
381 | 380 | ||
@@ -399,8 +398,15 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg) | |||
399 | */ | 398 | */ |
400 | if (ret) { | 399 | if (ret) { |
401 | thunder_pem_legacy_fw(root, res_pem); | 400 | thunder_pem_legacy_fw(root, res_pem); |
402 | /* Reserve PEM-specific resources and PCI configuration space */ | 401 | /* |
402 | * Reserve 64K size PEM specific resources. The full 16M range | ||
403 | * size is required for thunder_pem_init() call. | ||
404 | */ | ||
405 | res_pem->end = res_pem->start + SZ_64K - 1; | ||
403 | thunder_pem_reserve_range(dev, root->segment, res_pem); | 406 | thunder_pem_reserve_range(dev, root->segment, res_pem); |
407 | res_pem->end = res_pem->start + SZ_16M - 1; | ||
408 | |||
409 | /* Reserve PCI configuration space as well. */ | ||
404 | thunder_pem_reserve_range(dev, root->segment, &cfg->res); | 410 | thunder_pem_reserve_range(dev, root->segment, &cfg->res); |
405 | } | 411 | } |
406 | 412 | ||