netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-26] cxgb4vf: fix mailbox data/control coherency domain race
@ 2011-01-10 21:51 Casey Leedom
  2011-01-10 21:56 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Casey Leedom @ 2011-01-10 21:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Casey Leedom

For the VFs, the Mailbox Data "registers" are actually backed by
T4's "MA" interface rather than PL Registers (as is the case for
the PFs).  Because these are in different coherency domains, the
write to the VF's PL-register-backed Mailbox Control can race in
front of the writes to the MA-backed VF Mailbox Data "registers".
So we need to do a read-back on at least one byte of the VF Mailbox
Data registers before doing the write to the VF Mailbox Control
register.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb4vf/t4vf_hw.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c
index e4bec78..0f51c80 100644
--- a/drivers/net/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/cxgb4vf/t4vf_hw.c
@@ -147,9 +147,20 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
 	/*
 	 * Write the command array into the Mailbox Data register array and
 	 * transfer ownership of the mailbox to the firmware.
+	 *
+	 * For the VFs, the Mailbox Data "registers" are actually backed by
+	 * T4's "MA" interface rather than PL Registers (as is the case for
+	 * the PFs).  Because these are in different coherency domains, the
+	 * write to the VF's PL-register-backed Mailbox Control can race in
+	 * front of the writes to the MA-backed VF Mailbox Data "registers".
+	 * So we need to do a read-back on at least one byte of the VF Mailbox
+	 * Data registers before doing the write to the VF Mailbox Control
+	 * register.
 	 */
 	for (i = 0, p = cmd; i < size; i += 8)
 		t4_write_reg64(adapter, mbox_data + i, be64_to_cpu(*p++));
+	t4_read_reg(adapter, mbox_data);         /* flush write */
+
 	t4_write_reg(adapter, mbox_ctl,
 		     MBMSGVALID | MBOWNER(MBOX_OWNER_FW));
 	t4_read_reg(adapter, mbox_ctl);          /* flush write */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-26] cxgb4vf: fix mailbox data/control coherency domain race
  2011-01-10 21:51 [PATCH net-26] cxgb4vf: fix mailbox data/control coherency domain race Casey Leedom
@ 2011-01-10 21:56 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-01-10 21:56 UTC (permalink / raw)
  To: leedom; +Cc: netdev

From: Casey Leedom <leedom@chelsio.com>
Date: Mon, 10 Jan 2011 13:51:01 -0800

> For the VFs, the Mailbox Data "registers" are actually backed by
> T4's "MA" interface rather than PL Registers (as is the case for
> the PFs).  Because these are in different coherency domains, the
> write to the VF's PL-register-backed Mailbox Control can race in
> front of the writes to the MA-backed VF Mailbox Data "registers".
> So we need to do a read-back on at least one byte of the VF Mailbox
> Data registers before doing the write to the VF Mailbox Control
> register.
> 
> Signed-off-by: Casey Leedom <leedom@chelsio.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-10 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 21:51 [PATCH net-26] cxgb4vf: fix mailbox data/control coherency domain race Casey Leedom
2011-01-10 21:56 ` David Miller

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