xhci: Add rmb() between reading event validity & event data access.
authorMatt Evans <matt@ozlabs.org>
Tue, 29 Mar 2011 02:40:51 +0000 (13:40 +1100)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 2 May 2011 23:42:49 +0000 (16:42 -0700)
On weakly-ordered systems, the reading of an event's content must occur
after reading the event's validity.

Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/host/xhci-ring.c

index 9b1eeb04ce69b6b1b4ddfcb4996d52a44381eaa7..e0f05f5abe10336548ce3292178f3c734df1f495 100644 (file)
@@ -2193,6 +2193,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):