• J
    iwlwifi: use coherent DMA memory for command header · 38c0f334
    Johannes Berg 提交于
    Recently in commit 8a964f44
    ("iwlwifi: always copy first 16 bytes of commands") we fixed
    the problem that the hardware writes back to the command and
    that could overwrite parts of the data that was still needed
    and would thus be corrupted.
    
    Investigating this problem more closely we found that this
    write-back isn't really ordered very well with respect to
    other DMA traffic. Therefore, it sometimes happened that the
    write-back occurred after unmapping the command again which
    is clearly an issue and could corrupt the next allocation
    that goes to that spot, or (better) cause IOMMU faults.
    
    To fix this, allocate coherent memory for the first 16 bytes
    of each command, containing the write-back part, and use it
    for all queues. All the dynamic DMA mappings only need to be
    TO_DEVICE then. This ensures that even when the write-back
    happens "too late" it can't hit memory that has been freed
    or a mapping that doesn't exist any more.
    
    Since now the actual command is no longer modified, we can
    also remove CMD_WANT_HCMD and get rid of the DMA sync that
    was necessary to update the scratch pointer.
    Reviewed-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
    Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
    38c0f334
sta.c 39.2 KB