On Wed, 2025-10-29 at 11:05 +0100, Christian König wrote:
> On 10/28/25 23:06, Timur Kristóf wrote:
> > Add an extra 16M (4096 pages) to the GART before GTT.
> > This space is going to be used for the VCE VCPU BO.
> >
> > Split this into a separate patch to make it easier to bisect,
> > in case there are any errors in the future.
> >
> > Signed-off-by: Timur Kristóf <[email protected]>
> > ---
> > drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> > b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> > index 499dfd78092d..bfeb60cfbf62 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> > @@ -214,6 +214,9 @@ static void gmc_v6_0_vram_gtt_location(struct
> > amdgpu_device *adev,
> > amdgpu_gmc_set_agp_default(adev, mc);
> > amdgpu_gmc_vram_location(adev, mc, base);
> > amdgpu_gmc_gart_location(adev, mc,
> > AMDGPU_GART_PLACEMENT_LOW);
> > +
> > + /* Add space for VCE's VCPU BO so that VCE1 can access it.
> > */
> > + mc->num_gart_pages_before_gtt += 4096;
>
> 4096*4KiB=16MiB. Do we really need so much?
Is it enough to have just enough space for the VCPU BO?
In that case, I think we can use just 512 KiB (rounded up) if I
understand the VCPU BO size correctly. That would be 128 pages.
>
> > }
> >
> > static void gmc_v6_0_mc_program(struct amdgpu_device *adev)
> > @@ -338,7 +341,7 @@ static int gmc_v6_0_mc_init(struct
> > amdgpu_device *adev)
> > case CHIP_TAHITI: /* UVD, VCE do not support
> > GPUVM */
> > case CHIP_PITCAIRN: /* UVD, VCE do not support
> > GPUVM */
> > case CHIP_OLAND: /* UVD, VCE do not support
> > GPUVM */
> > - adev->gmc.gart_size = 1024ULL << 20;
> > + adev->gmc.gart_size = 1040ULL << 20;
>
> Ideally that should be a power of two.
>
> We can in theory increase it in units of 2MiB without wasting memory,
> but I'm not 100% sure if that is actually tested everywhere.
>
> Regards,
> Christian.
>
> > break;
> > }
> > } else {