[PATCH 2/7] drm/amdgpu:new field members for SRIOV

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


Am 09.01.2017 um 09:02 schrieb Monk Liu:
> Change-Id: Ife0eff7b13b8b5946f005a39f6ecb8db1cb72c38
> Signed-off-by: Monk Liu <Monk.Liu at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 19 +++++++++++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h   |  2 ++
>   2 files changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> index 0d821d9..5aa7f0c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> @@ -28,9 +28,28 @@
>   #define AMDGPU_SRIOV_CAPS_ENABLE_IOV   (1 << 1) /* sr-iov is enabled on this GPU */
>   #define AMDGPU_SRIOV_CAPS_IS_VF        (1 << 2) /* this GPU is a virtual function */
>   #define AMDGPU_PASSTHROUGH_MODE        (1 << 3) /* thw whole GPU is pass through for VM */
> +
> +struct amdgpu_vm;
>   /* GPU virtualization */
>   struct amdgpu_virt {
>   	uint32_t caps;
> +	uint32_t csa_size;
> +	struct amdgpu_bo *csa_obj;
> +	uint64_t csa_vmid0_addr;
> +	uint64_t gds_vmid0_addr;
> +	int (*allocate_csa)(struct amdgpu_device *adev);
> +	void (*deallocate_csa)(struct amdgpu_device *adev);
> +	int (*map_csa)(struct amdgpu_device *adev, struct amdgpu_vm *vm);
> +	void (*unmap_csa)(struct amdgpu_device *adev, struct amdgpu_vm *vm);

Why callbacks for this?

> +};
> +
> +struct amdgpu_vm_virt {
> +	/* each VM will map on CSA */
> +	struct ttm_validate_buffer csa_tv;
> +	struct amdgpu_bo_va *csa_bo_va;

Please put that directly into the amdgpu_vm structure.

> +	/* virtual MC address of CSA & GDS for each VM */
> +	uint64_t vm_csa_addr;
> +	uint64_t vm_gds_addr;

That should be constant, shouldn't it?

Regards,
Christian.

>   };
>   
>   #define amdgpu_sriov_enabled(adev) \
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 42a629b..27cbcbc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -29,6 +29,7 @@
>   #include "gpu_scheduler.h"
>   #include "amdgpu_sync.h"
>   #include "amdgpu_ring.h"
> +#include "amdgpu_virt.h"
>   
>   struct amdgpu_bo_va;
>   struct amdgpu_job;
> @@ -111,6 +112,7 @@ struct amdgpu_vm {
>   
>   	/* client id */
>   	u64                     client_id;
> +	struct amdgpu_vm_virt	vm_virt;
>   };
>   
>   struct amdgpu_vm_id {




More information about the amd-gfx mailing list