1. 24 Feb, 2012 15 commits
  2. 23 Feb, 2012 11 commits
  3. 17 Feb, 2012 3 commits
  4. 14 Feb, 2012 11 commits
    • Thomas Jarosch's avatar
      PCI: Add quirk for still enabled interrupts on Intel Sandy Bridge GPUs · f67fd55f
      Thomas Jarosch authored
      Some BIOS implementations leave the Intel GPU interrupts enabled,
      even though no one is handling them (f.e. i915 driver is never loaded).
      Additionally the interrupt destination is not set up properly
      and the interrupt ends up -somewhere-.
      
      These spurious interrupts are "sticky" and the kernel disables
      the (shared) interrupt line after 100.000+ generated interrupts.
      
      Fix it by disabling the still enabled interrupts.
      This resolves crashes often seen on monitor unplug.
      
      Tested on the following boards:
      - Intel DH61CR: Affected
      - Intel DH67BL: Affected
      - Intel S1200KP server board: Affected
      - Asus P8H61-M LE: Affected, but system does not crash.
        Probably the IRQ ends up somewhere unnoticed.
      
      According to reports on the net, the Intel DH61WW board is also affected.
      
      Many thanks to Jesse Barnes from Intel for helping
      with the register configuration and to Intel in general
      for providing public hardware documentation.
      Signed-off-by: default avatarThomas Jarosch <thomas.jarosch@intra2net.com>
      Tested-by: default avatarCharlie Suffin <charlie.suffin@stratus.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      f67fd55f
    • Arjan van de Ven's avatar
      PCI: Annotate PCI quirks in initcall_debug style · 3209874a
      Arjan van de Ven authored
      While diagnosing some boot time issues on a platform, all that I
      could see in the bootgraph/dmesg was that the system was spending
      a lot of time in applying one or more PCI quirks... which
      was virtually undebuggable.
      
      This patch adds printk's in "initcall_debug" style to the dmesg,
      which are added when the user asks for the initcall_debug
      (the nr one tool to use when debugging boot hangs or boot time issues)
      kernel command line option.
      
      v2: add #includes so quirks can build on non-x86
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      3209874a
    • Danny Kukawka's avatar
      PCI hotplug: cpcihp: fix debug module parameter to be bool · 309c6651
      Danny Kukawka authored
      Fix debug variable from module parameter to be really bool to
      fix 'warning: return from incompatible pointer type'.
      Acked-by: default avatarScott Murray <scott@spiteful.org>
      Signed-off-by: default avatarDanny Kukawka <danny.kukawka@bisect.de>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      309c6651
    • Kay, Allen M's avatar
      PCI: check for pci bar restore completion and retry · 26f41062
      Kay, Allen M authored
      On some OEM systems, pci_restore_state() is called while FLR has not yet
      completed.  As a result, PCI BAR register restore is not successful.  This fix
      reads back the restored value and compares it with saved value and re-tries 10
      times before giving up.
      Signed-off-by: default avatarJean Guyader <jean.guyader@eu.citrix.com>
      Signed-off-by: default avatarEric Chanudet <eric.chanudet@citrix.com>
      Signed-off-by: default avatarAllen Kay <allen.m.kay@intel.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      26f41062
    • Yinghai Lu's avatar
      PCI: pciehp: Disable/enable link during slot power off/on · 2debd928
      Yinghai Lu authored
      On a system with a repeater on the system board to support gen2 hotplug,
      we found that when an ExpressModule is removed from some slots,
      /var/log/messages will be full of "card present/not present" warnings.
      
      It turns out the root complex is continually trying to train the link to
      the repeater because the repeater has not been reset.
      
      This patch will disable the link at removal time to allow the repeater
      to be reset properly.  This also prevents a potential AER message at
      removal time.
      
      Also, when testing hotplug on a system under development, we found if we
      boot the system without an EM installed, and later hot-add an EM, it
      does not work with Linux, but another OS is ok.  The root cause is that
      BIOS left link disabled when slot was empty at boot time, and other OS
      is modifying the link disable bit in link ctrl during power on/off.
      
      So we should do the same thing to disable/enable link during power off/on.
      
      -v2: check link DLLA bit instead of 100ms waiting.
           Separate link disable/enable functions to another patch.
      Signed-off-by: default avatarYinghai Lu <yinghai.lu@oracle.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      2debd928
    • Yinghai Lu's avatar
      PCI: pciehp: Add Disable/enable link functions · 7f822999
      Yinghai Lu authored
      Will use it during power off/on of slots
      Signed-off-by: default avatarYinghai Lu <yinghai.lu@oracle.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      7f822999
    • Yinghai Lu's avatar
      PCI: pciehp: Add pcie_wait_link_not_active() · bffe4f72
      Yinghai Lu authored
      Will use it for link disable status checking.
      Signed-off-by: default avatarYinghai Lu <yinghai.lu@oracle.com>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      bffe4f72
    • Yinghai Lu's avatar
      PCI: pciehp: make check_link_active more helpful · 4e2ce405
      Yinghai Lu authored
      A few changes:
        - remove the 'inline' and let the complier decide
        - return a bool to indicate whether the link was active
        - add a debug message to indicate link state when it beocmes active
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      4e2ce405
    • Yinghai Lu's avatar
      PCI: pciehp: replace unconditional sleep with config space access check · 2f5d8e4f
      Yinghai Lu authored
      During reviewing
      |	PCI: pciehp: wait 1000 ms before Link Training check
      Linus said:
      >...
      > That's a *long* time, and it's irritating to the user. It makes the
      > user think "the machine is slow".
      >...
      > And quite frankly, an unconditional one-second delay here seems bad.
      >Two seconds was unacceptable, one second is just bad.
      
      Try to access the pci conf of a pci device that is supposed to show up
      in 1s.  If we can read back a valid vendor/device id, we can return
      early.
      
      Related discussion could be found:
      	https://lkml.org/lkml/2011/12/6/339
      
      -v2: seperate code to pci_bus_read_dev_vendor_id() from pci_scan_device()
          and reuse it from pciehp code. Suggested by Matthew Wilcox.
      -v3: According to Kenj, don't use array in stack, and don't wait too long
          for crs, also return fail status if not found.
          Also separate pci_bus_dev_read_vendor_id() change to another patch.
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      2f5d8e4f
    • Yinghai Lu's avatar
      PCI: Separate pci_bus_read_dev_vendor_id from pci_scan_device · efdc87da
      Yinghai Lu authored
      We can reuse it for pciehp probing.
      
      -v2: according to Kenji, fix crs timeout checking, and export the function
           for later use when pciehp is compiled as a module.
      Suggested-by: default avatarMatthew Wilcox <matthew@wil.cx>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      efdc87da
    • Yinghai Lu's avatar
      PCI: make sriov work with hotplug remove · ac205b7b
      Yinghai Lu authored
      When hot removing a pci express module that has a pcie switch and supports
      SRIOV, we got:
      
      [ 5918.610127] pciehp 0000:80:02.2:pcie04: pcie_isr: intr_loc 1
      [ 5918.615779] pciehp 0000:80:02.2:pcie04: Attention button interrupt received
      [ 5918.622730] pciehp 0000:80:02.2:pcie04: Button pressed on Slot(3)
      [ 5918.629002] pciehp 0000:80:02.2:pcie04: pciehp_get_power_status: SLOTCTRL a8 value read 1f9
      [ 5918.637416] pciehp 0000:80:02.2:pcie04: PCI slot #3 - powering off due to button press.
      [ 5918.647125] pciehp 0000:80:02.2:pcie04: pcie_isr: intr_loc 10
      [ 5918.653039] pciehp 0000:80:02.2:pcie04: pciehp_green_led_blink: SLOTCTRL a8 write cmd 200
      [ 5918.661229] pciehp 0000:80:02.2:pcie04: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0
      [ 5924.667627] pciehp 0000:80:02.2:pcie04: Disabling domain:bus:device=0000:b0:00
      [ 5924.674909] pciehp 0000:80:02.2:pcie04: pciehp_get_power_status: SLOTCTRL a8 value read 2f9
      [ 5924.683262] pciehp 0000:80:02.2:pcie04: pciehp_unconfigure_device: domain:bus:dev = 0000:b0:00
      [ 5924.693976] libfcoe_device_notification: NETDEV_UNREGISTER eth6
      [ 5924.764979] libfcoe_device_notification: NETDEV_UNREGISTER eth14
      [ 5924.873539] libfcoe_device_notification: NETDEV_UNREGISTER eth15
      [ 5924.995209] libfcoe_device_notification: NETDEV_UNREGISTER eth16
      [ 5926.114407] sxge 0000:b2:00.0: PCI INT A disabled
      [ 5926.119342] BUG: unable to handle kernel NULL pointer dereference at (null)
      [ 5926.127189] IP: [<ffffffff81353a3b>] pci_stop_bus_device+0x33/0x83
      [ 5926.133377] PGD 0
      [ 5926.135402] Oops: 0000 [#1] SMP
      [ 5926.138659] CPU 2
      [ 5926.140499] Modules linked in:
      ...
      [ 5926.143754]
      [ 5926.275823] Call Trace:
      [ 5926.278267]  [<ffffffff81353a38>] pci_stop_bus_device+0x30/0x83
      [ 5926.284180]  [<ffffffff81353af4>] pci_remove_bus_device+0x1a/0xba
      [ 5926.290264]  [<ffffffff81366311>] pciehp_unconfigure_device+0x110/0x17b
      [ 5926.296866]  [<ffffffff81365dd9>] ? pciehp_disable_slot+0x188/0x188
      [ 5926.303123]  [<ffffffff81365d6f>] pciehp_disable_slot+0x11e/0x188
      [ 5926.309206]  [<ffffffff81365e68>] pciehp_power_thread+0x8f/0xe0
      ...
      
       +-[0000:80]-+-00.0-[81-8f]--
       |           +-01.0-[90-9f]--
       |           +-02.0-[a0-af]--
       |           +-02.2-[b0-bf]----00.0-[b1-b3]--+-02.0-[b2]--+-00.0 Device
       |           |                               |            +-00.1 Device
       |           |                               |            +-00.2 Device
       |           |                               |            \-00.3 Device
       |           |                               \-03.0-[b3]--+-00.0 Device
       |           |                                            +-00.1 Device
       |           |                                            +-00.2 Device
       |           |                                            \-00.3 Device
      
      root complex: 80:02.2
      pci express modules: have pcie switch and are listed as b0:00.0, b1:02.0 and b1:03.0.
      end devices  are b2:00.0 and b3.00.0.
      VFs are: b2:00.1,... b2:00.3, and b3:00.1,...,b3:00.3
      
      Root cause: when doing pci_stop_bus_device() with phys fn, it will stop
      virt fn and remove the fn, so
      	list_for_each_safe(l, n, &bus->devices)
      will have problem to refer freed n that is pointed to vf entry.
      
      Solution is just replacing list_for_each_safe() with
      list_for_each_prev_safe().  This will make sure we can get valid n pointer
      to PF instead of the freed VF pointer (because newly added devices are
      inserted to the bus->devices list tail).
      
      During reviewing the patch, Bjorn said:
      |   The PCI hot-remove path calls pci_stop_bus_devices() via
      |   pci_remove_bus_device().
      |
      |   pci_stop_bus_devices() traverses the bus->devices list (point A below),
      |   stopping each device in turn, which calls the driver remove() method.  When
      |   the device is an SR-IOV PF, the driver calls pci_disable_sriov(), which
      |   also uses pci_remove_bus_device() to remove the VF devices from the
      |   bus->devices list (point B).
      |
      |       pci_remove_bus_device
      |         pci_stop_bus_device
      |           pci_stop_bus_devices(subordinate)
      |             list_for_each(bus->devices)             <-- A
      |               pci_stop_bus_device(PF)
      |                 ...
      |                   driver->remove
      |                     pci_disable_sriov
      |                       ...
      |                         pci_remove_bus_device(VF)
      |                             <remove from bus_list>  <-- B
      |
      |   At B, we're changing the same list we're iterating through at A, so when
      |   the driver remove() method returns, the pci_stop_bus_devices() iterator has
      |   a pointer to a list entry that has already been freed.
      
      Discussion thread can be found : https://lkml.org/lkml/2011/10/15/141
      				 https://lkml.org/lkml/2012/1/23/360
      
      -v5: According to Linus to make remove more robust, Change to
           list_for_each_prev_safe instead. That is more reasonable, because
           those devices are added to tail of the list before.
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
      ac205b7b