Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1edf9d02 authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: add memory barrier after ring operations



There are instances when MHI channel context read
pointer can be accessed simultaneously by different
CPU cores. To make sure read pointer updates visible
to all cores, add a memory barrier after completion
of MHI ring operation.

CRs-Fixed: 966338
Change-Id: Ifc8c4cd7595fed9049009c42420a665fb170079f
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 20b1a290
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ static int add_element(struct mhi_ring *ring, void **rp,
		*assigned_addr = (char *)ring->wp;
	*wp = (void *)(((d_wp + 1) % ring_size) * ring->el_size +
						(uintptr_t)ring->base);

	/* force update visible to other cores */
	smp_wmb();
	return 0;
}

@@ -101,6 +104,9 @@ int delete_element(struct mhi_ring *ring, void **rp,

	*rp = (void *)(((d_rp + 1) % ring_size) * ring->el_size +
						(uintptr_t)ring->base);

	/* force update visible to other cores */
	smp_wmb();
	return 0;
}