linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 04/11] iwlwifi: pcie: avoid dma unmap/remap in crash dump
Date: Thu, 19 Aug 2021 18:40:28 +0300	[thread overview]
Message-ID: <iwlwifi.20210819183728.5987f35883a2.I2d9ea5ecc69a5e5947b546fb15f33363a0595651@changeid> (raw)
In-Reply-To: <20210819154035.72584-1-luca@coelho.fi>

From: Johannes Berg <johannes.berg@intel.com>

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: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 86a949440486..1e6af3cbe026 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -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_fw_error_dump_rb *rb;
 
-		dma_unmap_page(trans->dev, rxb->page_dma, max_len,
-			       DMA_FROM_DEVICE);
+		dma_sync_single_for_cpu(trans->dev, rxb->page_dma,
+					max_len, DMA_FROM_DEVICE);
 
 		rb_len += sizeof(**data) + sizeof(*rb) + max_len;
 
@@ -2978,10 +2978,6 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans,
 		rb = (void *)(*data)->data;
 		rb->index = cpu_to_le32(i);
 		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);
 	}
-- 
2.33.0


  parent reply	other threads:[~2021-08-19 15:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 15:40 [PATCH 00/11] iwlwifi: updates intended for v5.15 2021-08-19 Luca Coelho
2021-08-19 15:40 ` [PATCH 01/11] iwlwifi: bump FW API to 65 for AX devices Luca Coelho
2021-08-26 20:37   ` Luca Coelho
2021-08-19 15:40 ` [PATCH 02/11] iwlwifi: acpi: fill in WGDS table with defaults Luca Coelho
2021-08-19 15:40 ` [PATCH 03/11] iwlwifi: acpi: fill in SAR tables " Luca Coelho
2021-08-19 15:40 ` Luca Coelho [this message]
2021-08-19 15:40 ` [PATCH 05/11] iwlwifi: fix __percpu annotation Luca Coelho
2021-08-19 15:40 ` [PATCH 06/11] iwlwifi: api: remove datamember from struct Luca Coelho
2021-08-19 15:40 ` [PATCH 07/11] iwlwifi: fw: fix debug dump data declarations Luca Coelho
2021-08-19 15:40 ` [PATCH 08/11] iwlwifi: add 'Rx control frame to MBSSID' HE capability Luca Coelho
2021-08-19 15:40 ` [PATCH 09/11] iwlwifi: yoyo: support for new DBGI_SRAM region Luca Coelho
2021-08-19 15:40 ` [PATCH 10/11] iwlwifi: mvm: don't schedule the roc_done_wk if it is already running Luca Coelho
2021-08-19 15:40 ` [PATCH 11/11] iwlwifi: allow debug init in RF-kill Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20210819183728.5987f35883a2.I2d9ea5ecc69a5e5947b546fb15f33363a0595651@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).