1. 26 9月, 2021 1 次提交
  2. 08 2月, 2021 1 次提交
    • X
      PCI: add a member in 'struct pci_bus' to record the original 'pci_ops' · 8dd667f5
      Xiongfeng Wang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: 47453
      CVE: NA
      
      -------------------------------------------------------------------------
      
      When I test 'aer-inject' with the following procedures:
      1. inject a fatal error into a upstream PCI bridge
      2. remove the upstream bridge by sysfs
      3. rescan the PCI tree by 'echo 1 > /sys/bus/pci/rescan'
      4. execute command 'rmmod aer-inject'
      5. remove the upstream bridge by sysfs again
      
      I came across the following Oops.
      
      [  799.713238] Internal error: Oops: 96000007 [#1] SMP
      [  799.718099] Process bash (pid: 10683, stack limit = 0x00000000125a3b1b)
      [  799.724686] CPU: 108 PID: 10683 Comm: bash Kdump: loaded Not tainted 4.19.36 #2
      [  799.731962] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 1.05 09/18/2019
      [  799.739325] pstate: 40400009 (nZcv daif +PAN -UAO)
      [  799.744104] pc : pci_remove_bus+0xc0/0x1c0
      [  799.748182] lr : pci_remove_bus+0x94/0x1c0
      [  799.752260] sp : ffffa02e335df940
      [  799.755560] x29: ffffa02e335df940 x28: ffff2000088216a8
      [  799.760849] x27: 1ffff405c66bbfbc x26: ffff20000a9518c0
      [  799.766139] x25: ffffa02dea6ec418 x24: 1ffff405bd4dd883
      [  799.771427] x23: ffffa02e72576628 x22: 1ffff405ce4aecc0
      [  799.776715] x21: ffffa02e72576608 x20: ffff200002e75080
      [  799.782003] x19: ffffa02e72576600 x18: 0000000000000000
      [  799.787291] x17: 0000000000000000 x16: 0000000000000000
      [  799.792578] x15: 0000000000000001 x14: dfff200000000000
      [  799.797866] x13: ffff20000a6dfaf0 x12: 0000000000000000
      [  799.803154] x11: 1fffe4000159b217 x10: ffff04000159b217
      [  799.808442] x9 : dfff200000000000 x8 : ffff20000acd90bf
      [  799.813730] x7 : 0000000000000000 x6 : 0000000000000000
      [  799.819017] x5 : 0000000000000001 x4 : 0000000000000000
      [  799.824306] x3 : 1ffff405dbe62603 x2 : 1fffe400005cea11
      [  799.829593] x1 : dfff200000000000 x0 : ffff200002e75088
      [  799.834882] Call trace:
      [  799.837323]  pci_remove_bus+0xc0/0x1c0
      [  799.841056]  pci_remove_bus_device+0xd0/0x2f0
      [  799.845392]  pci_stop_and_remove_bus_device_locked+0x2c/0x40
      [  799.851028]  remove_store+0x1b8/0x1d0
      [  799.854679]  dev_attr_store+0x60/0x80
      [  799.858330]  sysfs_kf_write+0x104/0x170
      [  799.862149]  kernfs_fop_write+0x23c/0x430
      [  799.866143]  __vfs_write+0xec/0x4e0
      [  799.869615]  vfs_write+0x12c/0x3d0
      [  799.873001]  ksys_write+0xd0/0x190
      [  799.876389]  __arm64_sys_write+0x70/0xa0
      [  799.880298]  el0_svc_common+0xfc/0x278
      [  799.884030]  el0_svc_handler+0x50/0xc0
      [  799.887764]  el0_svc+0x8/0xc
      [  799.890634] Code: d2c40001 f2fbffe1 91002280 d343fc02 (38e16841)
      [  799.896700] kernel fault(0x1) notification starting on CPU 108
      
      It is because when we alloc a new bus in rescanning process, the
      'pci_ops' of the newly allocced 'pci_bus' is inherited from its parent
      pci bus. Whereas, the 'pci_ops' of the parent bus may be changed to
      'aer_inj_pci_ops' in 'aer_inject()'. When we unload the module
      'aer_inject', we only restore the 'pci_ops' for the pci bus of the
      error-injected device and the root port in 'aer_inject_exit'. After we
      have unloaded the module, the 'pci_ops' of the newly allocced pci bus is
      still 'aer_inj_pci_ops'. When we access it, an Oops happened.
      
      This patch add a member 'backup_ops' in 'struct pci_bus' to record the
      original 'ops'. When we alloc a child pci bus, we assign the
      'backup_ops' of the parent bus to the 'ops' of the child bus.
      
      Maybe the best way is to not modify the 'pci_ops' in 'struct pci_bus',
      but this will refactor the 'aer_inject' framework a lot. I haven't found
      a better way to handle it.
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
      Signed-off-by: Nyangerkun <yangerkun@huawei.com>
      
      Conflicts:
      	drivers/pci/probe.c
      	include/linux/pci.h
      Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      8dd667f5
  3. 17 10月, 2020 1 次提交
  4. 30 9月, 2020 2 次提交
  5. 22 9月, 2020 1 次提交
  6. 07 9月, 2020 1 次提交
  7. 04 8月, 2020 1 次提交
  8. 30 7月, 2020 1 次提交
  9. 11 7月, 2020 2 次提交
  10. 08 7月, 2020 1 次提交
  11. 01 7月, 2020 1 次提交
  12. 02 6月, 2020 1 次提交
  13. 22 5月, 2020 1 次提交
  14. 20 5月, 2020 1 次提交
  15. 15 5月, 2020 1 次提交
  16. 12 5月, 2020 1 次提交
    • G
      PCI: Replace zero-length array with flexible-array · 914a1951
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language extension
      to the C90 standard, but the preferred mechanism to declare variable-length
      types such as these as a flexible array member [1][2], introduced in C99:
      
        struct foo {
          int stuff;
          struct boo array[];
        };
      
      By making use of the mechanism above, we will get a compiler warning in
      case the flexible array does not occur last in the structure, which will
      help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that dynamic memory allocations won't be affected by this
      change:
      
        Flexible array members have incomplete type, and so the sizeof operator
        may not be applied. As a quirk of the original implementation of
        zero-length arrays, sizeof evaluates to zero. [1]
      
      sizeof(flexible-array-member) triggers a warning because flexible array
      members have incomplete type [1]. There are some instances of code in which
      the sizeof() operator is being incorrectly/erroneously applied to
      zero-length arrays, and the result is zero. Such instances may be hiding
      some bugs. So, this work (flexible-array member conversions) will also help
      to get completely rid of those sorts of issues.
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      
      Link: https://lore.kernel.org/r/20200507190544.GA15633@embeddedorSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      914a1951
  17. 30 3月, 2020 2 次提交
    • I
      PCI: Add support for root bus sizing · 2c8d5a2d
      Ivan Kokshaysky 提交于
      In certain cases we should be able to enumerate IO and MEM ranges of all
      PCI devices installed in the system, and then set respective host bridge
      apertures basing on calculated size and alignment.  Particularly when
      firmware is broken and fails to assign bridge windows properly, like on
      Alpha UP1500 platform.
      
      Actually, almost everything is already in place, and required changes are
      minimal:
      
      - add "size_windows" flag to struct pci_host_bridge: when set, it
        instructs __pci_bus_size_bridges() to continue with the root bus;
      - in the __pci_bus_size_bridges() path: add checks for bus->self,
        as it can legitimately be null for the root bus.
      
      Link: https://lore.kernel.org/r/20200314194355.GA12510@mail.rc.ruTested-by: NMatt Turner <mattst88@gmail.com>
      Signed-off-by: NIvan Kokshaysky <ink@jurassic.park.msu.ru>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      2c8d5a2d
    • M
      PCI: Use ioremap(), not phys_to_virt() for platform ROM · 72e0ef0e
      Mikel Rychliski 提交于
      On some EFI systems, the video BIOS is provided by the EFI firmware.  The
      boot stub code stores the physical address of the ROM image in pdev->rom.
      Currently we attempt to access this pointer using phys_to_virt(), which
      doesn't work with CONFIG_HIGHMEM.
      
      On these systems, attempting to load the radeon module on a x86_32 kernel
      can result in the following:
      
        BUG: unable to handle page fault for address: 3e8ed03c
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        *pde = 00000000
        Oops: 0000 [#1] PREEMPT SMP
        CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
        Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS     MP11.88Z.005C.B08.0707021221 07/02/07
        EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
        Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
        EAX: 3e8ed03c EBX: 00000000 ECX: 3e8ed03c EDX: 00010000
        ESI: 00040000 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
        DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
        CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 000006d0
        Call Trace:
         r520_init+0x26/0x240 [radeon]
         radeon_device_init+0x533/0xa50 [radeon]
         radeon_driver_load_kms+0x80/0x220 [radeon]
         drm_dev_register+0xa7/0x180 [drm]
         radeon_pci_probe+0x10f/0x1a0 [radeon]
         pci_device_probe+0xd4/0x140
      
      Fix the issue by updating all drivers which can access a platform provided
      ROM. Instead of calling the helper function pci_platform_rom() which uses
      phys_to_virt(), call ioremap() directly on the pdev->rom.
      
      radeon_read_platform_bios() previously directly accessed an __iomem
      pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().
      
      pci_platform_rom() now has no remaining callers, so remove it.
      
      Link: https://lore.kernel.org/r/20200319021623.5426-1-mikel@mikelr.comSigned-off-by: NMikel Rychliski <mikel@mikelr.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NAlex Deucher <alexander.deucher@amd.com>
      72e0ef0e
  18. 29 3月, 2020 2 次提交
  19. 28 3月, 2020 1 次提交
  20. 11 3月, 2020 1 次提交
    • B
      PCI: Add pci_speed_string() · e56faff5
      Bjorn Helgaas 提交于
      Add pci_speed_string() to return a text description of the supplied bus or
      link speed.  The slot code previously used the private
      pci_bus_speed_strings[] array for this purpose, but adding this interface
      will enable us to consolidate similar code elsewhere.
      
      Export pcie_link_speed[] and pci_speed_string() so they can be used by
      modules.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      e56faff5
  21. 06 3月, 2020 1 次提交
  22. 05 3月, 2020 2 次提交
  23. 25 1月, 2020 1 次提交
  24. 19 12月, 2019 1 次提交
  25. 27 11月, 2019 1 次提交
  26. 21 11月, 2019 5 次提交
  27. 21 10月, 2019 2 次提交
  28. 16 10月, 2019 3 次提交