[PATCH 5/7] drm/amdgpu:set static csa function
Christian König
deathsimple at vodafone.de
Mon Jan 9 11:02:14 UTC 2017
Am 09.01.2017 um 09:03 schrieb Monk Liu:
> Change-Id: Ib59c9e7f37a10ef1d6335d400ab41fe3cc9e2fb6
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 ++++++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 2 ++
> drivers/gpu/drm/amd/amdgpu/vi.c | 3 +++
> 3 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 5b15483..8f9dff5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -132,3 +132,11 @@ static void amdgpu_unmap_static_csa(struct amdgpu_device *adev, struct amdgpu_vm
> vm->vm_virt.vm_csa_addr = vm->vm_virt.vm_gds_addr = 0;
> }
> }
> +
> +void amdgpu_virt_set_csa_funcs(struct amdgpu_device *adev) {
> + adev->virt.allocate_csa = amdgpu_allocate_static_csa;
> + adev->virt.deallocate_csa = amdgpu_deallocate_static_csa;
> + adev->virt.map_csa = amdgpu_map_static_csa;
> + adev->virt.unmap_csa = amdgpu_unmap_static_csa;
> + adev->virt.csa_size = 8 * 1024; /* two page now for VI and AI */
> +}
You don't abstract anything by using indirect calls, so please avoid
them and call the appropriate functions directly.
Christian.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> index 5aa7f0c..f036d3a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> @@ -73,4 +73,6 @@ static inline bool is_virtual_machine(void)
> #endif
> }
>
> +void amdgpu_virt_set_csa_funcs(struct amdgpu_device *adev);
> +
> #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
> index 7350a8f..42e96cb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vi.c
> @@ -455,6 +455,9 @@ static void vi_detect_hw_virtualization(struct amdgpu_device *adev)
> if (is_virtual_machine()) /* passthrough mode exclus sr-iov mode */
> adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
> }
> +
> + if (amdgpu_sriov_vf(adev))
> + amdgpu_virt_set_csa_funcs(adev);
> }
>
> static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = {
More information about the amd-gfx
mailing list