1. 23 12月, 2019 4 次提交
    • J
      iwlwifi: pcie: extend hardware workaround to context-info · d84a7a65
      Johannes Berg 提交于
      After more investigation on the hardware side, it appears that the
      hardware bug regarding 2^32 boundary reaching/crossing also affects
      other uses of the DMA engine, in particular the ones triggered by
      the context-info (image loader) mechanism.
      
      It also turns out that the bug only affects devices with gen2 TX
      hardware engine, so we don't need to change context info for gen3.
      The TX path workarounds are simpler to still keep for both though.
      
      Add the workaround to that code as well; this is a lot simpler as
      we have just a single way to allocate DMA memory there.
      
      I made the algorithm recursive (with a small limit) since it's
      actually (almost) impossible to hit this today - dma_alloc_coherent
      is currently documented to always return 32-bit addressable memory
      regardless of the DMA mask for it, and so we could only get REALLY
      unlucky to get the very last page in that area.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      d84a7a65
    • J
      iwlwifi: pcie: allocate smaller dev_cmd for TX headers · a89c72ff
      Johannes Berg 提交于
      As noted in the previous commit, due to the way we allocate the
      dev_cmd headers with 324 byte size, and 4/8 byte alignment, the
      part we use of them (bytes 20..40-68) could still cross a page
      and thus 2^32 boundary.
      
      Address this by using alignment to ensure that the allocation
      cannot cross a page boundary, on hardware that's affected. To
      make that not cause more memory consumption, reduce the size of
      the allocations to the necessary size - we go from 324 bytes in
      each allocation to 60/68 on gen2 depending on family, and ~120
      or so on gen1 (so on gen1 it's a pure reduction in size, since
      we don't need alignment there).
      
      To avoid size and clearing issues, add a new structure that's
      just the header, and use kmem_cache_zalloc().
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      a89c72ff
    • J
      iwlwifi: pcie: detect the DMA bug and warn if it happens · c5a4e8eb
      Johannes Berg 提交于
      Warn if the DMA bug is going to happen. We don't have a good
      way of actually aborting in this case and we have workarounds
      in place for the cases where it happens, but in order to not
      be surprised add a safety-check and warn.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      c5a4e8eb
    • J
      iwlwifi: pcie: work around DMA hardware bug · c4a786b3
      Johannes Berg 提交于
      There's a hardware bug in the flow handler (DMA engine), if the
      address + len of some TB wraps around a 2^32 boundary, the carry
      bit is then carried over into the next TB.
      
      Work around this by copying the data to a new page when we find
      this situation, and then copy it in a way that we cannot hit the
      very end of the page.
      
      To be able to free the new page again later we need to chain it
      to the TSO page, use the last pointer there to make sure we can
      never use the page fully for DMA, and thus cannot cause the same
      overflow situation on this page.
      
      This leaves a few potential places (where we didn't observe the
      problem) unaddressed:
       * The second TB could reach or cross the end of a page (and thus
         2^32) due to the way we allocate the dev_cmd for the header
       * For host commands, a similar thing could happen since they're
         just kmalloc().
      We'll address these in further commits.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      c4a786b3
  2. 20 12月, 2019 1 次提交
  3. 10 12月, 2019 2 次提交
  4. 28 11月, 2019 1 次提交
  5. 20 11月, 2019 4 次提交
  6. 15 11月, 2019 3 次提交
  7. 09 11月, 2019 1 次提交
  8. 25 10月, 2019 3 次提交
  9. 23 10月, 2019 5 次提交
  10. 09 10月, 2019 4 次提交
    • L
      iwlwifi: pcie: change qu with jf devices to use qu configuration · aa0cc7dd
      Luca Coelho 提交于
      There were a bunch of devices with qu and jf that were loading the
      configuration with pu and jf, which is wrong.  Fix them all
      accordingly.  Additionally, remove 0x1010 and 0x1210 subsytem IDs from
      the list, since they are obviously wrong, and 0x0044 and 0x0244, which
      were duplicate.
      
      Cc: stable@vger.kernel.org # 5.1+
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      aa0cc7dd
    • N
      iwlwifi: pcie: fix memory leaks in iwl_pcie_ctxt_info_gen3_init · 0f4f1994
      Navid Emamdoost 提交于
      In iwl_pcie_ctxt_info_gen3_init there are cases that the allocated dma
      memory is leaked in case of error.
      
      DMA memories prph_scratch, prph_info, and ctxt_info_gen3 are allocated
      and initialized to be later assigned to trans_pcie. But in any error case
      before such assignment the allocated memories should be released.
      
      First of such error cases happens when iwl_pcie_init_fw_sec fails.
      Current implementation correctly releases prph_scratch. But in two
      sunsequent error cases where dma_alloc_coherent may fail, such
      releases are missing.
      
      This commit adds release for prph_scratch when allocation for
      prph_info fails, and adds releases for prph_scratch and prph_info when
      allocation for ctxt_info_gen3 fails.
      
      Fixes: 2ee82402 ("iwlwifi: pcie: support context information for 22560 devices")
      Signed-off-by: NNavid Emamdoost <navid.emamdoost@gmail.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      0f4f1994
    • J
      iwlwifi: pcie: fix rb_allocator workqueue allocation · 8188a18e
      Johannes Berg 提交于
      We don't handle failures in the rb_allocator workqueue allocation
      correctly. To fix that, move the code earlier so the cleanup is
      easier and we don't have to undo all the interrupt allocations in
      this case.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      8188a18e
    • J
      iwlwifi: pcie: fix indexing in command dump for new HW · 08326a97
      Johannes Berg 提交于
      We got a crash in iwl_trans_pcie_get_cmdlen(), while the TFD was
      being accessed to sum up the lengths.
      
      We want to access the TFD here, which is the information for the
      hardware. We always only allocate 32 buffers for the cmd queue,
      but on newer hardware (using TFH) we can also allocate only a
      shorter hardware array, also only 32 TFDs. Prior to the TFH, we
      had to allocate a bigger TFD array but would make those point to
      a smaller set of buffers.
      
      Additionally, now max_tfd_queue_size is up to 65536, so we can
      access *way* out of bounds of a really only 32-entry array, so
      it crashes.
      
      Fix this by making the TFD index depend on which hardware we are
      using right now.
      
      While changing the calculation, also fix it to not use void ptr
      arithmetic, but cast to u8 * before.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      08326a97
  11. 06 9月, 2019 12 次提交