Skip to contentSkip to conversation

xhci: Add rmb() between reading event validity & event data access.

PATCH New Matt Evans 1 participant 1 message Mar 29, 2011

Subsystems (2)
lore
Share & tools
lore

Matt Evans

author
#0 lore raw

PATCH v3 2/4 xhci: Add rmb() between reading event validity & event data access.

On weakly-ordered systems, the reading of an event's content must occur after reading the event's validity.

---
 drivers/usb/host/xhci-ring.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/usb/host/xhci-ring.c +5 -0
index 1361032..86c8198 100644
@@ -2150,6 +2150,11 @@ static void xhci_handle_event(struct xhci_hcd *xhci)
 	}
 	xhci_dbg(xhci, "%s - OS owns TRB\n", __func__);
 
+	/*
+	 * Barrier between reading the TRB_CYCLE (valid) flag above and any
+	 * speculative reads of the event's flags/data below.
+	 */
+	rmb();
 	/* FIXME: Handle more event types. */
 	switch ((le32_to_cpu(event->event_cmd.flags) & TRB_TYPE_BITMASK)) {
 	case TRB_TYPE(TRB_COMPLETION):
Signature · 1 line
1.7.0.4