[PATCH] drm/ast: Fix start address computation

Thomas Zimmermann tzimmermann at suse.de
Tue Feb 7 11:17:48 UTC 2023


Hi

Am 07.02.23 um 11:53 schrieb Jocelyn Falempe:
> During the driver conversion to shmem, there is a missing page shift when
> computing the start address in GPU memory.
> This leads to graphic garbage when connecting to the remote BMC, depending
> on the PCI start address.
> 
> Tested on a sr645 affected by this bug.
> 
> Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
> Signed-off-by: Jocelyn Falempe <jfalempe at redhat.com>
> ---
>   drivers/gpu/drm/ast/ast_mode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index c7443317c747..d75e4a7611b3 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -714,7 +714,7 @@ static int ast_primary_plane_init(struct ast_private *ast)
>   	struct ast_plane *ast_primary_plane = &ast->primary_plane;
>   	struct drm_plane *primary_plane = &ast_primary_plane->base;
>   	void __iomem *vaddr = ast->vram;
> -	u64 offset = ast->vram_base;
> +	u64 offset = ast->vram_base << PAGE_SHIFT;

That can't be the problem, I think. vram_base is already an address. 
[1] In the old code, drm_gem_vram_pg_offset() returned a page index. So 
shifting it to the left here is most likely incorrect.

Can you verify that the new offset is the same as the old one?

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v6.2-rc7/source/drivers/gpu/drm/ast/ast_mm.c#L96

>   	unsigned long cursor_size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
>   	unsigned long size = ast->vram_fb_available - cursor_size;
>   	int ret;

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230207/4276a9c7/attachment.sig>


More information about the dri-devel mailing list