[PATCH 3/7] drm/amdgpu:impl static CSA alloc/dealloc

Christian König deathsimple at vodafone.de
Mon Jan 9 10:59:57 UTC 2017


Am 09.01.2017 um 09:02 schrieb Monk Liu:
> for SRIOV usage, CSA is only used per device and each
> VM will map on it.
>
> Change-Id: I0736b6e51329d643343e26968a47a81c3a27035f
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 23 ++++++++++++++++++++++-
>   1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 0bfec66..a6bce36 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -20,4 +20,25 @@
>    * OTHER DEALINGS IN THE SOFTWARE.
>    *
>    */
> -#include "amdgpu.h"
> \ No newline at end of file
> +#include "amdgpu.h"

Please add at least a newline between the includes and the start of the 
code.

> +static int amdgpu_allocate_static_csa(struct amdgpu_device *adev)
> +{
> +	int r;
> +	void *ptr;
> +
> +	r = amdgpu_bo_create_kernel(adev, adev->virt.csa_size, PAGE_SIZE,
> +				AMDGPU_GEM_DOMAIN_VRAM, &adev->virt.csa_obj,
> +				&adev->virt.csa_vmid0_addr, &ptr);
> +	if (r)
> +		return r;
> +
> +	/* gds part take the bottom half buffer */
> +	adev->virt.gds_vmid0_addr = adev->virt.csa_vmid0_addr + PAGE_SIZE;
> +	memset(ptr, 0, adev->virt.csa_size);
> +	return 0;
> +}
> +
> +static void amdgpu_deallocate_static_csa(struct amdgpu_device *adev)
> +{
> +	amdgpu_bo_free_kernel(&adev->virt.csa_obj, &adev->virt.csa_vmid0_addr, NULL);
> +}

Just static function which aren't called will raise compiler warning, 
please squash that into the functionality where it is used.

Christian.



More information about the amd-gfx mailing list