linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] NTB: ntb_perf: Clear stale values in doorbell and command SPAD register
@ 2019-02-15  9:21 Mehta, Sanju
  0 siblings, 0 replies; only message in thread
From: Mehta, Sanju @ 2019-02-15  9:21 UTC (permalink / raw)
  To: S-k, Shyam-sundar, jdmason, dave.jiang, allenbh
  Cc: linux-ntb, linux-kernel, Mehta, Sanju

From: Sanjay R Mehta <sanju.mehta@amd.com>

when ntb_perf is unloaded, the command scratchpad register still
retains the last initialized value of PERF_CMD_INVAL. When ntb_perf
is re-loaded and reads peer command scratchpad register and it mis
interprets the peer state as initialized.

To avoid this, clearing the local side command scratchpad register
in perf_disable_service

Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
---
 drivers/ntb/test/ntb_perf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index 4a3fba4..c7d1a48 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -754,6 +754,14 @@ static void perf_disable_service(struct perf_ctx *perf)
 	for (pidx = 0; pidx < perf->pcnt; pidx++)
 		flush_work(&perf->peers[pidx].service);
 
+	for (pidx = 0; pidx < perf->pcnt; pidx++) {
+		struct perf_peer *peer = &perf->peers[pidx];
+
+		ntb_spad_write(perf->ntb, PERF_SPAD_CMD(peer->gidx), 0);
+	}
+
+	ntb_db_clear(perf->ntb, PERF_SPAD_NOTIFY(perf->gidx));
+
 	ntb_link_disable(perf->ntb);
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-02-15  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-15  9:21 [PATCH 3/4] NTB: ntb_perf: Clear stale values in doorbell and command SPAD register Mehta, Sanju

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).