CSA patches
Subsystems (2)
cover CSA patches
*** BLURB HERE ***
Monk Liu (3):
drm/amdgpu:new field members for SRIOV
drm/amdgpu:add new file for SRIOV
drm/amdgpu:invoke CSA functions
drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 14 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 11 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 95 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 12 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 + drivers/gpu/drm/amd/amdgpu/vi.c | 3 + 8 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1484103205-5789-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org
PATCH 1/3 drm/amdgpu:new field members for SRIOV
and implement CSA functions in this file
Change-Id Ife0eff7b13b8b5946f005a39f6ecb8db1cb72c38
Signed-off-by Monk Liu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 +++ 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +8 -0
@@ -28,11 +28,19 @@#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 */ +/* 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; }; +#define AMDGPU_CSA_SIZE (8 * 1024) +#define AMDGPU_CSA_VADDR (AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE) +#define amdgpu_sriov_enabled (adev) \ ((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +3 -0
@@ -111,6 +111,9 @@ struct amdgpu_vm {/* client id */ u64 client_id; +/* each VM will map on CSA */ +struct ttm_validate_buffer csa_tv; +struct amdgpu_bo_va *csa_bo_va; };struct amdgpu_vm_id {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu:add new file for SRIOV
In reply to a message not in the archivefor SRIOV usage, CSA is only used per device and each VM will map on it.
Change-Id Ibc63d87be59d7d89b96117e4d1b7e970a872580d
Signed-off-by Monk Liu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 95 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 4 ++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -30,7 +30,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ atombios_encoders.o amdgpu_sa.o atombios_i2c.o \ amdgpu_prime.o amdgpu_vm.o amdgpu_ib.o amdgpu_pll.o \ amdgpu_ucode.o amdgpu_bo_list.o amdgpu_ctx.o amdgpu_sync.o \ - amdgpu_gtt_mgr.o amdgpu_vram_mgr.o + amdgpu_gtt_mgr.o amdgpu_vram_mgr.o amdgpu_virt.o # add asic specific block amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c new file +95 -0
95 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +4 -0
@@ -62,4 +62,8 @@ static inline bool is_virtual_machine(void) #endif } +struct amdgpu_vm ; +int amdgpu_allocate_static_csa (struct amdgpu_device *adev); +int amdgpu_map_static_csa (struct amdgpu_device *adev,struct amdgpu_vm *vm); +#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu:invoke CSA functions
In reply to a message not in the archiveChange-Id I528c2f324830aaa21ab8d8250bc80a2a6bab33bd
Signed-off-by Monk Liu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 14 ++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/vi.c | 3 +++ 4 files changed, 40 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +14 -0
@@ -771,6 +771,20 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,if (r)return r; +if (amdgpu_sriov_vf (adev)) { +struct fence *f; + bo_va = vm->csa_bo_va; +BUG_ON (!bo_va); + r =amdgpu_vm_bo_update (adev, bo_va, false); +if (r) +return r; + + f = bo_va->last_pt_update; + r =amdgpu_sync_fence (adev, &p->job->sync, f); +if (r) +return r; + } +if (p->bo_list) {for (i =0 ; i < p->bo_list->num_entries; i++) {struct fence *f;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -0
@@ -1384,6 +1384,15 @@ static int amdgpu_init(struct amdgpu_device *adev)return r; } adev->ip_blocks[i].status.hw = true; + +/* right after GMC hw init, we create CSA */ +if (amdgpu_sriov_vf (adev)) { + r =amdgpu_allocate_static_csa (adev); +if (r) { +DRM_ERROR ("allocate CSA failed %d\n" , r); +return r; + } + } } }
@@ -1517,6 +1526,9 @@ static int amdgpu_fini(struct amdgpu_device *adev) adev->ip_blocks[i].status.late_initialized = false; } +if (amdgpu_sriov_vf (adev)) +amdgpu_bo_free_kernel (&adev->virt.csa_obj, &adev->virt.csa_vmid0_addr,NULL ); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +11 -0
@@ -650,6 +650,12 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) goto out_suspend; } +if (amdgpu_sriov_vf (adev)) { + r =amdgpu_map_static_csa (adev, &fpriv->vm); +if (r) + goto out_suspend; + } +mutex_init (&fpriv->bo_list_lock);idr_init (&fpriv->bo_list_handles);
@@ -688,6 +694,11 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,amdgpu_uvd_free_handles (adev, file_priv);amdgpu_vce_free_handles (adev, file_priv); +if (amdgpu_sriov_vf (adev)) { +fence_put (fpriv->vm.csa_bo_va->last_pt_update); +kfree (fpriv->vm.csa_bo_va); + } +amdgpu_vm_fini (adev, &fpriv->vm);idr_for_each_entry (&fpriv->bo_list_handles, list, handle)
drivers/gpu/drm/amd/amdgpu/vi.c +3 -0
@@ -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)) + adev->virt.csa_size =8 *1024 ;/* two page now for VI and AI */ }static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx