[PATCH] Add 2-level GPUVM pagetables support to radeon driver.

Michel Dänzer michel at daenzer.net
Fri Sep 14 01:31:16 PDT 2012


On Don, 2012-09-13 at 18:13 +0400, Dmitry Cherkasov wrote: 
> PDE/PTE update code uses CP ring for memory writes.
> All page table entries are preallocated for now in alloc_pt().
> 
> It is made as whole because it's hard to divide it to several patches
> that compile and doesn't break anything being applied separately.
> 
> Tested on cayman card.
> 
> Signed-off-by: Dmitry Cherkasov <Dmitrii.Cherkasov at amd.com>
> ---
> I couldn't test in on SI card, so would be happy if someone could check it there.

[...]


> 		radeon_ring_write(ring, addr & 0xffffffff);
>  		radeon_ring_write(ring, (addr >> 32) & 0xffffffff);

FWIW, masking with 0xffffffff is superfluous here, as 64 bit values will
be implicitly truncated to 32 bits. The compiler will hopefully optimize
away the unnecessary & operations, but it might be better not to require
that in the first place.


> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 4d67f0f..062896f 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
> index 2f7adea..0df6a55 100644
> --- a/drivers/gpu/drm/radeon/radeon_asic.c
> +++ b/drivers/gpu/drm/radeon/radeon_asic.c
> @@ -1377,6 +1377,7 @@ static struct radeon_asic cayman_asic = {
>  		.fini = &cayman_vm_fini,
>  		.pt_ring_index = RADEON_RING_TYPE_GFX_INDEX,
>  		.set_page = &cayman_vm_set_page,
> +		.set_pdes = &cayman_vm_set_pdes,
>  	},
>  	.ring = {
>  		[RADEON_RING_TYPE_GFX_INDEX] = {

This also needs to be added to si_asic and trinity_asic, or it can't
work on SI or Trinity.

With that fixed, it seems to work on SI, but seems to slow things down
significantly. Have you noticed that as well? Any idea what might be the
reason?


> diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
> index 2f28ff3..f9bda6e 100644
> --- a/drivers/gpu/drm/radeon/radeon_gart.c
> +++ b/drivers/gpu/drm/radeon/radeon_gart.c
> @@ -576,9 +579,13 @@ retry:
>  		return r;
>  	}
>  
> -	vm->pt = radeon_sa_bo_cpu_addr(vm->sa_bo);
> -	vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(vm->sa_bo);
> -	memset(vm->pt, 0, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8));
> +	DRM_INFO("radeon: reserved %d kb pd & pt tables\n",
> +		 gpuvm_tables_sz/1024);

DRM_INFO() is too noisy here. Make it DRM_DEBUG_DRIVER() or drop it.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the dri-devel mailing list