diff mbox series

drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer

Message ID 20230615201511.565923-1-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series drm: bridge: samsung-dsim: Drain command transfer FIFO before transfer | expand

Commit Message

Marek Vasut June 15, 2023, 8:15 p.m. UTC
Wait until the command transfer FIFO is empty before loading in the next
command. The previous behavior where the code waited until command transfer
FIFO was not full suffered from transfer corruption, where the last command
in the FIFO could be overwritten in case the FIFO indicates not full, but
also does not have enough space to store another transfer yet.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Robert Foss <rfoss@kernel.org>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/samsung-dsim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jagan Teki June 30, 2023, 8:04 a.m. UTC | #1
On Fri, Jun 16, 2023 at 1:45 AM Marek Vasut <marex@denx.de> wrote:
>
> Wait until the command transfer FIFO is empty before loading in the next
> command. The previous behavior where the code waited until command transfer
> FIFO was not full suffered from transfer corruption, where the last command
> in the FIFO could be overwritten in case the FIFO indicates not full, but
> also does not have enough space to store another transfer yet.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # imx8mm-icore
Neil Armstrong July 3, 2023, 7:27 a.m. UTC | #2
On 15/06/2023 22:15, Marek Vasut wrote:
> Wait until the command transfer FIFO is empty before loading in the next
> command. The previous behavior where the code waited until command transfer
> FIFO was not full suffered from transfer corruption, where the last command
> in the FIFO could be overwritten in case the FIFO indicates not full, but
> also does not have enough space to store another transfer yet.
> 

I think you should add a Fixes tag since it solves a bug.

Neil

> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Robert Foss <rfoss@kernel.org>
> Cc: dri-devel@lists.freedesktop.org
> ---
>   drivers/gpu/drm/bridge/samsung-dsim.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 043b8109e64aa..9b7a00bafeaaa 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1009,7 +1009,7 @@ static int samsung_dsim_wait_for_hdr_fifo(struct samsung_dsim *dsi)
>   	do {
>   		u32 reg = samsung_dsim_read(dsi, DSIM_FIFOCTRL_REG);
>   
> -		if (!(reg & DSIM_SFR_HEADER_FULL))
> +		if (reg & DSIM_SFR_HEADER_EMPTY)
>   			return 0;
>   
>   		if (!cond_resched())
Marek Vasut July 3, 2023, 8:38 a.m. UTC | #3
On 7/3/23 09:27, Neil Armstrong wrote:
> On 15/06/2023 22:15, Marek Vasut wrote:
>> Wait until the command transfer FIFO is empty before loading in the next
>> command. The previous behavior where the code waited until command 
>> transfer
>> FIFO was not full suffered from transfer corruption, where the last 
>> command
>> in the FIFO could be overwritten in case the FIFO indicates not full, but
>> also does not have enough space to store another transfer yet.
>>
> 
> I think you should add a Fixes tag since it solves a bug.

I'm afraid that is no longer possible, I already applied it to 
drm-misc-next. I'll make a note to ping Greg when it hits Linus tree.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index 043b8109e64aa..9b7a00bafeaaa 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1009,7 +1009,7 @@  static int samsung_dsim_wait_for_hdr_fifo(struct samsung_dsim *dsi)
 	do {
 		u32 reg = samsung_dsim_read(dsi, DSIM_FIFOCTRL_REG);
 
-		if (!(reg & DSIM_SFR_HEADER_FULL))
+		if (reg & DSIM_SFR_HEADER_EMPTY)
 			return 0;
 
 		if (!cond_resched())