1. 07 7月, 2016 1 次提交
    • J
      iommu/amd: Fix unity mapping initialization race · 522e5cb7
      Joerg Roedel 提交于
      There is a race condition in the AMD IOMMU init code that
      causes requested unity mappings to be blocked by the IOMMU
      for a short period of time. This results on boot failures
      and IO_PAGE_FAULTs on some machines.
      
      Fix this by making sure the unity mappings are installed
      before all other DMA is blocked.
      
      Fixes: aafd8ba0 ('iommu/amd: Implement add_device and remove_device')
      Cc: stable@vger.kernel.org # v4.2+
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      522e5cb7
  2. 04 7月, 2016 1 次提交
    • A
      iommu/vt-d: Fix infinite loop in free_all_cpu_cached_iovas · 0caa7616
      Aaron Campbell 提交于
      Per VT-d spec Section 10.4.2 ("Capability Register"), the maximum
      number of possible domains is 64K; indeed this is the maximum value
      that the cap_ndoms() macro will expand to.  Since the value 65536
      will not fix in a u16, the 'did' variable must be promoted to an
      int, otherwise the test for < 65536 will always be true and the
      loop will never end.
      
      The symptom, in my case, was a hung machine during suspend.
      
      Fixes: 3bd4f911 ("iommu/vt-d: Fix overflow of iommu->domains array")
      Signed-off-by: NAaron Campbell <aaron@monkey.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      0caa7616
  3. 27 6月, 2016 3 次提交
    • N
      iommu/amd: Initialize devid variable before using it · 6082ee72
      Nicolas Iooss 提交于
      Commit 2a0cb4e2 ("iommu/amd: Add new map for storing IVHD dev entry
      type HID") added a call to DUMP_printk in init_iommu_from_acpi() which
      used the value of devid before this variable was initialized.
      
      Fixes: 2a0cb4e2 ('iommu/amd: Add new map for storing IVHD dev entry type HID')
      Signed-off-by: NNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      6082ee72
    • J
      iommu/vt-d: Fix overflow of iommu->domains array · 3bd4f911
      Jan Niehusmann 提交于
      The valid range of 'did' in get_iommu_domain(*iommu, did)
      is 0..cap_ndoms(iommu->cap), so don't exceed that
      range in free_all_cpu_cached_iovas().
      
      The user-visible impact of the out-of-bounds access is the machine
      hanging on suspend-to-ram. It is, in fact, a kernel panic, but due
      to already suspended devices, that's often not visible to the user.
      
      Fixes: 22e2f9fa ("iommu/vt-d: Use per-cpu IOVA caching")
      Signed-off-by: NJan Niehusmann <jan@gondor.com>
      Tested-By: NMarius Vlad <marius.c.vlad@intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      3bd4f911
    • C
      iommu/iova: Disable preemption around use of this_cpu_ptr() · 583248e6
      Chris Wilson 提交于
      Between acquiring the this_cpu_ptr() and using it, ideally we don't want
      to be preempted and work on another CPU's private data. this_cpu_ptr()
      checks whether or not preemption is disable, and get_cpu_ptr() provides
      a convenient wrapper for operating on the cpu ptr inside a preemption
      disabled critical section (which currently is provided by the
      spinlock).
      
      [  167.997877] BUG: using smp_processor_id() in preemptible [00000000] code: usb-storage/216
      [  167.997940] caller is debug_smp_processor_id+0x17/0x20
      [  167.997945] CPU: 7 PID: 216 Comm: usb-storage Tainted: G     U          4.7.0-rc1-gfxbench-RO_Patchwork_1057+ #1
      [  167.997948] Hardware name: Hewlett-Packard HP Pro 3500 Series/2ABF, BIOS 8.11 10/24/2012
      [  167.997951]  0000000000000000 ffff880118b7f9c8 ffffffff8140dca5 0000000000000007
      [  167.997958]  ffffffff81a3a7e9 ffff880118b7f9f8 ffffffff8142a927 0000000000000000
      [  167.997965]  ffff8800d499ed58 0000000000000001 00000000000fffff ffff880118b7fa08
      [  167.997971] Call Trace:
      [  167.997977]  [<ffffffff8140dca5>] dump_stack+0x67/0x92
      [  167.997981]  [<ffffffff8142a927>] check_preemption_disabled+0xd7/0xe0
      [  167.997985]  [<ffffffff8142a947>] debug_smp_processor_id+0x17/0x20
      [  167.997990]  [<ffffffff81507e17>] alloc_iova_fast+0xb7/0x210
      [  167.997994]  [<ffffffff8150c55f>] intel_alloc_iova+0x7f/0xd0
      [  167.997998]  [<ffffffff8151021d>] intel_map_sg+0xbd/0x240
      [  167.998002]  [<ffffffff810e5efd>] ? debug_lockdep_rcu_enabled+0x1d/0x20
      [  167.998009]  [<ffffffff81596059>] usb_hcd_map_urb_for_dma+0x4b9/0x5a0
      [  167.998013]  [<ffffffff81596d19>] usb_hcd_submit_urb+0xe9/0xaa0
      [  167.998017]  [<ffffffff810cff2f>] ? mark_held_locks+0x6f/0xa0
      [  167.998022]  [<ffffffff810d525c>] ? __raw_spin_lock_init+0x1c/0x50
      [  167.998025]  [<ffffffff810e5efd>] ? debug_lockdep_rcu_enabled+0x1d/0x20
      [  167.998028]  [<ffffffff815988f3>] usb_submit_urb+0x3f3/0x5a0
      [  167.998032]  [<ffffffff810d0082>] ? trace_hardirqs_on_caller+0x122/0x1b0
      [  167.998035]  [<ffffffff81599ae7>] usb_sg_wait+0x67/0x150
      [  167.998039]  [<ffffffff815dc202>] usb_stor_bulk_transfer_sglist.part.3+0x82/0xd0
      [  167.998042]  [<ffffffff815dc29c>] usb_stor_bulk_srb+0x4c/0x60
      [  167.998045]  [<ffffffff815dc42e>] usb_stor_Bulk_transport+0x17e/0x420
      [  167.998049]  [<ffffffff815dcf32>] usb_stor_invoke_transport+0x242/0x540
      [  167.998052]  [<ffffffff810e5efd>] ? debug_lockdep_rcu_enabled+0x1d/0x20
      [  167.998058]  [<ffffffff815dba19>] usb_stor_transparent_scsi_command+0x9/0x10
      [  167.998061]  [<ffffffff815de518>] usb_stor_control_thread+0x158/0x260
      [  167.998064]  [<ffffffff815de3c0>] ? fill_inquiry_response+0x20/0x20
      [  167.998067]  [<ffffffff815de3c0>] ? fill_inquiry_response+0x20/0x20
      [  167.998071]  [<ffffffff8109ddfa>] kthread+0xea/0x100
      [  167.998078]  [<ffffffff817ac6af>] ret_from_fork+0x1f/0x40
      [  167.998081]  [<ffffffff8109dd10>] ? kthread_create_on_node+0x1f0/0x1f0
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96293Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: iommu@lists.linux-foundation.org
      Cc: linux-kernel@vger.kernel.org
      Fixes: 9257b4a2 ('iommu/iova: introduce per-cpu caching to iova allocation')
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      583248e6
  4. 17 6月, 2016 1 次提交
  5. 15 6月, 2016 1 次提交
  6. 13 6月, 2016 1 次提交
  7. 28 5月, 2016 1 次提交
    • A
      remove lots of IS_ERR_VALUE abuses · 287980e4
      Arnd Bergmann 提交于
      Most users of IS_ERR_VALUE() in the kernel are wrong, as they
      pass an 'int' into a function that takes an 'unsigned long'
      argument. This happens to work because the type is sign-extended
      on 64-bit architectures before it gets converted into an
      unsigned type.
      
      However, anything that passes an 'unsigned short' or 'unsigned int'
      argument into IS_ERR_VALUE() is guaranteed to be broken, as are
      8-bit integers and types that are wider than 'unsigned long'.
      
      Andrzej Hajda has already fixed a lot of the worst abusers that
      were causing actual bugs, but it would be nice to prevent any
      users that are not passing 'unsigned long' arguments.
      
      This patch changes all users of IS_ERR_VALUE() that I could find
      on 32-bit ARM randconfig builds and x86 allmodconfig. For the
      moment, this doesn't change the definition of IS_ERR_VALUE()
      because there are probably still architecture specific users
      elsewhere.
      
      Almost all the warnings I got are for files that are better off
      using 'if (err)' or 'if (err < 0)'.
      The only legitimate user I could find that we get a warning for
      is the (32-bit only) freescale fman driver, so I did not remove
      the IS_ERR_VALUE() there but changed the type to 'unsigned long'.
      For 9pfs, I just worked around one user whose calling conventions
      are so obscure that I did not dare change the behavior.
      
      I was using this definition for testing:
      
       #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \
             unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO))
      
      which ends up making all 16-bit or wider types work correctly with
      the most plausible interpretation of what IS_ERR_VALUE() was supposed
      to return according to its users, but also causes a compile-time
      warning for any users that do not pass an 'unsigned long' argument.
      
      I suggested this approach earlier this year, but back then we ended
      up deciding to just fix the users that are obviously broken. After
      the initial warning that caused me to get involved in the discussion
      (fs/gfs2/dir.c) showed up again in the mainline kernel, Linus
      asked me to send the whole thing again.
      
      [ Updated the 9p parts as per Al Viro  - Linus ]
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Andrzej Hajda <a.hajda@samsung.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: https://lkml.org/lkml/2016/1/7/363
      Link: https://lkml.org/lkml/2016/5/27/486
      Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> # For nvmem part
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      287980e4
  8. 10 5月, 2016 1 次提交
  9. 09 5月, 2016 5 次提交
  10. 04 5月, 2016 9 次提交
  11. 22 4月, 2016 2 次提交
  12. 21 4月, 2016 10 次提交
  13. 20 4月, 2016 1 次提交
  14. 15 4月, 2016 1 次提交
  15. 13 4月, 2016 1 次提交
  16. 12 4月, 2016 1 次提交