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

Commit c3e185fa authored by Benjamin Chan's avatar Benjamin Chan Committed by Narendra Muppalla
Browse files

msm: sde: Fix SDE rotator context list locking



During rotator IRQ handling, it is possible that the context list
getting updated with open and close handling within the IRQ timeframe,
so it is necessary to add the spinlock to protect the context list.

CRs-Fixed: 1087423
Change-Id: I20a04c766e55c75db15662e9a13e20396b35f30e
Signed-off-by: default avatarBenjamin Chan <bkchan@codeaurora.org>
parent af529092
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1502,7 +1502,8 @@ static void sde_hw_rotator_free_rotctx(struct sde_hw_rotator *rot,
		ctx->q_id, ctx->timestamp,
		atomic_read(&ctx->hwres->num_active));

	rot->rotCtx[ctx->q_id][sde_hw_rotator_get_regdma_ctxidx(ctx)] = NULL;
	/* Clear rotator context from lookup purpose */
	sde_hw_rotator_clr_ctx(ctx);

	devm_kfree(&rot->pdev->dev, ctx);
}
+22 −0
Original line number Diff line number Diff line
@@ -345,10 +345,32 @@ static inline void sde_hw_rotator_put_ctx(struct sde_hw_rotator_context *ctx)
{
	 struct sde_hw_rotator *rot = ctx->rot;
	 u32 idx = sde_hw_rotator_get_regdma_ctxidx(ctx);
	 unsigned long flags;

	 spin_lock_irqsave(&rot->rotisr_lock, flags);
	 rot->rotCtx[ctx->q_id][idx] = ctx;
	 spin_unlock_irqrestore(&rot->rotisr_lock, flags);

	 SDEROT_DBG("rotCtx[%d][%d] <== ctx:%p | session-id:%d\n",
			 ctx->q_id, idx, ctx, ctx->session_id);
}

/**
 * sde_hw_rotator_clr_ctx(): Clearing rotator context according to its
 * timestamp.
 */
static inline void sde_hw_rotator_clr_ctx(struct sde_hw_rotator_context *ctx)
{
	 struct sde_hw_rotator *rot = ctx->rot;
	 u32 idx = sde_hw_rotator_get_regdma_ctxidx(ctx);
	 unsigned long flags;

	 spin_lock_irqsave(&rot->rotisr_lock, flags);
	 rot->rotCtx[ctx->q_id][idx] = NULL;
	 spin_unlock_irqrestore(&rot->rotisr_lock, flags);

	 SDEROT_DBG("rotCtx[%d][%d] <== null | session-id:%d\n",
			 ctx->q_id, idx, ctx->session_id);
}

#endif /*_SDE_ROTATOR_R3_INTERNAL_H */