Commit 59a6ee97 authored by Johannes Berg's avatar Johannes Berg Committed by Luca Coelho

iwlwifi: pcie: avoid dma unmap/remap in crash dump

DMA-API debug code pointed out that in this code path we
never check the return value of dma_map_page(), which could
fail.

However, we don't really even want to unmap/remap, we just
want to ensure that we can actually access the last version
of the data that the (now-dead) device may have written, so
only need to dma_sync_single_for_cpu() instead.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.5987f35883a2.I2d9ea5ecc69a5e5947b546fb15f33363a0595651@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 40063f60
...@@ -2968,8 +2968,8 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans, ...@@ -2968,8 +2968,8 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans,
struct iwl_rx_mem_buffer *rxb = rxq->queue[i]; struct iwl_rx_mem_buffer *rxb = rxq->queue[i];
struct iwl_fw_error_dump_rb *rb; struct iwl_fw_error_dump_rb *rb;
dma_unmap_page(trans->dev, rxb->page_dma, max_len, dma_sync_single_for_cpu(trans->dev, rxb->page_dma,
DMA_FROM_DEVICE); max_len, DMA_FROM_DEVICE);
rb_len += sizeof(**data) + sizeof(*rb) + max_len; rb_len += sizeof(**data) + sizeof(*rb) + max_len;
...@@ -2978,10 +2978,6 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans, ...@@ -2978,10 +2978,6 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans,
rb = (void *)(*data)->data; rb = (void *)(*data)->data;
rb->index = cpu_to_le32(i); rb->index = cpu_to_le32(i);
memcpy(rb->data, page_address(rxb->page), max_len); memcpy(rb->data, page_address(rxb->page), max_len);
/* remap the page for the free benefit */
rxb->page_dma = dma_map_page(trans->dev, rxb->page,
rxb->offset, max_len,
DMA_FROM_DEVICE);
*data = iwl_fw_error_next_data(*data); *data = iwl_fw_error_next_data(*data);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment