summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunming Zhou <David1.Zhou@amd.com>2017-04-28 17:22:29 +0800
committerQiang Yu <Qiang.Yu@amd.com>2017-05-17 11:19:54 +0800
commit8b42194c42051567cfc6d1324f01992898f65092 (patch)
tree876cec883ef6a0a33a8fa374cb53d507ebb9c701
parent6dd09c9911b8242d1e2b9bf9e1a5f31d90a4122e (diff)
amdgpu: add interface for reserve/unserve vmid v2
v2: delete unused comments. Change-Id: If533576eb8a65bd019a3480d6fe2a64f23e3c944 Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> Reviewed-by: Monk Liu <monk.liu@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
-rw-r--r--amdgpu/amdgpu.h13
-rw-r--r--amdgpu/amdgpu_cs.c28
2 files changed, 41 insertions, 0 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 38a1f540..b6779f9e 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1645,6 +1645,19 @@ int amdgpu_cs_signal_sem(amdgpu_device_handle dev,
uint32_t ip_instance,
uint32_t ring,
amdgpu_sem_handle sem);
+/**
+ * reserve vmid for this process
+ *
+ * \param dev - [in] Device handle. See #amdgpu_device_initialize()
+ */
+int amdgpu_cs_reserved_vmid(amdgpu_device_handle dev);
+
+/**
+ * unreserve vmid for this process
+ *
+ * \param dev - [in] Device handle. See #amdgpu_device_initialize()
+ */
+int amdgpu_cs_unreserved_vmid(amdgpu_device_handle dev);
/**
* wait sem
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 087e1d4a..9328e4e4 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -730,3 +730,31 @@ int amdgpu_cs_destroy_sem(amdgpu_device_handle dev,
return 0;
}
+
+int amdgpu_cs_unreserved_vmid(amdgpu_device_handle dev)
+{
+ union drm_amdgpu_vm args;
+ int r;
+
+ if (NULL == dev)
+ return -EINVAL;
+
+ memset(&args, 0, sizeof(args));
+ args.in.op = AMDGPU_VM_OP_UNRESERVE_VMID;
+ r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_VM, &args, sizeof(args));
+ return r;
+}
+
+int amdgpu_cs_reserved_vmid(amdgpu_device_handle dev)
+{
+ union drm_amdgpu_vm args;
+ int r;
+
+ if (NULL == dev)
+ return -EINVAL;
+
+ memset(&args, 0, sizeof(args));
+ args.in.op = AMDGPU_VM_OP_RESERVE_VMID;
+ r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_VM, &args, sizeof(args));
+ return r;
+}