lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  8 Jul 2022 18:01:51 +0100
From:   Ben Dooks <ben.dooks@...ive.com>
To:     dmaengine@...r.kernel.org, Eugeniy.Paltsev@...opsys.com
Cc:     linux-kernel@...r.kernel.org, vkoul@...nel.org,
        Sudip Mukherjee <sudip.mukherjee@...ive.com>,
        Jude Onyenegecha <jude.onyenegecha@...ive.com>,
        Ben Dooks <ben.dooks@...ive.com>
Subject: [PATCH 1/3] dmaengine: dw-axi-dmac: dump channel registers on error

On channel error, dump the channel register state before
the channel's LLI entries to see what the controller was
actually doing when the error happend.

Signed-off-by: Ben Dooks <ben.dooks@...ive.com>
---
 .../dma/dw-axi-dmac/dw-axi-dmac-platform.c    | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index e9c9bcb1f5c2..75c537153e92 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -79,6 +79,20 @@ axi_chan_iowrite64(struct axi_dma_chan *chan, u32 reg, u64 val)
 	iowrite32(upper_32_bits(val), chan->chan_regs + reg + 4);
 }
 
+static inline u64
+axi_chan_ioread64(struct axi_dma_chan *chan, u32 reg)
+{
+	u32 high, low;
+	u64 result;
+
+	low = ioread32(chan->chan_regs + reg);
+	high = ioread32(chan->chan_regs + reg + 4);
+
+	result = low;
+	result |= (u64)high << 32;
+	return result;
+}
+
 static inline void axi_chan_config_write(struct axi_dma_chan *chan,
 					 struct axi_dma_chan_config *config)
 {
@@ -979,6 +993,18 @@ static int dw_axi_dma_chan_slave_config(struct dma_chan *dchan,
 	return 0;
 }
 
+static void axi_chan_dump_regs(struct axi_dma_chan *chan)
+{
+	dev_err(dchan2dev(&chan->vc.chan),
+		"R: SAR: 0x%llx DAR: 0x%llx LLP: 0x%llx BTS 0x%x CTL: 0x%x:%08x\n",
+		axi_chan_ioread64(chan, CH_SAR),
+		axi_chan_ioread64(chan, CH_DAR),
+		axi_chan_ioread64(chan, CH_LLP),
+		axi_chan_ioread32(chan, CH_BLOCK_TS),
+		axi_chan_ioread32(chan, CH_CTL_H),
+		axi_chan_ioread32(chan, CH_CTL_L));
+}
+
 static void axi_chan_dump_lli(struct axi_dma_chan *chan,
 			      struct axi_dma_hw_desc *desc)
 {
@@ -1020,6 +1046,8 @@ static noinline void axi_chan_handle_err(struct axi_dma_chan *chan, u32 status)
 	dev_err(chan2dev(chan),
 		"Bad descriptor submitted for %s, cookie: %d, irq: 0x%08x\n",
 		axi_chan_name(chan), vd->tx.cookie, status);
+
+	axi_chan_dump_regs(chan);
 	axi_chan_list_dump_lli(chan, vd_to_axi_desc(vd));
 
 	vchan_cookie_complete(vd);
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ