Skip to contentSkip to conversation

sfc: Fix oops in register dump after mapping change

PATCH Applied Ben Hutchings 2 participants 2 messages May 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sfc: Fix oops in register dump after mapping change

Commit 747df2258b1b9a2e25929ef496262c339c380009 ('sfc: Always map MCDI shared memory as uncacheable') introduced a separate mapping for the MCDI shared memory (MC_TREG_SMEM). This means we can no longer easily include it in the register dump. Since it is not particularly useful in debugging, substitute a recognisable dummy value.

---
'ethtool -d' on a Siena controller will now result in an 'oops'. This is not a huge problem because I suspect I'm the only one actually actually using this feature. The patch is against net-2.6 because the above commit has not yet been merged into net-next-2.6, but I don't particularly mind if this misses 2.6.39.

Ben.

 drivers/net/sfc/nic.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/sfc/nic.c +7 -0
index 10f1cb7..9b29a8d 100644
@@ -1937,6 +1937,13 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
 
 		size = min_t(size_t, table->step, 16);
 
+		if (table->offset >= efx->type->mem_map_size) {
+			/* No longer mapped; return dummy data */
+			memcpy(buf, "\xde\xc0\xad\xde", 4);
+			buf += table->rows * size;
+			continue;
+		}
+
 		for (i = 0; i < table->rows; i++) {
 			switch (table->step) {
 			case 4: /* 32-bit register or SRAM */
Signature · 7 lines
1.7.4


-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer Applied
#1 lore raw

From: Ben Hutchings <[email protected]>
Date: Mon, 16 May 2011 17:13:49 +0100

Quoted 7 lines

Commit 747df2258b1b9a2e25929ef496262c339c380009 ('sfc: Always map MCDI shared memory as uncacheable') introduced a separate mapping for the MCDI shared memory (MC_TREG_SMEM). This means we can no longer easily include it in the register dump. Since it is not particularly useful in debugging, substitute a recognisable dummy value.

Applied.