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

Commit c42388b5 authored by Jeff Hugo's avatar Jeff Hugo
Browse files

soc: qcom: smem: Allow accesses to SMEM_SPINLOCK_ARRAY before probe done



There is a circular dependency between the SMEM driver and the remote
spinlock driver when the software locks are used.  SMEM requires the remote
spinlocks to be initialized before probe completes, but initializing the
software locks requires access to the SMEM_SPINLOCK_ARRAY smem item.  This
is a problem as access to smem items is gated by the completetion of SMEM's
probe().

Add some intelligence into the public API to allow accesses to the
SMEM_SPINLOCK_ARRAY before SMEM's probe() completes for the purpose of a
workaround to the circular dependency.

Change-Id: I4896d5589b6ebd7cc8e71f1b6162bb28e4107968
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent 9c6389a6
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -513,7 +513,14 @@ void *smem_find(unsigned id, unsigned size_in, unsigned to_proc, unsigned flags)
	SMEM_DBG("%s(%u, %u, %u, %u)\n", __func__, id, size_in, to_proc,
									flags);

	if (!is_probe_done())
	/*
	 * Handle the circular dependecy between SMEM and software implemented
	 * remote spinlocks.  SMEM must initialize the remote spinlocks in
	 * probe() before it is done.  EPROBE_DEFER handling will not resolve
	 * this code path, so we must be intellegent to know that the spinlock
	 * item is a special case.
	 */
	if (!is_probe_done() && id != SMEM_SPINLOCK_ARRAY)
		return ERR_PTR(-EPROBE_DEFER);

	ptr = smem_get_entry(id, &size, to_proc, flags);
@@ -781,7 +788,14 @@ void *smem_get_entry(unsigned id, unsigned *size, unsigned to_proc,
{
	SMEM_DBG("%s(%u, %u, %u, %u)\n", __func__, id, *size, to_proc, flags);

	if (!is_probe_done())
	/*
	 * Handle the circular dependecy between SMEM and software implemented
	 * remote spinlocks.  SMEM must initialize the remote spinlocks in
	 * probe() before it is done.  EPROBE_DEFER handling will not resolve
	 * this code path, so we must be intellegent to know that the spinlock
	 * item is a special case.
	 */
	if (!is_probe_done() && id != SMEM_SPINLOCK_ARRAY)
		return ERR_PTR(-EPROBE_DEFER);

	return __smem_get_entry_secure(id, size, to_proc, flags, false, true);