Commit 934deb64 authored by Philip Yang's avatar Philip Yang Committed by Alex Deucher

drm/amdgpu: Add memory partition id to amdgpu_vm

If xcp_mgr is initialized, add mem_id to amdgpu_vm structure to store
memory partition number when creating amdgpu_vm for the xcp. The xcp
number is decided when opening the render device, for example
/dev/dri/renderD129 is xcp_id 0, /dev/dri/renderD130 is xcp_id 1.
Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a476c0c6
...@@ -1223,10 +1223,6 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) ...@@ -1223,10 +1223,6 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
goto out_suspend; goto out_suspend;
} }
r = amdgpu_xcp_open_device(adev, fpriv, file_priv);
if (r)
return r;
pasid = amdgpu_pasid_alloc(16); pasid = amdgpu_pasid_alloc(16);
if (pasid < 0) { if (pasid < 0) {
dev_warn(adev->dev, "No more PASIDs available!"); dev_warn(adev->dev, "No more PASIDs available!");
...@@ -1237,6 +1233,10 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) ...@@ -1237,6 +1233,10 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
if (r) if (r)
goto error_pasid; goto error_pasid;
r = amdgpu_xcp_open_device(adev, fpriv, file_priv);
if (r)
goto error_vm;
r = amdgpu_vm_set_pasid(adev, &fpriv->vm, pasid); r = amdgpu_vm_set_pasid(adev, &fpriv->vm, pasid);
if (r) if (r)
goto error_vm; goto error_vm;
......
...@@ -329,6 +329,9 @@ struct amdgpu_vm { ...@@ -329,6 +329,9 @@ struct amdgpu_vm {
struct ttm_lru_bulk_move lru_bulk_move; struct ttm_lru_bulk_move lru_bulk_move;
/* Flag to indicate if VM is used for compute */ /* Flag to indicate if VM is used for compute */
bool is_compute_context; bool is_compute_context;
/* Memory partition number, -1 means any partition */
int8_t mem_id;
}; };
struct amdgpu_vm_manager { struct amdgpu_vm_manager {
......
...@@ -364,6 +364,9 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev, ...@@ -364,6 +364,9 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,
break; break;
} }
} }
fpriv->vm.mem_id = fpriv->xcp_id == ~0 ? -1 :
adev->xcp_mgr->xcp[fpriv->xcp_id].mem_id;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment