[PATCH 1/2] drm/amdgpu/gmc: always steal the first 32MB of vram for fw hand-over

Alex Deucher alexdeucher at gmail.com
Thu Apr 5 19:27:57 UTC 2018


On Thu, Apr 5, 2018 at 2:26 PM, Andrey Grodzovsky
<andrey.grodzovsky at amd.com> wrote:
> From: Alex Deucher <alexander.deucher at amd.com>
>
> The vbios uses memory from the start of vram for the pre-OS
> framebuffer. Reserve this at driver load time to prevent
> the driver from using it for other things which may cause
> atrifacts on screen before the console has kicked in.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index 5617cf6..056a41c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -851,7 +851,7 @@ static int gmc_v6_0_sw_init(void *handle)
>
>         adev->gmc.mc_mask = 0xffffffffffULL;
>
> -       adev->gmc.stolen_size = 256 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;

Maybe move this to a define so we don't have to update all those
places if we have to update this in the future.  Or maybe just call a
helper function if we need more logic for this (see below).

>
>         adev->need_dma32 = false;
>         dma_bits = adev->need_dma32 ? 32 : 40;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> index 80054f3..cf1b0f8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> @@ -998,7 +998,7 @@ static int gmc_v7_0_sw_init(void *handle)
>          */
>         adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
>
> -       adev->gmc.stolen_size = 256 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;
>
>         /* set DMA mask + need_dma32 flags.
>          * PCIE - can handle 40-bits.
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> index d71d4cb..c8c5ca2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> @@ -1096,7 +1096,7 @@ static int gmc_v8_0_sw_init(void *handle)
>          */
>         adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
>
> -       adev->gmc.stolen_size = 256 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;

For platforms that might have limited carve out (ST, CZ, RV), we may
want to do something like:
if (adev->gmc.real_vram_size <= 32MB) // 128MB?
    stolen_size = 256K;

>
>         /* set DMA mask + need_dma32 flags.
>          * PCIE - can handle 40-bits.
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 070946e..e55d32d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -848,7 +848,7 @@ static int gmc_v9_0_sw_init(void *handle)
>          * It needs to reserve 8M stolen memory for vega10
>          * TODO: Figure out how to avoid that...
>          */

The comment above here can be removed in your second patch.

> -       adev->gmc.stolen_size = 8 * 1024 * 1024;
> +       adev->gmc.stolen_size = 32 * 1024 * 1024;
>
>         /* set DMA mask + need_dma32 flags.
>          * PCIE - can handle 44-bits.
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list