dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 02/14] drm/amdgpu: add client id for every vm
Date: Wed,  4 May 2016 14:26:43 -0400	[thread overview]
Message-ID: <1462386415-25600-2-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1462386415-25600-1-git-send-email-alexander.deucher@amd.com>

From: Chunming Zhou <David1.Zhou@amd.com>

This adds a unique id for each vm client so we can
properly track them.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 1012bd3..7bea3e2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -363,6 +363,7 @@ struct amdgpu_fence_driver {
 /* some special values for the owner field */
 #define AMDGPU_FENCE_OWNER_UNDEFINED	((void*)0ul)
 #define AMDGPU_FENCE_OWNER_VM		((void*)1ul)
+#define AMDGPU_CLIENT_ID_RESERVED       2
 
 #define AMDGPU_FENCE_FLAG_64BIT         (1 << 0)
 #define AMDGPU_FENCE_FLAG_INT           (1 << 1)
@@ -885,6 +886,9 @@ struct amdgpu_vm {
 
 	/* Scheduler entity for page table updates */
 	struct amd_sched_entity	entity;
+
+	/* client id */
+	u64                     client_id;
 };
 
 struct amdgpu_vm_id {
@@ -924,6 +928,8 @@ struct amdgpu_vm_manager {
 	struct amdgpu_ring                      *vm_pte_rings[AMDGPU_MAX_RINGS];
 	unsigned				vm_pte_num_rings;
 	atomic_t				vm_pte_next_ring;
+	/* client id counter */
+	atomic64_t				client_counter;
 };
 
 void amdgpu_vm_manager_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e06d066..275378c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1386,6 +1386,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
 		vm->ids[i] = NULL;
 	vm->va = RB_ROOT;
+	vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter);
 	spin_lock_init(&vm->status_lock);
 	INIT_LIST_HEAD(&vm->invalidated);
 	INIT_LIST_HEAD(&vm->cleared);
@@ -1514,6 +1515,7 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev)
 	}
 
 	atomic_set(&adev->vm_manager.vm_pte_next_ring, 0);
+	atomic64_set(&adev->vm_manager.client_counter, AMDGPU_CLIENT_ID_RESERVED);
 }
 
 /**
-- 
2.5.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-05-04 18:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 18:26 [PATCH 01/14] drm/amdgpu: fix wrong release of vmid owner Alex Deucher
2016-05-04 18:26 ` Alex Deucher [this message]
2016-05-04 18:26 ` [PATCH 03/14] drm/amdgpu: make vmid owner be client_id Alex Deucher
2016-05-04 18:26 ` [PATCH 04/14] drm/amdgpu: keep vm in job instead of ib (v2) Alex Deucher
2016-05-04 18:26 ` [PATCH 05/14] drm/amdgpu: use fence_context to judge ctx switch Alex Deucher
2016-05-04 18:26 ` [PATCH 06/14] drm/amdgpu: add pipeline sync for compute job Alex Deucher
2016-05-04 18:26 ` [PATCH 07/14] drm/amd/amdgpu: Enable CG for UVD6 on Carrizo Alex Deucher
2016-05-04 18:26 ` [PATCH 08/14] drm/amdgpu: hdp flush&inval should always do Alex Deucher
2016-05-04 18:26 ` [PATCH 09/14] drm/amdgpu: two minor 80 char fixes Alex Deucher
2016-05-04 18:26 ` [PATCH 10/14] drm/amdgpu: make the VMID owner always 64bit Alex Deucher
2016-05-04 18:26 ` [PATCH 11/14] drm/amdgpu: remove owner cleanup v2 Alex Deucher
2016-05-04 18:26 ` [PATCH 12/14] drm/amdgpu: remove define for reserved client ID Alex Deucher
2016-05-04 18:26 ` [PATCH 13/14] drm/amd: cleanup remaining spaces and tabs v2 Alex Deucher
2016-05-04 18:26 ` [PATCH 14/14] drm/amdgpu: fetch cu_info once at init Alex Deucher
2016-05-09  8:17 ` [PATCH 01/14] drm/amdgpu: fix wrong release of vmid owner Daniel Vetter
2016-05-10  5:05   ` Dave Airlie
2016-05-10  8:21     ` Christian König
2016-05-11  7:46       ` Daniel Vetter
2016-05-11  7:48         ` Dave Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462386415-25600-2-git-send-email-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox