<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div dir="auto">Yeah that's on my TODO list for quite a while as well.
<div dir="auto"><br>
</div>
<div dir="auto">But we even need three IB pools. One very small for the IB tests, one for direct VM updates and one for the rest.</div>
<div dir="auto"><br>
</div>
<div dir="auto">So please make the pool a parameter to ib_get() and not the hack you have below.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks,</div>
<div dir="auto">Christian.</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">Am 26.03.2020 03:02 schrieb "Pan, Xinhui" <Xinhui.Pan@amd.com>:<br type="attribution">
</div>
</div>
</div>
<font size="2"><span style="font-size:11pt;">
<div class="PlainText">Another ib poll for direct submit.<br>
Any jobs schedule IBs without dependence on gpu scheduler should use<br>
this pool firstly.<br>
<br>
Signed-off-by: xinhui pan <xinhui.pan@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 12 ++++++++++--<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 8 +++++++-<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 3 ++-<br>
5 files changed, 21 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index 7dd74253e7b6..c01423ffb8ed 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -849,6 +849,7 @@ struct amdgpu_device {<br>
struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];<br>
bool ib_pool_ready;<br>
struct amdgpu_sa_manager ring_tmp_bo;<br>
+ struct amdgpu_sa_manager ring_tmp_bo_direct;<br>
<br>
/* interrupts */<br>
struct amdgpu_irq irq;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
index 8304d0c87899..28be4efb3d5b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
@@ -920,7 +920,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,<br>
parser->entity = entity;<br>
<br>
ring = to_amdgpu_ring(entity->rq->sched);<br>
- r = amdgpu_ib_get(adev, vm, ring->funcs->parse_cs ?<br>
+ r = amdgpu_ib_get(adev, (unsigned long )vm|0x1, ring->funcs->parse_cs ?<br>
chunk_ib->ib_bytes : 0, ib);<br>
if (r) {<br>
DRM_ERROR("Failed to get ib !\n");<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
index bece01f1cf09..f2e08c372d57 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c<br>
@@ -66,7 +66,7 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,<br>
int r;<br>
<br>
if (size) {<br>
- r = amdgpu_sa_bo_new(&adev->ring_tmp_bo,<br>
+ r = amdgpu_sa_bo_new(vm ? &adev->ring_tmp_bo : &adev->ring_tmp_bo_direct,<br>
&ib->sa_bo, size, 256);<br>
if (r) {<br>
dev_err(adev->dev, "failed to get a new IB (%d)\n", r);<br>
@@ -75,7 +75,7 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,<br>
<br>
ib->ptr = amdgpu_sa_bo_cpu_addr(ib->sa_bo);<br>
<br>
- if (!vm)<br>
+ if (!((unsigned long)vm & ~0x1))<br>
ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);<br>
}<br>
<br>
@@ -310,6 +310,13 @@ int amdgpu_ib_pool_init(struct amdgpu_device *adev)<br>
return r;<br>
}<br>
<br>
+ r = amdgpu_sa_bo_manager_init(adev, &adev->ring_tmp_bo_direct,<br>
+ AMDGPU_IB_POOL_SIZE*64*1024,<br>
+ AMDGPU_GPU_PAGE_SIZE,<br>
+ AMDGPU_GEM_DOMAIN_GTT);<br>
+ if (r) {<br>
+ return r;<br>
+ }<br>
adev->ib_pool_ready = true;<br>
<br>
return 0;<br>
@@ -327,6 +334,7 @@ void amdgpu_ib_pool_fini(struct amdgpu_device *adev)<br>
{<br>
if (adev->ib_pool_ready) {<br>
amdgpu_sa_bo_manager_fini(adev, &adev->ring_tmp_bo);<br>
+ amdgpu_sa_bo_manager_fini(adev, &adev->ring_tmp_bo_direct);<br>
adev->ib_pool_ready = false;<br>
}<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c<br>
index 4981e443a884..6a63826c6760 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c<br>
@@ -88,6 +88,12 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,<br>
<br>
int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,<br>
struct amdgpu_job **job)<br>
+{<br>
+ return amdgpu_job_alloc_with_ib_direct(adev, size, job, 0);<br>
+}<br>
+<br>
+int amdgpu_job_alloc_with_ib_direct(struct amdgpu_device *adev, unsigned size,<br>
+ struct amdgpu_job **job, int direct)<br>
{<br>
int r;<br>
<br>
@@ -95,7 +101,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,<br>
if (r)<br>
return r;<br>
<br>
- r = amdgpu_ib_get(adev, NULL, size, &(*job)->ibs[0]);<br>
+ r = amdgpu_ib_get(adev, direct ? NULL : 0x1, size, &(*job)->ibs[0]);<br>
if (r)<br>
kfree(*job);<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h<br>
index 2e2110dddb76..be9dd72b9912 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h<br>
@@ -67,7 +67,8 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,<br>
struct amdgpu_job **job, struct amdgpu_vm *vm);<br>
int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,<br>
struct amdgpu_job **job);<br>
-<br>
+int amdgpu_job_alloc_with_ib_direct(struct amdgpu_device *adev, unsigned size,<br>
+ struct amdgpu_job **job, int direct);<br>
void amdgpu_job_free_resources(struct amdgpu_job *job);<br>
void amdgpu_job_free(struct amdgpu_job *job);<br>
int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font>
</body>
</html>