Add explicit barrier before sev() in tftf_send_event_common API

Consider the following scenario: If sev() gets reordered above the
event->cnt+=inc operation in tftf_send_event_common() on core 0, and lets
say core 1 is in wfe in tftf_wait_for_event, core 1 receives the event
before the write to event->cnt from core 0 propagates to core 1. Later,
core 1 wakes up, reads event->cnt, sees that it is 0 and goes back to
wfe, thereby leading to hang.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I2e8a5ab7c220b02d5b637dc7cdf3562ca73dbfdc
diff --git a/lib/events/events.c b/lib/events/events.c
index 42130d5..5919d3b 100644
--- a/lib/events/events.c
+++ b/lib/events/events.c
@@ -25,6 +25,11 @@
 	event->cnt += inc;
 	spin_unlock(&event->lock);
 
+	/*
+	 * Make sure the cnt increment is observable by all CPUs
+	 * before the event is sent.
+	 */
+	dsbsy();
 	sev();
 }