1. 19 7月, 2018 1 次提交
    • S
      PCI: designware: Fix I/O space page leak · fd07f5e1
      Sergei Shtylyov 提交于
      When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY
      driver is left disabled, the kernel crashed with this BUG:
      
        kernel BUG at lib/ioremap.c:72!
        Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
        Modules linked in:
        CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
        Hardware name: Renesas Condor board based on r8a77980 (DT)
        Workqueue: events deferred_probe_work_func
        pstate: 80000005 (Nzcv daif -PAN -UAO)
        pc : ioremap_page_range+0x370/0x3c8
        lr : ioremap_page_range+0x40/0x3c8
        sp : ffff000008da39e0
        x29: ffff000008da39e0 x28: 00e8000000000f07
        x27: ffff7dfffee00000 x26: 0140000000000000
        x25: ffff7dfffef00000 x24: 00000000000fe100
        x23: ffff80007b906000 x22: ffff000008ab8000
        x21: ffff000008bb1d58 x20: ffff7dfffef00000
        x19: ffff800009c30fb8 x18: 0000000000000001
        x17: 00000000000152d0 x16: 00000000014012d0
        x15: 0000000000000000 x14: 0720072007200720
        x13: 0720072007200720 x12: 0720072007200720
        x11: 0720072007300730 x10: 00000000000000ae
        x9 : 0000000000000000 x8 : ffff7dffff000000
        x7 : 0000000000000000 x6 : 0000000000000100
        x5 : 0000000000000000 x4 : 000000007b906000
        x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
        x1 : 0000000040000000 x0 : 00e80000fe100f07
        Process kworker/0:1 (pid: 39, stack limit = 0x        (ptrval))
        Call trace:
         ioremap_page_range+0x370/0x3c8
         pci_remap_iospace+0x7c/0xac
         pci_parse_request_of_pci_ranges+0x13c/0x190
         rcar_pcie_probe+0x4c/0xb04
         platform_drv_probe+0x50/0xbc
         driver_probe_device+0x21c/0x308
         __device_attach_driver+0x98/0xc8
         bus_for_each_drv+0x54/0x94
         __device_attach+0xc4/0x12c
         device_initial_probe+0x10/0x18
         bus_probe_device+0x90/0x98
         deferred_probe_work_func+0xb0/0x150
         process_one_work+0x12c/0x29c
         worker_thread+0x200/0x3fc
         kthread+0x108/0x134
         ret_from_fork+0x10/0x18
        Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)
      
      It turned out that pci_remap_iospace() wasn't undone when the driver's
      probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER,
      the probe was retried, finally causing the BUG due to trying to remap
      already remapped pages.
      
      The DesignWare PCIe controller driver has the same issue.
      
      Replace devm_pci_remap_iospace() with a devm_ managed version to fix the
      bug.
      
      Fixes: cbce7900 ("PCI: designware: Make driver arch-agnostic")
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      [lorenzo.pieralisi@arm.com: updated the commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NJingoo Han <jingoohan1@gmail.com>
      fd07f5e1
  2. 08 6月, 2018 1 次提交
  3. 31 5月, 2018 2 次提交
  4. 15 5月, 2018 4 次提交
  5. 08 3月, 2018 1 次提交
    • K
      PCI: dwc: Fix enumeration end when reaching root subordinate · fc110ebd
      Koen Vandeputte 提交于
      The subordinate value indicates the highest bus number which can be
      reached downstream though a certain device.
      
      Commit a20c7f36 ("PCI: Do not allocate more buses than available in
      parent") ensures that downstream devices cannot assign busnumbers higher
      than the upstream device subordinate number, which was indeed illogical.
      
      By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a
      value of 0x01.
      
      Due to this combined with above commit, enumeration stops digging deeper
      downstream as soon as bus num 0x01 has been assigned, which is always the
      case for a bridge device.
      
      This results in all devices behind a bridge bus remaining undetected, as
      these would be connected to bus 0x02 or higher.
      
      Fix this by initializing the RC to a subordinate value of 0xff, which is
      not altering hardware behaviour in any way, but informs probing function
      pci_scan_bridge() later on which reads this value back from register.
      
      The following nasty errors during boot are also fixed by this:
      
        pci_bus 0000:02: busn_res: can not insert [bus 02-ff] under [bus 01] (conflicts with (null) [bus 01])
        ...
        pci_bus 0000:03: [bus 03] partially hidden behind bridge 0000:01 [bus 01]
        ...
        pci_bus 0000:04: [bus 04] partially hidden behind bridge 0000:01 [bus 01]
        ...
        pci_bus 0000:05: [bus 05] partially hidden behind bridge 0000:01 [bus 01]
        pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 05
        pci_bus 0000:02: busn_res: can not insert [bus 02-05] under [bus 01] (conflicts with (null) [bus 01])
        pci_bus 0000:02: [bus 02-05] partially hidden behind bridge 0000:01 [bus 01]
      
      Fixes: a20c7f36 ("PCI: Do not allocate more buses than available in
      parent")
      Tested-by: NNiklas Cassel <niklas.cassel@axis.com>
      Tested-by: NFabio Estevam <fabio.estevam@nxp.com>
      Tested-by: NSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: NKoen Vandeputte <koen.vandeputte@ncentric.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NLucas Stach <l.stach@pengutronix.de>
      Cc: stable@vger.kernel.org	# v4.15+
      Cc: Binghui Wang <wangbinghui@hisilicon.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Jianguo Sun <sunjianguo1@huawei.com>
      Cc: Jingoo Han <jingoohan1@gmail.com>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Minghuan Lian <minghuan.Lian@freescale.com>
      Cc: Mingkai Hu <mingkai.hu@freescale.com>
      Cc: Murali Karicheri <m-karicheri2@ti.com>
      Cc: Pratyush Anand <pratyush.anand@gmail.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: Roy Zang <tie-fei.zang@freescale.com>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Xiaowei Song <songxiaowei@hisilicon.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      fc110ebd
  6. 07 3月, 2018 1 次提交
    • K
      PCI: dwc: Fix enumeration end when reaching root subordinate · c2deae44
      Koen Vandeputte 提交于
      The subordinate value indicates the highest bus number which can be
      reached downstream though a certain device.
      
      Commit a20c7f36 ("PCI: Do not allocate more buses than available in
      parent")
      ensures that downstream devices cannot assign busnumbers higher than the
      upstream device subordinate number, which was indeed illogical.
      
      By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a
      value of 0x01.
      
      Due to this combined with above commit, enumeration stops digging deeper
      downstream as soon as bus num 0x01 has been assigned, which is always
      the case for a bridge device.
      
      This results in all devices behind a bridge bus to remain undetected, as
      these would be connected to bus 0x02 or higher.
      
      Fix this by initializing the RC to a subordinate value of 0xff, which is
      not altering hardware behaviour in any way, but informs probing
      function pci_scan_bridge() later on which reads this value back from
      register.
      
      Following nasty errors during boot are also fixed by this:
      
      [    0.459145] pci_bus 0000:02: busn_res: can not insert [bus 02-ff]
      under [bus 01] (conflicts with (null) [bus 01])
      ...
      [    0.464515] pci_bus 0000:03: [bus 03] partially hidden behind bridge
      0000:01 [bus 01]
      ...
      [    0.464892] pci_bus 0000:04: [bus 04] partially hidden behind bridge
      0000:01 [bus 01]
      ...
      [    0.466488] pci_bus 0000:05: [bus 05] partially hidden behind bridge
      0000:01 [bus 01]
      [    0.466506] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to
      05
      [    0.466517] pci_bus 0000:02: busn_res: can not insert [bus 02-05]
      under [bus 01] (conflicts with (null) [bus 01])
      [    0.466534] pci_bus 0000:02: [bus 02-05] partially hidden behind
      bridge 0000:01 [bus 01]
      
      Fixes: a20c7f36 ("PCI: Do not allocate more buses than available in
      parent")
      Tested-by: NNiklas Cassel <niklas.cassel@axis.com>
      Tested-by: NFabio Estevam <fabio.estevam@nxp.com>
      Tested-by: NSebastian Reichel <sebastian.reichel@collabora.co.uk>
      Signed-off-by: NKoen Vandeputte <koen.vandeputte@ncentric.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NLucas Stach <l.stach@pengutronix.de>
      Cc: <stable@vger.kernel.org> # 4.15
      Cc: Binghui Wang <wangbinghui@hisilicon.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Jianguo Sun <sunjianguo1@huawei.com>
      Cc: Jingoo Han <jingoohan1@gmail.com>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Minghuan Lian <minghuan.Lian@freescale.com>
      Cc: Mingkai Hu <mingkai.hu@freescale.com>
      Cc: Murali Karicheri <m-karicheri2@ti.com>
      Cc: Pratyush Anand <pratyush.anand@gmail.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: Roy Zang <tie-fei.zang@freescale.com>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Xiaowei Song <songxiaowei@hisilicon.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      c2deae44
  7. 06 3月, 2018 3 次提交
  8. 29 1月, 2018 1 次提交
  9. 21 12月, 2017 1 次提交
  10. 02 9月, 2017 1 次提交
  11. 30 8月, 2017 1 次提交
  12. 23 8月, 2017 1 次提交
  13. 04 8月, 2017 1 次提交
  14. 03 7月, 2017 2 次提交
  15. 25 4月, 2017 1 次提交
  16. 04 4月, 2017 2 次提交
  17. 22 2月, 2017 8 次提交
  18. 10 1月, 2017 1 次提交
    • M
      PCI: designware: Check for iATU unroll only on platforms that use ATU · a782b5f9
      Murali Karicheri 提交于
      Previously we checked for iATU unroll support by reading PCIE_ATU_VIEWPORT
      even on platforms, e.g., Keystone, that do not have ATU ports.  This can
      cause bad behavior such as asynchronous external aborts:
      
        OF: PCI:   MEM 0x60000000..0x6fffffff -> 0x60000000
        Unhandled fault: asynchronous external abort (0x1211) at 0x00000000
        pgd = c0003000
        [00000000] *pgd=80000800004003, *pmd=00000000
        Internal error: : 1211 [#1] PREEMPT SMP ARM
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-00009-g6ff59d2-dirty #7
        Hardware name: Keystone
        task: eb878000 task.stack: eb866000
        PC is at dw_pcie_setup_rc+0x24/0x380
        LR is at ks_pcie_host_init+0x10/0x170
      
      Move the dw_pcie_iatu_unroll_enabled() check so we only call it on
      platforms that do not use the ATU.  These platforms supply their own
      ->rd_other_conf() and ->wr_other_conf() methods.
      
      [bhelgaas: changelog]
      Fixes: a0601a47 ("PCI: designware: Add iATU Unroll feature")
      Fixes: 416379f9 ("PCI: designware: Check for iATU unroll support after initializing host")
      Tested-by: NKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: NMurali Karicheri <m-karicheri2@ti.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-By: NJoao Pinto <jpinto@synopsys.com>
      CC: stable@vger.kernel.org	# v4.9+
      a782b5f9
  19. 05 11月, 2016 1 次提交
  20. 11 10月, 2016 6 次提交