All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_exec_balancer: Convert to use gem_mmap__device_coherent()
Date: Tue, 28 Jan 2020 12:21:43 +0000	[thread overview]
Message-ID: <20200128122143.3765164-1-chris@chris-wilson.co.uk> (raw)

Replace gem_mmap_gtt and write-once mmaps with
gem_mmap__device_coherent.

For use as an invalid pointer, we need only worry about having an
mmap_offset (gtt or wc) as they work alike inside the kernel with
respect to locking. (GTT has the extra vm->mutex, but if there's no
aperture, there's never going to be such a mutex to worry about!)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_exec_balancer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c
index 6b0c47f09..150eba0db 100644
--- a/tests/i915/gem_exec_balancer.c
+++ b/tests/i915/gem_exec_balancer.c
@@ -278,7 +278,8 @@ static void invalid_balancer(int i915)
 		igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT);
 
 		handle = gem_create(i915, 4096 * 3);
-		ptr = gem_mmap__gtt(i915, handle, 4096 * 3, PROT_WRITE);
+		ptr = gem_mmap__device_coherent(i915, handle, 0, 4096 * 3,
+						PROT_WRITE);
 		gem_close(i915, handle);
 
 		memset(&engines, 0, sizeof(engines));
@@ -369,7 +370,7 @@ static void invalid_bonds(int i915)
 	gem_context_set_param(i915, &p);
 
 	handle = gem_create(i915, 4096 * 3);
-	ptr = gem_mmap__gtt(i915, handle, 4096 * 3, PROT_WRITE);
+	ptr = gem_mmap__device_coherent(i915, handle, 0, 4096 * 3, PROT_WRITE);
 	gem_close(i915, handle);
 
 	memcpy(ptr + 4096, &bonds[0], sizeof(bonds[0]));
@@ -720,7 +721,7 @@ static uint32_t create_semaphore_to_spinner(int i915, igt_spin_t *spin)
 	uint64_t addr;
 
 	handle = gem_create(i915, 4096);
-	cs = map = gem_mmap__cpu(i915, handle, 0, 4096, PROT_WRITE);
+	cs = map = gem_mmap__device_coherent(i915, handle, 0, 4096, PROT_WRITE);
 
 	/* Wait until the spinner is running */
 	addr = spin->obj[0].offset + 4 * SPIN_POLL_START_IDX;
-- 
2.25.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] i915/gem_exec_balancer: Convert to use gem_mmap__device_coherent()
Date: Tue, 28 Jan 2020 12:21:43 +0000	[thread overview]
Message-ID: <20200128122143.3765164-1-chris@chris-wilson.co.uk> (raw)

Replace gem_mmap_gtt and write-once mmaps with
gem_mmap__device_coherent.

For use as an invalid pointer, we need only worry about having an
mmap_offset (gtt or wc) as they work alike inside the kernel with
respect to locking. (GTT has the extra vm->mutex, but if there's no
aperture, there's never going to be such a mutex to worry about!)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_exec_balancer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_exec_balancer.c b/tests/i915/gem_exec_balancer.c
index 6b0c47f09..150eba0db 100644
--- a/tests/i915/gem_exec_balancer.c
+++ b/tests/i915/gem_exec_balancer.c
@@ -278,7 +278,8 @@ static void invalid_balancer(int i915)
 		igt_assert_eq(__gem_context_set_param(i915, &p), -EFAULT);
 
 		handle = gem_create(i915, 4096 * 3);
-		ptr = gem_mmap__gtt(i915, handle, 4096 * 3, PROT_WRITE);
+		ptr = gem_mmap__device_coherent(i915, handle, 0, 4096 * 3,
+						PROT_WRITE);
 		gem_close(i915, handle);
 
 		memset(&engines, 0, sizeof(engines));
@@ -369,7 +370,7 @@ static void invalid_bonds(int i915)
 	gem_context_set_param(i915, &p);
 
 	handle = gem_create(i915, 4096 * 3);
-	ptr = gem_mmap__gtt(i915, handle, 4096 * 3, PROT_WRITE);
+	ptr = gem_mmap__device_coherent(i915, handle, 0, 4096 * 3, PROT_WRITE);
 	gem_close(i915, handle);
 
 	memcpy(ptr + 4096, &bonds[0], sizeof(bonds[0]));
@@ -720,7 +721,7 @@ static uint32_t create_semaphore_to_spinner(int i915, igt_spin_t *spin)
 	uint64_t addr;
 
 	handle = gem_create(i915, 4096);
-	cs = map = gem_mmap__cpu(i915, handle, 0, 4096, PROT_WRITE);
+	cs = map = gem_mmap__device_coherent(i915, handle, 0, 4096, PROT_WRITE);
 
 	/* Wait until the spinner is running */
 	addr = spin->obj[0].offset + 4 * SPIN_POLL_START_IDX;
-- 
2.25.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2020-01-28 12:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 12:21 Chris Wilson [this message]
2020-01-28 12:21 ` [igt-dev] [PATCH i-g-t] i915/gem_exec_balancer: Convert to use gem_mmap__device_coherent() Chris Wilson
2020-01-28 12:45 ` [Intel-gfx] " Mika Kuoppala
2020-01-28 12:45   ` [igt-dev] " Mika Kuoppala
2020-01-28 15:29 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork

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=20200128122143.3765164-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.