diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-26 13:51:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-26 13:51:18 -0400 |
commit | 6ce47829113772b1d6b9046f5eaf00e154f0f9de (patch) | |
tree | 174aada47d7d2bc1839f271fe0fcbb13bb4a0343 | |
parent | 80941b2aebd3433594886d7774220c71c2d7ceec (diff) | |
parent | 4d071c3238987325b9e50e33051a40d1cce311cc (diff) |
Merge tag 'pci-v4.12-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas:
- fix PCI_ENDPOINT build error (merged for v4.12)
- fix Switchtec driver (merged for v4.12)
- fix imx6 config read timeouts, fallout from changing to non-postable
reads
- add PM "needs_resume" flag for i915 suspend issue
* tag 'pci-v4.12-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
PCI/PM: Add needs_resume flag to avoid suspend complete optimization
PCI: imx6: Fix config read timeout handling
switchtec: Fix minor bug with partition ID register
switchtec: Use new cdev_device_add() helper function
PCI: endpoint: Make PCI_ENDPOINT depend on HAS_DMA
-rw-r--r-- | drivers/pci/dwc/pci-imx6.c | 33 | ||||
-rw-r--r-- | drivers/pci/endpoint/Kconfig | 1 | ||||
-rw-r--r-- | drivers/pci/pci.c | 3 | ||||
-rw-r--r-- | drivers/pci/switch/switchtec.c | 16 | ||||
-rw-r--r-- | include/linux/pci.h | 5 |
5 files changed, 44 insertions, 14 deletions
diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c index a98cba55c7f0..19a289b8cc94 100644 --- a/drivers/pci/dwc/pci-imx6.c +++ b/drivers/pci/dwc/pci-imx6.c | |||
@@ -252,7 +252,34 @@ static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) | |||
252 | static int imx6q_pcie_abort_handler(unsigned long addr, | 252 | static int imx6q_pcie_abort_handler(unsigned long addr, |
253 | unsigned int fsr, struct pt_regs *regs) | 253 | unsigned int fsr, struct pt_regs *regs) |
254 | { | 254 | { |
255 | return 0; | 255 | unsigned long pc = instruction_pointer(regs); |
256 | unsigned long instr = *(unsigned long *)pc; | ||
257 | int reg = (instr >> 12) & 15; | ||
258 | |||
259 | /* | ||
260 | * If the instruction being executed was a read, | ||
261 | * make it look like it read all-ones. | ||
262 | */ | ||
263 | if ((instr & 0x0c100000) == 0x04100000) { | ||
264 | unsigned long val; | ||
265 | |||
266 | if (instr & 0x00400000) | ||
267 | val = 255; | ||
268 | else | ||
269 | val = -1; | ||
270 | |||
271 | regs->uregs[reg] = val; | ||
272 | regs->ARM_pc += 4; | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | if ((instr & 0x0e100090) == 0x00100090) { | ||
277 | regs->uregs[reg] = -1; | ||
278 | regs->ARM_pc += 4; | ||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | return 1; | ||
256 | } | 283 | } |
257 | 284 | ||
258 | static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) | 285 | static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) |
@@ -819,8 +846,8 @@ static int __init imx6_pcie_init(void) | |||
819 | * we can install the handler here without risking it | 846 | * we can install the handler here without risking it |
820 | * accessing some uninitialized driver state. | 847 | * accessing some uninitialized driver state. |
821 | */ | 848 | */ |
822 | hook_fault_code(16 + 6, imx6q_pcie_abort_handler, SIGBUS, 0, | 849 | hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0, |
823 | "imprecise external abort"); | 850 | "external abort on non-linefetch"); |
824 | 851 | ||
825 | return platform_driver_register(&imx6_pcie_driver); | 852 | return platform_driver_register(&imx6_pcie_driver); |
826 | } | 853 | } |
diff --git a/drivers/pci/endpoint/Kconfig b/drivers/pci/endpoint/Kconfig index c23f146fb5a6..c09623ca8c3b 100644 --- a/drivers/pci/endpoint/Kconfig +++ b/drivers/pci/endpoint/Kconfig | |||
@@ -6,6 +6,7 @@ menu "PCI Endpoint" | |||
6 | 6 | ||
7 | config PCI_ENDPOINT | 7 | config PCI_ENDPOINT |
8 | bool "PCI Endpoint Support" | 8 | bool "PCI Endpoint Support" |
9 | depends on HAS_DMA | ||
9 | help | 10 | help |
10 | Enable this configuration option to support configurable PCI | 11 | Enable this configuration option to support configurable PCI |
11 | endpoint. This should be enabled if the platform has a PCI | 12 | endpoint. This should be enabled if the platform has a PCI |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b01bd5bba8e6..563901cd9c06 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2144,7 +2144,8 @@ bool pci_dev_keep_suspended(struct pci_dev *pci_dev) | |||
2144 | 2144 | ||
2145 | if (!pm_runtime_suspended(dev) | 2145 | if (!pm_runtime_suspended(dev) |
2146 | || pci_target_state(pci_dev) != pci_dev->current_state | 2146 | || pci_target_state(pci_dev) != pci_dev->current_state |
2147 | || platform_pci_need_resume(pci_dev)) | 2147 | || platform_pci_need_resume(pci_dev) |
2148 | || (pci_dev->dev_flags & PCI_DEV_FLAGS_NEEDS_RESUME)) | ||
2148 | return false; | 2149 | return false; |
2149 | 2150 | ||
2150 | /* | 2151 | /* |
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index cc6e085008fb..f6a63406c76e 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c | |||
@@ -1291,7 +1291,6 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) | |||
1291 | cdev = &stdev->cdev; | 1291 | cdev = &stdev->cdev; |
1292 | cdev_init(cdev, &switchtec_fops); | 1292 | cdev_init(cdev, &switchtec_fops); |
1293 | cdev->owner = THIS_MODULE; | 1293 | cdev->owner = THIS_MODULE; |
1294 | cdev->kobj.parent = &dev->kobj; | ||
1295 | 1294 | ||
1296 | return stdev; | 1295 | return stdev; |
1297 | 1296 | ||
@@ -1442,12 +1441,15 @@ static int switchtec_init_pci(struct switchtec_dev *stdev, | |||
1442 | stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; | 1441 | stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; |
1443 | stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; | 1442 | stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET; |
1444 | stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; | 1443 | stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET; |
1445 | stdev->partition = ioread8(&stdev->mmio_ntb->partition_id); | 1444 | stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id); |
1446 | stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); | 1445 | stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count); |
1447 | stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; | 1446 | stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET; |
1448 | stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; | 1447 | stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition]; |
1449 | stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; | 1448 | stdev->mmio_pff_csr = stdev->mmio + SWITCHTEC_GAS_PFF_CSR_OFFSET; |
1450 | 1449 | ||
1450 | if (stdev->partition_count < 1) | ||
1451 | stdev->partition_count = 1; | ||
1452 | |||
1451 | init_pff(stdev); | 1453 | init_pff(stdev); |
1452 | 1454 | ||
1453 | pci_set_drvdata(pdev, stdev); | 1455 | pci_set_drvdata(pdev, stdev); |
@@ -1479,11 +1481,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev, | |||
1479 | SWITCHTEC_EVENT_EN_IRQ, | 1481 | SWITCHTEC_EVENT_EN_IRQ, |
1480 | &stdev->mmio_part_cfg->mrpc_comp_hdr); | 1482 | &stdev->mmio_part_cfg->mrpc_comp_hdr); |
1481 | 1483 | ||
1482 | rc = cdev_add(&stdev->cdev, stdev->dev.devt, 1); | 1484 | rc = cdev_device_add(&stdev->cdev, &stdev->dev); |
1483 | if (rc) | ||
1484 | goto err_put; | ||
1485 | |||
1486 | rc = device_add(&stdev->dev); | ||
1487 | if (rc) | 1485 | if (rc) |
1488 | goto err_devadd; | 1486 | goto err_devadd; |
1489 | 1487 | ||
@@ -1492,7 +1490,6 @@ static int switchtec_pci_probe(struct pci_dev *pdev, | |||
1492 | return 0; | 1490 | return 0; |
1493 | 1491 | ||
1494 | err_devadd: | 1492 | err_devadd: |
1495 | cdev_del(&stdev->cdev); | ||
1496 | stdev_kill(stdev); | 1493 | stdev_kill(stdev); |
1497 | err_put: | 1494 | err_put: |
1498 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); | 1495 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); |
@@ -1506,8 +1503,7 @@ static void switchtec_pci_remove(struct pci_dev *pdev) | |||
1506 | 1503 | ||
1507 | pci_set_drvdata(pdev, NULL); | 1504 | pci_set_drvdata(pdev, NULL); |
1508 | 1505 | ||
1509 | device_del(&stdev->dev); | 1506 | cdev_device_del(&stdev->cdev, &stdev->dev); |
1510 | cdev_del(&stdev->cdev); | ||
1511 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); | 1507 | ida_simple_remove(&switchtec_minor_ida, MINOR(stdev->dev.devt)); |
1512 | dev_info(&stdev->dev, "unregistered.\n"); | 1508 | dev_info(&stdev->dev, "unregistered.\n"); |
1513 | 1509 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index fc2e832d7b9c..8039f9f0ca05 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -183,6 +183,11 @@ enum pci_dev_flags { | |||
183 | PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9), | 183 | PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9), |
184 | /* Do not use FLR even if device advertises PCI_AF_CAP */ | 184 | /* Do not use FLR even if device advertises PCI_AF_CAP */ |
185 | PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), | 185 | PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), |
186 | /* | ||
187 | * Resume before calling the driver's system suspend hooks, disabling | ||
188 | * the direct_complete optimization. | ||
189 | */ | ||
190 | PCI_DEV_FLAGS_NEEDS_RESUME = (__force pci_dev_flags_t) (1 << 11), | ||
186 | }; | 191 | }; |
187 | 192 | ||
188 | enum pci_irq_reroute_variant { | 193 | enum pci_irq_reroute_variant { |